Fix offsets again. Really, it works this time. Promise.

This commit is contained in:
Keith Packard 2004-08-14 21:57:58 +00:00
parent e6216b48f5
commit e483fe3ec3

View File

@ -679,7 +679,7 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
BoxPtr pExtents;
int x_off, y_off;
int dx, dy;
DrawablePtr pBackingDrawable;
PixmapPtr pBackingPixmap;
RegionPtr pClip;
int src_x, src_y, dst_x, dst_y, w, h;
@ -688,34 +688,35 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
pExtents = REGION_EXTENTS(pScreen, prgnSrc);
src_x = pExtents->x1;
src_y = pExtents->y1;
pBackingPixmap = (PixmapPtr) cwGetBackingDrawable((DrawablePtr)pWin,
&x_off, &y_off);
src_x = pExtents->x1 - pBackingPixmap->screen_x;
src_y = pExtents->y1 - pBackingPixmap->screen_y;
w = pExtents->x2 - pExtents->x1;
h = pExtents->y2 - pExtents->y1;
dst_x = src_x - dx;
dst_y = src_y - dy;
pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off,
&y_off);
/* Translate region (as required by API) */
REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
pGC = GetScratchGC(pBackingDrawable->depth, pScreen);
pGC = GetScratchGC(pBackingPixmap->drawable.depth, pScreen);
/*
* Copy region to GC as clip, aligning as dest clip
*/
pClip = REGION_CREATE (pScreen, NULL, 0);
REGION_INTERSECT(pScreen, pClip, &pWin->borderClip, prgnSrc);
REGION_TRANSLATE(pScreen, pClip,
-pWin->drawable.x + x_off,
-pWin->drawable.y + y_off);
-pBackingPixmap->screen_x,
-pBackingPixmap->screen_y);
(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
ValidateGC(pBackingDrawable, pGC);
ValidateGC(&pBackingPixmap->drawable, pGC);
(*pGC->ops->CopyArea) (pBackingDrawable, pBackingDrawable, pGC,
(*pGC->ops->CopyArea) (&pBackingPixmap->drawable,
&pBackingPixmap->drawable, pGC,
src_x, src_y, w, h, dst_x, dst_y);
(*pGC->funcs->DestroyClip) (pGC);