summaryrefslogtreecommitdiff
path: root/src/cairo-path-stroke.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-10-03 17:38:21 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2012-10-03 17:38:21 +0100
commitd6a05676849509049fc54eea2559803b6247a6fe (patch)
treedaa475d1127713396a8293f4c02d06ea48957e9a /src/cairo-path-stroke.c
parent8020e0bc8cbd3e5ac188eb305b74ae1c1f362a31 (diff)
downloadcairo-d6a05676849509049fc54eea2559803b6247a6fe.tar.gz
stroke: Remove redundant code for computing culling extents
Same code repeated! Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-path-stroke.c')
-rw-r--r--src/cairo-path-stroke.c91
1 files changed, 33 insertions, 58 deletions
diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 5ef212c3d..66ab3bd13 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -88,6 +88,36 @@ typedef struct cairo_stroker {
cairo_box_t bounds;
} cairo_stroker_t;
+static void
+_cairo_stroker_limit (cairo_stroker_t *stroker,
+ const cairo_path_fixed_t *path,
+ const cairo_box_t *boxes,
+ int num_boxes)
+{
+ double dx, dy;
+ cairo_fixed_t fdx, fdy;
+
+ stroker->has_bounds = TRUE;
+ _cairo_boxes_get_extents (boxes, num_boxes, &stroker->bounds);
+
+ /* Extend the bounds in each direction to account for the maximum area
+ * we might generate trapezoids, to capture line segments that are outside
+ * of the bounds but which might generate rendering that's within bounds.
+ */
+
+ _cairo_stroke_style_max_distance_from_path (&stroker->style, path,
+ stroker->ctm, &dx, &dy);
+
+ fdx = _cairo_fixed_from_double (dx);
+ fdy = _cairo_fixed_from_double (dy);
+
+ stroker->bounds.p1.x -= fdx;
+ stroker->bounds.p2.x += fdx;
+
+ stroker->bounds.p1.y -= fdy;
+ stroker->bounds.p2.y += fdy;
+}
+
static cairo_status_t
_cairo_stroker_init (cairo_stroker_t *stroker,
const cairo_path_fixed_t *path,
@@ -122,65 +152,14 @@ _cairo_stroker_init (cairo_stroker_t *stroker,
stroker->add_external_edge = NULL;
- stroker->has_bounds = num_limits;
- if (stroker->has_bounds) {
- /* Extend the bounds in each direction to account for the maximum area
- * we might generate trapezoids, to capture line segments that are
- * outside of the bounds but which might generate rendering that's
- * within bounds.
- */
- double dx, dy;
- cairo_fixed_t fdx, fdy;
- int i;
-
- stroker->bounds = limits[0];
- for (i = 1; i < num_limits; i++)
- _cairo_box_add_box (&stroker->bounds, &limits[i]);
-
- _cairo_stroke_style_max_distance_from_path (stroke_style, path, ctm, &dx, &dy);
- fdx = _cairo_fixed_from_double (dx);
- fdy = _cairo_fixed_from_double (dy);
-
- stroker->bounds.p1.x -= fdx;
- stroker->bounds.p2.x += fdx;
- stroker->bounds.p1.y -= fdy;
- stroker->bounds.p2.y += fdy;
- }
+ stroker->has_bounds = FALSE;
+ if (num_limits)
+ _cairo_stroker_limit (stroker, path, limits, num_limits);
return CAIRO_STATUS_SUCCESS;
}
static void
-_cairo_stroker_limit (cairo_stroker_t *stroker,
- const cairo_path_fixed_t *path,
- const cairo_box_t *boxes,
- int num_boxes)
-{
- double dx, dy;
- cairo_fixed_t fdx, fdy;
-
- stroker->has_bounds = TRUE;
- _cairo_boxes_get_extents (boxes, num_boxes, &stroker->bounds);
-
- /* Extend the bounds in each direction to account for the maximum area
- * we might generate trapezoids, to capture line segments that are outside
- * of the bounds but which might generate rendering that's within bounds.
- */
-
- _cairo_stroke_style_max_distance_from_path (&stroker->style, path,
- stroker->ctm, &dx, &dy);
-
- fdx = _cairo_fixed_from_double (dx);
- fdy = _cairo_fixed_from_double (dy);
-
- stroker->bounds.p1.x -= fdx;
- stroker->bounds.p2.x += fdx;
-
- stroker->bounds.p1.y -= fdy;
- stroker->bounds.p2.y += fdy;
-}
-
-static void
_cairo_stroker_fini (cairo_stroker_t *stroker)
{
_cairo_pen_fini (&stroker->pen);
@@ -1339,10 +1318,6 @@ _cairo_path_fixed_stroke_dashed_to_polygon (const cairo_path_fixed_t *path,
stroker.add_external_edge = _cairo_polygon_add_external_edge,
stroker.closure = polygon;
- if (polygon->num_limits)
- _cairo_stroker_limit (&stroker, path,
- polygon->limits, polygon->num_limits);
-
status = _cairo_path_fixed_interpret (path,
_cairo_stroker_move_to,
stroker.dash.dashed ?