summaryrefslogtreecommitdiff
path: root/src/cairo-pen.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2003-11-17 07:04:15 +0000
committerCarl Worth <cworth@cworth.org>2003-11-17 07:04:15 +0000
commitf27af5d98d90395b6bddceecfec0d12181af5a50 (patch)
treed759bd8c49ae93460742bc50ffa49c8bb51ff2c8 /src/cairo-pen.c
parent399803d067ab60d11cd20fd5826fae281c4081ae (diff)
Remove infinite looping when stroking with a line width at or close to 0.0. Thanks to Rob Buis <buis@kde.org> and Noah Levitt <nlevitt@columbia.edu> for providing in-the-wild examples of SVG files with stroke-width:0 that demonstrated the problem, (cowboy.svg and albania.svg).
Do nothing if the pen is a degenerate, single point. This happens when the line width is a very small, non-zero value. Do nothing when asked to stroke a path with a line_width of 0.0. Previously, this would lead to an infinite loop. Force negative line width to 0.0. Updated TODO list.
Diffstat (limited to 'src/cairo-pen.c')
-rw-r--r--src/cairo-pen.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index ce876a31..dd054372 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -322,6 +322,11 @@ _cairo_pen_stroke_spline (cairo_pen_t *pen,
cairo_status_t status;
cairo_polygon_t polygon;
+ /* If the line width is so small that the pen is reduced to a
+ single point, then we have nothing to do. */
+ if (pen->num_vertices <= 1)
+ return CAIRO_STATUS_SUCCESS;
+
_cairo_polygon_init (&polygon);
status = _cairo_spline_decompose (spline, tolerance);