summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2011-10-27 18:09:23 +0200
committerCarlos Garcia Campos <cgarcia@igalia.com>2011-10-27 18:13:29 +0200
commit8ddecc08a5e4fc43368c01e4e85215962b009b92 (patch)
treec6725ddd54958779fadb468a1abdb490b878b914
parent5c3156667898a1b111ae586c69c66378b7dafed6 (diff)
xlib: Check pixman format before trying to create an image surface for it
-rw-r--r--src/cairo-xlib-surface.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 1806e64b..0ec12646 100644
--- a/src/cairo-xlib-surface.c
+++ b/src/cairo-xlib-surface.c
@@ -687,12 +687,15 @@ _get_image_surface (cairo_xlib_surface_t *surface,
xlib_masks.red_mask = surface->r_mask;
xlib_masks.green_mask = surface->g_mask;
xlib_masks.blue_mask = surface->b_mask;
- _pixman_format_from_masks (&xlib_masks, &pixman_format);
- return _cairo_image_surface_create_with_pixman_format (NULL,
- pixman_format,
- extents->width,
- extents->height,
- 0);
+ if (_pixman_format_from_masks (&xlib_masks, &pixman_format) &&
+ _cairo_format_from_pixman_format (pixman_format) != CAIRO_FORMAT_INVALID)
+ {
+ return _cairo_image_surface_create_with_pixman_format (NULL,
+ pixman_format,
+ extents->width,
+ extents->height,
+ 0);
+ }
}
status = _cairo_xlib_display_acquire (surface->base.device, &display);