From e483fe3ec384da556c31292001a86ec95c2ddc46 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 14 Aug 2004 21:57:58 +0000 Subject: [PATCH] Fix offsets again. Really, it works this time. Promise. --- miext/cw/cw.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/miext/cw/cw.c b/miext/cw/cw.c index 5046164d9..5867c3ec1 100644 --- a/miext/cw/cw.c +++ b/miext/cw/cw.c @@ -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);