[PATCH] Fix degenerate-pen test case by removing the triggering assertion
Carl Worth
cworth at cworth.org
Tue Oct 30 17:09:56 PDT 2007
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.
---
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 0f0dee8..6291763 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;
}
--
1.5.3.4
--Multipart_Tue_Oct_30_17:17:23_2007-1--
--pgp-sign-Multipart_Tue_Oct_30_17:17:23_2007-1
Content-Type: application/pgp-signature
Content-Transfer-Encoding: 7bit
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
iD8DBQBHJ8mZ6JDdNq8qSWgRAsesAJsEWozVIp4OBoMJJ4zfZSzSwIZw8gCfYcQc
EB4sch88Bk5kUSo07B7xiDI=
=kSVD
-----END PGP SIGNATURE-----
--pgp-sign-Multipart_Tue_Oct_30_17:17:23_2007-1--
More information about the cairo
mailing list