From 03db332a363909271802c21da87ff1d171b2191f Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 28 Sep 2008 19:04:39 +0100 Subject: [PATCH] [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. --- src/cairo-traps.c | 9 +++++++-- 1 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/cairo-traps.c b/src/cairo-traps.c index 3a38c69..d41009a 100644 --- a/src/cairo-traps.c +++ b/src/cairo-traps.c @@ -214,9 +214,14 @@ _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; + if (right->p1.x <= left->p1.x && right->p2.x <= left->p2.x) return; - } if (traps->num_traps == traps->traps_size) { if (! _cairo_traps_grow (traps)) -- 1.5.6.5