static RegionPtr rdpCopyAreaWndToPixmap(WindowPtr pSrcWnd, PixmapPtr pDstPixmap, rdpPixmapRec *pDstPriv, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty) { int cd; int lsrcx; int lsrcy; int ldstx; int ldsty; int num_clips; int j; BoxRec box; RegionPtr rv; RegionRec clip_reg; LLOGLN(10, ("rdpCopyAreaWndToPixmap:")); RegionInit(&clip_reg, NullBox, 0); cd = rdp_get_clip(&clip_reg, &(pDstPixmap->drawable), pGC); lsrcx = pSrcWnd->drawable.x + srcx; lsrcy = pSrcWnd->drawable.y + srcy; ldstx = pDstPixmap->drawable.x + dstx; ldsty = pDstPixmap->drawable.y + dsty; if (cd == 1) { rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_begin_update(); rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy); rdpup_end_update(); rdpup_switch_os_surface(-1); } else if (cd == 2) { num_clips = REGION_NUM_RECTS(&clip_reg); if (num_clips > 0) { rdpup_switch_os_surface(pDstPriv->rdpindex); rdpup_begin_update(); for (j = 0; j < num_clips; j++) { box = REGION_RECTS(&clip_reg)[j]; rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy); } rdpup_reset_clip(); rdpup_end_update(); rdpup_switch_os_surface(-1); } } RegionUninit(&clip_reg); rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstPixmap->drawable), pGC, srcx, srcy, w, h, dstx, dsty); return rv; }
static RegionPtr rdpCopyAreaWndToWnd(WindowPtr pSrcWnd, WindowPtr pDstWnd, GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty) { int cd; int lsrcx; int lsrcy; int ldstx; int ldsty; int num_clips; int dx; int dy; int j; BoxRec box; RegionPtr rv; RegionRec clip_reg; LLOGLN(10, ("rdpCopyAreaWndToWnd:")); RegionInit(&clip_reg, NullBox, 0); cd = rdp_get_clip(&clip_reg, &(pDstWnd->drawable), pGC); lsrcx = pSrcWnd->drawable.x + srcx; lsrcy = pSrcWnd->drawable.y + srcy; ldstx = pDstWnd->drawable.x + dstx; ldsty = pDstWnd->drawable.y + dsty; if (cd == 1) { rdpup_begin_update(); rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy); rdpup_end_update(); } else if (cd == 2) { num_clips = REGION_NUM_RECTS(&clip_reg); if (num_clips > 0) { rdpup_begin_update(); dx = ldstx - lsrcx; dy = ldsty - lsrcy; if ((dy < 0) || ((dy == 0) && (dx < 0))) { for (j = 0; j < num_clips; j++) { box = REGION_RECTS(&clip_reg)[j]; LLOGLN(10, (" index %d x1 %d y1 %d x2 %d y2 %d", j, box.x1, box.y1, box.x2, box.y2)); rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy); } } else { for (j = num_clips - 1; j >= 0; j--) { box = REGION_RECTS(&clip_reg)[j]; LLOGLN(10, (" index %d x1 %d y1 %d x2 %d y2 %d", j, box.x1, box.y1, box.x2, box.y2)); rdpup_set_clip(box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1); rdpup_screen_blt(ldstx, ldsty, w, h, lsrcx, lsrcy); } } rdpup_reset_clip(); rdpup_end_update(); } } RegionUninit(&clip_reg); rv = rdpCopyAreaOrg(&(pSrcWnd->drawable), &(pDstWnd->drawable), pGC, srcx, srcy, w, h, dstx, dsty); return rv; }
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; }