summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2014-04-09 22:15:19 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2014-04-09 22:15:19 +0100
commitf9a279b2dc8417b6504478ac96514125d6136523 (patch)
tree4dd9786153015620ea29e49a2b517b5ca17d0abe /tools
parente0c93a3e53a624beb5d3a15631237ac33b8c92cd (diff)
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@chris-wilson.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/virtual.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/tools/virtual.c b/tools/virtual.c
index 19af4446..28b69f47 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,