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

Uli Schlachter psychon at kemper.freedesktop.org
Mon Jun 13 00:43:24 PDT 2011


 src/cairo-xcb-surface.c |   10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

New commits:
commit 9d256b7db90ba0517a2d06a7c99f8e59021c1d6a
Author: Uli Schlachter <psychon at znc.in>
Date:   Sun Jun 12 15:42:01 2011 +0200

    xcb: Fallback to image surface for create similar
    
    We can't use an X11 surface in create_similar if the specified coordinates are
    too small/large. However, we can still use SHM-backed memory for the image
    surface which will be used instead.
    
    Thanks to Chris Wilson for the hint.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 95121b4..6278773 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -185,11 +185,11 @@ _cairo_xcb_surface_create_similar (void			*abstract_other,
     xcb_pixmap_t pixmap;
     cairo_status_t status;
 
-    if (width > XLIB_COORD_MAX || height > XLIB_COORD_MAX)
-	return NULL;
-
-    if (width <= 0 || height <= 0)
-	return NULL;
+    if (unlikely(width  > XLIB_COORD_MAX ||
+		 height > XLIB_COORD_MAX ||
+		 width  <= 0 ||
+		 height <= 0))
+	return _cairo_xcb_surface_create_similar_image (other, content, width, height);
 
 #if CAIRO_HAS_DRM_SURFACE && CAIRO_HAS_XCB_DRM_FUNCTIONS
     if (other->drm != NULL) {


More information about the cairo-commit mailing list