diff options
author | Carl Worth <cworth@cworth.org> | 2007-10-30 17:09:56 -0700 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2007-10-30 17:17:38 -0700 |
commit | 448c9314252bba779194d2b01950b8738b26fd13 (patch) | |
tree | 74012e4fee9ab4c09f212a02a78578a92150fc65 | |
parent | 5e76f652842d36086f500735f67cfd1d2f3e3edf (diff) |
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.
-rw-r--r-- | src/cairo-pen.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/cairo-pen.c b/src/cairo-pen.c index 0f0dee84..62917631 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; } |