[cairo-commit] src/cairo-traps.c

Chris Wilson ickle at kemper.freedesktop.org
Tue Sep 23 17:02:58 PDT 2008


 src/cairo-traps.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

New commits:
commit 651c6598c98118ba04bc4970557c24241b91dab0
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Sep 24 00:49:03 2008 +0100

    [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.

diff --git a/src/cairo-traps.c b/src/cairo-traps.c
index 1267015..c7dc947 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;
+	}
+    }
 }
 
 /**


More information about the cairo-commit mailing list