diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-29 00:32:36 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-03-29 00:51:46 +0100 |
commit | d304f0e57be8036719c3709e2419487326369105 (patch) | |
tree | cf01a45634671674fb91ec3863dfcf4129ee91ed /src/cairo-composite-rectangles.c | |
parent | 5b3d878c82fc862038c8e6730f34de317d734bd0 (diff) | |
download | cairo-d304f0e57be8036719c3709e2419487326369105.tar.gz |
composite-rectangles: Trim extents for SOURCE and CLEAR to the mask
The SOURCE and CLEAR are the odd pair in Cairo's range of operators that
are bound by the shape/mask, but are unbound by the source. This
regularly leads to bugs as only track the bound/unbound rectangles and
confuse the meaning when bound only by the mask.
What is required is that the unbound extents in this case is only
trimmed by the mask (the bounded extents are still the intersection of
all).
Fixes bug-source-cu
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-composite-rectangles.c')
-rw-r--r-- | src/cairo-composite-rectangles.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/cairo-composite-rectangles.c b/src/cairo-composite-rectangles.c index 106571e3c..8c5cd5a99 100644 --- a/src/cairo-composite-rectangles.c +++ b/src/cairo-composite-rectangles.c @@ -147,8 +147,12 @@ _cairo_composite_rectangles_intersect (cairo_composite_rectangles_t *extents, if (! ret && extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK) return CAIRO_INT_STATUS_NOTHING_TO_DO; - if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE)) + if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE)) { extents->unbounded = extents->bounded; + } else if (extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK) { + if (!_cairo_rectangle_intersect (&extents->unbounded, &extents->mask)) + return CAIRO_INT_STATUS_NOTHING_TO_DO; + } extents->clip = _cairo_clip_reduce_for_composite (clip, extents); if (_cairo_clip_is_all_clipped (extents->clip)) @@ -199,8 +203,12 @@ _cairo_composite_rectangles_intersect_source_extents (cairo_composite_rectangles rect.height == extents->bounded.height) return CAIRO_INT_STATUS_SUCCESS; - if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE)) + if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE)) { extents->unbounded = extents->bounded; + } else if (extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK) { + if (!_cairo_rectangle_intersect (&extents->unbounded, &extents->mask)) + return CAIRO_INT_STATUS_NOTHING_TO_DO; + } clip = extents->clip; extents->clip = _cairo_clip_reduce_for_composite (clip, extents); @@ -253,8 +261,12 @@ _cairo_composite_rectangles_intersect_mask_extents (cairo_composite_rectangles_t mask.height == extents->bounded.height) return CAIRO_INT_STATUS_SUCCESS; - if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE)) + if (extents->is_bounded == (CAIRO_OPERATOR_BOUND_BY_MASK | CAIRO_OPERATOR_BOUND_BY_SOURCE)) { extents->unbounded = extents->bounded; + } else if (extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK) { + if (!_cairo_rectangle_intersect (&extents->unbounded, &extents->mask)) + return CAIRO_INT_STATUS_NOTHING_TO_DO; + } clip = extents->clip; extents->clip = _cairo_clip_reduce_for_composite (clip, extents); |