diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-13 12:33:21 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-08-13 13:15:36 +0100 |
commit | 279f6ceb595412bef165a808f05caa3044ef102c (patch) | |
tree | b94702c96796dc524402ba8330b6722f08761187 /src/cairo-composite-rectangles.c | |
parent | d391f0908c404344aa6873fbca2b7bd6499009e0 (diff) | |
download | cairo-279f6ceb595412bef165a808f05caa3044ef102c.tar.gz |
Only reduce the clip if it is not in active use for the operation
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 | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/cairo-composite-rectangles.c b/src/cairo-composite-rectangles.c index 439f453bd..6083973f6 100644 --- a/src/cairo-composite-rectangles.c +++ b/src/cairo-composite-rectangles.c @@ -54,11 +54,12 @@ _cairo_composite_rectangles_init (cairo_composite_rectangles_t *extents, const cairo_clip_t *clip) { extents->clip = NULL; + extents->destination = *unbounded; if (_cairo_clip_is_all_clipped (clip)) return FALSE; - extents->unbounded = *unbounded; + extents->unbounded = extents->destination; if (clip != NULL) { if (! _cairo_rectangle_intersect (&extents->unbounded, _cairo_clip_get_extents (clip))) @@ -247,3 +248,26 @@ _cairo_composite_rectangles_init_for_glyphs (cairo_composite_rectangles_t *exten return _cairo_composite_rectangles_intersect (extents, clip); } + +cairo_bool_t +_cairo_composite_rectangles_can_reduce_clip (cairo_composite_rectangles_t *composite, + cairo_clip_t *clip) +{ + cairo_rectangle_int_t extents; + + if (clip == NULL) + return TRUE; + + /* XXX In the not a region case, we could still search through the boxes */ + if (! _cairo_clip_is_region (clip)) + return FALSE; + + extents = composite->destination; + if (composite->is_bounded & CAIRO_OPERATOR_BOUND_BY_SOURCE) + _cairo_rectangle_intersect (&extents, &composite->source); + if (composite->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK) + _cairo_rectangle_intersect (&extents, &composite->mask); + + return cairo_region_contains_rectangle (_cairo_clip_get_region (clip), + &extents) == CAIRO_REGION_OVERLAP_IN; +} |