summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2011-02-06 14:11:30 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2011-02-06 14:19:23 +0000
commitd558f40c44f3d4f4a8a613318ff556c5d26914f7 (patch)
treedb4158490a8ef7a1a7e5815988b9915d6874a112 /src
parentfc8c54dafe8e607053523e80447507fb57bc0fc0 (diff)
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@chris-wilson.co.uk>
Diffstat (limited to 'src')
-rw-r--r--src/cairo-image-surface.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 6082215ff..ea6b44905 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,