[cairo] [PATCH] Reset dashing for new subpaths.

Jeff Muizelaar jeff at infidigm.net
Sun Apr 9 20:13:36 PDT 2006


Fixes the bug mentioned in b87726ee2aa0220b66ee4d97513c0ac89ffc4621 by reseting
the dash pattern for each new subpath. This is correct behaviour according to
the end of PDF Reference v1.6 section 4.3.2. This patch applies on top of the
zero length dashing patches.

---

diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index f827e61..5976877 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -620,6 +620,16 @@ _cairo_stroker_move_to (void *closure, c
 }
 
 static cairo_status_t
+_cairo_stroker_move_to_dashed (void *closure, cairo_point_t *point)
+{
+    /* reset the dash pattern for new sub paths */
+    cairo_stroker_t *stroker = closure;
+    _cairo_stroker_start_dash (stroker);
+
+    return _cairo_stroker_move_to (closure, point);
+}
+
+static cairo_status_t
 _cairo_stroker_line_to (void *closure, cairo_point_t *point)
 {
     cairo_status_t status;
@@ -972,7 +982,7 @@ _cairo_path_fixed_stroke_to_traps (cairo
     if (stroker.style->dash)
 	status = _cairo_path_fixed_interpret (path,
 					      CAIRO_DIRECTION_FORWARD,
-					      _cairo_stroker_move_to,
+					      _cairo_stroker_move_to_dashed,
 					      _cairo_stroker_line_to_dashed,
 					      _cairo_stroker_curve_to_dashed,
 					      _cairo_stroker_close_path,


More information about the cairo mailing list