Index: xaaPict.c =================================================================== RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c,v retrieving revision 1.3 diff -u -r1.3 xaaPict.c --- xaaPict.c 4 Aug 2004 10:05:37 -0000 1.3 +++ xaaPict.c 14 Aug 2004 05:54:51 -0000 @@ -172,6 +172,10 @@ } } +#define DRAWABLE_IS_OFFSCREEN(pDraw) \ + (pDraw->type == DRAWABLE_WINDOW || \ + (pDraw->type == DRAWABLE_PIXMAP && IS_OFFSCREEN_PIXMAP(pDraw))) + Bool XAADoComposite ( CARD8 op, @@ -198,13 +202,10 @@ if(!REGION_NUM_RECTS(pDst->pCompositeClip)) return TRUE; - if(!infoRec->pScrn->vtSema || - ((pDst->pDrawable->type != DRAWABLE_WINDOW) && - !IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) + if(!infoRec->pScrn->vtSema || !DRAWABLE_IS_OFFSCREEN(pDst->pDrawable)) return FALSE; - if((pSrc->pDrawable->type != DRAWABLE_PIXMAP) || - IS_OFFSCREEN_PIXMAP(pSrc->pDrawable)) + if(DRAWABLE_IS_OFFSCREEN(pSrc->pDrawable)) return FALSE; if (pSrc->transform || (pMask && pMask->transform)) @@ -425,6 +426,59 @@ return FALSE; } +static void +XAACompositeSrcCopy (PicturePtr pSrc, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height) +{ + ScreenPtr pScreen = pDst->pDrawable->pScreen; + XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); + int i, nbox; + int xoff, yoff; + BoxPtr pbox; + DDXPointPtr pptSrc; + RegionRec region; + + xDst += pDst->pDrawable->x; + yDst += pDst->pDrawable->y; + xSrc += pSrc->pDrawable->x; + ySrc += pSrc->pDrawable->y; + + if (!miComputeCompositeRegion (®ion, pSrc, NULL, pDst, + xSrc, ySrc, 0, 0, xDst, yDst, + width, height)) + return; + + nbox = REGION_NUM_RECTS(®ion); + pbox = REGION_RECTS(®ion); + + if(!nbox) { + REGION_UNINIT(pScreen, ®ion); + return; + } + pptSrc = ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox); + if (!pptSrc) { + REGION_UNINIT(pScreen, ®ion); + return; + } + xoff = xSrc - xDst; + yoff = ySrc - yDst; + for (i = 0; i < nbox; i++) { + pptSrc[i].x = pbox[i].x1 + xoff; + pptSrc[i].y = pbox[i].y1 + yoff; + } + + XAAScreenToScreenBitBlt(infoRec->pScrn, nbox, pptSrc, pbox, 0, 0, GXcopy, + -1); + + REGION_UNINIT(pScreen, ®ion); + return; +} void XAAComposite (CARD8 op, @@ -444,7 +498,13 @@ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen); XAA_RENDER_PROLOGUE(pScreen, Composite); - if(!infoRec->Composite || + if((op == PictOpSrc) && !pMask && infoRec->pScrn->vtSema && + DRAWABLE_IS_OFFSCREEN(pSrc->pDrawable) && + DRAWABLE_IS_OFFSCREEN(pDst->pDrawable) && + !pSrc->transform && !pSrc->repeat && (pSrc->format == pDst->format)) + { + XAACompositeSrcCopy(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height); + } else if(!infoRec->Composite || !(*infoRec->Composite)(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height))