summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2007-10-30 17:09:56 -0700
committerCarl Worth <cworth@cworth.org>2007-11-26 21:24:53 -0800
commit19e29dfb80ee06b4a4a187ba40e2e0c6ecf0dab2 (patch)
tree73372b6986f928e448515916e533352749e62c62
parentefcaee8f838177c1d1766e48aaa5dbf8cb9cf1d8 (diff)
downloadcairo-19e29dfb80ee06b4a4a187ba40e2e0c6ecf0dab2.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. (cherry picked from commit 448c9314252bba779194d2b01950b8738b26fd13)
-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 a18192553..24c3eaea8 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -322,7 +322,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;
@@ -352,6 +358,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;
return CAIRO_STATUS_SUCCESS;