diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-24 10:03:48 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-07-24 11:50:48 +0100 |
commit | dc67d8e7f907062c7d0f02b57498c7503cb72f69 (patch) | |
tree | 408c6ebd84d78ce7f2be019398770d6dd19eadd9 /src/cairo-composite-rectangles.c | |
parent | 05bed4c574a9e6577bca93bfce837804c3dc6d19 (diff) |
composite: Perform a quick is-clipped for glyphs
Computing the exact bbox of the glyphs and whether they are overlapped
is expensive. However, we can often check whether they are visible just
by looking at the maximal extents of the fonts along with the bbox of
the positions; much cheaper.
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 | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/cairo-composite-rectangles.c b/src/cairo-composite-rectangles.c index 7f288cb9..881d2649 100644 --- a/src/cairo-composite-rectangles.c +++ b/src/cairo-composite-rectangles.c @@ -234,6 +234,17 @@ _cairo_composite_rectangles_init_for_glyphs (cairo_composite_rectangles_t *exten return CAIRO_INT_STATUS_NOTHING_TO_DO; } + /* Computing the exact bbox and the overlap is expensive. + * First perform a cheap test to see if the glyphs are all clipped out. + */ + if (extents->is_bounded & CAIRO_OPERATOR_BOUND_BY_MASK) { + _cairo_scaled_font_glyph_approximate_extents (scaled_font, + glyphs, num_glyphs, + &extents->mask); + if (! _cairo_rectangle_intersect (&extents->bounded, &extents->mask)) + return CAIRO_INT_STATUS_NOTHING_TO_DO; + } + status = _cairo_scaled_font_glyph_device_extents (scaled_font, glyphs, num_glyphs, &extents->mask, |