summaryrefslogtreecommitdiff
path: root/src/cairo-gstate.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2013-06-20 14:23:15 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2013-06-20 14:26:21 +0100
commitb7331f0c52cc64f2c224eac502afa6c50a1a8d8b (patch)
treed9411bf0d1e3d3810b6144b15821832a77881a99 /src/cairo-gstate.c
parent9ea5993b036f5930179263baaf3162eeebb7c153 (diff)
downloadcairo-b7331f0c52cc64f2c224eac502afa6c50a1a8d8b.tar.gz
gstate: Speed up stroked path extents
We can skip the intermediate evaluation of the trapezoids for determining the extents of a stroked path by using the relatively new functions for computing the contours of the stroke. Then we can simply use the bbox of the points within the contours to retrieve the path extents - which is already provided by the polygon holding the contours of the stroke. This provides a faster result with less numerical inaccuracy due to fewer stages required in the computation References: https://bugs.freedesktop.org/show_bug.cgi?id=62375 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-gstate.c')
-rw-r--r--src/cairo-gstate.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index 6319471ac..b8caa63f1 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -1462,19 +1462,19 @@ _cairo_gstate_stroke_extents (cairo_gstate_t *gstate,
}
if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
- cairo_traps_t traps;
-
- _cairo_traps_init (&traps);
- status = _cairo_path_fixed_stroke_polygon_to_traps (path,
- &gstate->stroke_style,
- &gstate->ctm,
- &gstate->ctm_inverse,
- gstate->tolerance,
- &traps);
- empty = traps.num_traps == 0;
+ cairo_polygon_t polygon;
+
+ _cairo_polygon_init (&polygon, NULL, 0);
+ status = _cairo_path_fixed_stroke_to_polygon (path,
+ &gstate->stroke_style,
+ &gstate->ctm,
+ &gstate->ctm_inverse,
+ gstate->tolerance,
+ &polygon);
+ empty = polygon.num_edges == 0;
if (! empty)
- _cairo_traps_extents (&traps, &extents);
- _cairo_traps_fini (&traps);
+ extents = polygon.extents;
+ _cairo_polygon_fini (&polygon);
}
if (! empty) {
_cairo_gstate_extents_to_user_rectangle (gstate, &extents,