From 651c6598c98118ba04bc4970557c24241b91dab0 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Wed, 24 Sep 2008 00:49:03 +0100 Subject: [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. --- src/cairo-traps.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/cairo-traps.c') diff --git a/src/cairo-traps.c b/src/cairo-traps.c index 126701521..c7dc94762 100644 --- a/src/cairo-traps.c +++ b/src/cairo-traps.c @@ -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; + } + } } /** -- cgit v1.2.1