summaryrefslogtreecommitdiff
path: root/src/cairo-path-stroke.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-08-28 10:05:52 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2009-08-29 08:08:33 +0100
commit3f12d9ec5db1ac372742c3c03408bdaeaffdc1e4 (patch)
treea46be582bac6364db75df1c5c32ef79ab2538e2f /src/cairo-path-stroke.c
parent2457c4bedef0447f7bff9b54dba96126010917ac (diff)
downloadcairo-3f12d9ec5db1ac372742c3c03408bdaeaffdc1e4.tar.gz
[clip] Use geometric clipping for unaligned clips
For the simple cases where the clip is an unaligned box (or boxes), apply the clip directly to the geometry and avoid having to use an intermediate clip-mask.
Diffstat (limited to 'src/cairo-path-stroke.c')
-rw-r--r--src/cairo-path-stroke.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index d37c597b5..33fed4fc3 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -186,13 +186,14 @@ _cairo_stroker_init (cairo_stroker_t *stroker,
static void
_cairo_stroker_limit (cairo_stroker_t *stroker,
- const cairo_box_t *box)
+ const cairo_box_t *boxes,
+ int num_boxes)
{
double dx, dy;
cairo_fixed_t fdx, fdy;
stroker->has_bounds = TRUE;
- stroker->bounds = *box;
+ _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
@@ -1353,8 +1354,8 @@ _cairo_path_fixed_stroke_to_polygon (const cairo_path_fixed_t *path,
stroker.add_external_edge = _cairo_polygon_add_external_edge,
stroker.closure = polygon;
- if (polygon->has_limits)
- _cairo_stroker_limit (&stroker, &polygon->limits);
+ if (polygon->num_limits)
+ _cairo_stroker_limit (&stroker, polygon->limits, polygon->num_limits);
status = _cairo_path_fixed_interpret (path,
CAIRO_DIRECTION_FORWARD,
@@ -1404,8 +1405,7 @@ _cairo_path_fixed_stroke_to_traps (const cairo_path_fixed_t *path,
}
_cairo_polygon_init (&polygon);
- if (traps->has_limits)
- _cairo_polygon_limit (&polygon, &traps->limits);
+ _cairo_polygon_limit (&polygon, traps->limits, traps->num_limits);
status = _cairo_path_fixed_stroke_to_polygon (path,
stroke_style,
@@ -1458,10 +1458,11 @@ typedef struct _cairo_rectilinear_stroker {
static void
_cairo_rectilinear_stroker_limit (cairo_rectilinear_stroker_t *stroker,
- const cairo_box_t *box)
+ const cairo_box_t *boxes,
+ int num_boxes)
{
stroker->has_bounds = TRUE;
- stroker->bounds = *box;
+ _cairo_boxes_get_extents (boxes, num_boxes, &stroker->bounds);
stroker->bounds.p1.x -= stroker->half_line_width;
stroker->bounds.p2.x += stroker->half_line_width;
@@ -2005,9 +2006,10 @@ _cairo_path_fixed_stroke_rectilinear_to_traps (const cairo_path_fixed_t *path,
stroke_style,
ctm,
traps);
- if (traps->has_limits) {
+ if (traps->num_limits) {
_cairo_rectilinear_stroker_limit (&rectilinear_stroker,
- &traps->limits);
+ traps->limits,
+ traps->num_limits);
}
status = _cairo_path_fixed_interpret (path,