diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2012-06-24 11:33:47 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2012-06-24 11:53:25 +0100 |
commit | 166e6f199e909d8aea13cdd4c858d48faad26247 (patch) | |
tree | 18fa804feac3743e2278aab41cbff6665853f0d2 /src/cairo-path-stroke-polygon.c | |
parent | b7bd5ae4f3da44131261711bb236cd7aa24a3ae3 (diff) | |
download | cairo-166e6f199e909d8aea13cdd4c858d48faad26247.tar.gz |
stroke: Skip inserting a round-join if within tolerance
If the angle between two segments is small we can simply replace the
round-join with a bevel-join. This is done automatically by the
insertion of the triangle fan as it will not be able to find a point
around the pen between the two vectors. However, we can make that search
cheaper by inspecting whether the bisection angle is small enough that
the bevel-join will be within geometric tolerance of the round-join.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'src/cairo-path-stroke-polygon.c')
-rw-r--r-- | src/cairo-path-stroke-polygon.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/cairo-path-stroke-polygon.c b/src/cairo-path-stroke-polygon.c index e8e7bb238..b7c18b72e 100644 --- a/src/cairo-path-stroke-polygon.c +++ b/src/cairo-path-stroke-polygon.c @@ -424,11 +424,15 @@ outer_close (struct stroker *stroker, switch (stroker->style.line_join) { case CAIRO_LINE_JOIN_ROUND: /* construct a fan around the common midpoint */ - add_fan (stroker, - &in->dev_vector, - &out->dev_vector, - &in->point, inpt, outpt, - clockwise, outer); + if ((in->dev_slope.x * out->dev_slope.x + + in->dev_slope.y * out->dev_slope.y) < stroker->spline_cusp_tolerance) + { + add_fan (stroker, + &in->dev_vector, + &out->dev_vector, + &in->point, inpt, outpt, + clockwise, outer); + } break; case CAIRO_LINE_JOIN_MITER: |