summaryrefslogtreecommitdiffstats
path: root/unix
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2015-09-14 14:39:07 +0200
committerPierre Ossman <ossman@cendio.se>2015-09-14 14:39:07 +0200
commit9f03a09e4083c1fa636291f5e90496b7c2ea29c1 (patch)
treef5c2049aa15454f4278776c5757fcac7463a708e /unix
parent1ba66612eb20598542144aafc4913028c2a65224 (diff)
downloadtigervnc-9f03a09e4083c1fa636291f5e90496b7c2ea29c1.tar.gz
tigervnc-9f03a09e4083c1fa636291f5e90496b7c2ea29c1.zip
Use REGION_INTERSECT() rather than trying to compute things manually
REGION_INIT() does not handle an empty or invalid BoxRec, so this method makes sure we don't feed bad rects further in to the process.
Diffstat (limited to 'unix')
-rw-r--r--unix/xserver/hw/vnc/vncHooks.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/unix/xserver/hw/vnc/vncHooks.c b/unix/xserver/hw/vnc/vncHooks.c
index 9ab6febc..58a0eca8 100644
--- a/unix/xserver/hw/vnc/vncHooks.c
+++ b/unix/xserver/hw/vnc/vncHooks.c
@@ -728,13 +728,23 @@ static void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask,
if (pDst->pDrawable->type == DRAWABLE_WINDOW &&
((WindowPtr) pDst->pDrawable)->viewable) {
BoxRec box;
+ RegionRec fbreg;
box.x1 = max(pDst->pDrawable->x + xDst, 0);
box.y1 = max(pDst->pDrawable->y + yDst, 0);
- box.x2 = min(box.x1 + width, pScreen->width);
- box.y2 = min(box.y1 + height, pScreen->height);
-
+ box.x2 = box.x1 + width;
+ box.y2 = box.y1 + height;
REGION_INIT(pScreen, &changed, &box, 0);
+
+ box.x1 = 0;
+ box.y1 = 0;
+ box.x2 = pScreen->width;
+ box.y2 = pScreen->height;
+ REGION_INIT(pScreen, &fbreg, &box, 0);
+
+ REGION_INTERSECT(pScreen, &changed, &changed, &fbreg);
+
+ REGION_UNINIT(pScreen, &fbreg);
} else {
REGION_NULL(pScreen, &changed);
}