summaryrefslogtreecommitdiff
path: root/src/cairo-pen.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2007-10-30 17:09:56 -0700
committerCarl Worth <cworth@cworth.org>2007-10-30 17:17:38 -0700
commit448c9314252bba779194d2b01950b8738b26fd13 (patch)
tree74012e4fee9ab4c09f212a02a78578a92150fc65 /src/cairo-pen.c
parent5e76f652842d36086f500735f67cfd1d2f3e3edf (diff)
downloadcairo-448c9314252bba779194d2b01950b8738b26fd13.tar.gz
Fix degenerate-pen test case by removing the triggering assertion
Instead we choose either the first or last pen vertex as appropriate. This makes the degenerate-pen pass stop failing on an assertion, and passes for most backends. It's still failing for the PDF backend, but that looks like a new, PDF-specific bug.
Diffstat (limited to 'src/cairo-pen.c')
-rw-r--r--src/cairo-pen.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index 0f0dee840..629176317 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -323,7 +323,13 @@ _cairo_pen_find_active_cw_vertex_index (cairo_pen_t *pen,
break;
}
- assert (i < pen->num_vertices);
+ /* If the desired slope cannot be found between any of the pen
+ * vertices, then we must have a degenerate pen, (such as a pen
+ * that's been transformed to a line). In that case, we consider
+ * the first pen vertex as the appropriate clockwise vertex.
+ */
+ if (i == pen->num_vertices)
+ i = 0;
*active = i;
}
@@ -351,6 +357,14 @@ _cairo_pen_find_active_ccw_vertex_index (cairo_pen_t *pen,
break;
}
+ /* If the desired slope cannot be found between any of the pen
+ * vertices, then we must have a degenerate pen, (such as a pen
+ * that's been transformed to a line). In that case, we consider
+ * the last pen vertex as the appropriate counterclockwise vertex.
+ */
+ if (i < 0)
+ i = pen->num_vertices - 1;
+
*active = i;
}