Beispiel #1
0
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;

    RegionNull(&rgnDst);

    dx = ptOldOrg.x - pWin->drawable.x;
    dy = ptOldOrg.y - pWin->drawable.y;
    RegionTranslate(prgnSrc, -dx, -dy);
    RegionIntersect(&rgnDst, &pWin->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 = ~0L;
    infoRec->ScratchGC.alu = GXcopy;

    XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
        		&(infoRec->ScratchGC), &rgnDst, pptSrc);

    free(pptSrc);
    RegionUninit(&rgnDst);
}
Beispiel #2
0
static void
XAACopyWindow8_32(
    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));
    Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
    RegionPtr borderClip = &pWin->borderClip;
    Bool freeReg = FALSE;

    if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt ||
	(infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK)) 
    { 
	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, XAACopyWindow8_32);
    	return;
    }

    pwinRoot = WindowTable[pScreen->myNum];

    if(doUnderlay)
	freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);

    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, borderClip, prgnSrc);

    pbox = REGION_RECTS(&rgnDst);
    nbox = REGION_NUM_RECTS(&rgnDst);
    if(!nbox || 
      !(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(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 = doUnderlay ? 0x00ffffff : 0xff000000;
    infoRec->ScratchGC.alu = GXcopy;

    XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
        		&(infoRec->ScratchGC), &rgnDst, pptSrc);

    DEALLOCATE_LOCAL(pptSrc);
    REGION_UNINIT(pScreen, &rgnDst);
    if(freeReg) 
	REGION_DESTROY(pScreen, borderClip);
}
Beispiel #3
0
static void
XAACopyWindow8_32(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));
    Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
    RegionPtr borderClip = &pWin->borderClip;
    Bool freeReg = FALSE;

    if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt ||
        (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK)) {
        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, XAACopyWindow8_32);
        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)
        RegionDestroy(borderClip);
}
void
XAAOverCopyWindow(
    WindowPtr pWin,
    DDXPointRec ptOldOrg,
    RegionPtr prgnSrc
){
    ScreenPtr pScreen = pWin->drawable.pScreen;
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
    ScrnInfoPtr pScrn = infoRec->pScrn;
    DDXPointPtr ppt, pptSrc;
    RegionRec rgnDst;
    BoxPtr pbox;
    int i, nbox, dx, dy;
    WindowPtr pRoot = WindowTable[pScreen->myNum];


    if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) { 
	XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
	if(pScrn->vtSema && infoRec->NeedToSync) {
	    (*infoRec->Sync)(pScrn);
	    infoRec->NeedToSync = FALSE;
	}
        (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
	XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAAOverCopyWindow);
    	return;
    }

    infoRec->ScratchGC.alu = GXcopy;
    infoRec->ScratchGC.planemask = ~0;

    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);

    nbox = REGION_NUM_RECTS(&rgnDst);
    if(nbox &&
	(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) {

	pbox = REGION_RECTS(&rgnDst);
	for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
	    ppt->x = pbox->x1 + dx;
	    ppt->y = pbox->y1 + dy;
	}

	SWITCH_DEPTH(8);
	XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
        		&(infoRec->ScratchGC), &rgnDst, pptSrc);

	if(pWin->drawable.bitsPerPixel != 8) {
	    SWITCH_DEPTH(pScrn->depth);
	    XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
        		&(infoRec->ScratchGC), &rgnDst, pptSrc);
	}

	DEALLOCATE_LOCAL(pptSrc);
    }

    REGION_UNINIT(pScreen, &rgnDst);

    if(pWin->drawable.depth == 8) {
      REGION_NULL(pScreen, &rgnDst);
      miSegregateChildren(pWin, &rgnDst, pScrn->depth);
      if(REGION_NOTEMPTY(pScreen, &rgnDst)) {
	REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc);
	nbox = REGION_NUM_RECTS(&rgnDst);
	if(nbox &&
	  (pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))){

	    pbox = REGION_RECTS(&rgnDst);
	    for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
		ppt->x = pbox->x1 + dx;
		ppt->y = pbox->y1 + dy;
	    }

	    SWITCH_DEPTH(pScrn->depth);
	    XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
        		&(infoRec->ScratchGC), &rgnDst, pptSrc);
	    DEALLOCATE_LOCAL(pptSrc);
	}
      }
      REGION_UNINIT(pScreen, &rgnDst);
    }
}
Beispiel #5
0
void
XAAOverCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
    ScreenPtr pScreen = pWin->drawable.pScreen;
    XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
    XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
    ScrnInfoPtr pScrn = infoRec->pScrn;
    DDXPointPtr ppt, pptSrc;
    RegionRec rgnDst;
    BoxPtr pbox;
    int i, nbox, dx, dy;
    WindowPtr pRoot = pScreen->root;

    if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
        XAA_SCREEN_PROLOGUE(pScreen, CopyWindow);
        if (pScrn->vtSema && infoRec->NeedToSync) {
            (*infoRec->Sync) (pScrn);
            infoRec->NeedToSync = FALSE;
        }
        (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
        XAA_SCREEN_EPILOGUE(pScreen, CopyWindow, XAAOverCopyWindow);
        return;
    }

    infoRec->ScratchGC.alu = GXcopy;
    infoRec->ScratchGC.planemask = ~0;

    RegionNull(&rgnDst);

    dx = ptOldOrg.x - pWin->drawable.x;
    dy = ptOldOrg.y - pWin->drawable.y;
    RegionTranslate(prgnSrc, -dx, -dy);
    RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);

    nbox = RegionNumRects(&rgnDst);
    if (nbox && (pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {

        pbox = RegionRects(&rgnDst);
        for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
            ppt->x = pbox->x1 + dx;
            ppt->y = pbox->y1 + dy;
        }

        SWITCH_DEPTH(8);
        XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
                    &(infoRec->ScratchGC), &rgnDst, pptSrc);

        if (pWin->drawable.bitsPerPixel != 8) {
            SWITCH_DEPTH(pScrn->depth);
            XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
                        &(infoRec->ScratchGC), &rgnDst, pptSrc);
        }

        free(pptSrc);
    }

    RegionUninit(&rgnDst);

    if (pWin->drawable.depth == 8) {
        RegionNull(&rgnDst);
        miSegregateChildren(pWin, &rgnDst, pScrn->depth);
        if (RegionNotEmpty(&rgnDst)) {
            RegionIntersect(&rgnDst, &rgnDst, prgnSrc);
            nbox = RegionNumRects(&rgnDst);
            if (nbox &&
                (pptSrc = (DDXPointPtr) malloc(nbox * sizeof(DDXPointRec)))) {

                pbox = RegionRects(&rgnDst);
                for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
                    ppt->x = pbox->x1 + dx;
                    ppt->y = pbox->y1 + dy;
                }

                SWITCH_DEPTH(pScrn->depth);
                XAADoBitBlt((DrawablePtr) pRoot, (DrawablePtr) pRoot,
                            &(infoRec->ScratchGC), &rgnDst, pptSrc);
                free(pptSrc);
            }
        }
        RegionUninit(&rgnDst);
    }
}