void ExaCheckCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { DrawablePtr pDrawable = &pWin->drawable; ScreenPtr pScreen = pDrawable->pScreen; EXA_PRE_FALLBACK(pScreen); EXA_FALLBACK(("from %p\n", pWin)); /* Only need the source bits, the destination region will be overwritten */ if (pExaScr->prepare_access_reg) { PixmapPtr pPixmap = pScreen->GetWindowPixmap(pWin); int xoff, yoff; exaGetDrawableDeltas(&pWin->drawable, pPixmap, &xoff, &yoff); RegionTranslate(prgnSrc, xoff, yoff); pExaScr->prepare_access_reg(pPixmap, EXA_PREPARE_SRC, prgnSrc); RegionTranslate(prgnSrc, -xoff, -yoff); } else exaPrepareAccess(pDrawable, EXA_PREPARE_SRC); swap(pExaScr, pScreen, CopyWindow); pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc); swap(pExaScr, pScreen, CopyWindow); exaFinishAccess(pDrawable, EXA_PREPARE_SRC); EXA_POST_FALLBACK(pScreen); }
void glWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWindow->drawable.pScreen; glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum]; __GLXdrawablePrivate *glxPriv; /* Check if the window is attached and discard any drawing request */ glxPriv = __glXFindDrawablePrivate(pWindow->drawable.id); if (glxPriv) { __GLXcontext *gx; /* GL contexts bound to this window for drawing */ for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { /* GLWIN_DEBUG_MSG("glWinCopyWindow - calling glDrawBuffer\n"); glDrawBuffer(GL_FRONT); */ return; } /* GL contexts bound to this window for reading */ for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { return; } } GLWIN_DEBUG_MSG("glWinCopyWindow - passing to hw layer\n"); pScreen->CopyWindow = screenPriv->CopyWindow; pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc); pScreen->CopyWindow = glWinCopyWindow; }
void rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion) { RegionRec reg; RegionRec clip; int dx; int dy; int i; int j; int num_clip_rects; int num_reg_rects; BoxRec box1; BoxRec box2; DEBUG_OUT_OPS(("in rdpCopyWindow\n")); RegionInit(®, NullBox, 0); RegionCopy(®, pOldRegion); g_pScreen->CopyWindow = g_rdpScreen.CopyWindow; g_pScreen->CopyWindow(pWin, ptOldOrg, pOldRegion); RegionInit(&clip, NullBox, 0); RegionCopy(&clip, &pWin->borderClip); dx = pWin->drawable.x - ptOldOrg.x; dy = pWin->drawable.y - ptOldOrg.y; rdpup_begin_update(); num_clip_rects = REGION_NUM_RECTS(&clip); num_reg_rects = REGION_NUM_RECTS(®); /* should maybe sort the rects instead of checking dy < 0 */ /* If we can depend on the rects going from top to bottom, left to right we are ok */ if (dy < 0 || (dy == 0 && dx < 0)) { for (j = 0; j < num_clip_rects; j++) { box1 = REGION_RECTS(&clip)[j]; rdpup_set_clip(box1.x1, box1.y1, box1.x2 - box1.x1, box1.y2 - box1.y1); for (i = 0; i < num_reg_rects; i++) { box2 = REGION_RECTS(®)[i]; rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy, box2.x2 - box2.x1, box2.y2 - box2.y1, box2.x1, box2.y1); } } } else { for (j = num_clip_rects - 1; j >= 0; j--) { box1 = REGION_RECTS(&clip)[j]; rdpup_set_clip(box1.x1, box1.y1, box1.x2 - box1.x1, box1.y2 - box1.y1); for (i = num_reg_rects - 1; i >= 0; i--) { box2 = REGION_RECTS(®)[i]; rdpup_screen_blt(box2.x1 + dx, box2.y1 + dy, box2.x2 - box2.x1, box2.y2 - box2.y1, box2.x1, box2.y1); } } } rdpup_reset_clip(); rdpup_end_update(); RegionUninit(®); RegionUninit(&clip); g_pScreen->CopyWindow = rdpCopyWindow; }