[cairo] [PATCH 3/5] Move the test for zero length sub edges below the computation of faces.

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


Face computation still works if a line has zero length, all that is needed is a
slope and a point. This patch fixes bug #5561 because the faces are initialized
even if the segment has zero length as expected by
_cairo_stroker_line_to_dashed.

---

diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 633b048..3136148 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -554,19 +554,19 @@ _cairo_stroker_add_sub_edge (cairo_strok
     cairo_status_t status;
     cairo_polygon_t polygon;
 
-    if (p1->x == p2->x && p1->y == p2->y) {
-	/* XXX: Need to rethink how this case should be handled, (both
-           here and in _compute_face). The key behavior is that
-           degenerate paths should draw as much as possible. */
-	return CAIRO_STATUS_SUCCESS;
-    }
-
     _compute_face (p1, slope, stroker, start);
 
     /* XXX: This could be optimized slightly by not calling
        _compute_face again but rather  translating the relevant
        fields from start. */
     _compute_face (p2, slope, stroker, end);
+
+    if (p1->x == p2->x && p1->y == p2->y) {
+	/* XXX: Need to rethink how this case should be handled, (both
+           here and in _compute_face). The key behavior is that
+           degenerate paths should draw as much as possible. */
+	return CAIRO_STATUS_SUCCESS;
+    }
 
     /* XXX: I should really check the return value of the
        move_to/line_to functions here to catch out of memory


More information about the cairo mailing list