From 8ddecc08a5e4fc43368c01e4e85215962b009b92 Mon Sep 17 00:00:00 2001 From: Carlos Garcia Campos Date: Thu, 27 Oct 2011 18:09:23 +0200 Subject: xlib: Check pixman format before trying to create an image surface for it --- src/cairo-xlib-surface.c | 15 +++++++++------ 1 file 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); -- cgit v1.2.3