[cairo-commit] 2 commits - src/cairo-image-source.c src/cairo-surface-wrapper.c

Chris Wilson ickle at kemper.freedesktop.org
Sat Sep 17 04:04:35 PDT 2011


 src/cairo-image-source.c    |    5 +++-
 src/cairo-surface-wrapper.c |   49 ++++++++++++++++++++++++++------------------
 2 files changed, 34 insertions(+), 20 deletions(-)

New commits:
commit cea41a61c104f235c1f896207115507aed93d9ea
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Sep 17 12:01:49 2011 +0100

    image: intersect the source extents with the replay extents for EXTEND_NONE
    
    Fixes up the boundary on EXTEND_NONE replays.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-image-source.c b/src/cairo-image-source.c
index c6c5345..4c2c1d2 100644
--- a/src/cairo-image-source.c
+++ b/src/cairo-image-source.c
@@ -639,8 +639,11 @@ _pixman_image_for_recording (cairo_image_surface_t *dst,
     } else
 	extend = CAIRO_EXTEND_NONE;
 
-    if (extend == CAIRO_EXTEND_NONE)
+    if (extend == CAIRO_EXTEND_NONE) {
 	limit = *extents;
+	if (! _cairo_rectangle_intersect (&limit, sample))
+	    return _pixman_transparent_image ();
+    }
 
     if (dst->base.content == source->content)
 	clone = cairo_image_surface_create (dst->format,
commit 09b42c748e9dbcc923560c7d8bf5298fbffe95ef
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sat Sep 17 12:00:49 2011 +0100

    wrapper: intersect with target extents
    
    Treat the target extents as an implicit clip for computing the maximal
    operation extents.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-surface-wrapper.c b/src/cairo-surface-wrapper.c
index d2d971d..48bd30a 100644
--- a/src/cairo-surface-wrapper.c
+++ b/src/cairo-surface-wrapper.c
@@ -621,35 +621,46 @@ cairo_bool_t
 _cairo_surface_wrapper_get_target_extents (cairo_surface_wrapper_t *wrapper,
 					   cairo_rectangle_int_t *extents)
 {
-    cairo_rectangle_int_t tmp;
+    cairo_rectangle_int_t clip;
+    cairo_bool_t has_clip;
 
+    has_clip = _cairo_surface_get_extents (wrapper->target, &clip);
     if (wrapper->clip) {
-	const cairo_rectangle_int_t *r = _cairo_clip_get_extents (wrapper->clip);
-	if (wrapper->needs_transform) {
-	    cairo_matrix_t m;
-	    double x1, y1, x2, y2;
+	if (has_clip) {
+	    if (! _cairo_rectangle_intersect (&clip,
+					      _cairo_clip_get_extents (wrapper->clip)))
+		return FALSE;
+	} else {
+	    has_clip = TRUE;
+	    clip = *_cairo_clip_get_extents (wrapper->clip);
+	}
+    }
 
-	    _cairo_surface_wrapper_get_inverse_transform (wrapper, &m);
+    if (has_clip && wrapper->needs_transform) {
+	cairo_matrix_t m;
+	double x1, y1, x2, y2;
 
-	    x1 = r->x;
-	    y1 = r->y;
-	    x2 = r->x + r->width;
-	    y2 = r->y + r->height;
+	_cairo_surface_wrapper_get_inverse_transform (wrapper, &m);
 
-	    _cairo_matrix_transform_bounding_box (&m, &x1, &y1, &x2, &y2, NULL);
+	x1 = clip.x;
+	y1 = clip.y;
+	x2 = clip.x + clip.width;
+	y2 = clip.y + clip.height;
 
-	    tmp.x = floor (x1);
-	    tmp.y = floor (y1);
-	    tmp.width  = ceil (x2) - tmp.x;
-	    tmp.height = ceil (y2) - tmp.y;
-	    r = &tmp;
-	}
+	_cairo_matrix_transform_bounding_box (&m, &x1, &y1, &x2, &y2, NULL);
+
+	clip.x = floor (x1);
+	clip.y = floor (y1);
+	clip.width  = ceil (x2) - clip.x;
+	clip.height = ceil (y2) - clip.y;
+    }
 
+    if (has_clip) {
 	if (wrapper->has_extents) {
 	    *extents = wrapper->extents;
-	    return _cairo_rectangle_intersect (extents, r);
+	    return _cairo_rectangle_intersect (extents, &clip);
 	} else {
-	    *extents = *r;
+	    *extents = clip;
 	    return TRUE;
 	}
     } else if (wrapper->has_extents) {


More information about the cairo-commit mailing list