[cairo] [PATCH 4/5] Fix skipping zero length dash segments in dash_start.

Jeff Muizelaar jeff at infidigm.net
Sun Apr 9 20:11:27 PDT 2006


The extra check makes sure zero length segments are not skipped when computing
the dash start state. This is needed so that we get proper line capping if, for
example, the first dash segment has zero length and we have a dash offset of
zero.

---

diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 3136148..f827e61 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -117,6 +117,11 @@ _cairo_stroker_start_dash (cairo_stroker
 
     offset = stroker->style->dash_offset;
     while (offset >= stroker->style->dash[i]) {
+	/* if we are at the last dash interval and its length is zero 
+	 * we need to avoid skipping over it */
+	if (offset == 0.0 && stroker->style->dash[i] == 0.0)
+	    break;
+
 	offset -= stroker->style->dash[i];
 	on = 1-on;
 	if (++i == stroker->style->num_dashes)


More information about the cairo mailing list