GNU bug report logs -
#38109
27.0.50; xpm image scaling doesn't work
Previous Next
Reported by: Adam Sjøgren <asjo <at> koldfront.dk>
Date: Thu, 7 Nov 2019 21:12:02 UTC
Severity: normal
Found in version 27.0.50
Done: Alan Third <alan <at> idiocy.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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 <at> 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.
This bug report was last modified 5 years and 176 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.