[cairo] [PATCH 1/5] Check for zero length dashed lines.

Jeff Muizelaar jeff at infidigm.net
Sun Apr 9 20:10:46 PDT 2006


This makes line_to_dashed more like line_to by returning immediately on
degenerate paths. This is needed so that we can do the slope calculation for
the entire line.

---

diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 96664ce..36cfcc6 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -676,7 +676,15 @@ _cairo_stroker_line_to_dashed (void *clo
 
     if (!stroker->has_current_point)
 	return _cairo_stroker_move_to (stroker, point);
-    
+
+    if (p1->x == p2->x && p1->y == p2->y) {
+	/* XXX: Need to rethink how this case should be handled, (both
+           here and in cairo_stroker_add_sub_edge and in _compute_face). The
+           key behavior is that degenerate paths should draw as much
+           as possible. */
+	return CAIRO_STATUS_SUCCESS;
+    }
+
     dx = _cairo_fixed_to_double (p2->x - p1->x);
     dy = _cairo_fixed_to_double (p2->y - p1->y);
 


More information about the cairo mailing list