[cairo-commit] 5 commits - src/cairo-xcb-connection-core.c src/cairo-xcb-surface.c src/cairo-xcb-surface-render.c

Uli Schlachter psychon at kemper.freedesktop.org
Fri Jul 29 01:34:24 PDT 2011


 src/cairo-xcb-connection-core.c |    3 +++
 src/cairo-xcb-surface-render.c  |    5 +++++
 src/cairo-xcb-surface.c         |   34 +++++++++++++++++++++++++++++++++-
 3 files changed, 41 insertions(+), 1 deletion(-)

New commits:
commit e06a3b97618ec19a26003fd02bc6054f11039ef4
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Jul 29 10:27:31 2011 +0200

    xcb: Handle fallback in map_to_image
    
    Fixes (for xcb-fallback): map-all-to-image map-bit-to-image map-to-image-fill
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index bc23324..072f3e3 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -655,6 +655,9 @@ _cairo_xcb_surface_map_to_image (void *abstract_surface,
     cairo_xcb_surface_t *surface = abstract_surface;
     cairo_image_surface_t *image;
 
+    if (surface->fallback)
+	return surface->fallback->base.backend->map_to_image (surface->fallback, extents);
+
     image = _get_image (surface, TRUE,
 			extents->x, extents->y,
 			extents->width, extents->height);
@@ -686,6 +689,10 @@ static cairo_int_status_t
 _cairo_xcb_surface_unmap (void *abstract_surface,
 			  cairo_image_surface_t *image)
 {
+    cairo_xcb_surface_t *surface = abstract_surface;
+
+    if (surface->fallback)
+	return surface->fallback->base.backend->unmap_image (surface->fallback, image);
     return _put_image (abstract_surface, image);
 }
 
commit 27702768bf684ed7c91b505451414237af0f5853
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Jul 29 10:18:55 2011 +0200

    xcb: _get_image only works without fallback
    
    This turns the test suite-failures for map-all-to-image map-bit-to-image
    map-to-image-fill with xcb-fallback into failed assertions.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index 7cf761d..bc23324 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -346,6 +346,7 @@ _get_image (cairo_xcb_surface_t		 *surface,
     xcb_get_image_reply_t *reply;
     cairo_int_status_t status;
 
+    assert (surface->fallback == NULL);
     assert (x >= 0);
     assert (y >= 0);
     assert (x + width <= surface->width);
commit 1beab6cca431c0c4a9e9feda6121922fa7f71623
Author: Uli Schlachter <psychon at znc.in>
Date:   Fri Jul 29 10:09:10 2011 +0200

    xcb: Handle deferred clear in map_to_image
    
    Fixes: map-all-to-image map-bit-to-image map-to-image-fill
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c
index db75d25..7cf761d 100644
--- a/src/cairo-xcb-surface.c
+++ b/src/cairo-xcb-surface.c
@@ -660,6 +660,23 @@ _cairo_xcb_surface_map_to_image (void *abstract_surface,
     if (unlikely (image->base.status))
 	return &image->base;
 
+    /* Do we have a deferred clear and this image surface does NOT cover the
+     * whole xcb surface? Have to apply the clear in that case, else
+     * uploading the image will handle the problem for us.
+     */
+    if (surface->deferred_clear &&
+	    ! (extents->x == 0 &&
+	       extents->y == 0 &&
+	       extents->width == surface->width &&
+	       extents->height == surface->height)) {
+	cairo_status_t status = _cairo_xcb_surface_clear (surface);
+	if (unlikely (status)) {
+	    cairo_surface_destroy(&image->base);
+	    return _cairo_surface_create_in_error (status);
+	}
+    }
+    surface->deferred_clear = FALSE;
+
     cairo_surface_set_device_offset (&image->base, -extents->x, -extents->y);
     return &image->base;
 }
@@ -674,7 +691,14 @@ _cairo_xcb_surface_unmap (void *abstract_surface,
 static cairo_image_surface_t *
 _cairo_xcb_surface_fallback (cairo_xcb_surface_t *surface)
 {
-    return _get_image (surface, TRUE, 0, 0, surface->width, surface->height);
+    cairo_image_surface_t *image;
+    image = _get_image (surface, TRUE, 0, 0, surface->width, surface->height);
+
+    /* If there was a deferred clear, _get_image applied it */
+    if (image->base.status == CAIRO_STATUS_SUCCESS)
+	surface->deferred_clear = FALSE;
+
+    return image;
 }
 
 static cairo_int_status_t
commit 8f8149a2073e1e290b6f854595caaf27bd16a80b
Author: Uli Schlachter <psychon at znc.in>
Date:   Thu Jul 28 18:18:07 2011 +0200

    xcb: Error on 0x0 source surfaces
    
    Recording surfaces can be unbounded which causes
    _cairo_surface_acquire_source_image to return a 0x0 image surface for them.
    Since X11 doesn't like anything with a size of 0x0, we should reject such source
    images. Users might still try to mess with 0x0 surfaces, so we will eventually
    need a better idea for handling this.
    
    Instead of failing the assertion that was added in the previous commit, this
    commit makes cairo-xcb return an error.
    
    This makes the recording-* tests fail instead of crash.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index d7c677f..a36bbf1 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -328,6 +328,11 @@ _picture_from_image (cairo_xcb_surface_t *target,
     xcb_gcontext_t gc;
     cairo_xcb_picture_t *picture;
 
+    /* FIXME: Can we somehow optimize this away at a higher layer? */
+    if (unlikely (image->width <= 0 || image->height <= 0))
+	return (cairo_xcb_picture_t *)
+	    _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
+
     pixmap = _cairo_xcb_connection_create_pixmap (target->connection,
 						  image->depth,
 						  target->drawable,
commit 5d72e59982edc21f3e15c46dc77408bce849e4f3
Author: Uli Schlachter <psychon at znc.in>
Date:   Wed Jul 27 20:30:12 2011 +0200

    xcb: Assert that pixmap sizes are positive
    
    Currently, all the recording-* tests fail with an X11 error. This commit turns
    those errors into failed assertions. Now someone just has to figure out why this
    happens in the first place...
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/src/cairo-xcb-connection-core.c b/src/cairo-xcb-connection-core.c
index 089cc4e..5a20004 100644
--- a/src/cairo-xcb-connection-core.c
+++ b/src/cairo-xcb-connection-core.c
@@ -43,6 +43,9 @@ _cairo_xcb_connection_create_pixmap (cairo_xcb_connection_t *connection,
 				     uint16_t height)
 {
     xcb_pixmap_t pixmap = _cairo_xcb_connection_get_xid (connection);
+
+    assert (width > 0);
+    assert (height > 0);
     xcb_create_pixmap (connection->xcb_connection,
 		       depth, pixmap, drawable,
 		       width, height);


More information about the cairo-commit mailing list