xf86-video-intel: tools/virtual.c

Chris Wilson ickle at kemper.freedesktop.org
Wed Apr 9 14:18:19 PDT 2014


 tools/virtual.c |   18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

New commits:
commit f9a279b2dc8417b6504478ac96514125d6136523
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date:   Wed Apr 9 22:15:19 2014 +0100

    intel-virtual-output: Fix damage bounds
    
    Sigh. A serious mixup of integer promotion rules and wraparound caused
    the damage computation for small regions to be completely bogus.
    
    Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/tools/virtual.c b/tools/virtual.c
index 19af444..28b69f4 100644
--- a/tools/virtual.c
+++ b/tools/virtual.c
@@ -1661,14 +1661,16 @@ done:
 
 static void clone_damage(struct clone *c, const XRectangle *rec)
 {
-	if (rec->x < c->damaged.x1)
-		c->damaged.x1 = rec->x;
-	if (rec->width > c->damaged.x2 - rec->x)
-		c->damaged.x2 = (int)rec->x + rec->width;
-	if (rec->y < c->damaged.y1)
-		c->damaged.y1 = rec->y;
-	if (rec->height > c->damaged.y2 - rec->y)
-		c->damaged.y2 = (int)rec->y + rec->height;
+	int v;
+
+	if ((v = rec->x) < c->damaged.x1)
+		c->damaged.x1 = v;
+	if ((v = (int)rec->x + rec->width) > c->damaged.x2)
+		c->damaged.x2 = v;
+	if ((v = rec->y) < c->damaged.y1)
+		c->damaged.y1 = v;
+	if ((v = (int)rec->y + rec->height) > c->damaged.y2)
+		c->damaged.y2 = v;
 
 	DBG(("%s-%s damaged: (%d, %d), (%d, %d)\n",
 	     DisplayString(c->dst.display->dpy), c->dst.name,


More information about the xorg-commit mailing list