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.
This commit is contained in:
Carl Worth 2007-10-30 17:09:56 -07:00
parent 5e76f65284
commit 448c931425

View file

@ -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;
}