From d77d6aaac9a5c72c1de37b44f78b77b251aa8c4a Mon Sep 17 00:00:00 2001 From: Peter Åstrand Date: Wed, 17 Aug 2005 08:33:29 +0000 Subject: Updated vncHooksComposite, to fix additional RENDER problems. It's not enough to check that xDst/yDst is greater than zero: we must take greater care not to add change regions that are fully or partially outside the framebuffer. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@305 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- xc/programs/Xserver/vnc/vncHooks.cc | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'xc') diff --git a/xc/programs/Xserver/vnc/vncHooks.cc b/xc/programs/Xserver/vnc/vncHooks.cc index d040e4f5..34c7aca3 100644 --- a/xc/programs/Xserver/vnc/vncHooks.cc +++ b/xc/programs/Xserver/vnc/vncHooks.cc @@ -504,21 +504,22 @@ void vncHooksComposite(CARD8 op, PicturePtr pSrc, PicturePtr pMask, vncHooksScreenPtr vncHooksScreen = ((vncHooksScreenPtr)pScreen->devPrivates[vncHooksScreenIndex].ptr); BoxRec box; PictureScreenPtr ps = GetPictureScreen(pScreen); - - // For some reason, this hook is sometimes called with a negative - // xDst. This causes graphics errors, as well as error messages of - // the type: - // ComparingUpdateTracker: rect outside fb (-47,76-171,89) - // I've never observed a negative yDst, but let's check it anyway. - if ((xDst >= 0) && (yDst >= 0)) { - box.x1 = pDst->pDrawable->x + xDst; - box.y1 = pDst->pDrawable->y + yDst; - box.x2 = box.x1 + width; - box.y2 = box.y1 + height; - - RegionHelper changed(pScreen, &box, 0); - vncHooksScreen->desktop->add_changed(changed.reg); - } + rfb::Rect rect1, rect2; + + rect1.setXYWH(pDst->pDrawable->x + xDst, + pDst->pDrawable->y + yDst, + width, + height); + + rect2 = rect1.intersect(vncHooksScreen->desktop->getRect()); + if (!rect2.is_empty()) { + box.x1 = rect2.tl.x; + box.y1 = rect2.tl.y; + box.x2 = rect2.br.x; + box.y2 = rect2.br.y; + RegionHelper changed(pScreen, &box, 0); + vncHooksScreen->desktop->add_changed(changed.reg); + } ps->Composite = vncHooksScreen->Composite; (*ps->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc, -- cgit v1.2.3