[cairo] [PATCH 1/1] Complete fix to intersect_with_boxes().

James Cloos cloos at jhcloos.com
Wed Jun 22 21:10:09 PDT 2011


The old code forgot to dereference the boxes pointer.

Signed-off-by: James Cloos <cloos at jhcloos.com>
---
 src/cairo-clip.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/cairo-clip.c b/src/cairo-clip.c
index b03e27c..60c592d 100644
--- a/src/cairo-clip.c
+++ b/src/cairo-clip.c
@@ -1402,16 +1402,18 @@ intersect_with_boxes (cairo_composite_rectangles_t *extents,
     /* Find the extents over all the clip boxes */
     box.p1.x = box.p1.y = INT_MAX;
     box.p2.x = box.p2.y = INT_MIN;
-    while (num_boxes--) {
-	if (boxes->p1.x < box.p1.x)
-	    box.p1.x = boxes->p1.x;
-	if (boxes->p1.y < box.p1.y)
-	    box.p1.y = boxes->p1.y;
-
-	if (boxes->p2.x > box.p2.x)
-	    box.p2.x = boxes->p2.x;
-	if (boxes->p2.y > box.p2.y)
-	    box.p2.y = boxes->p2.y;
+    while (num_boxes) {
+	num_boxes--;
+
+	if (boxes[num_boxes].p1.x < box.p1.x)
+	    box.p1.x = boxes[num_boxes].p1.x;
+	if (boxes[num_boxes].p1.y < box.p1.y)
+	    box.p1.y = boxes[num_boxes].p1.y;
+
+	if (boxes[num_boxes].p2.x > box.p2.x)
+	    box.p2.x = boxes[num_boxes].p2.x;
+	if (boxes[num_boxes].p2.y > box.p2.y)
+	    box.p2.y = boxes[num_boxes].p2.y;
     }
 
     _cairo_box_round_to_rectangle (&box, &rect);
-- 
1.7.5.3



More information about the cairo mailing list