[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 03b8903: Be more specific with XRender bit-depths (
From: |
Alan Third |
Subject: |
[Emacs-diffs] master 03b8903: Be more specific with XRender bit-depths (bug#34051) |
Date: |
Thu, 17 Jan 2019 12:31:06 -0500 (EST) |
branch: master
commit 03b8903ee7fffc75085600899c992829a49d4442
Author: Alan Third <address@hidden>
Commit: Alan Third <address@hidden>
Be more specific with XRender bit-depths (bug#34051)
* src/image.c (x_create_x_image_and_pixmap): Fail gracefully if a bit
depth is requested that XRender doesn't support.
---
src/image.c | 32 +++++++++++++++++++++++---------
1 file changed, 23 insertions(+), 9 deletions(-)
diff --git a/src/image.c b/src/image.c
index 2f0b63c..e4b0975 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2179,15 +2179,29 @@ x_create_x_image_and_pixmap (struct frame *f, int
width, int height, int depth,
int event_basep, error_basep;
if (picture && XRenderQueryExtension (display, &event_basep, &error_basep))
{
- XRenderPictFormat *format;
- XRenderPictureAttributes attr;
-
- /* FIXME: Do we need to handle all possible bit depths? */
- format = XRenderFindStandardFormat (display,
- depth > 24 ? PictStandardARGB32
- : depth > 8 ? PictStandardRGB24
- : PictStandardA8);
- *picture = XRenderCreatePicture (display, *pixmap, format, 0, &attr);
+ if (depth == 32 || depth == 24 || depth == 8)
+ {
+ XRenderPictFormat *format;
+ XRenderPictureAttributes attr;
+
+ /* FIXME: Do we need to handle all possible bit depths?
+ XRenderFindStandardFormat supports PictStandardARGB32,
+ PictStandardRGB24, PictStandardA8, PictStandardA4,
+ PictStandardA1, and PictStandardNUM (what is this?!).
+
+ XRenderFindFormat may support more, but I don't
+ understand the documentation. */
+ format = XRenderFindStandardFormat (display,
+ depth == 32 ? PictStandardARGB32
+ : depth == 24 ? PictStandardRGB24
+ : PictStandardA8);
+ *picture = XRenderCreatePicture (display, *pixmap, format, 0, &attr);
+ }
+ else
+ {
+ image_error ("Specified image bit depth is not supported by
XRender");
+ *picture = NULL;
+ }
}
# endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 03b8903: Be more specific with XRender bit-depths (bug#34051),
Alan Third <=