diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2008-09-28 19:04:39 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2008-10-04 10:12:37 +0100 |
commit | 59e569576d00e9c1cb66a77cf447c3cc3fb038e7 (patch) | |
tree | 814d5f465a60f05c610022d5155726967e7a4443 /src/cairo-traps.c | |
parent | 7a2329e9c8afbfecb88c6c50bd63aa03ea7f9f81 (diff) | |
download | cairo-59e569576d00e9c1cb66a77cf447c3cc3fb038e7.tar.gz |
[traps] Discard trivially empty trapezoid.
The convex_quad tessellator (and possibly even the more general polygon
tessellator) will generate empty trapezoids when given a
rectangle which can be trivially discarded before inserting into traps.
Diffstat (limited to 'src/cairo-traps.c')
-rw-r--r-- | src/cairo-traps.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/cairo-traps.c b/src/cairo-traps.c index 042a89e9b..b76e9089c 100644 --- a/src/cairo-traps.c +++ b/src/cairo-traps.c @@ -216,9 +216,16 @@ _cairo_traps_add_trap (cairo_traps_t *traps, } } - if (top >= bottom) { + /* Trivial discards for empty trapezoids that are likely to be produced + * by our tessellators (most notably convex_quad when given a simple + * rectangle). + */ + if (top >= bottom) + return; + /* cheap colinearity check */ + if (right->p1.x <= left->p1.x && right->p1.y == left->p1.y && + right->p2.x <= left->p2.x && right->p2.y == left->p2.y) return; - } if (traps->num_traps == traps->traps_size) { if (! _cairo_traps_grow (traps)) |