/** * Union the window's accum-dirty and prev-accum-dirty regions with the * incoming region. * Called by crHashtableWalk() via vncspuGetScreenRects(). */ static void WindowDirtyUnionCB(unsigned long key, void *windowData, void *regionData) { WindowInfo *window = (WindowInfo *) windowData; RegionPtr regionUnion = (RegionPtr) regionData; RegionRec accumScrn; /* accumulated region, in screen coords */ Bool overlap; miRegionInit(&accumScrn, NULL, 0); /* init local var */ CRASSERT(miValidRegion(&window->accumDirtyRegion)); CRASSERT(miValidRegion(&window->prevAccumDirtyRegion)); /* crDebug("accum area: %d prev accum: %d", miRegionArea(&window->accumDirtyRegion), miRegionArea(&window->prevAccumDirtyRegion)); */ /* at first, accumScrn region is in window coords */ REGION_UNION(&accumScrn, &window->accumDirtyRegion, &window->prevAccumDirtyRegion); /* intersect with window bounds */ REGION_INTERSECT(&accumScrn, &accumScrn, &window->clipRegion); REGION_VALIDATE(&accumScrn, &overlap); /* change y=0=bottom to y=0=top */ InvertRegion(&accumScrn, window->height ? window->height : 1); if (REGION_NUM_RECTS(&accumScrn) == 1 && accumScrn.extents.x1 == 0 && accumScrn.extents.y1 == 0 && accumScrn.extents.x2 == 1 && accumScrn.extents.y2 == 1) { /* empty / sentinal region */ } else { /* add window offset */ miTranslateRegion(&accumScrn, window->xPos, window->yPos); } /* now, accumScrn region is in screen coords */ REGION_UNION(regionUnion, regionUnion, &accumScrn); REGION_UNINIT(&accumScrn); /* done with local var */ }
void Region::translate(int dx, int dy) { miTranslateRegion(&m_reg, dx, dy); }