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

Chris Wilson ickle at kemper.freedesktop.org
Sun Feb 6 06:22:06 PST 2011


 src/cairo-image-surface.c |   28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

New commits:
commit d558f40c44f3d4f4a8a613318ff556c5d26914f7
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Feb 6 14:11:30 2011 +0000

    image: Limit span rendering to bounded extents
    
    We make the presumption that the incoming geometry is appropriately
    clipped to the bounded extents and can simply memset without being out
    of bounds.
    
    However, this was not always the case as we were removing the clip boxes
    in order to optimise the common case where the operation is naturally
    limited to the surface.
    
    (This is a candidate for 1.10)
    
    Bugzilla: https://bugs.launchpad.net/ubuntu/+source/cairo/+bug/710072
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 6082215..ea6b449 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -3577,6 +3577,20 @@ _cairo_image_surface_stroke (void			*abstract_surface,
 	cairo_boxes_t boxes;
 
 	_cairo_boxes_init (&boxes);
+	if (num_boxes == 0) {
+		/* When compositing with the span renderer, we limit the mask
+		 * to the bounded area, and so we must also constrain the path
+		 * appropriately. (Unlike the other compositing paths
+		 * where the operation itself is limited to extents.)
+		 */
+		boxes_stack[0].p1.x = extents.bounded.x;
+		boxes_stack[0].p1.y = extents.bounded.y;
+		boxes_stack[0].p2.x = extents.bounded.x + extents.bounded.width;
+		boxes_stack[0].p2.y = extents.bounded.y + extents.bounded.height;
+
+		clip_boxes = boxes_stack;
+		num_boxes = 1;
+	}
 	_cairo_boxes_limit (&boxes, clip_boxes, num_boxes);
 
 	status = _cairo_path_fixed_stroke_rectilinear_to_boxes (path,
@@ -3676,6 +3690,20 @@ _cairo_image_surface_fill (void				*abstract_surface,
 	cairo_boxes_t boxes;
 
 	_cairo_boxes_init (&boxes);
+	if (num_boxes == 0) {
+		/* When compositing with the span renderer, we limit the mask
+		 * to the bounded area, and so we must also constrain the path
+		 * appropriately. (Unlike the other compositing paths
+		 * where the operation itself is limited to extents.)
+		 */
+		boxes_stack[0].p1.x = extents.bounded.x;
+		boxes_stack[0].p1.y = extents.bounded.y;
+		boxes_stack[0].p2.x = extents.bounded.x + extents.bounded.width;
+		boxes_stack[0].p2.y = extents.bounded.y + extents.bounded.height;
+
+		clip_boxes = boxes_stack;
+		num_boxes = 1;
+	}
 	_cairo_boxes_limit (&boxes, clip_boxes, num_boxes);
 
 	status = _cairo_path_fixed_fill_rectilinear_to_boxes (path,


More information about the cairo-commit mailing list