diff options
| author | Alan Third | 2019-01-15 16:38:34 +0000 |
|---|---|---|
| committer | Alan Third | 2019-01-17 17:30:54 +0000 |
| commit | 03b8903ee7fffc75085600899c992829a49d4442 (patch) | |
| tree | bd0928c2fdb9696c9cf3d604b1e255ffcdd70d3f /src/image.c | |
| parent | 5a6df06494f9ba6df53af82cfdf81f1d3708edc3 (diff) | |
| download | emacs-03b8903ee7fffc75085600899c992829a49d4442.tar.gz emacs-03b8903ee7fffc75085600899c992829a49d4442.zip | |
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.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/src/image.c b/src/image.c index 2f0b63ca899..e4b097588ad 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, | |||
| 2179 | int event_basep, error_basep; | 2179 | int event_basep, error_basep; |
| 2180 | if (picture && XRenderQueryExtension (display, &event_basep, &error_basep)) | 2180 | if (picture && XRenderQueryExtension (display, &event_basep, &error_basep)) |
| 2181 | { | 2181 | { |
| 2182 | XRenderPictFormat *format; | 2182 | if (depth == 32 || depth == 24 || depth == 8) |
| 2183 | XRenderPictureAttributes attr; | 2183 | { |
| 2184 | 2184 | XRenderPictFormat *format; | |
| 2185 | /* FIXME: Do we need to handle all possible bit depths? */ | 2185 | XRenderPictureAttributes attr; |
| 2186 | format = XRenderFindStandardFormat (display, | 2186 | |
| 2187 | depth > 24 ? PictStandardARGB32 | 2187 | /* FIXME: Do we need to handle all possible bit depths? |
| 2188 | : depth > 8 ? PictStandardRGB24 | 2188 | XRenderFindStandardFormat supports PictStandardARGB32, |
| 2189 | : PictStandardA8); | 2189 | PictStandardRGB24, PictStandardA8, PictStandardA4, |
| 2190 | *picture = XRenderCreatePicture (display, *pixmap, format, 0, &attr); | 2190 | PictStandardA1, and PictStandardNUM (what is this?!). |
| 2191 | |||
| 2192 | XRenderFindFormat may support more, but I don't | ||
| 2193 | understand the documentation. */ | ||
| 2194 | format = XRenderFindStandardFormat (display, | ||
| 2195 | depth == 32 ? PictStandardARGB32 | ||
| 2196 | : depth == 24 ? PictStandardRGB24 | ||
| 2197 | : PictStandardA8); | ||
| 2198 | *picture = XRenderCreatePicture (display, *pixmap, format, 0, &attr); | ||
| 2199 | } | ||
| 2200 | else | ||
| 2201 | { | ||
| 2202 | image_error ("Specified image bit depth is not supported by XRender"); | ||
| 2203 | *picture = NULL; | ||
| 2204 | } | ||
| 2191 | } | 2205 | } |
| 2192 | # endif | 2206 | # endif |
| 2193 | 2207 | ||