xf86-video-intel: src/sna/sna_accel.c

Chris Wilson ickle at kemper.freedesktop.org
Sun Oct 30 09:14:37 PDT 2011


 src/sna/sna_accel.c |   24 +++++++-----------------
 1 file changed, 7 insertions(+), 17 deletions(-)

New commits:
commit bb840ee09fa620648065884306fbe3e0da37ad77
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Sun Oct 30 16:13:04 2011 +0000

    sna: Convert PolyRectangles to use Box32
    
    For the same overflow protection.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 47b8698..c285c97 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -4186,7 +4186,7 @@ sna_poly_rectangle_extents(DrawablePtr drawable, GCPtr gc,
 			   int n, xRectangle *r,
 			   BoxPtr out)
 {
-	BoxRec box;
+	Box32Rec box;
 	int extra = gc->lineWidth >> 1;
 	bool clipped;
 
@@ -4195,20 +4195,11 @@ sna_poly_rectangle_extents(DrawablePtr drawable, GCPtr gc,
 
 	box.x1 = r->x;
 	box.y1 = r->y;
-	box.x2 = r->x + r->width;
-	box.y2 = r->y + r->height;
+	box.x2 = box.x1 + r->width;
+	box.y2 = box.y1 + r->height;
 
-	while (--n) {
-		r++;
-		if (r->x < box.x1)
-			box.x1 = r->x;
-		if (r->x + r->width > box.x2)
-			box.x2 = r->x + r->width;
-		if (r->y < box.y1)
-			box.y1 = r->y;
-		if (r->y + r->width > box.y2)
-			box.y2 = r->y + r->height;
-	}
+	while (--n)
+		box32_add_rect(&box, r++);
 
 	box.x2++;
 	box.y2++;
@@ -4220,11 +4211,10 @@ sna_poly_rectangle_extents(DrawablePtr drawable, GCPtr gc,
 		box.y2 += extra;
 	}
 
-	if (box_empty(&box))
+	clipped = box32_trim_and_translate(&box, drawable, gc);
+	if (!box32_to_box16(&box, out))
 		return 0;
 
-	clipped = trim_and_translate_box(&box, drawable, gc);
-	*out = box;
 	return 1 | clipped << 1;
 }
 


More information about the xorg-commit mailing list