summaryrefslogtreecommitdiff
path: root/src/cairo-path-bounds.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-01-19 15:36:29 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2009-01-29 10:10:39 +0000
commit54f6a49ebb18cf396823d0d70b95e4e264142171 (patch)
tree0c0e09a8b92f59b1e3ae01462c65779f7398fff4 /src/cairo-path-bounds.c
parente217c4da7bc5c4817e0d829ff61dd2bd5b3145a6 (diff)
downloadcairo-54f6a49ebb18cf396823d0d70b95e4e264142171.tar.gz
[bounds] Skip spline evaluation based on bounding bbox of control points.
The bounding polygon of the control points, defines the extents of the spline. Therefore if the control points are entirely contained within the current path extents, so is the spline and we do not need to evaluate its tight bounds.
Diffstat (limited to 'src/cairo-path-bounds.c')
-rw-r--r--src/cairo-path-bounds.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/cairo-path-bounds.c b/src/cairo-path-bounds.c
index 9f30eb509..1fadd84dd 100644
--- a/src/cairo-path-bounds.c
+++ b/src/cairo-path-bounds.c
@@ -121,8 +121,25 @@ _cairo_path_bounder_curve_to (void *closure,
{
cairo_path_bounder_t *bounder = closure;
- return _cairo_spline_bound (_cairo_path_bounder_line_to, bounder,
- &bounder->current_point, b, c, d);
+ /* If the bbox of the control points is entirely inside, then we
+ * do not need to further evaluate the spline.
+ */
+ if (! bounder->has_point ||
+ b->x < bounder->extents.p1.x || b->x > bounder->extents.p2.x ||
+ b->y < bounder->extents.p1.y || b->y > bounder->extents.p2.y ||
+ c->x < bounder->extents.p1.x || c->x > bounder->extents.p2.x ||
+ c->y < bounder->extents.p1.y || c->y > bounder->extents.p2.y ||
+ d->x < bounder->extents.p1.x || d->x > bounder->extents.p2.x ||
+ d->y < bounder->extents.p1.y || d->y > bounder->extents.p2.y)
+ {
+ return _cairo_spline_bound (_cairo_path_bounder_line_to, bounder,
+ &bounder->current_point, b, c, d);
+ }
+ else
+ {
+ /* All control points are within the current extents. */
+ return CAIRO_STATUS_SUCCESS;
+ }
}
static cairo_status_t