xserver-multidpi/hw/xfree86/xaa/xaaCpyWin.c
Jamey Sharp e7fae9ecc4 Move each screen's root-window pointer into ScreenRec.
Many references to the WindowTable array already had the corresponding
screen pointer handy, which meant they usually looked like
"WindowTable[pScreen->myNum]". Adding a field to ScreenRec instead of
keeping this information in a parallel array simplifies those
expressions, and eliminates a MAXSCREENS-sized array.

Since dix uses this data, a screen private entry isn't appropriate.

xf86-video-dummy currently uses WindowTable, so it needs to be updated
to reflect this change.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
2010-06-03 14:03:23 -07:00

83 lines
1.9 KiB
C

#ifdef HAVE_XORG_CONFIG_H
#include <xorg-config.h>
#endif
#include "misc.h"
#include "xf86.h"
#include "xf86_OSproc.h"
#include <X11/X.h>
#include "scrnintstr.h"
#include "windowstr.h"
#include "xf86str.h"
#include "xaa.h"
#include "xaalocal.h"
#include "gcstruct.h"
#include "pixmapstr.h"
#include "xaawrap.h"
/*
Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
*/
void
XAACopyWindow(
WindowPtr pWin,
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));
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;
REGION_NULL(pScreen, &rgnDst);
dx = ptOldOrg.x - pWin->drawable.x;
dy = ptOldOrg.y - pWin->drawable.y;
REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
pbox = REGION_RECTS(&rgnDst);
nbox = REGION_NUM_RECTS(&rgnDst);
if(!nbox ||
!(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
REGION_UNINIT(pScreen, &rgnDst);
return;
}
ppt = pptSrc;
while(nbox--) {
ppt->x = pbox->x1 + dx;
ppt->y = pbox->y1 + dy;
ppt++; pbox++;
}
infoRec->ScratchGC.planemask = ~0L;
infoRec->ScratchGC.alu = GXcopy;
XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
&(infoRec->ScratchGC), &rgnDst, pptSrc);
free(pptSrc);
REGION_UNINIT(pScreen, &rgnDst);
}