[traps] Limit extents to imposed constraints.

When reporting the extents of the traps, constrain them to the imposed
limits. This is relied upon in the analysis-surface which sets the
limits on the traps (based on clip/surface extents) and then reports the
extents of the traps as the region of the operation.
This commit is contained in:
Chris Wilson 2008-09-24 00:49:03 +01:00
parent 0baf12f450
commit 651c6598c9

View file

@ -562,8 +562,21 @@ _cairo_traps_extents (const cairo_traps_t *traps,
if (traps->num_traps == 0) {
extents->p1.x = extents->p1.y = _cairo_fixed_from_int (0);
extents->p2.x = extents->p2.y = _cairo_fixed_from_int (0);
} else
} else {
*extents = traps->extents;
if (traps->has_limits) {
/* clip the traps to the imposed limits */
if (extents->p1.x < traps->limits.p1.x)
extents->p1.x = traps->limits.p1.x;
if (extents->p2.x > traps->limits.p2.x)
extents->p2.x = traps->limits.p2.x;
if (extents->p1.y < traps->limits.p1.y)
extents->p1.y = traps->limits.p1.y;
if (extents->p2.y > traps->limits.p2.y)
extents->p2.y = traps->limits.p2.y;
}
}
}
/**