bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#38109: Updated Emacs to HEAD, consistently not scaling now


From: Adam Sjøgren
Subject: bug#38109: Updated Emacs to HEAD, consistently not scaling now
Date: Fri, 08 Nov 2019 22:03:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Alan writes:

[...]

> There should be an error message somewhere telling you that Emacs
> doesn’t support scaling with that bit depth.

Indeed there is for the:

  /tmp/wry.png: PNG image data, 16 x 16, 4-bit colormap, non-interlaced

image. But not for the .xpm. Ah, but xpm doesn't go through
image_create_x_image_and_pixmap_1(), so that explains that.

> I guess it should be simple enough to add 4 and 1 bit to the above
> which I hope would cover some of the above cases...

Yes, with this patch:

diff --git a/src/image.c b/src/image.c
index 870f008b14..bb76e9db60 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2585,7 +2585,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 == 4 || depth == 1)
         {
           XRenderPictFormat *format;
           XRenderPictureAttributes attr;
@@ -2600,12 +2600,16 @@ 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
+                                              : depth ==  4 ? PictStandardA4
+                                              : PictStandardA1);
           *picture = XRenderCreatePicture (display, *pixmap, format, 0, &attr);
         }
       else
         {
-          image_error ("Specified image bit depth is not supported by 
XRender");
+          Lisp_Object depth_err;
+          XSETINT(depth_err, depth);
+          image_error ("Specified image bit depth (%d) is not supported by 
XRender", depth_err);
           *picture = 0;
         }
     }

the error in *Messages* doesn't appear.

However the png-image is still not scaled, and still shown in the larger
canvas.

I apparently haven't got Cairo enabled in my build, maybe that's a
problem?

  asjo@tullinup:/usr/src/emacs$ grep CAIRO src/config.h
  /* #undef USE_CAIRO */

An observation: when displaying the colormapped .png,
image_create_x_image_and_pixmap_1() is called twice, the first time
depth is <= 0, and the second time it isn't.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]