diff options
| -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 | ||