Fix offsets, do whole region at once by using GC clipping
This commit is contained in:
parent
ed425d1d88
commit
e6216b48f5
|
@ -676,29 +676,49 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
|
||||||
(*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
|
(*pScreen->CopyWindow)(pWin, ptOldOrg, prgnSrc);
|
||||||
} else {
|
} else {
|
||||||
GCPtr pGC;
|
GCPtr pGC;
|
||||||
BoxPtr pBox;
|
BoxPtr pExtents;
|
||||||
int nbox, i, x_off, y_off;
|
int x_off, y_off;
|
||||||
int dx, dy;
|
int dx, dy;
|
||||||
DrawablePtr pBackingDrawable;
|
DrawablePtr pBackingDrawable;
|
||||||
|
RegionPtr pClip;
|
||||||
pBackingDrawable = cwGetBackingDrawable((DrawablePtr)pWin, &x_off,
|
int src_x, src_y, dst_x, dst_y, w, h;
|
||||||
&y_off);
|
|
||||||
|
|
||||||
pGC = GetScratchGC(pBackingDrawable->depth, pScreen);
|
|
||||||
ValidateGC(pBackingDrawable, pGC);
|
|
||||||
|
|
||||||
pBox = REGION_RECTS(prgnSrc);
|
|
||||||
nbox = REGION_NUM_RECTS(prgnSrc);
|
|
||||||
|
|
||||||
dx = ptOldOrg.x - pWin->drawable.x;
|
dx = ptOldOrg.x - pWin->drawable.x;
|
||||||
dy = ptOldOrg.y - pWin->drawable.y;
|
dy = ptOldOrg.y - pWin->drawable.y;
|
||||||
|
|
||||||
for (i = 0; i < nbox; i++, pBox++) {
|
pExtents = REGION_EXTENTS(pScreen, prgnSrc);
|
||||||
(*pGC->ops->CopyArea)(pBackingDrawable, pBackingDrawable, pGC,
|
|
||||||
pBox->x1 + x_off, pBox->y1 + y_off,
|
src_x = pExtents->x1;
|
||||||
pBox->x2 - pBox->x1, pBox->y2 - pBox->y1,
|
src_y = pExtents->y1;
|
||||||
pBox->x1 + x_off + dx, pBox->y1 + y_off + dy);
|
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);
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
(*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0);
|
||||||
|
|
||||||
|
ValidateGC(pBackingDrawable, pGC);
|
||||||
|
|
||||||
|
(*pGC->ops->CopyArea) (pBackingDrawable, pBackingDrawable, pGC,
|
||||||
|
src_x, src_y, w, h, dst_x, dst_y);
|
||||||
|
|
||||||
|
(*pGC->funcs->DestroyClip) (pGC);
|
||||||
|
|
||||||
FreeScratchGC(pGC);
|
FreeScratchGC(pGC);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue