summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2005-08-27 18:54:03 +0000
committerOwen Taylor <otaylor@redhat.com>2005-08-27 18:54:03 +0000
commit96342fe7beee1d0c2084cb6e0f44969d5b05b100 (patch)
tree34fb8d2f5451cf6301f5823e3376cd25731636e9
parent30e3d538dfbd763872117760ec473481e2c5926d (diff)
Make the check for rectangular trapezoids simpler and more accurate. (#4220, found using test case from Richard Stellingwerff)
reviewed by: cworth
-rw-r--r--ChangeLog8
-rw-r--r--src/cairo-traps.c16
2 files changed, 13 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index ac429fa0f..36484cca8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2005-08-27 Owen Taylor <otaylor@redhat.com>
+ reviewed by: cworth
+
+ * src/cairo-traps.c (_cairo_traps_extract_region): Make the
+ check for rectangular trapezoids simpler and more accurate.
+ (#4220, found using test case from Richard Stellingwerff)
+
+2005-08-27 Owen Taylor <otaylor@redhat.com>
+
* src/cairo-xlib-surface.c (_cairo_xlib_surface_create_internal):
Make the vendor string check for XFree86 more liberal, to deal
with older versions of gentoo that modified it in a different
diff --git a/src/cairo-traps.c b/src/cairo-traps.c
index 18b944c1d..6afb499bd 100644
--- a/src/cairo-traps.c
+++ b/src/cairo-traps.c
@@ -827,16 +827,10 @@ _cairo_traps_extract_region (cairo_traps_t *traps,
for (i = 0; i < traps->num_traps; i++)
if (!(traps->traps[i].left.p1.x == traps->traps[i].left.p2.x
&& traps->traps[i].right.p1.x == traps->traps[i].right.p2.x
- && traps->traps[i].left.p1.y == traps->traps[i].right.p1.y
- && traps->traps[i].left.p2.y == traps->traps[i].right.p2.y
+ && _cairo_fixed_is_integer(traps->traps[i].top)
+ && _cairo_fixed_is_integer(traps->traps[i].bottom)
&& _cairo_fixed_is_integer(traps->traps[i].left.p1.x)
- && _cairo_fixed_is_integer(traps->traps[i].left.p1.y)
- && _cairo_fixed_is_integer(traps->traps[i].left.p2.x)
- && _cairo_fixed_is_integer(traps->traps[i].left.p2.y)
- && _cairo_fixed_is_integer(traps->traps[i].right.p1.x)
- && _cairo_fixed_is_integer(traps->traps[i].right.p1.y)
- && _cairo_fixed_is_integer(traps->traps[i].right.p2.x)
- && _cairo_fixed_is_integer(traps->traps[i].right.p2.y))) {
+ && _cairo_fixed_is_integer(traps->traps[i].right.p1.x))) {
*region = NULL;
return CAIRO_STATUS_SUCCESS;
}
@@ -845,9 +839,9 @@ _cairo_traps_extract_region (cairo_traps_t *traps,
for (i = 0; i < traps->num_traps; i++) {
int x = _cairo_fixed_integer_part(traps->traps[i].left.p1.x);
- int y = _cairo_fixed_integer_part(traps->traps[i].left.p1.y);
+ int y = _cairo_fixed_integer_part(traps->traps[i].top);
int width = _cairo_fixed_integer_part(traps->traps[i].right.p1.x) - x;
- int height = _cairo_fixed_integer_part(traps->traps[i].left.p2.y) - y;
+ int height = _cairo_fixed_integer_part(traps->traps[i].bottom) - y;
/* XXX: Sometimes we get degenerate trapezoids from the tesellator,
* if we call pixman_region_union_rect(), it bizarrly fails on such