[cairo-commit] 2 commits - src/cairo-xcb-surface-render.c

Andrea Canciani ranma42 at kemper.freedesktop.org
Sat Dec 18 06:55:27 PST 2010


 src/cairo-xcb-surface-render.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

New commits:
commit cf0a4ed862d93b7e6d7d26942cfe98a50beccd4c
Author: Uli Schlachter <psychon at znc.in>
Date:   Mon Nov 29 19:11:26 2010 +0100

    xcb: Remove a wrong optimization
    
    Clear surfaces with an alpha channel are already replaced with a
    transparent color in gstate, so this code was never hit.
    
    Clear surfaces without an alpha channel, can be replaced with solid
    black only if the surface pattern has an extend other than
    CAIRO_EXTEND_NONE.
    
    Fixes the clear-source test for xcb.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>
    Reviewed-by: Andrea Canciani <ranma42 at gmail.com>

diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index f90d6c8..6f29224 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -1156,13 +1156,6 @@ _cairo_xcb_surface_picture (cairo_xcb_surface_t *target,
     cairo_filter_t filter;
     cairo_status_t status;
 
-    if (source->is_clear) {
-        if (source->content & CAIRO_CONTENT_ALPHA)
-	    return _cairo_xcb_transparent_picture (target);
-        else
-            return _cairo_xcb_black_picture (target);
-    }
-
     {
 	cairo_xcb_surface_t *snapshot;
 
commit e6c3efdd650a4eadceb003a5e1bf9d871f61a48f
Author: Uli Schlachter <psychon at znc.in>
Date:   Sat Nov 27 21:52:59 2010 +0100

    xcb: Work around wrong extent computation in the X server
    
    The X server calculates the bounding box for traps and then allocates
    a temporary picture for this. When the X server calculates different
    values than cairo got in extents->bounded, unbounded operators will
    have wrong results. The X server only ever calculates bounds that are
    larger than the correct values.
    
    Fix this by explicitly clipping the drawing to the expected bounds.
    
    Fixes clip-fill-{eo,nz}-unbounded and clip-stroke-unbounded.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>
    Reviewed-by: Andrea Canciani <ranma42 at gmail.com>

diff --git a/src/cairo-xcb-surface-render.c b/src/cairo-xcb-surface-render.c
index f712818..f90d6c8 100644
--- a/src/cairo-xcb-surface-render.c
+++ b/src/cairo-xcb-surface-render.c
@@ -2391,6 +2391,7 @@ _clip_and_composite (cairo_xcb_surface_t	*dst,
 {
     cairo_status_t status;
     cairo_region_t *clip_region = NULL;
+    cairo_region_t extents_region;
     cairo_bool_t need_clip_surface = FALSE;
 
     if (clip != NULL) {
@@ -2414,6 +2415,14 @@ _clip_and_composite (cairo_xcb_surface_t	*dst,
 	    if (unlikely (is_empty && extents->is_bounded))
 		return CAIRO_STATUS_SUCCESS;
 	}
+    } else if (!extents->is_bounded) {
+	/* The X server will estimate the affected region of the unbounded
+	 * operation and will apply the operation to that rectangle.
+	 * However, there are cases where this estimate is too high (e.g.
+	 * the test suite's clip-fill-{eo,nz}-unbounded tests).
+	 */
+	_cairo_region_init_rectangle (&extents_region, &extents->unbounded);
+	clip_region = &extents_region;
     }
 
     status = _cairo_xcb_connection_acquire (dst->connection);
@@ -2482,6 +2491,8 @@ _clip_and_composite (cairo_xcb_surface_t	*dst,
 
     if (clip_region != NULL)
 	_cairo_xcb_surface_clear_clip_region (dst);
+    if (clip_region == &extents_region)
+	_cairo_region_fini (&extents_region);
 
     _cairo_xcb_connection_release (dst->connection);
 


More information about the cairo-commit mailing list