[cairo-commit] src/cairo-xlib-surface.c

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Thu Oct 27 09:21:33 PDT 2011


 src/cairo-xlib-surface.c |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

New commits:
commit 8ddecc08a5e4fc43368c01e4e85215962b009b92
Author: Carlos Garcia Campos <cgarcia at igalia.com>
Date:   Thu Oct 27 18:09:23 2011 +0200

    xlib: Check pixman format before trying to create an image surface for it

diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c
index 1806e64..0ec1264 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);


More information about the cairo-commit mailing list