[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.
This commit is contained in:
Chris Wilson 2008-09-28 19:04:39 +01:00
parent 7a2329e9c8
commit 59e569576d

View file

@ -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))