mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-03 12:27:59 +02:00
[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:
parent
7a2329e9c8
commit
59e569576d
1 changed files with 9 additions and 2 deletions
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue