From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Third Newsgroups: gmane.emacs.bugs Subject: bug#38109: Updated Emacs to HEAD, consistently not scaling now Date: Sun, 17 Nov 2019 17:22:08 +0000 Message-ID: <20191117172208.GA63158@breton.holly.idiocy.org> References: <87o8xn9vzk.fsf@tullinup.koldfront.dk> <20191108193407.GA42511@breton.holly.idiocy.org> <87h83egjxm.fsf@tullinup.koldfront.dk> <20191108230345.GA42932@breton.holly.idiocy.org> <20191109172241.GA45056@breton.holly.idiocy.org> <8736ew1zp0.fsf@tullinup.koldfront.dk> <87sgmwvgmd.fsf@tullinup.koldfront.dk> <87d0e0ve29.fsf@tullinup.koldfront.dk> <20191110171241.GA60416@breton.holly.idiocy.org> <875zjj4vb7.fsf@tullinup.koldfront.dk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="YiEDa0DAkWCtVeE4" Content-Transfer-Encoding: 8bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="14509"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.12.0 (2019-05-25) Cc: 38109@debbugs.gnu.org To: Adam =?UTF-8?Q?Sj=C3=B8gren?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Nov 17 18:23:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iWOGX-0003fp-3b for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Nov 2019 18:23:13 +0100 Original-Received: from localhost ([::1]:55174 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWOGV-0006w9-QC for geb-bug-gnu-emacs@m.gmane.org; Sun, 17 Nov 2019 12:23:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39264) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iWOGO-0006tH-3F for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 12:23:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iWOGM-0006QJ-MR for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 12:23:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33700) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iWOGM-0006Q8-Ex for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 12:23:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iWOGM-0002r3-7k for bug-gnu-emacs@gnu.org; Sun, 17 Nov 2019 12:23:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Third Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Nov 2019 17:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38109 X-GNU-PR-Package: emacs Original-Received: via spool by 38109-submit@debbugs.gnu.org id=B38109.157401134210904 (code B ref 38109); Sun, 17 Nov 2019 17:23:02 +0000 Original-Received: (at 38109) by debbugs.gnu.org; 17 Nov 2019 17:22:22 +0000 Original-Received: from localhost ([127.0.0.1]:42518 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWOFh-0002pm-SF for submit@debbugs.gnu.org; Sun, 17 Nov 2019 12:22:22 -0500 Original-Received: from mail-wr1-f51.google.com ([209.85.221.51]:36356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWOFe-0002pU-3N for 38109@debbugs.gnu.org; Sun, 17 Nov 2019 12:22:20 -0500 Original-Received: by mail-wr1-f51.google.com with SMTP id r10so16728867wrx.3 for <38109@debbugs.gnu.org>; Sun, 17 Nov 2019 09:22:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=bME2qYygpJCBJM0k1sh73KUUPkjkYUSXjB8bUmy8fEg=; b=MzHSHfksANc2PZ+3t6Kppd5cJ1D6j2t62hLg7VaWhSe0pQAMXEzaM5/M/JUGHYfbeM BhKGWj0nbwZM3cyeZ64jw9HBbFKRSuDEWDagI02Kz8U3wbbcIV9kOJMOuZIG//k+QWNM g/LH1DvwWQ4wydaFMLkbQu076VqSWWW2Rlg6EBqPp2uw+YeeJQbveSa8g5y8n+A33k65 M7cn6ePKSCr4EmW/LcHC8gOBRf0p18uG3difbrrxc+AsQqTKXU3S2cjFpt7MOFf+2yLh bQv9mJPBqxxn57QLymwYF3nP7zLBz/meG+wQ6p2OCMQ6uVe7K+WGkN2qLCJ+Y9HPYvzQ dn5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=bME2qYygpJCBJM0k1sh73KUUPkjkYUSXjB8bUmy8fEg=; b=RNOYSOGCa8H72yTSeRbUl9Ir7Y14NnDUd8pDbdhKcCsQsie/vINrtt5tjzEbkr5rfE zsvLaJ7MfgMyVukBz11axFMULU0u4roxvFsTTT7nQL+ny7oCFpDleWmfDdp3JMEpD07Z GF8itXf0IUJhdOHRVeXO1IZnWxqxBgXYITHG4bJN2XlJqobA55Be/gbK2SnEN8n70Cno /rb2NeCC3JO75Jjy3TpPM9OjFAcmX5P66AzS7QxaMJ65SdJzFAZMr8/InyfwvandVDNK gz0zZ+nBrmCdXtkS7LDK4ZlQUhV+9pgyAONI66yLjuJzSZFVXbXgoFij5qYYydDFxxkI 1wcA== X-Gm-Message-State: APjAAAUbiVPpFy/NyRmImn8Z5vc09TfXU6nHYJWnG9eGbUVodJijICW8 BeaeAeadLX+UnGZZjBrhzUU= X-Google-Smtp-Source: APXvYqySz64uHzmVTnODu41Lpf0psIvHZfetfPYrff4SuPsBc0QpS4x4khaNhtyXtfV7v133rMoJtg== X-Received: by 2002:adf:9f43:: with SMTP id f3mr26148197wrg.76.1574011331918; Sun, 17 Nov 2019 09:22:11 -0800 (PST) Original-Received: from breton.holly.idiocy.org (ip6-2001-08b0-03f8-8129-1980-cc6a-4f4e-9c42.holly.idiocy.org. [2001:8b0:3f8:8129:1980:cc6a:4f4e:9c42]) by smtp.gmail.com with ESMTPSA id v9sm19329378wrs.95.2019.11.17.09.22.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 Nov 2019 09:22:10 -0800 (PST) Content-Disposition: inline In-Reply-To: <875zjj4vb7.fsf@tullinup.koldfront.dk> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:171825 Archived-At: --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Sat, Nov 16, 2019 at 05:53:16PM +0100, Adam Sjøgren wrote: > Alan writes: > > > Hi Adam, can you try with the patch again, but undoing the changes to > > image_clear_image_1 in image.c? There should be two, both wrapped in > > ‘#ifdef HAVE_XRENDER’. > > > > Those changes weren’t required for the fix, but looked as though they > > should be needed generally. > > > > If that doesn’t help can you try running under a debugger and sending > > us the backtrace? > > I'm trying the patch without those two sections now (finally). No > crashes so far (around an hours worth of using Gnus). I’m pretty sure we need to free the Pictures there, so perhaps we need to free the Picture before freeing the associated pixmap... New patch attached. -- Alan Third --YiEDa0DAkWCtVeE4 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v2-0001-Fix-image-scaling-with-masks-bug-38109.patch" >From 00d2632c91bc8a930aaeb87018aa9f06dd5dbecd Mon Sep 17 00:00:00 2001 From: Alan Third Date: Sat, 9 Nov 2019 17:04:25 +0000 Subject: [PATCH v2] Fix image scaling with masks (bug#38109) * src/image.c (image_clear_image_1): Free the XRender Pictures. (lookup_image): Move call to image_set_transform after postprocess_image. (image_create_x_image_and_pixmap_1): Add 1 bit image type for masks. * src/xterm.c (x_composite_image): Use PictOpOver when there is a mask so the transparency is honoured. (x_draw_image_foreground_1): Use x_composite_image. --- src/image.c | 35 +++++++++++++++++++++++++++++------ src/xterm.c | 8 ++++---- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/image.c b/src/image.c index 870f008b14..f872cb31fb 100644 --- a/src/image.c +++ b/src/image.c @@ -1453,6 +1453,13 @@ image_clear_image_1 (struct frame *f, struct image *img, int flags) { if (img->pixmap) { +#if !defined USE_CAIRO && defined HAVE_XRENDER + if (img->picture) + { + XRenderFreePicture (FRAME_X_DISPLAY (f), img->picture); + img->picture = 0; + } +# endif FRAME_TERMINAL (f)->free_pixmap (f, img->pixmap); img->pixmap = NO_PIXMAP; /* NOTE (HAVE_NS): background color is NOT an indexed color! */ @@ -1472,6 +1479,13 @@ image_clear_image_1 (struct frame *f, struct image *img, int flags) { if (img->mask) { +#if !defined USE_CAIRO && defined HAVE_XRENDER + if (img->mask_picture) + { + XRenderFreePicture (FRAME_X_DISPLAY (f), img->mask_picture); + img->mask_picture = 0; + } +#endif FRAME_TERMINAL (f)->free_pixmap (f, img->mask); img->mask = NO_PIXMAP; img->background_transparent_valid = 0; @@ -2244,6 +2258,14 @@ image_set_transform (struct frame *f, struct image *img) XRenderSetPictureFilter (FRAME_X_DISPLAY (f), img->picture, FilterBest, 0, 0); XRenderSetPictureTransform (FRAME_X_DISPLAY (f), img->picture, &tmat); + + if (img->mask_picture) + { + XRenderSetPictureFilter (FRAME_X_DISPLAY (f), img->mask_picture, + FilterBest, 0, 0); + XRenderSetPictureTransform (FRAME_X_DISPLAY (f), img->mask_picture, + &tmat); + } } # elif defined HAVE_NTGUI /* Store the transform matrix for application at draw time. */ @@ -2313,10 +2335,6 @@ lookup_image (struct frame *f, Lisp_Object spec) Lisp_Object ascent, margin, relief, bg; int relief_bound; -#ifdef HAVE_NATIVE_TRANSFORMS - image_set_transform (f, img); -#endif - ascent = image_spec_value (spec, QCascent, NULL); if (FIXNUMP (ascent)) img->ascent = XFIXNUM (ascent); @@ -2357,6 +2375,10 @@ lookup_image (struct frame *f, Lisp_Object spec) don't have the image yet. */ if (!EQ (builtin_lisp_symbol (img->type->type), Qpostscript)) postprocess_image (f, img); + +#ifdef HAVE_NATIVE_TRANSFORMS + image_set_transform (f, img); +#endif } unblock_input (); @@ -2585,7 +2607,7 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int width, int height, int d { if (depth <= 0) depth = DefaultDepthOfScreen (FRAME_X_SCREEN (f)); - if (depth == 32 || depth == 24 || depth == 8) + if (depth == 32 || depth == 24 || depth == 8 || depth == 1) { XRenderPictFormat *format; XRenderPictureAttributes attr; @@ -2600,7 +2622,8 @@ image_create_x_image_and_pixmap_1 (struct frame *f, int width, int height, int d format = XRenderFindStandardFormat (display, depth == 32 ? PictStandardARGB32 : depth == 24 ? PictStandardRGB24 - : PictStandardA8); + : depth == 8 ? PictStandardA8 + : PictStandardA1); *picture = XRenderCreatePicture (display, *pixmap, format, 0, &attr); } else diff --git a/src/xterm.c b/src/xterm.c index 44fbd27b11..6de1644cb0 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -3056,7 +3056,7 @@ x_composite_image (struct glyph_string *s, Pixmap dest, destination = XRenderCreatePicture (display, dest, default_format, 0, &attr); - XRenderComposite (display, PictOpSrc, + XRenderComposite (display, s->img->mask_picture ? PictOpOver : PictOpSrc, s->img->picture, s->img->mask_picture, destination, srcX, srcY, srcX, srcY, @@ -3325,9 +3325,9 @@ x_draw_image_foreground_1 (struct glyph_string *s, Pixmap pixmap) xgcv.function = GXcopy; XChangeGC (display, s->gc, mask, &xgcv); - XCopyArea (display, s->img->pixmap, pixmap, s->gc, - s->slice.x, s->slice.y, - s->slice.width, s->slice.height, x, y); + x_composite_image (s, pixmap, + s->slice.x, s->slice.y, + x, y, s->slice.width, s->slice.height); XSetClipMask (display, s->gc, None); } else -- 2.21.0 --YiEDa0DAkWCtVeE4--