[PATCH 2/2] image: Don't use the fast path if it's wrong

Uli Schlachter psychon at znc.in
Mon Mar 21 10:46:32 PDT 2011


Fixes the new "operator-source" test and the original report from:
http://lists.cairographics.org/archives/cairo/2011-March/021827.html

I tested this code path with all operators and "source" is the only one which
causes issues due to rendering outside of the boxes.

Signed-off-by: Uli Schlachter <psychon at znc.in>
---
 src/cairo-image-surface.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/cairo-image-surface.c b/src/cairo-image-surface.c
index 2a421b7..e00f6d9 100644
--- a/src/cairo-image-surface.c
+++ b/src/cairo-image-surface.c
@@ -2781,6 +2781,12 @@ _composite_unaligned_boxes (cairo_image_surface_t *dst,
     const struct _cairo_boxes_chunk *chunk;
     int i, src_x, src_y;
 
+    /* The below code breaks for unaligned boxes with operator source. This can
+     * best be seen with multiple boxes where black is drawn to dst outside of
+     * the boxes. */
+    if (op == CAIRO_OPERATOR_SOURCE && ! boxes->is_pixel_aligned)
+	return CAIRO_INT_STATUS_UNSUPPORTED;
+
     i = CAIRO_STRIDE_FOR_WIDTH_BPP (extents->bounded.width, 8) * extents->bounded.height;
     if ((unsigned) i <= sizeof (buf)) {
 	mask = pixman_image_create_bits (PIXMAN_a8,
-- 
1.7.4.1


--------------090902070304070202040907--


More information about the cairo mailing list