[cairo-commit] cairo/src cairo.c,1.28,1.29 cairo_gstate.c,1.32,1.33 cairo_pen.c,1.12,1.13
Carl Worth
commit at pdx.freedesktop.org
Mon Nov 17 07:04:18 PST 2003
Committed by: cworth
Update of /cvs/cairo/cairo/src
In directory pdx:/tmp/cvs-serv23102/src
Modified Files:
cairo.c cairo_gstate.c cairo_pen.c
Log Message:
* Remove infinite looping when stroking with a line width at or
close to 0.0. Thanks to Rob Buis <buis at kde.org> and Noah Levitt
<nlevitt at columbia.edu> for providing in-the-wild examples of SVG
files with stroke-width:0 that demonstrated the problem,
(cowboy.svg and albania.svg).
* src/cairo_pen.c (_cairo_pen_stroke_spline): Do nothing if the
pen is a degenerate, single point. This happens when the line
width is a very small, non-zero value.
* src/cairo_gstate.c (_cairo_gstate_stroke): Do nothing when asked
to stroke a path with a line_width of 0.0. Previously, this would
lead to an infinite loop.
* src/cairo.c (cairo_set_line_width): Force negative line width
to 0.0.
* TODO: Updated TODO list.
Index: cairo.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** cairo.c 7 Nov 2003 02:33:28 -0000 1.28
--- cairo.c 17 Nov 2003 15:04:16 -0000 1.29
***************
*** 266,269 ****
--- 266,271 ----
return;
+ _cairo_restrict_value (&width, 0.0, width);
+
cr->status = _cairo_gstate_set_line_width (cr->gstate, width);
}
Index: cairo_gstate.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_gstate.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** cairo_gstate.c 7 Nov 2003 02:33:28 -0000 1.32
--- cairo_gstate.c 17 Nov 2003 15:04:16 -0000 1.33
***************
*** 1158,1161 ****
--- 1158,1164 ----
cairo_matrix_t user_to_source, device_to_source;
+ if (gstate->line_width <= 0.0)
+ return CAIRO_STATUS_SUCCESS;
+
status = _cairo_gstate_ensure_source (gstate);
if (status)
Index: cairo_pen.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_pen.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** cairo_pen.c 6 Nov 2003 20:53:39 -0000 1.12
--- cairo_pen.c 17 Nov 2003 15:04:16 -0000 1.13
***************
*** 323,326 ****
--- 323,331 ----
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);
More information about the cairo-commit
mailing list