summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2011-04-03 19:06:18 +1000
committerDave Airlie <airlied@redhat.com>2011-06-11 17:59:32 +1000
commitfd0b0c5b715dc98b5dd576cb29050474e0b64244 (patch)
tree42ee2f0ae286eb92758ee587a56aaabf4480d48c
parent02d11af01211da55e9d93fe0e1851a0c6fe57472 (diff)
xaa: merge copy window implementations
-rw-r--r--hw/xfree86/xaa/xaaCpyWin.c55
-rw-r--r--hw/xfree86/xaa/xaaOverlay.c43
-rw-r--r--hw/xfree86/xaa/xaalocal.h7
3 files changed, 47 insertions, 58 deletions
diff --git a/hw/xfree86/xaa/xaaCpyWin.c b/hw/xfree86/xaa/xaaCpyWin.c
index c3c2690b2..2be47a611 100644
--- a/hw/xfree86/xaa/xaaCpyWin.c
+++ b/hw/xfree86/xaa/xaaCpyWin.c
@@ -22,31 +22,21 @@
*/
void
-XAACopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc )
+XAACopyWindow_int(WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc,
+ RegionPtr borderClip,
+ unsigned int planemask)
{
DDXPointPtr pptSrc, ppt;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr pwinRoot;
RegionRec rgnDst;
BoxPtr pbox;
int dx, dy, nbox;
- WindowPtr pwinRoot;
- ScreenPtr pScreen = pWin->drawable.pScreen;
XAAInfoRecPtr infoRec =
GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
- if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
- XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
- if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow);
- return;
- }
-
pwinRoot = pScreen->root;
RegionNull(&rgnDst);
@@ -54,7 +44,7 @@ XAACopyWindow(
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
RegionTranslate(prgnSrc, -dx, -dy);
- RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
+ RegionIntersect(&rgnDst, borderClip, prgnSrc);
pbox = RegionRects(&rgnDst);
nbox = RegionNumRects(&rgnDst);
@@ -71,7 +61,7 @@ XAACopyWindow(
ppt++; pbox++;
}
- infoRec->ScratchGC.planemask = ~0L;
+ infoRec->ScratchGC.planemask = planemask;
infoRec->ScratchGC.alu = GXcopy;
XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
@@ -79,4 +69,31 @@ XAACopyWindow(
free(pptSrc);
RegionUninit(&rgnDst);
+
+
+}
+
+void
+XAACopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc )
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec =
+ GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
+
+ if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
+ XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
+ if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow);
+ return;
+ }
+
+ XAACopyWindow_int(pWin, ptOldOrg, prgnSrc, &pWin->borderClip,
+ 0xffffffff);
}
diff --git a/hw/xfree86/xaa/xaaOverlay.c b/hw/xfree86/xaa/xaaOverlay.c
index 4b52bf6fd..8e04745ee 100644
--- a/hw/xfree86/xaa/xaaOverlay.c
+++ b/hw/xfree86/xaa/xaaOverlay.c
@@ -29,11 +29,6 @@ XAACopyWindow8_32(
DDXPointRec ptOldOrg,
RegionPtr prgnSrc
){
- DDXPointPtr pptSrc, ppt;
- RegionRec rgnDst;
- BoxPtr pbox;
- int dx, dy, nbox;
- WindowPtr pwinRoot;
ScreenPtr pScreen = pWin->drawable.pScreen;
XAAInfoRecPtr infoRec =
GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
@@ -51,45 +46,15 @@ XAACopyWindow8_32(
}
(*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow8_32);
- return;
+ return;
}
- pwinRoot = pScreen->root;
-
if(doUnderlay)
freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
- RegionNull(&rgnDst);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- RegionTranslate(prgnSrc, -dx, -dy);
- RegionIntersect(&rgnDst, borderClip, prgnSrc);
-
- pbox = RegionRects(&rgnDst);
- nbox = RegionNumRects(&rgnDst);
- if(!nbox ||
- !(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
- RegionUninit(&rgnDst);
- return;
- }
- ppt = pptSrc;
-
- while(nbox--) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- ppt++; pbox++;
- }
-
- infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000;
- infoRec->ScratchGC.alu = GXcopy;
-
- XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
-
- free(pptSrc);
- RegionUninit(&rgnDst);
- if(freeReg)
+ XAACopyWindow_int(pWin, ptOldOrg, prgnSrc, borderClip,
+ doUnderlay ? 0x00ffffff : 0xff000000);
+ if(freeReg)
RegionDestroy(borderClip);
}
diff --git a/hw/xfree86/xaa/xaalocal.h b/hw/xfree86/xaa/xaalocal.h
index a9a70da08..d6c8b344f 100644
--- a/hw/xfree86/xaa/xaalocal.h
+++ b/hw/xfree86/xaa/xaalocal.h
@@ -159,6 +159,13 @@ XAADoImageRead(
);
extern _X_EXPORT void
+XAACopyWindow_int(WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc,
+ RegionPtr borderClip,
+ unsigned int planemask);
+
+extern _X_EXPORT void
XAACopyWindow(
WindowPtr pWin,
DDXPointRec ptOldOrg,