[cairo-commit] 4 commits - src/cairo-clip-boxes.c src/cairo-clip-surface.c src/cairo-spans-compositor.c src/cairo-traps-compositor.c

Chris Wilson ickle at kemper.freedesktop.org
Thu Feb 9 14:13:11 PST 2012


 src/cairo-clip-boxes.c       |    3 +++
 src/cairo-clip-surface.c     |   10 ++++++----
 src/cairo-spans-compositor.c |   16 +++++-----------
 src/cairo-traps-compositor.c |    2 +-
 4 files changed, 15 insertions(+), 16 deletions(-)

New commits:
commit bb86e332da9a7837b6fd6476efd9be77572dd706
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Feb 9 22:11:24 2012 +0000

    traps: composite_boxes() is not a mask constructor
    
    Since it doesn't combine the clip in a single pass, don't claim to.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-traps-compositor.c b/src/cairo-traps-compositor.c
index 4c05e80..b435180 100644
--- a/src/cairo-traps-compositor.c
+++ b/src/cairo-traps-compositor.c
@@ -1538,7 +1538,7 @@ clip_and_composite_boxes (const cairo_traps_compositor_t *compositor,
     }
 
     return clip_and_composite (compositor, extents,
-			       composite_boxes, composite_boxes, boxes,
+			       composite_boxes, NULL, boxes,
 			       need_unbounded_clip (extents));
 }
 
commit 3443ad903d2ccff7d63a9116df7629d69d87d673
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Feb 9 22:08:41 2012 +0000

    spans: Pass unbounded operations to the spans compositors
    
    Only bail if we need to combine clipping with the spans (either for a
    bounded or unbounded operation).
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-spans-compositor.c b/src/cairo-spans-compositor.c
index 0abb505..f069bcd 100644
--- a/src/cairo-spans-compositor.c
+++ b/src/cairo-spans-compositor.c
@@ -565,16 +565,10 @@ composite_aligned_boxes (const cairo_spans_compositor_t		*compositor,
 }
 
 static cairo_bool_t
-composite_needs_clip (const cairo_composite_rectangles_t *composit,
+composite_needs_clip (const cairo_composite_rectangles_t *composite,
 		      const cairo_box_t *extents)
 {
-    cairo_bool_t needs_clip;
-
-    needs_clip = ! composit->is_bounded;
-    if (needs_clip)
-	needs_clip = ! _cairo_clip_contains_box (composit->clip, extents);
-
-    return needs_clip;
+    return !_cairo_clip_contains_box (composite->clip, extents);
 }
 
 static cairo_int_status_t
@@ -588,11 +582,11 @@ composite_boxes (const cairo_spans_compositor_t *compositor,
     cairo_int_status_t status;
     cairo_box_t box;
 
-    _cairo_box_from_rectangle (&box, &extents->bounded);
+    _cairo_box_from_rectangle (&box, &extents->unbounded);
     if (composite_needs_clip (extents, &box))
 	return CAIRO_INT_STATUS_UNSUPPORTED;
 
-    _cairo_rectangular_scan_converter_init (&converter, &extents->bounded);
+    _cairo_rectangular_scan_converter_init (&converter, &extents->unbounded);
     for (chunk = &boxes->chunks; chunk != NULL; chunk = chunk->next) {
 	const cairo_box_t *box = chunk->base;
 	int i;
@@ -633,7 +627,7 @@ composite_polygon (const cairo_spans_compositor_t	*compositor,
 							   polygon,
 							   fill_rule, antialias);
     } else {
-	const cairo_rectangle_int_t *r = &extents->bounded;
+	const cairo_rectangle_int_t *r = &extents->unbounded;
 
 	if (antialias == CAIRO_ANTIALIAS_FAST) {
 	    converter = _cairo_tor22_scan_converter_create (r->x, r->y,
commit 3023ff86d58f97f3b2d3304c337920647bc8a147
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Feb 9 22:08:08 2012 +0000

    clip: Apply the partial boxes for clip_combine_with_surface
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-clip-surface.c b/src/cairo-clip-surface.c
index 244e7f2..523cd42 100644
--- a/src/cairo-clip-surface.c
+++ b/src/cairo-clip-surface.c
@@ -54,8 +54,8 @@ _cairo_clip_combine_with_surface (const cairo_clip_t *clip,
 				  cairo_surface_t *dst,
 				  int dst_x, int dst_y)
 {
-    cairo_clip_path_t *clip_path;
     cairo_clip_path_t *copy_path;
+    cairo_clip_path_t *clip_path;
     cairo_clip_t *copy;
     cairo_status_t status = CAIRO_STATUS_SUCCESS;
 
@@ -63,14 +63,16 @@ _cairo_clip_combine_with_surface (const cairo_clip_t *clip,
     copy_path = copy->path;
     copy->path = NULL;
 
-    if (copy_path == NULL) {
-	assert (copy->num_boxes);
+    if (copy->boxes) {
 	status = _cairo_surface_paint (dst,
 				       CAIRO_OPERATOR_IN,
 				       &_cairo_pattern_white.base,
 				       copy);
     }
 
+    clip = NULL;
+    if (_cairo_clip_is_region (copy))
+	clip = copy;
     clip_path = copy_path;
     while (status == CAIRO_STATUS_SUCCESS && clip_path) {
 	status = _cairo_surface_fill (dst,
@@ -80,7 +82,7 @@ _cairo_clip_combine_with_surface (const cairo_clip_t *clip,
 				      clip_path->fill_rule,
 				      clip_path->tolerance,
 				      clip_path->antialias,
-				      copy);
+				      clip);
 	clip_path = clip_path->prev;
     }
 
commit fb3a193959bbfa71308338182f208e3221ddfa04
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Thu Feb 9 22:06:18 2012 +0000

    clip: Check whether an extents only clip contains the box
    
    If we steal the boxes, we leave behind an extents-only clip, i.e. only
    without a path or boxes, in which case do not return FALSE for the
    is-contained check on a rectangle.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-clip-boxes.c b/src/cairo-clip-boxes.c
index be4497c..7372c73 100644
--- a/src/cairo-clip-boxes.c
+++ b/src/cairo-clip-boxes.c
@@ -85,6 +85,9 @@ _cairo_clip_contains_rectangle_box (const cairo_clip_t *clip,
     if (! _cairo_rectangle_contains_rectangle (&clip->extents, rect))
 	return FALSE;
 
+    if (clip->num_boxes == 0)
+	return TRUE;
+
     /* Check for a clip-box that wholly contains the rectangle */
     for (i = 0; i < clip->num_boxes; i++) {
 	if (box->p1.x >= clip->boxes[i].p1.x &&


More information about the cairo-commit mailing list