aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/mi
diff options
context:
space:
mode:
authorMihai Moldovan <ionic@ionic.de>2016-05-13 06:19:21 +0200
committerMihai Moldovan <ionic@ionic.de>2016-05-13 06:19:21 +0200
commitaba2a534f630f5b65a53e0ea7cdba17b77263f87 (patch)
tree8c4e2be57984a1d9e6143944d080e19f6c3049ec /nx-X11/programs/Xserver/mi
parent6c6b6b962654ac3c15d27aafbe583ee74e4f2266 (diff)
parent52dc49607e244c0e39b5d7cbdb8b41755f078aac (diff)
downloadnx-libs-aba2a534f630f5b65a53e0ea7cdba17b77263f87.tar.gz
nx-libs-aba2a534f630f5b65a53e0ea7cdba17b77263f87.tar.bz2
nx-libs-aba2a534f630f5b65a53e0ea7cdba17b77263f87.zip
Merge branch 'sunweaver-pr/nxagent-no-compiler-warnings' into arctica-3.6.x
Attributes GH PR #102: https://github.com/ArcticaProject/nx-libs/pull/102
Diffstat (limited to 'nx-X11/programs/Xserver/mi')
-rw-r--r--nx-X11/programs/Xserver/mi/Imakefile7
-rw-r--r--nx-X11/programs/Xserver/mi/mi.h11
-rw-r--r--nx-X11/programs/Xserver/mi/mibank.c92
-rw-r--r--nx-X11/programs/Xserver/mi/mibitblt.c32
-rw-r--r--nx-X11/programs/Xserver/mi/mibstore.c288
-rw-r--r--nx-X11/programs/Xserver/mi/miexpose.c112
-rw-r--r--nx-X11/programs/Xserver/mi/migc.c45
-rw-r--r--nx-X11/programs/Xserver/mi/mioverlay.c424
-rw-r--r--nx-X11/programs/Xserver/mi/miregion.c2578
-rw-r--r--nx-X11/programs/Xserver/mi/miscrinit.c44
-rw-r--r--nx-X11/programs/Xserver/mi/mispans.h2
-rw-r--r--nx-X11/programs/Xserver/mi/misprite.c6
-rw-r--r--nx-X11/programs/Xserver/mi/mivaltree.c140
-rw-r--r--nx-X11/programs/Xserver/mi/miwindow.c154
14 files changed, 678 insertions, 3257 deletions
diff --git a/nx-X11/programs/Xserver/mi/Imakefile b/nx-X11/programs/Xserver/mi/Imakefile
index e62fb0005..4f87dec8e 100644
--- a/nx-X11/programs/Xserver/mi/Imakefile
+++ b/nx-X11/programs/Xserver/mi/Imakefile
@@ -44,7 +44,7 @@ SRCS = $(CBRT_SRC) mivaltree.c mipolyseg.c mipolyrect.c \
mipoly.c mipolycon.c mipolygen.c mipolyutil.c \
mifillrct.c miwideline.c mispans.c \
miarc.c mizerarc.c mifillarc.c \
- miwindow.c micursor.c miregion.c \
+ miwindow.c micursor.c \
mipolytext.c mibitblt.c mipolypnt.c mipushpxl.c \
miexpose.c miglblt.c mizerline.c mizerclip.c mifpolycon.c \
midash.c mibstore.c mibank.c $(MIINITEXTSRC) mieq.c \
@@ -55,7 +55,7 @@ OBJS = $(CBRT_OBJ) mivaltree.o mipolyseg.o mipolyrect.o \
mipoly.o mipolycon.o mipolygen.o mipolyutil.o \
mifillrct.o miwideline.o mispans.o \
miarc.o mizerarc.o mifillarc.o \
- miwindow.o micursor.o miregion.o \
+ miwindow.o micursor.o \
mipolytext.o mibitblt.o mipolypnt.o mipushpxl.o \
miexpose.o miglblt.o mizerline.o mizerclip.o mifpolycon.o \
midash.o mibstore.o mibank.o $(MIINITEXTOBJ) mieq.o \
@@ -90,7 +90,8 @@ EXT_DEFINES = ExtensionDefines -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC \
INCLUDES = -I. -I../include -I../render \
-I../xfixes -I../damageext -I../miext/damage \
- -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext
+ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext \
+ `pkg-config --cflags-only-I pixman-1`
LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln
DEFINES = $(FFS_DEFINES)
diff --git a/nx-X11/programs/Xserver/mi/mi.h b/nx-X11/programs/Xserver/mi/mi.h
index 6eea34b6c..86db39ad8 100644
--- a/nx-X11/programs/Xserver/mi/mi.h
+++ b/nx-X11/programs/Xserver/mi/mi.h
@@ -403,16 +403,14 @@ extern void miPushPixels(
int /*yOrg*/
);
-/* miregion.c */
-
/* see also region.h */
-extern Bool miRectAlloc(
+extern Bool RegionRectAlloc(
RegionPtr /*pRgn*/,
int /*n*/
);
-extern void miSetExtents(
+extern void RegionSetExtents(
RegionPtr /*pReg*/
);
@@ -421,13 +419,12 @@ extern int miFindMaxBand(
);
#ifdef DEBUG
-extern Bool miValidRegion(
+extern Bool RegionIsValid(
RegionPtr /*prgn*/
);
#endif
-extern Bool miRegionDataCopy(RegionPtr dst, RegionPtr src);
-extern Bool miRegionBroken(RegionPtr pReg);
+extern Bool RegionBroken(RegionPtr pReg);
/* miscrinit.c */
diff --git a/nx-X11/programs/Xserver/mi/mibank.c b/nx-X11/programs/Xserver/mi/mibank.c
index b5da2267f..24e202094 100644
--- a/nx-X11/programs/Xserver/mi/mibank.c
+++ b/nx-X11/programs/Xserver/mi/mibank.c
@@ -607,8 +607,8 @@ miBankCopy(
if (!pScreenPriv->pBanks[ns])
continue;
- nBox = REGION_NUM_RECTS(pScreenPriv->pBanks[ns]);
- pBox = REGION_RECTS(pScreenPriv->pBanks[ns]);
+ nBox = RegionNumRects(pScreenPriv->pBanks[ns]);
+ pBox = RegionRects(pScreenPriv->pBanks[ns]);
for (; nBox--; pBox++)
{
@@ -668,8 +668,8 @@ miBankCopy(
* It's faster to let the lower-level CopyArea do the clipping
* within each bank.
*/
- nBox = REGION_NUM_RECTS(pScreenPriv->pBanks[nd]);
- pBox = REGION_RECTS(pScreenPriv->pBanks[nd]);
+ nBox = RegionNumRects(pScreenPriv->pBanks[nd]);
+ pBox = RegionRects(pScreenPriv->pBanks[nd]);
for (; nBox--; pBox++)
{
@@ -775,10 +775,10 @@ miBankCopy(
}
else
{
- REGION_INIT(pScreen, &rgnDst, &fastBox, 1);
- REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrcClip);
- pBox = REGION_RECTS(&rgnDst);
- nBox = REGION_NUM_RECTS(&rgnDst);
+ RegionInit(&rgnDst, &fastBox, 1);
+ RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip);
+ pBox = RegionRects(&rgnDst);
+ nBox = RegionNumRects(&rgnDst);
}
/*
@@ -804,8 +804,8 @@ miBankCopy(
if (!pScreenPriv->pBanks[ns])
continue;
- nBoxClipSrc = REGION_NUM_RECTS(pScreenPriv->pBanks[ns]);
- pBoxClipSrc = REGION_RECTS(pScreenPriv->pBanks[ns]);
+ nBoxClipSrc = RegionNumRects(pScreenPriv->pBanks[ns]);
+ pBoxClipSrc = RegionRects(pScreenPriv->pBanks[ns]);
for (; nBoxClipSrc--; pBoxClipSrc++)
{
@@ -836,9 +836,9 @@ miBankCopy(
* so use the bank clips here instead.
*/
nBoxClipDst =
- REGION_NUM_RECTS(pScreenPriv->pBanks[nd]);
+ RegionNumRects(pScreenPriv->pBanks[nd]);
pBoxClipDst =
- REGION_RECTS(pScreenPriv->pBanks[nd]);
+ RegionRects(pScreenPriv->pBanks[nd]);
for (; nBoxClipDst--; pBoxClipDst++)
{
@@ -878,7 +878,7 @@ miBankCopy(
pScreenPriv->nPixelsPerScanlinePadUnit) ||
(ccBox.x2 %
pScreenPriv->nPixelsPerScanlinePadUnit) ||
- (RECT_IN_REGION(pScreen,
+ (RegionContainsRect(
pGCPriv->pBankedClips[nd], &ccBox) !=
rgnIN)))
pQueue->fastBlit = FALSE;
@@ -892,9 +892,9 @@ miBankCopy(
if (!fastClip)
{
- REGION_UNINIT(pScreen, &rgnDst);
+ RegionUninit(&rgnDst);
if (freeSrcClip)
- REGION_DESTROY(pScreen, prgnSrcClip);
+ RegionDestroy(prgnSrcClip);
}
pQueueNew = pQueue;
@@ -1405,16 +1405,16 @@ miBankValidateGC(
continue;
if (!(prgnClip = pGCPriv->pBankedClips[i]))
- prgnClip = REGION_CREATE(pScreen, NULL, 1);
+ prgnClip = RegionCreate(NULL, 1);
- REGION_INTERSECT(pScreen, prgnClip,
+ RegionIntersect(prgnClip,
pScreenPriv->pBanks[i], pGC->pCompositeClip);
- if ((REGION_NUM_RECTS(prgnClip) <= 1) &&
+ if ((RegionNumRects(prgnClip) <= 1) &&
((prgnClip->extents.x1 == prgnClip->extents.x2) ||
(prgnClip->extents.y1 == prgnClip->extents.y2)))
{
- REGION_DESTROY(pScreen, prgnClip);
+ RegionDestroy(prgnClip);
pGCPriv->pBankedClips[i] = NULL;
}
else
@@ -1469,7 +1469,7 @@ miBankValidateGC(
if (!pGCPriv->pBankedClips[i])
continue;
- REGION_DESTROY(pScreen, pGCPriv->pBankedClips[i]);
+ RegionDestroy(pGCPriv->pBankedClips[i]);
pGCPriv->pBankedClips[i] = NULL;
}
}
@@ -1528,7 +1528,7 @@ miBankDestroyGC(
if (!pGCPriv->pBankedClips[i])
continue;
- REGION_DESTROY(pScreen, pGCPriv->pBankedClips[i]);
+ RegionDestroy(pGCPriv->pBankedClips[i]);
pGCPriv->pBankedClips[i] = NULL;
}
@@ -1707,7 +1707,7 @@ miBankCloseScreen(
/* Delete bank clips */
for (i = 0; i < pScreenPriv->nBanks; i++)
if (pScreenPriv->pBanks[i])
- REGION_DESTROY(pScreen, pScreenPriv->pBanks[i]);
+ RegionDestroy(pScreenPriv->pBanks[i]);
Xfree(pScreenPriv->pBanks);
@@ -1915,17 +1915,17 @@ miBankPaintWindow(
}
else
{
- REGION_NULL(pScreen, &tmpReg);
+ RegionNull(&tmpReg);
for (i = 0; i < pScreenPriv->nBanks; i++)
{
if (!pScreenPriv->pBanks[i])
continue;
- REGION_INTERSECT(pScreen, &tmpReg, pRegion,
+ RegionIntersect(&tmpReg, pRegion,
pScreenPriv->pBanks[i]);
- if (REGION_NIL(&tmpReg))
+ if (RegionNil(&tmpReg))
continue;
SET_SINGLE_BANK(pScreenPriv->pScreenPixmap, -1, -1, i);
@@ -1933,7 +1933,7 @@ miBankPaintWindow(
(*PaintWindow)(pWin, &tmpReg, what);
}
- REGION_UNINIT(pScreen, &tmpReg);
+ RegionUninit(&tmpReg);
}
if (what == PW_BORDER)
@@ -1968,15 +1968,15 @@ miBankCopyWindow(
ChangeGC(pGC, GCSubwindowMode, &subWindowMode);
ValidateGC(pDrawable, pGC);
- pRgnDst = REGION_CREATE(pScreen, NULL, 1);
+ pRgnDst = RegionCreate(NULL, 1);
dx = ptOldOrg.x - pWindow->drawable.x;
dy = ptOldOrg.y - pWindow->drawable.y;
- REGION_TRANSLATE(pScreen, pRgnSrc, -dx, -dy);
- REGION_INTERSECT(pScreen, pRgnDst, &pWindow->borderClip, pRgnSrc);
+ RegionTranslate(pRgnSrc, -dx, -dy);
+ RegionIntersect(pRgnDst, &pWindow->borderClip, pRgnSrc);
- pBox = REGION_RECTS(pRgnDst);
- nBox = REGION_NUM_RECTS(pRgnDst);
+ pBox = RegionRects(pRgnDst);
+ nBox = RegionNumRects(pRgnDst);
pBoxNew1 = NULL;
pBoxNew2 = NULL;
@@ -2052,7 +2052,7 @@ miBankCopyWindow(
FreeScratchGC(pGC);
- REGION_DESTROY(pScreen, pRgnDst);
+ RegionDestroy(pRgnDst);
DEALLOCATE_LOCAL(pBoxNew2);
DEALLOCATE_LOCAL(pBoxNew1);
@@ -2086,30 +2086,30 @@ miBankSaveAreas(
}
else
{
- REGION_NULL(pScreen, &rgnClipped);
- REGION_TRANSLATE(pScreen, prgnSave, xorg, yorg);
+ RegionNull(&rgnClipped);
+ RegionTranslate(prgnSave, xorg, yorg);
for (i = 0; i < pScreenPriv->nBanks; i++)
{
if (!pScreenPriv->pBanks[i])
continue;
- REGION_INTERSECT(pScreen, &rgnClipped,
+ RegionIntersect(&rgnClipped,
prgnSave, pScreenPriv->pBanks[i]);
- if (REGION_NIL(&rgnClipped))
+ if (RegionNil(&rgnClipped))
continue;
SET_SINGLE_BANK(pScreenPriv->pScreenPixmap, -1, -1, i);
- REGION_TRANSLATE(pScreen, &rgnClipped, -xorg, -yorg);
+ RegionTranslate(&rgnClipped, -xorg, -yorg);
(*pScreen->BackingStoreFuncs.SaveAreas)(pPixmap, &rgnClipped,
xorg, yorg, pWin);
}
- REGION_TRANSLATE(pScreen, prgnSave, -xorg, -yorg);
- REGION_UNINIT(pScreen, &rgnClipped);
+ RegionTranslate(prgnSave, -xorg, -yorg);
+ RegionUninit(&rgnClipped);
}
SCREEN_WRAP(BackingStoreFuncs.SaveAreas, miBankSaveAreas);
@@ -2140,17 +2140,17 @@ miBankRestoreAreas(
}
else
{
- REGION_NULL(pScreen, &rgnClipped);
+ RegionNull(&rgnClipped);
for (i = 0; i < pScreenPriv->nBanks; i++)
{
if (!pScreenPriv->pBanks[i])
continue;
- REGION_INTERSECT(pScreen, &rgnClipped,
+ RegionIntersect(&rgnClipped,
prgnRestore, pScreenPriv->pBanks[i]);
- if (REGION_NIL(&rgnClipped))
+ if (RegionNil(&rgnClipped))
continue;
SET_SINGLE_BANK(pScreenPriv->pScreenPixmap, -1, -1, i);
@@ -2159,7 +2159,7 @@ miBankRestoreAreas(
xorg, yorg, pWin);
}
- REGION_UNINIT(pScreen, &rgnClipped);
+ RegionUninit(&rgnClipped);
}
SCREEN_WRAP(BackingStoreFuncs.RestoreAreas, miBankRestoreAreas);
@@ -2345,9 +2345,9 @@ miInitializeBanking(
}
pScreenPriv->pBanks[iBank] =
- RECTS_TO_REGION(pScreen, pRect - pRects, pRects, 0);
+ RegionFromRects(pRect - pRects, pRects, 0);
if (!pScreenPriv->pBanks[iBank] ||
- REGION_NAR(pScreenPriv->pBanks[iBank]))
+ RegionNar(pScreenPriv->pBanks[iBank]))
{
we = 1;
break;
@@ -2358,7 +2358,7 @@ miInitializeBanking(
{
for (i = iBank; i >= 0; i--)
if (pScreenPriv->pBanks[i])
- REGION_DESTROY(pScreen, pScreenPriv->pBanks[i]);
+ RegionDestroy(pScreenPriv->pBanks[i]);
Xfree(pScreenPriv->pBanks);
Xfree(pScreenPriv);
diff --git a/nx-X11/programs/Xserver/mi/mibitblt.c b/nx-X11/programs/Xserver/mi/mibitblt.c
index 60318a046..b19a15900 100644
--- a/nx-X11/programs/Xserver/mi/mibitblt.c
+++ b/nx-X11/programs/Xserver/mi/mibitblt.c
@@ -117,7 +117,7 @@ miCopyArea(pSrcDrawable, pDstDrawable,
box.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
box.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
- prgnSrcClip = REGION_CREATE(pGC->pScreen, &box, 1);
+ prgnSrcClip = RegionCreate(&box, 1);
realSrcClip = 1;
}
else
@@ -148,8 +148,8 @@ miCopyArea(pSrcDrawable, pDstDrawable,
ALLOCATE_LOCAL(heightSrc * sizeof(DDXPointRec));
pwidthFirst = pwidth = (unsigned int *)
ALLOCATE_LOCAL(heightSrc * sizeof(unsigned int));
- numRects = REGION_NUM_RECTS(prgnSrcClip);
- boxes = REGION_RECTS(prgnSrcClip);
+ numRects = RegionNumRects(prgnSrcClip);
+ boxes = RegionRects(prgnSrcClip);
ordering = (unsigned int *)
ALLOCATE_LOCAL(numRects * sizeof(unsigned int));
if(!pptFirst || !pwidthFirst || !ordering)
@@ -264,7 +264,7 @@ miCopyArea(pSrcDrawable, pDstDrawable,
prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
widthSrc, heightSrc, xOut, yOut, (unsigned long)0);
if(realSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ RegionDestroy(prgnSrcClip);
DEALLOCATE_LOCAL(ordering);
DEALLOCATE_LOCAL(pwidthFirst);
@@ -452,9 +452,9 @@ miOpqStipDrawable(pDraw, pGC, prgnSrc, pbits, srcx, w, h, dstx, dsty)
to destroy what it's sent. note that this means we don't
have to free prgnSrcClip ourselves.
*/
- prgnSrcClip = REGION_CREATE(pGCT->pScreen, NULL, 0);
- REGION_COPY(pGCT->pScreen, prgnSrcClip, prgnSrc);
- REGION_TRANSLATE(pGCT->pScreen, prgnSrcClip, srcx, 0);
+ prgnSrcClip = RegionCreate(NULL, 0);
+ RegionCopy(prgnSrcClip, prgnSrc);
+ RegionTranslate(prgnSrcClip, srcx, 0);
(*pGCT->funcs->ChangeClip)(pGCT, CT_REGION, prgnSrcClip, 0);
ValidateGC((DrawablePtr)pPixmap, pGCT);
@@ -587,7 +587,7 @@ miCopyPlane(pSrcDrawable, pDstDrawable,
box.x2 = box.x1;
if (box.y1 > box.y2)
box.y2 = box.y1;
- prgnSrc = REGION_CREATE(pGC->pScreen, &box, 1);
+ prgnSrc = RegionCreate(&box, 1);
if (pSrcDrawable->type != DRAWABLE_PIXMAP) {
/* clip to visible drawable */
@@ -595,15 +595,15 @@ miCopyPlane(pSrcDrawable, pDstDrawable,
if (pGC->subWindowMode == IncludeInferiors)
{
RegionPtr clipList = NotClippedByChildren ((WindowPtr) pSrcDrawable);
- REGION_INTERSECT(pGC->pScreen, prgnSrc, prgnSrc, clipList);
- REGION_DESTROY(pGC->pScreen, clipList);
+ RegionIntersect(prgnSrc, prgnSrc, clipList);
+ RegionDestroy(clipList);
} else
- REGION_INTERSECT(pGC->pScreen, prgnSrc, prgnSrc,
+ RegionIntersect(prgnSrc, prgnSrc,
&((WindowPtr)pSrcDrawable)->clipList);
}
- box = *REGION_EXTENTS(pGC->pScreen, prgnSrc);
- REGION_TRANSLATE(pGC->pScreen, prgnSrc, -box.x1, -box.y1);
+ box = *RegionExtents(prgnSrc);
+ RegionTranslate(prgnSrc, -box.x1, -box.y1);
if ((box.x2 > box.x1) && (box.y2 > box.y1))
{
@@ -627,7 +627,7 @@ miCopyPlane(pSrcDrawable, pDstDrawable,
}
prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC, srcx, srcy,
width, height, dstx, dsty, bitPlane);
- REGION_DESTROY(pGC->pScreen, prgnSrc);
+ RegionDestroy(prgnSrc);
return prgnExposed;
}
@@ -776,11 +776,11 @@ miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
box.y1 = 0;
box.x2 = w;
box.y2 = h;
- prgnSrc = REGION_CREATE(pGC->pScreen, &box, 1);
+ prgnSrc = RegionCreate(&box, 1);
miOpqStipDrawable(pDraw, pGC, prgnSrc, (MiBits *) pImage,
leftPad, w, h, x, y);
- REGION_DESTROY(pGC->pScreen, prgnSrc);
+ RegionDestroy(prgnSrc);
break;
case XYPixmap:
diff --git a/nx-X11/programs/Xserver/mi/mibstore.c b/nx-X11/programs/Xserver/mi/mibstore.c
index 875ec87f3..a24e2cbcd 100644
--- a/nx-X11/programs/Xserver/mi/mibstore.c
+++ b/nx-X11/programs/Xserver/mi/mibstore.c
@@ -477,7 +477,7 @@ miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
bounds.y1 = sy + pDrawable->y;
bounds.x2 = bounds.x1 + w;
bounds.y2 = bounds.y1 + h;
- REGION_INIT(pScreen, &Remaining, &bounds, 0);
+ RegionInit(&Remaining, &bounds, 0);
for (;;)
{
bounds.x1 = sx + pDrawable->x - pWin->drawable.x;
@@ -486,11 +486,11 @@ miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
bounds.y2 = bounds.y1 + h;
if (pWin->viewable && pWin->backStorage &&
pWin->drawable.depth == depth &&
- (RECT_IN_REGION(pScreen, &(pWindowPriv =
+ (RegionContainsRect(&(pWindowPriv =
(miBSWindowPtr) pWin->backStorage)->SavedRegion,
&bounds) != rgnOUT ||
- RECT_IN_REGION(pScreen, &Remaining,
- REGION_EXTENTS(pScreen, &pWin->borderSize)) != rgnOUT))
+ RegionContainsRect(&Remaining,
+ RegionExtents(&pWin->borderSize)) != rgnOUT))
{
if (!pPixmap)
{
@@ -508,8 +508,8 @@ miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
}
ChangeGC (pGC, GCSubwindowMode, &subWindowMode);
ValidateGC ((DrawablePtr)pPixmap, pGC);
- REGION_NULL(pScreen, &Border);
- REGION_NULL(pScreen, &Inside);
+ RegionNull(&Border);
+ RegionNull(&Inside);
pSrcWin = (WindowPtr) pDrawable;
x = sx;
y = sy;
@@ -523,28 +523,28 @@ miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
(DrawablePtr)pPixmap, pGC,
x, y, w, h,
0, 0);
- REGION_SUBTRACT(pScreen, &Remaining, &Remaining,
+ RegionSubtract(&Remaining, &Remaining,
&((WindowPtr) pDrawable)->borderClip);
}
- REGION_INTERSECT(pScreen, &Inside, &Remaining, &pWin->winSize);
- REGION_TRANSLATE(pScreen, &Inside,
+ RegionIntersect(&Inside, &Remaining, &pWin->winSize);
+ RegionTranslate(&Inside,
-pWin->drawable.x,
-pWin->drawable.y);
- REGION_INTERSECT(pScreen, &Inside, &Inside,
+ RegionIntersect(&Inside, &Inside,
&pWindowPriv->SavedRegion);
/* offset of sub-window in GetImage pixmap */
xoff = pWin->drawable.x - pDrawable->x - sx;
yoff = pWin->drawable.y - pDrawable->y - sy;
- if (REGION_NUM_RECTS(&Inside) > 0)
+ if (RegionNumRects(&Inside) > 0)
{
switch (pWindowPriv->status)
{
case StatusContents:
- pBox = REGION_RECTS(&Inside);
- for (n = REGION_NUM_RECTS(&Inside); --n >= 0;)
+ pBox = RegionRects(&Inside);
+ for (n = RegionNumRects(&Inside); --n >= 0;)
{
(*pGC->ops->CopyArea) (
(DrawablePtr)pWindowPriv->pBackingPixmap,
@@ -569,12 +569,12 @@ miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
break;
}
}
- REGION_SUBTRACT(pScreen, &Border, &pWin->borderSize,
+ RegionSubtract(&Border, &pWin->borderSize,
&pWin->winSize);
- REGION_INTERSECT(pScreen, &Border, &Border, &Remaining);
- if (REGION_NUM_RECTS(&Border) > 0)
+ RegionIntersect(&Border, &Border, &Remaining);
+ if (RegionNumRects(&Border) > 0)
{
- REGION_TRANSLATE(pScreen, &Border, -pWin->drawable.x,
+ RegionTranslate(&Border, -pWin->drawable.x,
-pWin->drawable.y);
miBSFillVirtualBits ((DrawablePtr) pPixmap, pGC, &Border,
xoff, yoff,
@@ -595,12 +595,12 @@ miBSGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
}
}
- REGION_UNINIT(pScreen, &Remaining);
+ RegionUninit(&Remaining);
if (pPixmap)
{
- REGION_UNINIT(pScreen, &Border);
- REGION_UNINIT(pScreen, &Inside);
+ RegionUninit(&Border);
+ RegionUninit(&Inside);
(*pScreen->GetImage) ((DrawablePtr) pPixmap,
0, 0, w, h, format, planemask, pdstLine);
(*pScreen->DestroyPixmap) (pPixmap);
@@ -664,7 +664,7 @@ miBSGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
bounds.y2 = ppt[i].y;
}
- switch (RECT_IN_REGION(pScreen, &pWindowPriv->SavedRegion, &bounds))
+ switch (RegionContainsRect(&pWindowPriv->SavedRegion, &bounds))
{
case rgnPART:
if (!pPixmap)
@@ -1177,39 +1177,39 @@ miBSDoCopy(
box.y1 = srcy + pWin->drawable.y;
box.y2 = box.y1 + h;
- pRgnExp = REGION_CREATE(pGC->pScreen, &box, 1);
- REGION_INTERSECT(pGC->pScreen, pRgnExp, pRgnExp, &pWin->clipList);
- pRgnObs = REGION_CREATE(pGC->pScreen, NULL, 1);
- REGION_INVERSE( pGC->pScreen, pRgnObs, pRgnExp, &box);
+ pRgnExp = RegionCreate(&box, 1);
+ RegionIntersect(pRgnExp, pRgnExp, &pWin->clipList);
+ pRgnObs = RegionCreate(NULL, 1);
+ RegionInverse(pRgnObs, pRgnExp, &box);
/*
* Translate regions into window coordinates for proper calls
* to the copyProc, then make sure none of the obscured region sticks
* into invalid areas of the backing pixmap.
*/
- REGION_TRANSLATE(pGC->pScreen, pRgnExp,
+ RegionTranslate(pRgnExp,
-pWin->drawable.x,
-pWin->drawable.y);
- REGION_TRANSLATE(pGC->pScreen, pRgnObs,
+ RegionTranslate(pRgnObs,
-pWin->drawable.x,
-pWin->drawable.y);
- REGION_INTERSECT(pGC->pScreen, pRgnObs, pRgnObs, &pBackingStore->SavedRegion);
+ RegionIntersect(pRgnObs, pRgnObs, &pBackingStore->SavedRegion);
/*
* If the obscured region is empty, there's no point being fancy.
*/
- if (!REGION_NOTEMPTY(pGC->pScreen, pRgnObs))
+ if (!RegionNotEmpty(pRgnObs))
{
- REGION_DESTROY(pGC->pScreen, pRgnExp);
- REGION_DESTROY(pGC->pScreen, pRgnObs);
+ RegionDestroy(pRgnExp);
+ RegionDestroy(pRgnObs);
return (FALSE);
}
- numRectsExp = REGION_NUM_RECTS(pRgnExp);
- pBoxExp = REGION_RECTS(pRgnExp);
- pBoxObs = REGION_RECTS(pRgnObs);
- numRectsObs = REGION_NUM_RECTS(pRgnObs);
+ numRectsExp = RegionNumRects(pRgnExp);
+ pBoxExp = RegionRects(pRgnExp);
+ pBoxObs = RegionRects(pRgnObs);
+ numRectsObs = RegionNumRects(pRgnObs);
nrects = numRectsExp + numRectsObs;
boxes = (struct BoxDraw *)ALLOCATE_LOCAL(nrects * sizeof(struct BoxDraw));
@@ -1220,8 +1220,8 @@ miBSDoCopy(
{
if (sequence) DEALLOCATE_LOCAL(sequence);
if (boxes) DEALLOCATE_LOCAL(boxes);
- REGION_DESTROY(pGC->pScreen, pRgnExp);
- REGION_DESTROY(pGC->pScreen, pRgnObs);
+ RegionDestroy(pRgnExp);
+ RegionDestroy(pRgnObs);
return(TRUE);
}
@@ -1437,25 +1437,25 @@ miBSDoCopy(
* to return to dispatch which will send the appropriate expose
* events.
*/
- REGION_UNION(pGC->pScreen, pRgnExp, pRgnExp, pRgnObs);
+ RegionUnion(pRgnExp, pRgnExp, pRgnObs);
box.x1 = srcx;
box.x2 = srcx + w;
box.y1 = srcy;
box.y2 = srcy + h;
- if (RECT_IN_REGION(pGC->pScreen, pRgnExp, &box) == rgnIN)
+ if (RegionContainsRect(pRgnExp, &box) == rgnIN)
{
- REGION_EMPTY(pGC->pScreen, pRgnExp);
+ RegionEmpty(pRgnExp);
}
else
{
- REGION_INVERSE( pGC->pScreen, pRgnExp, pRgnExp, &box);
- REGION_TRANSLATE( pGC->pScreen, pRgnExp,
+ RegionInverse(pRgnExp, pRgnExp, &box);
+ RegionTranslate(pRgnExp,
dx + pWin->drawable.x,
dy + pWin->drawable.y);
- REGION_INTERSECT( pGC->pScreen, pRgnObs, pRgnExp, &pWin->clipList);
+ RegionIntersect(pRgnObs, pRgnExp, &pWin->clipList);
(*pWin->drawable.pScreen->PaintWindowBackground) (pWin,
pRgnObs, PW_BACKGROUND);
- REGION_TRANSLATE( pGC->pScreen, pRgnExp,
+ RegionTranslate(pRgnExp,
-pWin->drawable.x,
-pWin->drawable.y);
miBSClearBackingRegion (pWin, pRgnExp);
@@ -1463,8 +1463,8 @@ miBSDoCopy(
if (graphicsExposures)
*ppRgn = pRgnExp;
else
- REGION_DESTROY(pGC->pScreen, pRgnExp);
- REGION_DESTROY(pGC->pScreen, pRgnObs);
+ RegionDestroy(pRgnExp);
+ RegionDestroy(pRgnObs);
return (TRUE);
}
@@ -1524,7 +1524,7 @@ miBSCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty)
* the backing store. An unnecessary optimisation,
* but a useful one when GetSpans is slow.
*/
- pExtents = REGION_EXTENTS(pDst->pScreen,
+ pExtents = RegionExtents(
(RegionPtr)pBackingGC->clientClip);
bsrcx = srcx;
bsrcy = srcy;
@@ -1573,8 +1573,8 @@ miBSCopyArea (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty)
if (winExposed)
{
if (pixExposed){
- REGION_UNION(pDst->pScreen, winExposed, winExposed, pixExposed);
- REGION_DESTROY(pDst->pScreen, pixExposed);
+ RegionUnion(winExposed, winExposed, pixExposed);
+ RegionDestroy(pixExposed);
}
} else
winExposed = pixExposed;
@@ -1633,7 +1633,7 @@ miBSCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane)
* the backing store. An unnecessary optimisation,
* but a useful one when GetSpans is slow.
*/
- pExtents = REGION_EXTENTS(pDst->pScreen,
+ pExtents = RegionExtents(
(RegionPtr)pBackingGC->clientClip);
bsrcx = srcx;
bsrcy = srcy;
@@ -1687,8 +1687,8 @@ miBSCopyPlane (pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty, plane)
{
if (pixExposed)
{
- REGION_UNION(pDst->pScreen, winExposed, winExposed, pixExposed);
- REGION_DESTROY(pDst->pScreen, pixExposed);
+ RegionUnion(winExposed, winExposed, pixExposed);
+ RegionDestroy(pixExposed);
}
} else
winExposed = pixExposed;
@@ -2312,12 +2312,12 @@ miBSClearBackingStore(pWin, x, y, w, h, generateExposures)
box.y1 = y;
box.x2 = x + w;
box.y2 = y + h;
- pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1);
+ pRgn = RegionCreate(&box, 1);
if (!pRgn)
return NullRegion;
- REGION_INTERSECT( pScreen, pRgn, pRgn, &pBackingStore->SavedRegion);
+ RegionIntersect(pRgn, pRgn, &pBackingStore->SavedRegion);
- if (REGION_NOTEMPTY( pScreen, pRgn))
+ if (RegionNotEmpty(pRgn))
{
/*
* if clearing entire window, simply make new virtual
@@ -2393,12 +2393,12 @@ miBSClearBackingStore(pWin, x, y, w, h, generateExposures)
* Figure out the array of rectangles to fill and fill them with
* PolyFillRect in the proper mode, as set in the GC above.
*/
- numRects = REGION_NUM_RECTS(pRgn);
+ numRects = RegionNumRects(pRgn);
rects = (xRectangle *)ALLOCATE_LOCAL(numRects*sizeof(xRectangle));
if (rects)
{
- for (i = 0, pBox = REGION_RECTS(pRgn);
+ for (i = 0, pBox = RegionRects(pRgn);
i < numRects;
i++, pBox++)
{
@@ -2418,7 +2418,7 @@ miBSClearBackingStore(pWin, x, y, w, h, generateExposures)
if (!generateExposures)
{
- REGION_DESTROY(pScreen, pRgn);
+ RegionDestroy(pRgn);
pRgn = NULL;
}
else
@@ -2427,13 +2427,13 @@ miBSClearBackingStore(pWin, x, y, w, h, generateExposures)
* result must be screen relative, but is currently
* drawable relative.
*/
- REGION_TRANSLATE(pScreen, pRgn, pWin->drawable.x,
+ RegionTranslate(pRgn, pWin->drawable.x,
pWin->drawable.y);
}
}
else
{
- REGION_DESTROY( pScreen, pRgn);
+ RegionDestroy(pRgn);
pRgn = NULL;
}
return pRgn;
@@ -2447,8 +2447,8 @@ miBSClearBackingRegion (pWin, pRgn)
BoxPtr pBox;
int i;
- i = REGION_NUM_RECTS(pRgn);
- pBox = REGION_RECTS(pRgn);
+ i = RegionNumRects(pRgn);
+ pBox = RegionRects(pRgn);
while (i--)
{
(void) miBSClearBackingStore(pWin, pBox->x1, pBox->y1,
@@ -2485,7 +2485,7 @@ miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask)
if (state == None)
return;
- numRects = REGION_NUM_RECTS(pRgn);
+ numRects = RegionNumRects(pRgn);
pRect = (xRectangle *)ALLOCATE_LOCAL(numRects * sizeof(xRectangle));
if (!pRect)
return;
@@ -2545,7 +2545,7 @@ miBSFillVirtualBits (pDrawable, pGC, pRgn, x, y, state, pixunion, planeMask)
if (pDrawable->serialNumber != pGC->serialNumber)
ValidateGC (pDrawable, pGC);
- pBox = REGION_RECTS(pRgn);
+ pBox = RegionRects(pRgn);
for (i = numRects; --i >= 0; pBox++, pRect++)
{
pRect->x = pBox->x1 + x;
@@ -2588,7 +2588,7 @@ miBSAllocate(pWin)
pBackingStore->pBackingPixmap = NullPixmap;
pBackingStore->x = 0;
pBackingStore->y = 0;
- REGION_NULL( pScreen, &pBackingStore->SavedRegion);
+ RegionNull(&pBackingStore->SavedRegion);
pBackingStore->viewable = (char)pWin->viewable;
pBackingStore->status = StatusNoPixmap;
pBackingStore->backgroundState = None;
@@ -2617,16 +2617,16 @@ miBSAllocate(pWin)
box.y1 = pWin->drawable.y;
box.y2 = pWin->drawable.y + (int) pWin->drawable.height;
- REGION_INVERSE( pScreen, pSavedRegion, &pWin->clipList, &box);
- REGION_TRANSLATE( pScreen, pSavedRegion,
+ RegionInverse(pSavedRegion, &pWin->clipList, &box);
+ RegionTranslate(pSavedRegion,
-pWin->drawable.x,
-pWin->drawable.y);
#ifdef SHAPE
if (wBoundingShape (pWin))
- REGION_INTERSECT(pScreen, pSavedRegion, pSavedRegion,
+ RegionIntersect(pSavedRegion, pSavedRegion,
wBoundingShape (pWin));
if (wClipShape (pWin))
- REGION_INTERSECT(pScreen, pSavedRegion, pSavedRegion,
+ RegionIntersect(pSavedRegion, pSavedRegion,
wClipShape (pWin));
#endif
/* if window is already on-screen, assume it has been drawn to */
@@ -2649,7 +2649,7 @@ miBSAllocate(pWin)
*/
if (pBackingStore->status != StatusNoPixmap)
{
- REGION_EMPTY( pScreen, &pBackingStore->SavedRegion);
+ RegionEmpty(&pBackingStore->SavedRegion);
miDestroyBSPixmap (pWin);
}
}
@@ -2683,7 +2683,7 @@ miBSFree(pWin)
{
miDestroyBSPixmap (pWin);
- REGION_UNINIT( pScreen, &pBackingStore->SavedRegion);
+ RegionUninit(&pBackingStore->SavedRegion);
xfree(pBackingStore);
pWin->backStorage = NULL;
@@ -2726,7 +2726,7 @@ miResizeBackingStore(
if (!pBackingPixmap)
return;
pScreen = pWin->drawable.pScreen;
- extents = REGION_EXTENTS(pScreen, &pBackingStore->SavedRegion);
+ extents = RegionExtents(&pBackingStore->SavedRegion);
pNewPixmap = pBackingPixmap;
nw = extents->x2 - extents->x1;
@@ -2838,7 +2838,7 @@ miBSSaveDoomedAreas(pWin, pObscured, dx, dy)
pBackingStore->viewable = (char)pWin->viewable;
if (pWin->backingStore != Always)
{
- REGION_EMPTY( pScreen, &pBackingStore->SavedRegion);
+ RegionEmpty(&pBackingStore->SavedRegion);
miDestroyBSPixmap (pWin);
return;
}
@@ -2851,14 +2851,14 @@ miBSSaveDoomedAreas(pWin, pObscured, dx, dy)
(pBackingStore->backgroundState == None))
return;
- if (REGION_NOTEMPTY(pScreen, pObscured))
+ if (RegionNotEmpty(pObscured))
{
BoxRec oldExtents;
x = pWin->drawable.x;
y = pWin->drawable.y;
- REGION_TRANSLATE(pScreen, pObscured, -x, -y);
- oldExtents = *REGION_EXTENTS(pScreen, &pBackingStore->SavedRegion);
- REGION_UNION( pScreen, &pBackingStore->SavedRegion,
+ RegionTranslate(pObscured, -x, -y);
+ oldExtents = *RegionExtents(&pBackingStore->SavedRegion);
+ RegionUnion(&pBackingStore->SavedRegion,
&pBackingStore->SavedRegion,
pObscured);
/*
@@ -2875,7 +2875,7 @@ miBSSaveDoomedAreas(pWin, pObscured, dx, dy)
if (pBackingStore->pBackingPixmap) {
if (pBackingStore->x | pBackingStore->y)
{
- REGION_TRANSLATE( pScreen, pObscured,
+ RegionTranslate(pObscured,
-pBackingStore->x,
-pBackingStore->y);
x += pBackingStore->x;
@@ -2886,13 +2886,13 @@ miBSSaveDoomedAreas(pWin, pObscured, dx, dy)
x - dx, y - dy, pWin);
}
}
- REGION_TRANSLATE(pScreen, pObscured, x, y);
+ RegionTranslate(pObscured, x, y);
}
else
{
- if (REGION_BROKEN (pScreen, pObscured))
+ if (RegionBroken(pObscured))
{
- REGION_EMPTY( pScreen, &pBackingStore->SavedRegion);
+ RegionEmpty(&pBackingStore->SavedRegion);
miDestroyBSPixmap (pWin);
return;
}
@@ -2943,11 +2943,11 @@ miBSRestoreAreas(pWin, prgnExposed)
if (pBackingStore->status == StatusContents)
{
- REGION_TRANSLATE(pScreen, prgnSaved, pWin->drawable.x,
+ RegionTranslate(prgnSaved, pWin->drawable.x,
pWin->drawable.y);
- prgnRestored = REGION_CREATE( pScreen, (BoxPtr)NULL, 1);
- REGION_INTERSECT( pScreen, prgnRestored, prgnExposed, prgnSaved);
+ prgnRestored = RegionCreate((BoxPtr)NULL, 1);
+ RegionIntersect(prgnRestored, prgnExposed, prgnSaved);
/*
* Since prgnExposed is no longer obscured, we no longer
@@ -2956,10 +2956,10 @@ miBSRestoreAreas(pWin, prgnExposed)
* from the area to be exposed.
*/
- if (REGION_NOTEMPTY( pScreen, prgnRestored))
+ if (RegionNotEmpty(prgnRestored))
{
- REGION_SUBTRACT( pScreen, prgnSaved, prgnSaved, prgnExposed);
- REGION_SUBTRACT( pScreen, prgnExposed, prgnExposed, prgnRestored);
+ RegionSubtract(prgnSaved, prgnSaved, prgnExposed);
+ RegionSubtract(prgnExposed, prgnExposed, prgnRestored);
/*
* Do the actual restoration
@@ -2975,9 +2975,9 @@ miBSRestoreAreas(pWin, prgnExposed)
* region to window relative
*/
- if (REGION_NOTEMPTY(pScreen, prgnSaved))
+ if (RegionNotEmpty(prgnSaved))
{
- REGION_TRANSLATE(pScreen, prgnSaved,
+ RegionTranslate(prgnSaved,
-pWin->drawable.x,
-pWin->drawable.y);
miResizeBackingStore(pWin, 0, 0, TRUE);
@@ -2986,33 +2986,33 @@ miBSRestoreAreas(pWin, prgnExposed)
miDestroyBSPixmap (pWin);
}
else
- REGION_TRANSLATE(pScreen, prgnSaved,
+ RegionTranslate(prgnSaved,
-pWin->drawable.x, -pWin->drawable.y);
- REGION_DESTROY( pScreen, prgnRestored);
+ RegionDestroy(prgnRestored);
}
else if ((pBackingStore->status == StatusVirtual) ||
(pBackingStore->status == StatusVDirty))
{
- REGION_TRANSLATE(pScreen, prgnSaved,
+ RegionTranslate(prgnSaved,
pWin->drawable.x, pWin->drawable.y);
- exposures = REGION_CREATE( pScreen, NullBox, 1);
+ exposures = RegionCreate(NullBox, 1);
if (SameBackground (pBackingStore->backgroundState,
pBackingStore->background,
pWin->backgroundState,
pWin->background))
{
- REGION_SUBTRACT( pScreen, exposures, prgnExposed, prgnSaved);
+ RegionSubtract(exposures, prgnExposed, prgnSaved);
}
else
{
miTileVirtualBS(pWin);
/* we need to expose all we have (virtually) retiled */
- REGION_UNION( pScreen, exposures, prgnExposed, prgnSaved);
+ RegionUnion(exposures, prgnExposed, prgnSaved);
}
- REGION_SUBTRACT( pScreen, prgnSaved, prgnSaved, prgnExposed);
- REGION_TRANSLATE(pScreen, prgnSaved,
+ RegionSubtract(prgnSaved, prgnSaved, prgnExposed);
+ RegionTranslate(prgnSaved,
-pWin->drawable.x, -pWin->drawable.y);
}
else if (pWin->viewable && !pBackingStore->viewable &&
@@ -3034,21 +3034,21 @@ miBSRestoreAreas(pWin, prgnExposed)
box.y1 = pWin->drawable.y;
box.y2 = box.y1 + (int) pWin->drawable.height;
- REGION_INVERSE( pScreen, prgnSaved, &pWin->clipList, &box);
- REGION_TRANSLATE( pScreen, prgnSaved,
+ RegionInverse(prgnSaved, &pWin->clipList, &box);
+ RegionTranslate(prgnSaved,
-pWin->drawable.x,
-pWin->drawable.y);
#ifdef SHAPE
if (wBoundingShape (pWin))
- REGION_INTERSECT(pScreen, prgnSaved, prgnSaved,
+ RegionIntersect(prgnSaved, prgnSaved,
wBoundingShape (pWin));
if (wClipShape (pWin))
- REGION_INTERSECT(pScreen, prgnSaved, prgnSaved,
+ RegionIntersect(prgnSaved, prgnSaved,
wClipShape (pWin));
#endif
miTileVirtualBS(pWin);
- exposures = REGION_CREATE( pScreen, &box, 1);
+ exposures = RegionCreate(&box, 1);
}
pBackingStore->viewable = (char)pWin->viewable;
return exposures;
@@ -3143,22 +3143,22 @@ miBSTranslateBackingStore(pWin, windx, windy, oldClip, oldx, oldy)
* Compute the new saved region
*/
- newSaved = REGION_CREATE( pScreen, NullBox, 1);
+ newSaved = RegionCreate(NullBox, 1);
extents.x1 = pWin->drawable.x;
extents.x2 = pWin->drawable.x + (int) pWin->drawable.width;
extents.y1 = pWin->drawable.y;
extents.y2 = pWin->drawable.y + (int) pWin->drawable.height;
- REGION_INVERSE( pScreen, newSaved, &pWin->clipList, &extents);
+ RegionInverse(newSaved, &pWin->clipList, &extents);
- REGION_TRANSLATE( pScreen, newSaved,
+ RegionTranslate(newSaved,
-pWin->drawable.x, -pWin->drawable.y);
#ifdef SHAPE
if (wBoundingShape (pWin) || wClipShape (pWin)) {
if (wBoundingShape (pWin))
- REGION_INTERSECT( pScreen, newSaved, newSaved,
+ RegionIntersect(newSaved, newSaved,
wBoundingShape (pWin));
if (wClipShape (pWin))
- REGION_INTERSECT( pScreen, newSaved, newSaved, wClipShape (pWin));
+ RegionIntersect(newSaved, newSaved, wClipShape (pWin));
}
#endif
@@ -3191,23 +3191,23 @@ miBSTranslateBackingStore(pWin, windx, windy, oldClip, oldx, oldy)
* bits on the screen which can be put into the
* new backing store
*/
- REGION_TRANSLATE( pScreen, oldClip, windx - oldx, windy - oldy);
- doomed = REGION_CREATE( pScreen, NullBox, 1);
- REGION_INTERSECT( pScreen, doomed, oldClip, newSaved);
- REGION_TRANSLATE( pScreen, oldClip, oldx - windx, oldy - windy);
+ RegionTranslate(oldClip, windx - oldx, windy - oldy);
+ doomed = RegionCreate(NullBox, 1);
+ RegionIntersect(doomed, oldClip, newSaved);
+ RegionTranslate(oldClip, oldx - windx, oldy - windy);
/*
* Translate the old saved region to the position in the
* window where it will appear to be
*/
- REGION_TRANSLATE( pScreen, pSavedRegion, windx, windy);
+ RegionTranslate(pSavedRegion, windx, windy);
/*
* Add the old saved region to the new saved region, so
* that calls to RestoreAreas will be able to fetch those
* bits back
*/
- REGION_UNION( pScreen, newSaved, newSaved, pSavedRegion);
+ RegionUnion(newSaved, newSaved, pSavedRegion);
/*
* Swap the new saved region into the window
@@ -3227,47 +3227,47 @@ miBSTranslateBackingStore(pWin, windx, windy, oldClip, oldx, oldy)
* set to background in the backing pixmap and
* sent as exposure events to the client.
*/
- REGION_SUBTRACT( pScreen, newSaved, pSavedRegion, newSaved);
+ RegionSubtract(newSaved, pSavedRegion, newSaved);
/*
* Fetch bits which will be obscured from
* the screen
*/
- if (REGION_NOTEMPTY( pScreen, doomed))
+ if (RegionNotEmpty(doomed))
{
/*
* Don't clear regions which have bits on the
* screen
*/
- REGION_SUBTRACT( pScreen, newSaved, newSaved, doomed);
+ RegionSubtract(newSaved, newSaved, doomed);
/*
* Make the region to SaveDoomedAreas absolute, instead
* of window relative.
*/
- REGION_TRANSLATE( pScreen, doomed,
+ RegionTranslate(doomed,
pWin->drawable.x, pWin->drawable.y);
(* pScreen->SaveDoomedAreas) (pWin, doomed, scrdx, scrdy);
}
- REGION_DESTROY(pScreen, doomed);
+ RegionDestroy(doomed);
/*
* and clear whatever there is that's new
*/
- if (REGION_NOTEMPTY( pScreen, newSaved))
+ if (RegionNotEmpty(newSaved))
{
miBSClearBackingRegion (pWin, newSaved);
/*
* Make the exposed region absolute
*/
- REGION_TRANSLATE(pScreen, newSaved,
+ RegionTranslate(newSaved,
pWin->drawable.x,
pWin->drawable.y);
}
else
{
- REGION_DESTROY(pScreen, newSaved);
+ RegionDestroy(newSaved);
newSaved = NullRegion;
}
}
@@ -3277,8 +3277,8 @@ miBSTranslateBackingStore(pWin, windx, windy, oldClip, oldx, oldy)
* ForgetGravity: just reset backing store and
* expose the whole mess
*/
- REGION_COPY( pScreen, pSavedRegion, newSaved);
- REGION_TRANSLATE( pScreen, newSaved,
+ RegionCopy(pSavedRegion, newSaved);
+ RegionTranslate(newSaved,
pWin->drawable.x, pWin->drawable.y);
miResizeBackingStore (pWin, 0, 0, FALSE);
@@ -3409,13 +3409,13 @@ miBSValidateGC (pGC, stateChanges, pDrawable)
((pDrawable->serialNumber != pPriv->serialNumber) ||
(stateChanges&(GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode))))
{
- if (REGION_NOTEMPTY(pGC->pScreen, &pWindowPriv->SavedRegion))
+ if (RegionNotEmpty(&pWindowPriv->SavedRegion))
{
- backingCompositeClip = REGION_CREATE(pGC->pScreen, NULL, 1);
+ backingCompositeClip = RegionCreate(NULL, 1);
if ((pGC->clientClipType == CT_NONE) ||
(pGC->clientClipType == CT_PIXMAP))
{
- REGION_COPY(pGC->pScreen, backingCompositeClip,
+ RegionCopy(backingCompositeClip,
&pWindowPriv->SavedRegion);
}
else
@@ -3425,12 +3425,12 @@ miBSValidateGC (pGC, stateChanges, pDrawable)
* its proper origin.
*/
- REGION_COPY(pGC->pScreen, backingCompositeClip,
+ RegionCopy(backingCompositeClip,
pGC->clientClip);
- REGION_TRANSLATE(pGC->pScreen, backingCompositeClip,
+ RegionTranslate(backingCompositeClip,
pGC->clipOrg.x,
pGC->clipOrg.y);
- REGION_INTERSECT(pGC->pScreen, backingCompositeClip,
+ RegionIntersect(backingCompositeClip,
backingCompositeClip,
&pWindowPriv->SavedRegion);
}
@@ -3444,14 +3444,14 @@ miBSValidateGC (pGC, stateChanges, pDrawable)
* can be fixed only at great cost to the shadow routines.
*/
translatedClip = NotClippedByChildren (pWin);
- REGION_TRANSLATE(pGC->pScreen, translatedClip,
+ RegionTranslate(translatedClip,
-pDrawable->x,
-pDrawable->y);
- REGION_SUBTRACT(pGC->pScreen, backingCompositeClip,
+ RegionSubtract(backingCompositeClip,
backingCompositeClip, translatedClip);
- REGION_DESTROY(pGC->pScreen, translatedClip);
+ RegionDestroy(translatedClip);
}
- if (!REGION_NOTEMPTY(pGC->pScreen, backingCompositeClip))
+ if (!RegionNotEmpty(backingCompositeClip))
lift_functions = TRUE;
}
else
@@ -3508,7 +3508,7 @@ miBSValidateGC (pGC, stateChanges, pDrawable)
if (lift_functions)
{
if (backingCompositeClip)
- REGION_DESTROY( pGC->pScreen, backingCompositeClip);
+ RegionDestroy(backingCompositeClip);
/* unwrap the GC again */
miBSDestroyGCPrivate (pGC);
@@ -3541,14 +3541,14 @@ miBSValidateGC (pGC, stateChanges, pDrawable)
if (pGC->clientClipType == CT_PIXMAP)
{
(*pBackingGC->funcs->CopyClip)(pBackingGC, pGC);
- REGION_TRANSLATE(pGC->pScreen, backingCompositeClip,
+ RegionTranslate(backingCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
vals[0] = pGC->clipOrg.x - pWindowPriv->x;
vals[1] = pGC->clipOrg.y - pWindowPriv->y;
DoChangeGC(pBackingGC, GCClipXOrigin|GCClipYOrigin, vals, 0);
(* pGC->pScreen->BackingStoreFuncs.SetClipmaskRgn)
(pBackingGC, backingCompositeClip);
- REGION_DESTROY( pGC->pScreen, backingCompositeClip);
+ RegionDestroy(backingCompositeClip);
}
else
{
@@ -3732,7 +3732,7 @@ miCreateBSPixmap (pWin, pExtents)
backSet = ((pBackingStore->status == StatusVirtual) ||
(pBackingStore->status == StatusVDirty));
- extents = REGION_EXTENTS( pScreen, &pBackingStore->SavedRegion);
+ extents = RegionExtents(&pBackingStore->SavedRegion);
if (!pBackingStore->pBackingPixmap &&
extents->x2 != extents->x1 &&
@@ -3797,7 +3797,7 @@ miCreateBSPixmap (pWin, pExtents)
if (exposed)
{
miSendExposures(pWin, exposed, pWin->drawable.x, pWin->drawable.y);
- REGION_DESTROY( pScreen, exposed);
+ RegionDestroy(exposed);
}
}
@@ -3846,7 +3846,7 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
register int dx, dy;
BITS32 gcMask;
- if (!REGION_NOTEMPTY(pGC->pScreen, prgnExposed))
+ if (!RegionNotEmpty(prgnExposed))
return;
pBackingStore = (miBSWindowPtr)pSrc->backStorage;
@@ -3854,10 +3854,10 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
(pBackingStore->status == StatusBadAlloc))
return;
- REGION_NULL( pGC->pScreen, &tempRgn);
- REGION_INTERSECT( pGC->pScreen, &tempRgn, prgnExposed,
+ RegionNull(&tempRgn);
+ RegionIntersect(&tempRgn, prgnExposed,
&pBackingStore->SavedRegion);
- REGION_SUBTRACT( pGC->pScreen, prgnExposed, prgnExposed, &tempRgn);
+ RegionSubtract(prgnExposed, prgnExposed, &tempRgn);
if (plane != 0) {
copyProc = pGC->ops->CopyPlane;
@@ -3889,7 +3889,7 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
}
break;
case StatusContents:
- for (i = REGION_NUM_RECTS(&tempRgn), pBox = REGION_RECTS(&tempRgn);
+ for (i = RegionNumRects(&tempRgn), pBox = RegionRects(&tempRgn);
--i >= 0;
pBox++)
{
@@ -3901,5 +3901,5 @@ miBSExposeCopy (pSrc, pDst, pGC, prgnExposed, srcx, srcy, dstx, dsty, plane)
}
break;
}
- REGION_UNINIT( pGC->pScreen, &tempRgn);
+ RegionUninit(&tempRgn);
}
diff --git a/nx-X11/programs/Xserver/mi/miexpose.c b/nx-X11/programs/Xserver/mi/miexpose.c
index 782ddad49..379dd380f 100644
--- a/nx-X11/programs/Xserver/mi/miexpose.c
+++ b/nx-X11/programs/Xserver/mi/miexpose.c
@@ -185,21 +185,21 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
if (pGC->subWindowMode == IncludeInferiors)
{
prgnSrcClip = NotClippedByChildren (pSrcWin);
- if ((RECT_IN_REGION(pscr, prgnSrcClip, &TsrcBox)) == rgnIN)
+ if ((RegionContainsRect(prgnSrcClip, &TsrcBox)) == rgnIN)
{
- REGION_DESTROY(pscr, prgnSrcClip);
+ RegionDestroy(prgnSrcClip);
return NULL;
}
}
else
{
- if ((RECT_IN_REGION(pscr, &pSrcWin->clipList, &TsrcBox)) == rgnIN)
+ if ((RegionContainsRect(&pSrcWin->clipList, &TsrcBox)) == rgnIN)
return NULL;
prgnSrcClip = &rgnSrcRec;
- REGION_NULL(pscr, prgnSrcClip);
- REGION_COPY(pscr, prgnSrcClip, &pSrcWin->clipList);
+ RegionNull(prgnSrcClip);
+ RegionCopy(prgnSrcClip, &pSrcWin->clipList);
}
- REGION_TRANSLATE(pscr, prgnSrcClip,
+ RegionTranslate(prgnSrcClip,
-pSrcDrawable->x, -pSrcDrawable->y);
}
else
@@ -216,7 +216,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
box.x2 = pSrcDrawable->width;
box.y2 = pSrcDrawable->height;
prgnSrcClip = &rgnSrcRec;
- REGION_INIT(pscr, prgnSrcClip, &box, 1);
+ RegionInit(prgnSrcClip, &box, 1);
pSrcWin = (WindowPtr)NULL;
}
@@ -233,11 +233,11 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
else
{
prgnDstClip = &rgnDstRec;
- REGION_NULL(pscr, prgnDstClip);
- REGION_COPY(pscr, prgnDstClip,
+ RegionNull(prgnDstClip);
+ RegionCopy(prgnDstClip,
&((WindowPtr)pDstDrawable)->clipList);
}
- REGION_TRANSLATE(pscr, prgnDstClip,
+ RegionTranslate(prgnDstClip,
-pDstDrawable->x, -pDstDrawable->y);
}
else
@@ -249,14 +249,14 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
box.x2 = pDstDrawable->width;
box.y2 = pDstDrawable->height;
prgnDstClip = &rgnDstRec;
- REGION_INIT(pscr, prgnDstClip, &box, 1);
+ RegionInit(prgnDstClip, &box, 1);
}
/* drawable-relative source region */
- REGION_INIT(pscr, &rgnExposed, &srcBox, 1);
+ RegionInit(&rgnExposed, &srcBox, 1);
/* now get the hidden parts of the source box*/
- REGION_SUBTRACT(pscr, &rgnExposed, &rgnExposed, prgnSrcClip);
+ RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip);
if (pSrcWin && pSrcWin->backStorage)
{
@@ -274,10 +274,10 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
}
/* move them over the destination */
- REGION_TRANSLATE(pscr, &rgnExposed, dstx-srcx, dsty-srcy);
+ RegionTranslate(&rgnExposed, dstx-srcx, dsty-srcy);
/* intersect with visible areas of dest */
- REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, prgnDstClip);
+ RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip);
/*
* If we have LOTS of rectangles, we decide to take the extents
@@ -287,7 +287,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
* for windows.
*/
extents = pGC->graphicsExposures &&
- (REGION_NUM_RECTS(&rgnExposed) > RECTLIMIT) &&
+ (RegionNumRects(&rgnExposed) > RECTLIMIT) &&
(pDstDrawable->type != DRAWABLE_PIXMAP);
#ifdef SHAPE
if (pSrcWin)
@@ -300,7 +300,7 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
* exposed region will undo all our work!
*/
if (extents && pSrcWin && region &&
- (RECT_IN_REGION(pscr, region, &srcBox) != rgnIN))
+ (RegionContainsRect(region, &srcBox) != rgnIN))
extents = FALSE;
}
#endif
@@ -308,8 +308,8 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
{
WindowPtr pWin = (WindowPtr)pDstDrawable;
- expBox = *REGION_EXTENTS(pscr, &rgnExposed);
- REGION_RESET(pscr, &rgnExposed, &expBox);
+ expBox = *RegionExtents(&rgnExposed);
+ RegionReset(&rgnExposed, &expBox);
/* need to clear out new areas of backing store */
if (pWin->backStorage)
(void) (* pWin->drawable.pScreen->ClearBackingStore)(
@@ -326,53 +326,53 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
WindowPtr pWin = (WindowPtr)pDstDrawable;
/* make the exposed area screen-relative */
- REGION_TRANSLATE(pscr, &rgnExposed,
+ RegionTranslate(&rgnExposed,
pDstDrawable->x, pDstDrawable->y);
if (extents)
{
/* PaintWindowBackground doesn't clip, so we have to */
- REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, &pWin->clipList);
+ RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList);
}
(*pWin->drawable.pScreen->PaintWindowBackground)(
(WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND);
if (extents)
{
- REGION_RESET(pscr, &rgnExposed, &expBox);
+ RegionReset(&rgnExposed, &expBox);
}
else
- REGION_TRANSLATE(pscr, &rgnExposed,
+ RegionTranslate(&rgnExposed,
-pDstDrawable->x, -pDstDrawable->y);
}
if (prgnDstClip == &rgnDstRec)
{
- REGION_UNINIT(pscr, prgnDstClip);
+ RegionUninit(prgnDstClip);
}
else if (prgnDstClip != prgnSrcClip)
{
- REGION_DESTROY(pscr, prgnDstClip);
+ RegionDestroy(prgnDstClip);
}
if (prgnSrcClip == &rgnSrcRec)
{
- REGION_UNINIT(pscr, prgnSrcClip);
+ RegionUninit(prgnSrcClip);
}
else
{
- REGION_DESTROY(pscr, prgnSrcClip);
+ RegionDestroy(prgnSrcClip);
}
if (pGC->graphicsExposures)
{
/* don't look */
- RegionPtr exposed = REGION_CREATE(pscr, NullBox, 0);
+ RegionPtr exposed = RegionCreate(NullBox, 0);
*exposed = rgnExposed;
return exposed;
}
else
{
- REGION_UNINIT(pscr, &rgnExposed);
+ RegionUninit(&rgnExposed);
return NULL;
}
}
@@ -387,7 +387,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
int major;
int minor;
{
- if (pRgn && !REGION_NIL(pRgn))
+ if (pRgn && !RegionNil(pRgn))
{
xEvent *pEvent;
register xEvent *pe;
@@ -395,8 +395,8 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
register int i;
int numRects;
- numRects = REGION_NUM_RECTS(pRgn);
- pBox = REGION_RECTS(pRgn);
+ numRects = RegionNumRects(pRgn);
+ pBox = RegionRects(pRgn);
if(!(pEvent = (xEvent *)ALLOCATE_LOCAL(numRects * sizeof(xEvent))))
return;
pe = pEvent;
@@ -442,8 +442,8 @@ miSendExposures(pWin, pRgn, dx, dy)
register xEvent *pEvent, *pe;
register int i;
- pBox = REGION_RECTS(pRgn);
- numRects = REGION_NUM_RECTS(pRgn);
+ pBox = RegionRects(pRgn);
+ numRects = RegionNumRects(pRgn);
if(!(pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent))))
return;
memset(pEvent, 0, numRects * sizeof(xEvent));
@@ -513,8 +513,8 @@ miWindowExposures(pWin, prgn, other_exposed)
* no areas will be repainted.
*/
exposures = (*pWin->drawable.pScreen->RestoreAreas)(pWin, prgn);
- if ((prgn && !REGION_NIL(prgn)) ||
- (exposures && !REGION_NIL(exposures)) || other_exposed)
+ if ((prgn && !RegionNil(prgn)) ||
+ (exposures && !RegionNil(exposures)) || other_exposed)
{
RegionRec expRec;
int clientInterested;
@@ -527,15 +527,15 @@ miWindowExposures(pWin, prgn, other_exposed)
{
if (exposures)
{
- REGION_UNION(pWin->drawable.pScreen, other_exposed,
+ RegionUnion(other_exposed,
exposures,
other_exposed);
if (exposures != prgn)
- REGION_DESTROY(pWin->drawable.pScreen, exposures);
+ RegionDestroy(exposures);
}
exposures = other_exposed;
}
- if (clientInterested && exposures && (REGION_NUM_RECTS(exposures) > RECTLIMIT))
+ if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT))
{
/*
* If we have LOTS of rectangles, we decide to take the extents
@@ -545,17 +545,17 @@ miWindowExposures(pWin, prgn, other_exposed)
*/
BoxRec box;
- box = *REGION_EXTENTS( pWin->drawable.pScreen, exposures);
+ box = *RegionExtents(exposures);
if (exposures == prgn) {
exposures = &expRec;
- REGION_INIT( pWin->drawable.pScreen, exposures, &box, 1);
- REGION_RESET( pWin->drawable.pScreen, prgn, &box);
+ RegionInit(exposures, &box, 1);
+ RegionReset(prgn, &box);
} else {
- REGION_RESET( pWin->drawable.pScreen, exposures, &box);
- REGION_UNION( pWin->drawable.pScreen, prgn, prgn, exposures);
+ RegionReset(exposures, &box);
+ RegionUnion(prgn, prgn, exposures);
}
/* PaintWindowBackground doesn't clip, so we have to */
- REGION_INTERSECT( pWin->drawable.pScreen, prgn, prgn, &pWin->clipList);
+ RegionIntersect(prgn, prgn, &pWin->clipList);
/* need to clear out new areas of backing store, too */
if (pWin->backStorage)
(void) (* pWin->drawable.pScreen->ClearBackingStore)(
@@ -566,22 +566,22 @@ miWindowExposures(pWin, prgn, other_exposed)
box.y2 - box.y1,
FALSE);
}
- if (prgn && !REGION_NIL(prgn))
+ if (prgn && !RegionNil(prgn))
(*pWin->drawable.pScreen->PaintWindowBackground)(pWin, prgn, PW_BACKGROUND);
- if (clientInterested && exposures && !REGION_NIL(exposures))
+ if (clientInterested && exposures && !RegionNil(exposures))
miSendExposures(pWin, exposures,
pWin->drawable.x, pWin->drawable.y);
if (exposures == &expRec)
{
- REGION_UNINIT( pWin->drawable.pScreen, exposures);
+ RegionUninit(exposures);
}
else if (exposures && exposures != prgn && exposures != other_exposed)
- REGION_DESTROY( pWin->drawable.pScreen, exposures);
+ RegionDestroy(exposures);
if (prgn)
- REGION_EMPTY( pWin->drawable.pScreen, prgn);
+ RegionEmpty(prgn);
}
else if (exposures && exposures != prgn)
- REGION_DESTROY( pWin->drawable.pScreen, exposures);
+ RegionDestroy(exposures);
}
@@ -706,7 +706,7 @@ int what;
}
}
- prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) *
+ prect = (xRectangle *)ALLOCATE_LOCAL(RegionNumRects(prgn) *
sizeof(xRectangle));
if (!prect)
return;
@@ -749,7 +749,7 @@ int what;
box.y1 = 0;
box.x2 = pScreen->width;
box.y2 = pScreen->height;
- REGION_INIT(pScreen, &pWin->clipList, &box, 1);
+ RegionInit(&pWin->clipList, &box, 1);
pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
newValues[ABSX].val = pBgWin->drawable.x;
newValues[ABSY].val = pBgWin->drawable.y;
@@ -852,8 +852,8 @@ int what;
if (pWin->drawable.serialNumber != pGC->serialNumber)
ValidateGC((DrawablePtr)pWin, pGC);
- numRects = REGION_NUM_RECTS(prgn);
- pbox = REGION_RECTS(prgn);
+ numRects = RegionNumRects(prgn);
+ pbox = RegionRects(prgn);
for (i= numRects; --i >= 0; pbox++, prect++)
{
prect->x = pbox->x1 - pWin->drawable.x;
@@ -872,7 +872,7 @@ int what;
{
if (what == PW_BORDER)
{
- REGION_UNINIT(pScreen, &pWin->clipList);
+ RegionUninit(&pWin->clipList);
pWin->clipList = prgnWin;
pWin->drawable.x = oldCorner.x;
pWin->drawable.y = oldCorner.y;
diff --git a/nx-X11/programs/Xserver/mi/migc.c b/nx-X11/programs/Xserver/mi/migc.c
index 2b38b257d..167163686 100644
--- a/nx-X11/programs/Xserver/mi/migc.c
+++ b/nx-X11/programs/Xserver/mi/migc.c
@@ -33,6 +33,7 @@ from The Open Group.
#include <dix-config.h>
#endif
+#include "regionstr.h"
#include "scrnintstr.h"
#include "gcstruct.h"
#include "pixmapstr.h"
@@ -55,7 +56,7 @@ miDestroyGC(pGC)
if (pGC->pRotatedPixmap)
(*pGC->pScreen->DestroyPixmap) (pGC->pRotatedPixmap);
if (pGC->freeCompClip)
- REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
+ RegionDestroy(pGC->pCompositeClip);
miDestroyGCOps(pGC->ops);
}
@@ -104,7 +105,7 @@ miDestroyClip(pGC)
* we know we'll never have a list of rectangles, since ChangeClip
* immediately turns them into a region
*/
- REGION_DESTROY(pGC->pScreen, pGC->clientClip);
+ RegionDestroy(pGC->clientClip);
}
pGC->clientClip = NULL;
pGC->clientClipType = CT_NONE;
@@ -121,7 +122,7 @@ miChangeClip(pGC, type, pvalue, nrects)
if (type == CT_PIXMAP)
{
/* convert the pixmap to a region */
- pGC->clientClip = (void *) BITMAP_TO_REGION(pGC->pScreen,
+ pGC->clientClip = (void *) BitmapToRegion(pGC->pScreen,
(PixmapPtr) pvalue);
(*pGC->pScreen->DestroyPixmap) (pvalue);
}
@@ -132,7 +133,7 @@ miChangeClip(pGC, type, pvalue, nrects)
}
else if (type != CT_NONE)
{
- pGC->clientClip = (void *) RECTS_TO_REGION(pGC->pScreen, nrects,
+ pGC->clientClip = (void *) RegionFromRects(nrects,
(xRectangle *) pvalue,
type);
xfree(pvalue);
@@ -157,8 +158,8 @@ miCopyClip(pgcDst, pgcSrc)
pgcSrc->clientClip, 0);
break;
case CT_REGION:
- prgnNew = REGION_CREATE(pgcSrc->pScreen, NULL, 1);
- REGION_COPY(pgcDst->pScreen, prgnNew,
+ prgnNew = RegionCreate(NULL, 1);
+ RegionCopy(prgnNew,
(RegionPtr) (pgcSrc->clientClip));
(*pgcDst->funcs->ChangeClip) (pgcDst, CT_REGION, (void *) prgnNew, 0);
break;
@@ -213,7 +214,7 @@ miComputeCompositeClip(pGC, pDrawable)
if (pGC->clientClipType == CT_NONE)
{
if (freeCompClip)
- REGION_DESTROY(pScreen, pGC->pCompositeClip);
+ RegionDestroy(pGC->pCompositeClip);
pGC->pCompositeClip = pregWin;
pGC->freeCompClip = freeTmpClip;
}
@@ -228,30 +229,30 @@ miComputeCompositeClip(pGC, pDrawable)
* clip. if neither is real, create a new region.
*/
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
pDrawable->x + pGC->clipOrg.x,
pDrawable->y + pGC->clipOrg.y);
if (freeCompClip)
{
- REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ RegionIntersect(pGC->pCompositeClip,
pregWin, pGC->clientClip);
if (freeTmpClip)
- REGION_DESTROY(pScreen, pregWin);
+ RegionDestroy(pregWin);
}
else if (freeTmpClip)
{
- REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
+ RegionIntersect(pregWin, pregWin, pGC->clientClip);
pGC->pCompositeClip = pregWin;
}
else
{
- pGC->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
- REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip = RegionCreate(NullBox, 0);
+ RegionIntersect(pGC->pCompositeClip,
pregWin, pGC->clientClip);
}
pGC->freeCompClip = TRUE;
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y));
}
@@ -269,31 +270,31 @@ miComputeCompositeClip(pGC, pDrawable)
if (pGC->freeCompClip)
{
- REGION_RESET(pScreen, pGC->pCompositeClip, &pixbounds);
+ RegionReset(pGC->pCompositeClip, &pixbounds);
}
else
{
pGC->freeCompClip = TRUE;
- pGC->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1);
+ pGC->pCompositeClip = RegionCreate(&pixbounds, 1);
}
if (pGC->clientClipType == CT_REGION)
{
if(pDrawable->x || pDrawable->y) {
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
pDrawable->x + pGC->clipOrg.x,
pDrawable->y + pGC->clipOrg.y);
- REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ RegionIntersect(pGC->pCompositeClip,
pGC->pCompositeClip, pGC->clientClip);
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
-(pDrawable->x + pGC->clipOrg.x),
-(pDrawable->y + pGC->clipOrg.y));
} else {
- REGION_TRANSLATE(pScreen, pGC->pCompositeClip,
+ RegionTranslate(pGC->pCompositeClip,
-pGC->clipOrg.x, -pGC->clipOrg.y);
- REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ RegionIntersect(pGC->pCompositeClip,
pGC->pCompositeClip, pGC->clientClip);
- REGION_TRANSLATE(pScreen, pGC->pCompositeClip,
+ RegionTranslate(pGC->pCompositeClip,
pGC->clipOrg.x, pGC->clipOrg.y);
}
}
diff --git a/nx-X11/programs/Xserver/mi/mioverlay.c b/nx-X11/programs/Xserver/mi/mioverlay.c
index f67704e11..96d5cc4f0 100644
--- a/nx-X11/programs/Xserver/mi/mioverlay.c
+++ b/nx-X11/programs/Xserver/mi/mioverlay.c
@@ -212,8 +212,8 @@ miOverlayCreateWindow(WindowPtr pWin)
pTree->visibility = VisibilityNotViewable;
pWinPriv->tree = pTree;
if(pWin->parent) {
- REGION_NULL(pScreen, &(pTree->borderClip));
- REGION_NULL(pScreen, &(pTree->clipList));
+ RegionNull(&(pTree->borderClip));
+ RegionNull(&(pTree->clipList));
RebuildTree(pWin);
} else {
BoxRec fullBox;
@@ -221,8 +221,8 @@ miOverlayCreateWindow(WindowPtr pWin)
fullBox.y1 = 0;
fullBox.x2 = pScreen->width;
fullBox.y2 = pScreen->height;
- REGION_INIT(pScreen, &(pTree->borderClip), &fullBox, 1);
- REGION_INIT(pScreen, &(pTree->clipList), &fullBox, 1);
+ RegionInit(&(pTree->borderClip), &fullBox, 1);
+ RegionInit(&(pTree->clipList), &fullBox, 1);
}
} else xfree(pTree);
}
@@ -250,8 +250,8 @@ miOverlayDestroyWindow(WindowPtr pWin)
else if(pTree->parent)
pTree->parent->lastChild = pTree->prevSib;
- REGION_UNINIT(pScreen, &(pTree->borderClip));
- REGION_UNINIT(pScreen, &(pTree->clipList));
+ RegionUninit(&(pTree->borderClip));
+ RegionUninit(&(pTree->clipList));
xfree(pTree);
}
@@ -349,7 +349,7 @@ miOverlayMarkOverlappedWindows(
doUnderlay = (IN_UNDERLAY(pWin) || HasUnderlayChildren(pWin));
- box = REGION_EXTENTS(pScreen, &pWin->borderSize);
+ box = RegionExtents(&pWin->borderSize);
if((pChild = pFirst)) {
pLast = pChild->parent->lastChild;
@@ -360,13 +360,13 @@ miOverlayMarkOverlappedWindows(
pTree = MIOVERLAY_GET_WINDOW_TREE(pChild);
if(pChild->viewable) {
- if (REGION_BROKEN (pScreen, &pChild->winSize))
+ if (RegionBroken(&pChild->winSize))
SetWinSize (pChild);
- if (REGION_BROKEN (pScreen, &pChild->borderSize))
+ if (RegionBroken(&pChild->borderSize))
SetBorderSize (pChild);
if (markAll ||
- RECT_IN_REGION(pScreen, &pChild->borderSize, box))
+ RegionContainsRect(&pChild->borderSize, box))
{
MARK_OVERLAY(pChild);
overMarked = TRUE;
@@ -421,12 +421,12 @@ miOverlayMarkOverlappedWindows(
while(1) {
if(tChild->pWin->viewable) {
- if (REGION_BROKEN (pScreen, &tChild->pWin->winSize))
+ if (RegionBroken(&tChild->pWin->winSize))
SetWinSize (tChild->pWin);
- if (REGION_BROKEN (pScreen, &tChild->pWin->borderSize))
+ if (RegionBroken(&tChild->pWin->borderSize))
SetBorderSize (tChild->pWin);
- if(RECT_IN_REGION(pScreen, &(tChild->pWin->borderSize), box))
+ if(RegionContainsRect(&(tChild->pWin->borderSize), box))
{
MARK_UNDERLAY(tChild->pWin);
underMarked = TRUE;
@@ -484,7 +484,7 @@ miOverlayComputeClips(
borderSize.y2 = dy;
oldVis = tParent->visibility;
- switch (RECT_IN_REGION( pScreen, universe, &borderSize)) {
+ switch (RegionContainsRect(universe, &borderSize)) {
case rgnIN:
newVis = VisibilityUnobscured;
break;
@@ -534,8 +534,8 @@ miOverlayComputeClips(
while (1) {
if (tChild->pWin->viewable) {
if (tChild->visibility != VisibilityFullyObscured) {
- REGION_TRANSLATE( pScreen, &tChild->borderClip, dx, dy);
- REGION_TRANSLATE( pScreen, &tChild->clipList, dx, dy);
+ RegionTranslate(&tChild->borderClip, dx, dy);
+ RegionTranslate(&tChild->clipList, dx, dy);
tChild->pWin->drawable.serialNumber =
NEXT_SERIAL_NUMBER;
@@ -543,14 +543,14 @@ miOverlayComputeClips(
(* pScreen->ClipNotify) (tChild->pWin, dx, dy);
}
if (tChild->valdata) {
- REGION_NULL(pScreen, &tChild->valdata->borderExposed);
+ RegionNull(&tChild->valdata->borderExposed);
if (HasParentRelativeBorder(tChild->pWin)){
- REGION_SUBTRACT(pScreen,
+ RegionSubtract(
&tChild->valdata->borderExposed,
&tChild->borderClip,
&tChild->pWin->winSize);
}
- REGION_NULL(pScreen, &tChild->valdata->exposed);
+ RegionNull(&tChild->valdata->exposed);
}
if (tChild->firstChild) {
tChild = tChild->firstChild;
@@ -568,50 +568,50 @@ miOverlayComputeClips(
/* fall through */
default:
if (dx || dy) {
- REGION_TRANSLATE( pScreen, &tParent->borderClip, dx, dy);
- REGION_TRANSLATE( pScreen, &tParent->clipList, dx, dy);
+ RegionTranslate(&tParent->borderClip, dx, dy);
+ RegionTranslate(&tParent->clipList, dx, dy);
}
break;
case VTBroken:
- REGION_EMPTY (pScreen, &tParent->borderClip);
- REGION_EMPTY (pScreen, &tParent->clipList);
+ RegionEmpty(&tParent->borderClip);
+ RegionEmpty(&tParent->clipList);
break;
}
borderVisible = tParent->valdata->borderVisible;
- REGION_NULL(pScreen, &tParent->valdata->borderExposed);
- REGION_NULL(pScreen, &tParent->valdata->exposed);
+ RegionNull(&tParent->valdata->borderExposed);
+ RegionNull(&tParent->valdata->exposed);
if (HasBorder (pParent)) {
if (borderVisible) {
- REGION_SUBTRACT( pScreen, exposed, universe, borderVisible);
- REGION_DESTROY( pScreen, borderVisible);
+ RegionSubtract(exposed, universe, borderVisible);
+ RegionDestroy(borderVisible);
} else
- REGION_SUBTRACT( pScreen, exposed, universe, &tParent->borderClip);
+ RegionSubtract(exposed, universe, &tParent->borderClip);
if (HasParentRelativeBorder(pParent) && (dx || dy))
- REGION_SUBTRACT( pScreen, &tParent->valdata->borderExposed,
+ RegionSubtract(&tParent->valdata->borderExposed,
universe, &pParent->winSize);
else
- REGION_SUBTRACT( pScreen, &tParent->valdata->borderExposed,
+ RegionSubtract(&tParent->valdata->borderExposed,
exposed, &pParent->winSize);
- REGION_COPY( pScreen, &tParent->borderClip, universe);
- REGION_INTERSECT( pScreen, universe, universe, &pParent->winSize);
+ RegionCopy(&tParent->borderClip, universe);
+ RegionIntersect(universe, universe, &pParent->winSize);
}
else
- REGION_COPY( pScreen, &tParent->borderClip, universe);
+ RegionCopy(&tParent->borderClip, universe);
if ((tChild = tParent->firstChild) && pParent->mapped) {
- REGION_NULL(pScreen, &childUniverse);
- REGION_NULL(pScreen, &childUnion);
+ RegionNull(&childUniverse);
+ RegionNull(&childUnion);
for (; tChild; tChild = tChild->nextSib) {
if (tChild->pWin->viewable)
- REGION_APPEND( pScreen, &childUnion, &tChild->pWin->borderSize);
+ RegionAppend(&childUnion, &tChild->pWin->borderSize);
}
- REGION_VALIDATE( pScreen, &childUnion, &overlap);
+ RegionValidate(&childUnion, &overlap);
for (tChild = tParent->firstChild;
tChild;
@@ -619,31 +619,31 @@ miOverlayComputeClips(
{
if (tChild->pWin->viewable) {
if (tChild->valdata) {
- REGION_INTERSECT( pScreen, &childUniverse, universe,
+ RegionIntersect(&childUniverse, universe,
&tChild->pWin->borderSize);
miOverlayComputeClips (tChild->pWin, &childUniverse,
kind, exposed);
}
if (overlap)
- REGION_SUBTRACT( pScreen, universe, universe,
+ RegionSubtract(universe, universe,
&tChild->pWin->borderSize);
}
}
if (!overlap)
- REGION_SUBTRACT( pScreen, universe, universe, &childUnion);
- REGION_UNINIT( pScreen, &childUnion);
- REGION_UNINIT( pScreen, &childUniverse);
+ RegionSubtract(universe, universe, &childUnion);
+ RegionUninit(&childUnion);
+ RegionUninit(&childUniverse);
}
if (oldVis == VisibilityFullyObscured ||
oldVis == VisibilityNotViewable)
{
- REGION_COPY( pScreen, &tParent->valdata->exposed, universe);
+ RegionCopy(&tParent->valdata->exposed, universe);
}
else if (newVis != VisibilityFullyObscured &&
newVis != VisibilityNotViewable)
{
- REGION_SUBTRACT( pScreen, &tParent->valdata->exposed,
+ RegionSubtract(&tParent->valdata->exposed,
universe, &tParent->clipList);
}
@@ -721,14 +721,14 @@ miOverlayMarkUnrealizedWindow(
if ((pChild != pWin) || fromConfigure) {
miOverlayTreePtr pTree;
- REGION_EMPTY(pChild->drawable.pScreen, &pChild->clipList);
+ RegionEmpty(&pChild->clipList);
if (pChild->drawable.pScreen->ClipNotify)
(* pChild->drawable.pScreen->ClipNotify)(pChild, 0, 0);
- REGION_EMPTY(pChild->drawable.pScreen, &pChild->borderClip);
+ RegionEmpty(&pChild->borderClip);
if((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
if(pTree->valdata != (miOverlayValDataPtr)UnmapValData) {
- REGION_EMPTY(pChild->drawable.pScreen, &pTree->clipList);
- REGION_EMPTY(pChild->drawable.pScreen, &pTree->borderClip);
+ RegionEmpty(&pTree->clipList);
+ RegionEmpty(&pTree->borderClip);
}
}
}
@@ -753,9 +753,9 @@ miOverlayValidateTree(
if (!pChild) pChild = pParent->firstChild;
- REGION_NULL(pScreen, &totalClip);
- REGION_NULL(pScreen, &childClip);
- REGION_NULL(pScreen, &exposed);
+ RegionNull(&totalClip);
+ RegionNull(&childClip);
+ RegionNull(&exposed);
newParent = pParent;
@@ -769,52 +769,52 @@ miOverlayValidateTree(
else
tChild = tParent->firstChild;
- if (REGION_BROKEN (pScreen, &tParent->clipList) &&
- !REGION_BROKEN (pScreen, &tParent->borderClip))
+ if (RegionBroken(&tParent->clipList) &&
+ !RegionBroken(&tParent->borderClip))
{
kind = VTBroken;
- REGION_COPY (pScreen, &totalClip, &tParent->borderClip);
- REGION_INTERSECT (pScreen, &totalClip, &totalClip,
+ RegionCopy(&totalClip, &tParent->borderClip);
+ RegionIntersect(&totalClip, &totalClip,
&tParent->pWin->winSize);
for (tWin = tParent->firstChild; tWin != tChild; tWin = tWin->nextSib) {
if (tWin->pWin->viewable)
- REGION_SUBTRACT (pScreen, &totalClip, &totalClip,
+ RegionSubtract(&totalClip, &totalClip,
&tWin->pWin->borderSize);
}
- REGION_EMPTY (pScreen, &tParent->clipList);
+ RegionEmpty(&tParent->clipList);
} else {
for(tWin = tChild; tWin; tWin = tWin->nextSib) {
if(tWin->valdata)
- REGION_APPEND(pScreen, &totalClip, &tWin->borderClip);
+ RegionAppend(&totalClip, &tWin->borderClip);
}
- REGION_VALIDATE(pScreen, &totalClip, &overlap);
+ RegionValidate(&totalClip, &overlap);
}
if(kind != VTStack)
- REGION_UNION(pScreen, &totalClip, &totalClip, &tParent->clipList);
+ RegionUnion(&totalClip, &totalClip, &tParent->clipList);
for(tWin = tChild; tWin; tWin = tWin->nextSib) {
if(tWin->valdata) {
if(tWin->pWin->viewable) {
- REGION_INTERSECT(pScreen, &childClip, &totalClip,
+ RegionIntersect(&childClip, &totalClip,
&tWin->pWin->borderSize);
miOverlayComputeClips(tWin->pWin, &childClip, kind, &exposed);
- REGION_SUBTRACT(pScreen, &totalClip, &totalClip,
+ RegionSubtract(&totalClip, &totalClip,
&tWin->pWin->borderSize);
} else { /* Means we are unmapping */
- REGION_EMPTY(pScreen, &tWin->clipList);
- REGION_EMPTY( pScreen, &tWin->borderClip);
+ RegionEmpty(&tWin->clipList);
+ RegionEmpty(&tWin->borderClip);
tWin->valdata = NULL;
}
}
}
- REGION_UNINIT(pScreen, &childClip);
+ RegionUninit(&childClip);
if(!((*pPriv->InOverlay)(newParent))) {
- REGION_NULL(pScreen, &tParent->valdata->exposed);
- REGION_NULL(pScreen, &tParent->valdata->borderExposed);
+ RegionNull(&tParent->valdata->exposed);
+ RegionNull(&tParent->valdata->borderExposed);
}
switch (kind) {
@@ -822,18 +822,18 @@ miOverlayValidateTree(
break;
default:
if(!((*pPriv->InOverlay)(newParent)))
- REGION_SUBTRACT(pScreen, &tParent->valdata->exposed, &totalClip,
+ RegionSubtract(&tParent->valdata->exposed, &totalClip,
&tParent->clipList);
/* fall through */
case VTMap:
- REGION_COPY( pScreen, &tParent->clipList, &totalClip);
+ RegionCopy(&tParent->clipList, &totalClip);
if(!((*pPriv->InOverlay)(newParent)))
newParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
break;
}
- REGION_UNINIT( pScreen, &totalClip);
- REGION_UNINIT( pScreen, &exposed);
+ RegionUninit(&totalClip);
+ RegionUninit(&exposed);
SKIP_UNDERLAY:
@@ -866,13 +866,13 @@ miOverlayHandleExposures(WindowPtr pWin)
while (1) {
if((mival = pTree->valdata)) {
if(!((*pPriv->InOverlay)(pTree->pWin))) {
- if (REGION_NOTEMPTY(pScreen, &mival->borderExposed))
+ if (RegionNotEmpty(&mival->borderExposed))
(*pWin->drawable.pScreen->PaintWindowBorder)(
pTree->pWin, &mival->borderExposed, PW_BORDER);
- REGION_UNINIT(pScreen, &mival->borderExposed);
+ RegionUninit(&mival->borderExposed);
(*WindowExposures)(pTree->pWin,&mival->exposed,NullRegion);
- REGION_UNINIT(pScreen, &mival->exposed);
+ RegionUninit(&mival->exposed);
}
xfree(mival);
pTree->valdata = NULL;
@@ -894,24 +894,24 @@ miOverlayHandleExposures(WindowPtr pWin)
while (1) {
if ( (val = pChild->valdata) ) {
if(!((*pPriv->InOverlay)(pChild))) {
- REGION_UNION(pScreen, &val->after.exposed, &val->after.exposed,
+ RegionUnion(&val->after.exposed, &val->after.exposed,
&val->after.borderExposed);
- if (REGION_NOTEMPTY(pScreen, &val->after.exposed)) {
+ if (RegionNotEmpty(&val->after.exposed)) {
(*(MIOVERLAY_GET_SCREEN_PRIVATE(pScreen)->MakeTransparent))(
pScreen,
- REGION_NUM_RECTS(&val->after.exposed),
- REGION_RECTS(&val->after.exposed));
+ RegionNumRects(&val->after.exposed),
+ RegionRects(&val->after.exposed));
}
} else {
- if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed))
+ if (RegionNotEmpty(&val->after.borderExposed))
(*pChild->drawable.pScreen->PaintWindowBorder)(pChild,
&val->after.borderExposed,
PW_BORDER);
(*WindowExposures)(pChild, &val->after.exposed, NullRegion);
}
- REGION_UNINIT(pScreen, &val->after.borderExposed);
- REGION_UNINIT(pScreen, &val->after.exposed);
+ RegionUninit(&val->after.borderExposed);
+ RegionUninit(&val->after.exposed);
xfree(val);
pChild->valdata = (ValidatePtr)NULL;
if (pChild->firstChild)
@@ -955,13 +955,13 @@ miOverlayMoveWindow(
oldpt.x = pWin->drawable.x;
oldpt.y = pWin->drawable.y;
if (WasViewable) {
- REGION_NULL(pScreen, &overReg);
- REGION_NULL(pScreen, &underReg);
+ RegionNull(&overReg);
+ RegionNull(&underReg);
if(pTree) {
- REGION_COPY(pScreen, &overReg, &pWin->borderClip);
- REGION_COPY(pScreen, &underReg, &pTree->borderClip);
+ RegionCopy(&overReg, &pWin->borderClip);
+ RegionCopy(&underReg, &pTree->borderClip);
} else {
- REGION_COPY(pScreen, &overReg, &pWin->borderClip);
+ RegionCopy(&overReg, &pWin->borderClip);
CollectUnderlayChildrenRegions(pWin, &underReg);
}
(*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
@@ -990,16 +990,16 @@ miOverlayMoveWindow(
#endif /* DO_SAVE_UNDERS */
(*pScreen->ValidateTree)(pWin->parent, NullWindow, kind);
- if(REGION_NOTEMPTY(pScreen, &underReg)) {
+ if(RegionNotEmpty(&underReg)) {
pPriv->copyUnderlay = TRUE;
(* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, &underReg);
}
- REGION_UNINIT(pScreen, &underReg);
- if(REGION_NOTEMPTY(pScreen, &overReg)) {
+ RegionUninit(&underReg);
+ if(RegionNotEmpty(&overReg)) {
pPriv->copyUnderlay = FALSE;
(* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, &overReg);
}
- REGION_UNINIT(pScreen, &overReg);
+ RegionUninit(&overReg);
(*pScreen->HandleExposures)(pWin->parent);
#ifdef DO_SAVE_UNDERS
@@ -1028,8 +1028,8 @@ miOverlayWindowExposures(
if (pWin->backStorage && prgn)
exposures = (*pScreen->RestoreAreas)(pWin, prgn);
- if ((prgn && !REGION_NIL(prgn)) ||
- (exposures && !REGION_NIL(exposures)) || other_exposed)
+ if ((prgn && !RegionNil(prgn)) ||
+ (exposures && !RegionNil(exposures)) || other_exposed)
{
RegionRec expRec;
int clientInterested;
@@ -1038,35 +1038,35 @@ miOverlayWindowExposures(
ExposureMask;
if (other_exposed) {
if (exposures) {
- REGION_UNION(pScreen, other_exposed, exposures, other_exposed);
+ RegionUnion(other_exposed, exposures, other_exposed);
if (exposures != prgn)
- REGION_DESTROY(pScreen, exposures);
+ RegionDestroy(exposures);
}
exposures = other_exposed;
}
if (clientInterested && exposures &&
- (REGION_NUM_RECTS(exposures) > RECTLIMIT))
+ (RegionNumRects(exposures) > RECTLIMIT))
{
miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
BoxRec box;
- box = *REGION_EXTENTS(pScreen, exposures);
+ box = *RegionExtents(exposures);
if (exposures == prgn) {
exposures = &expRec;
- REGION_INIT(pScreen, exposures, &box, 1);
- REGION_RESET(pScreen, prgn, &box);
+ RegionInit(exposures, &box, 1);
+ RegionReset(prgn, &box);
} else {
- REGION_RESET(pScreen, exposures, &box);
- REGION_UNION(pScreen, prgn, prgn, exposures);
+ RegionReset(exposures, &box);
+ RegionUnion(prgn, prgn, exposures);
}
/* This is the only reason why we are replacing mi's version
of this file */
if(!((*pPriv->InOverlay)(pWin))) {
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
- REGION_INTERSECT(pScreen, prgn, prgn, &pTree->clipList);
+ RegionIntersect(prgn, prgn, &pTree->clipList);
} else
- REGION_INTERSECT(pScreen, prgn, prgn, &pWin->clipList);
+ RegionIntersect(prgn, prgn, &pWin->clipList);
/* need to clear out new areas of backing store, too */
if (pWin->backStorage)
@@ -1078,22 +1078,22 @@ miOverlayWindowExposures(
box.y2 - box.y1,
FALSE);
}
- if (prgn && !REGION_NIL(prgn))
+ if (prgn && !RegionNil(prgn))
(*pScreen->PaintWindowBackground)(
pWin, prgn, PW_BACKGROUND);
- if (clientInterested && exposures && !REGION_NIL(exposures))
+ if (clientInterested && exposures && !RegionNil(exposures))
miSendExposures(pWin, exposures,
pWin->drawable.x, pWin->drawable.y);
if (exposures == &expRec) {
- REGION_UNINIT(pScreen, exposures);
+ RegionUninit(exposures);
}
else if (exposures && exposures != prgn && exposures != other_exposed)
- REGION_DESTROY(pScreen, exposures);
+ RegionDestroy(exposures);
if (prgn)
- REGION_EMPTY(pScreen, prgn);
+ RegionEmpty(prgn);
}
else if (exposures && exposures != prgn)
- REGION_DESTROY(pScreen, exposures);
+ RegionDestroy(exposures);
}
@@ -1118,23 +1118,23 @@ miOverlayRecomputeExposures (
/*
* compute exposed regions of this window
*/
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed,
+ RegionSubtract(&pWin->valdata->after.exposed,
&pWin->clipList, pValid->over);
/*
* compute exposed regions of the border
*/
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.borderExposed,
+ RegionSubtract(&pWin->valdata->after.borderExposed,
&pWin->borderClip, &pWin->winSize);
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.borderExposed,
+ RegionSubtract(&pWin->valdata->after.borderExposed,
&pWin->valdata->after.borderExposed, pValid->over);
}
if(pTree && pTree->valdata) {
- REGION_SUBTRACT(pScreen, &pTree->valdata->exposed,
+ RegionSubtract(&pTree->valdata->exposed,
&pTree->clipList, pValid->under);
- REGION_SUBTRACT(pScreen, &pTree->valdata->borderExposed,
+ RegionSubtract(&pTree->valdata->borderExposed,
&pTree->borderClip, &pWin->winSize);
- REGION_SUBTRACT(pScreen, &pTree->valdata->borderExposed,
+ RegionSubtract(&pTree->valdata->borderExposed,
&pTree->valdata->borderExposed, pValid->under);
} else if (!pWin->valdata)
return WT_NOMATCH;
@@ -1194,11 +1194,11 @@ miOverlayResizeWindow(
/*
* save the visible region of the window
*/
- oldRegion = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldRegion, &pWin->winSize);
+ oldRegion = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion, &pWin->winSize);
if(doUnderlay) {
- oldRegion2 = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldRegion2, &pWin->winSize);
+ oldRegion2 = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion2, &pWin->winSize);
}
/*
@@ -1210,16 +1210,16 @@ miOverlayResizeWindow(
g = pChild->winGravity;
if (g != UnmapGravity) {
if (!gravitate[g])
- gravitate[g] = REGION_CREATE(pScreen, NullBox, 1);
- REGION_UNION(pScreen, gravitate[g],
+ gravitate[g] = RegionCreate(NullBox, 1);
+ RegionUnion(gravitate[g],
gravitate[g], &pChild->borderClip);
if(doUnderlay) {
if (!gravitate2[g])
- gravitate2[g] = REGION_CREATE(pScreen, NullBox, 0);
+ gravitate2[g] = RegionCreate(NullBox, 0);
if((tChild = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
- REGION_UNION(pScreen, gravitate2[g],
+ RegionUnion(gravitate2[g],
gravitate2[g], &tChild->borderClip);
} else
CollectUnderlayChildrenRegions(pChild, gravitate2[g]);
@@ -1233,11 +1233,11 @@ miOverlayResizeWindow(
oldWinClip = oldWinClip2 = NULL;
if (pWin->bitGravity != ForgetGravity) {
- oldWinClip = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldWinClip, &pWin->clipList);
+ oldWinClip = RegionCreate(NullBox, 1);
+ RegionCopy(oldWinClip, &pWin->clipList);
if(pTree) {
- oldWinClip2 = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldWinClip2, &pTree->clipList);
+ oldWinClip2 = RegionCreate(NullBox, 1);
+ RegionCopy(oldWinClip2, &pTree->clipList);
}
}
/*
@@ -1253,26 +1253,26 @@ miOverlayResizeWindow(
if ((pWin->drawable.height != h || pWin->drawable.width != w) &&
HasBorder (pWin))
{
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+ borderVisible = RegionCreate(NullBox, 1);
if(pTree)
- borderVisible2 = REGION_CREATE(pScreen, NullBox, 1);
+ borderVisible2 = RegionCreate(NullBox, 1);
/* for tiled borders, we punt and draw the whole thing */
if (pWin->borderIsPixel || !moved)
{
if (shrunk || moved)
- REGION_SUBTRACT(pScreen, borderVisible,
+ RegionSubtract(borderVisible,
&pWin->borderClip,
&pWin->winSize);
else
- REGION_COPY(pScreen, borderVisible,
+ RegionCopy(borderVisible,
&pWin->borderClip);
if(pTree) {
if (shrunk || moved)
- REGION_SUBTRACT(pScreen, borderVisible,
+ RegionSubtract(borderVisible,
&pTree->borderClip,
&pWin->winSize);
else
- REGION_COPY(pScreen, borderVisible,
+ RegionCopy(borderVisible,
&pTree->borderClip);
}
}
@@ -1299,9 +1299,9 @@ miOverlayResizeWindow(
pFirstChange = MoveWindowInStack(pWin, pSib);
if (WasViewable) {
- pRegion = REGION_CREATE(pScreen, NullBox, 1);
+ pRegion = RegionCreate(NullBox, 1);
if (pWin->backStorage)
- REGION_COPY(pScreen, pRegion, &pWin->clipList);
+ RegionCopy(pRegion, &pWin->clipList);
(*pScreen->MarkOverlappedWindows)(pWin, pFirstChange, NULL);
@@ -1320,9 +1320,9 @@ miOverlayResizeWindow(
* the entire window is trashed unless bitGravity
* recovers portions of it
*/
- REGION_COPY(pScreen, &pWin->valdata->after.exposed, &pWin->clipList);
+ RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList);
if(pTree)
- REGION_COPY(pScreen, &pTree->valdata->exposed, &pTree->clipList);
+ RegionCopy(&pTree->valdata->exposed, &pTree->clipList);
}
GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny);
@@ -1361,20 +1361,20 @@ miOverlayResizeWindow(
dx = (oldx - nx) - offx;
dy = (oldy - ny) - offy;
if (dx || dy) {
- REGION_TRANSLATE(pScreen, &pWin->winSize, dx, dy);
+ RegionTranslate(&pWin->winSize, dx, dy);
offx += dx;
offy += dy;
}
if(gravitate[g])
- REGION_INTERSECT(pScreen, gravitate[g], gravitate[g],
+ RegionIntersect(gravitate[g], gravitate[g],
&pWin->winSize);
if(gravitate2[g])
- REGION_INTERSECT(pScreen, gravitate2[g], gravitate2[g],
+ RegionIntersect(gravitate2[g], gravitate2[g],
&pWin->winSize);
}
/* get winSize back where it belongs */
if (offx || offy)
- REGION_TRANSLATE(pScreen, &pWin->winSize, -offx, -offy);
+ RegionTranslate(&pWin->winSize, -offx, -offy);
}
/*
* add screen bits to the appropriate bucket
@@ -1382,22 +1382,22 @@ miOverlayResizeWindow(
if (oldWinClip2)
{
- REGION_COPY(pScreen, pRegion, oldWinClip2);
- REGION_TRANSLATE(pScreen, pRegion, nx - oldx, ny - oldy);
- REGION_INTERSECT(pScreen, oldWinClip2, pRegion, &pTree->clipList);
+ RegionCopy(pRegion, oldWinClip2);
+ RegionTranslate(pRegion, nx - oldx, ny - oldy);
+ RegionIntersect(oldWinClip2, pRegion, &pTree->clipList);
for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) {
if (gravitate2[g])
- REGION_SUBTRACT(pScreen, oldWinClip2, oldWinClip2,
+ RegionSubtract(oldWinClip2, oldWinClip2,
gravitate2[g]);
}
- REGION_TRANSLATE(pScreen, oldWinClip2, oldx - nx, oldy - ny);
+ RegionTranslate(oldWinClip2, oldx - nx, oldy - ny);
g = pWin->bitGravity;
if (!gravitate2[g])
gravitate2[g] = oldWinClip2;
else {
- REGION_UNION(pScreen,gravitate2[g],gravitate2[g],oldWinClip2);
- REGION_DESTROY(pScreen, oldWinClip2);
+ RegionUnion(gravitate2[g],gravitate2[g],oldWinClip2);
+ RegionDestroy(oldWinClip2);
}
}
@@ -1406,9 +1406,9 @@ miOverlayResizeWindow(
/*
* clip to new clipList
*/
- REGION_COPY(pScreen, pRegion, oldWinClip);
- REGION_TRANSLATE(pScreen, pRegion, nx - oldx, ny - oldy);
- REGION_INTERSECT(pScreen, oldWinClip, pRegion, &pWin->clipList);
+ RegionCopy(pRegion, oldWinClip);
+ RegionTranslate(pRegion, nx - oldx, ny - oldy);
+ RegionIntersect(oldWinClip, pRegion, &pWin->clipList);
/*
* don't step on any gravity bits which will be copied after this
* region. Note -- this assumes that the regions will be copied
@@ -1416,16 +1416,16 @@ miOverlayResizeWindow(
*/
for (g = pWin->bitGravity + 1; g <= StaticGravity; g++) {
if (gravitate[g])
- REGION_SUBTRACT(pScreen, oldWinClip, oldWinClip,
+ RegionSubtract(oldWinClip, oldWinClip,
gravitate[g]);
}
- REGION_TRANSLATE(pScreen, oldWinClip, oldx - nx, oldy - ny);
+ RegionTranslate(oldWinClip, oldx - nx, oldy - ny);
g = pWin->bitGravity;
if (!gravitate[g])
gravitate[g] = oldWinClip;
else {
- REGION_UNION(pScreen, gravitate[g], gravitate[g], oldWinClip);
- REGION_DESTROY(pScreen, oldWinClip);
+ RegionUnion(gravitate[g], gravitate[g], oldWinClip);
+ RegionDestroy(oldWinClip);
}
}
@@ -1449,23 +1449,23 @@ miOverlayResizeWindow(
/* only copy the remaining useful bits */
if(gravitate[g])
- REGION_INTERSECT(pScreen, gravitate[g],
+ RegionIntersect(gravitate[g],
gravitate[g], oldRegion);
if(gravitate2[g])
- REGION_INTERSECT(pScreen, gravitate2[g],
+ RegionIntersect(gravitate2[g],
gravitate2[g], oldRegion2);
/* clip to not overwrite already copied areas */
if (destClip && gravitate[g]) {
- REGION_TRANSLATE(pScreen, destClip, oldpt.x - x, oldpt.y - y);
- REGION_SUBTRACT(pScreen, gravitate[g], gravitate[g], destClip);
- REGION_TRANSLATE(pScreen, destClip, x - oldpt.x, y - oldpt.y);
+ RegionTranslate(destClip, oldpt.x - x, oldpt.y - y);
+ RegionSubtract(gravitate[g], gravitate[g], destClip);
+ RegionTranslate(destClip, x - oldpt.x, y - oldpt.y);
}
if (destClip2 && gravitate2[g]) {
- REGION_TRANSLATE(pScreen, destClip2, oldpt.x - x, oldpt.y - y);
- REGION_SUBTRACT(pScreen,gravitate2[g],gravitate2[g],destClip2);
- REGION_TRANSLATE(pScreen, destClip2, x - oldpt.x, y - oldpt.y);
+ RegionTranslate(destClip2, oldpt.x - x, oldpt.y - y);
+ RegionSubtract(gravitate2[g],gravitate2[g],destClip2);
+ RegionTranslate(destClip2, x - oldpt.x, y - oldpt.y);
}
/* and move those bits */
@@ -1486,9 +1486,9 @@ miOverlayResizeWindow(
/* remove any overwritten bits from the remaining useful bits */
if(gravitate[g])
- REGION_SUBTRACT(pScreen, oldRegion, oldRegion, gravitate[g]);
+ RegionSubtract(oldRegion, oldRegion, gravitate[g]);
if(gravitate2[g])
- REGION_SUBTRACT(pScreen, oldRegion2, oldRegion2, gravitate2[g]);
+ RegionSubtract(oldRegion2, oldRegion2, gravitate2[g]);
/*
* recompute exposed regions of child windows
@@ -1513,38 +1513,38 @@ miOverlayResizeWindow(
if (g == pWin->bitGravity) {
if(gravitate[g])
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed,
+ RegionSubtract(&pWin->valdata->after.exposed,
&pWin->valdata->after.exposed, gravitate[g]);
if(gravitate2[g] && pTree)
- REGION_SUBTRACT(pScreen, &pTree->valdata->exposed,
+ RegionSubtract(&pTree->valdata->exposed,
&pTree->valdata->exposed, gravitate2[g]);
}
if(gravitate[g]) {
if (!destClip)
destClip = gravitate[g];
else {
- REGION_UNION(pScreen, destClip, destClip, gravitate[g]);
- REGION_DESTROY(pScreen, gravitate[g]);
+ RegionUnion(destClip, destClip, gravitate[g]);
+ RegionDestroy(gravitate[g]);
}
}
if(gravitate2[g]) {
if (!destClip2)
destClip2 = gravitate2[g];
else {
- REGION_UNION(pScreen, destClip2, destClip2, gravitate2[g]);
- REGION_DESTROY(pScreen, gravitate2[g]);
+ RegionUnion(destClip2, destClip2, gravitate2[g]);
+ RegionDestroy(gravitate2[g]);
}
}
}
- REGION_DESTROY(pScreen, pRegion);
- REGION_DESTROY(pScreen, oldRegion);
+ RegionDestroy(pRegion);
+ RegionDestroy(oldRegion);
if(doUnderlay)
- REGION_DESTROY(pScreen, oldRegion2);
+ RegionDestroy(oldRegion2);
if (destClip)
- REGION_DESTROY(pScreen, destClip);
+ RegionDestroy(destClip);
if (destClip2)
- REGION_DESTROY(pScreen, destClip2);
+ RegionDestroy(destClip2);
if (bsExposed) {
RegionPtr valExposed = NullRegion;
@@ -1552,8 +1552,8 @@ miOverlayResizeWindow(
valExposed = &pWin->valdata->after.exposed;
(*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
if (valExposed)
- REGION_EMPTY(pScreen, valExposed);
- REGION_DESTROY(pScreen, bsExposed);
+ RegionEmpty(valExposed);
+ RegionDestroy(bsExposed);
}
(*pScreen->HandleExposures)(pWin->parent);
#ifdef DO_SAVE_UNDERS
@@ -1565,7 +1565,7 @@ miOverlayResizeWindow(
}
else if (bsExposed) {
(*pScreen->WindowExposures) (pWin, NullRegion, bsExposed);
- REGION_DESTROY(pScreen, bsExposed);
+ RegionDestroy(bsExposed);
}
if (pWin->realized)
WindowsRestructured ();
@@ -1589,8 +1589,8 @@ miOverlaySetShape(WindowPtr pWin)
if (HasBorder (pWin)) {
RegionPtr borderVisible;
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
+ borderVisible = RegionCreate(NullBox, 1);
+ RegionSubtract(borderVisible,
&pWin->borderClip, &pWin->winSize);
pWin->valdata->before.borderVisible = borderVisible;
pWin->valdata->before.resized = TRUE;
@@ -1598,8 +1598,8 @@ miOverlaySetShape(WindowPtr pWin)
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
RegionPtr borderVisible2;
- borderVisible2 = REGION_CREATE(pScreen, NULL, 1);
- REGION_SUBTRACT(pScreen, borderVisible2,
+ borderVisible2 = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible2,
&pTree->borderClip, &pWin->winSize);
pTree->valdata->borderVisible = borderVisible2;
}
@@ -1613,8 +1613,8 @@ miOverlaySetShape(WindowPtr pWin)
if (WasViewable) {
if (pWin->backStorage) {
- pOldClip = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, pOldClip, &pWin->clipList);
+ pOldClip = RegionCreate(NullBox, 1);
+ RegionCopy(pOldClip, &pWin->clipList);
}
(*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
@@ -1634,7 +1634,7 @@ miOverlaySetShape(WindowPtr pWin)
(pWin, 0, 0, pOldClip,
pWin->drawable.x, pWin->drawable.y);
if (WasViewable)
- REGION_DESTROY(pScreen, pOldClip);
+ RegionDestroy(pOldClip);
if (bsExposed)
{
RegionPtr valExposed = NullRegion;
@@ -1643,8 +1643,8 @@ miOverlaySetShape(WindowPtr pWin)
valExposed = &pWin->valdata->after.exposed;
(*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
if (valExposed)
- REGION_EMPTY(pScreen, valExposed);
- REGION_DESTROY(pScreen, bsExposed);
+ RegionEmpty(valExposed);
+ RegionDestroy(bsExposed);
}
}
if (WasViewable) {
@@ -1694,16 +1694,16 @@ miOverlayChangeBorderWidth(
if (HadBorder) {
RegionPtr borderVisible;
- borderVisible = REGION_CREATE(pScreen, NULL, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
+ borderVisible = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible,
&pWin->borderClip, &pWin->winSize);
pWin->valdata->before.borderVisible = borderVisible;
if(IN_UNDERLAY(pWin)) {
miOverlayTreePtr pTree = MIOVERLAY_GET_WINDOW_TREE(pWin);
RegionPtr borderVisible2;
- borderVisible2 = REGION_CREATE(pScreen, NULL, 1);
- REGION_SUBTRACT(pScreen, borderVisible2,
+ borderVisible2 = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible2,
&pTree->borderClip, &pWin->winSize);
pTree->valdata->borderVisible = borderVisible2;
}
@@ -1746,11 +1746,11 @@ miOverlaySetRootClip(ScreenPtr pScreen, Bool enable)
box.x2 = pScreen->width;
box.y2 = pScreen->height;
- REGION_RESET(pScreen, &pTree->borderClip, &box);
+ RegionReset(&pTree->borderClip, &box);
} else
- REGION_EMPTY(pScreen, &pTree->borderClip);
+ RegionEmpty(&pTree->borderClip);
- REGION_BREAK(pScreen, &pTree->clipList);
+ RegionBreak(&pTree->clipList);
}
static void
@@ -1785,7 +1785,7 @@ miOverlayClearToBackground(
clipList = ((*pScreenPriv->InOverlay)(pWin)) ? &pWin->clipList :
&pTree->clipList;
- extents = REGION_EXTENTS(pScreen, clipList);
+ extents = RegionExtents(clipList);
if (x1 < extents->x1) x1 = extents->x1;
if (x2 > extents->x2) x2 = extents->x2;
@@ -1798,20 +1798,20 @@ miOverlayClearToBackground(
box.x1 = x1; box.x2 = x2;
box.y1 = y1; box.y2 = y2;
- REGION_INIT(pScreen, &reg, &box, 1);
+ RegionInit(&reg, &box, 1);
if (pWin->backStorage) {
pBSReg = (* pScreen->ClearBackingStore)(pWin, x, y, w, h,
generateExposures);
}
- REGION_INTERSECT(pScreen, &reg, &reg, clipList);
+ RegionIntersect(&reg, &reg, clipList);
if (generateExposures)
(*pScreen->WindowExposures)(pWin, &reg, pBSReg);
else if (pWin->backgroundState != None)
(*pScreen->PaintWindowBackground)(pWin, &reg, PW_BACKGROUND);
- REGION_UNINIT(pScreen, &reg);
+ RegionUninit(&reg);
if (pBSReg)
- REGION_DESTROY(pScreen, pBSReg);
+ RegionDestroy(pBSReg);
}
@@ -1865,12 +1865,12 @@ miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin)
}
if (pGC->subWindowMode == IncludeInferiors) {
- pregWin = REGION_CREATE(pScreen, NullBox, 1);
+ pregWin = RegionCreate(NullBox, 1);
freeTmpClip = TRUE;
if (pWin->parent || (screenIsSaved != SCREEN_SAVER_ON) ||
!HasSaverWindow (pScreen->myNum))
{
- REGION_INTERSECT(pScreen,pregWin,&pTree->borderClip,&pWin->winSize);
+ RegionIntersect(pregWin,&pTree->borderClip,&pWin->winSize);
}
} else {
pregWin = &pTree->clipList;
@@ -1879,29 +1879,29 @@ miOverlayComputeCompositeClip(GCPtr pGC, WindowPtr pWin)
freeCompClip = pGC->freeCompClip;
if (pGC->clientClipType == CT_NONE) {
if (freeCompClip)
- REGION_DESTROY(pScreen, pGC->pCompositeClip);
+ RegionDestroy(pGC->pCompositeClip);
pGC->pCompositeClip = pregWin;
pGC->freeCompClip = freeTmpClip;
} else {
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
pWin->drawable.x + pGC->clipOrg.x,
pWin->drawable.y + pGC->clipOrg.y);
if (freeCompClip) {
- REGION_INTERSECT(pGC->pScreen, pGC->pCompositeClip,
+ RegionIntersect(pGC->pCompositeClip,
pregWin, pGC->clientClip);
if (freeTmpClip)
- REGION_DESTROY(pScreen, pregWin);
+ RegionDestroy(pregWin);
} else if (freeTmpClip) {
- REGION_INTERSECT(pScreen, pregWin, pregWin, pGC->clientClip);
+ RegionIntersect(pregWin, pregWin, pGC->clientClip);
pGC->pCompositeClip = pregWin;
} else {
- pGC->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0);
- REGION_INTERSECT(pScreen, pGC->pCompositeClip,
+ pGC->pCompositeClip = RegionCreate(NullBox, 0);
+ RegionIntersect(pGC->pCompositeClip,
pregWin, pGC->clientClip);
}
pGC->freeCompClip = TRUE;
- REGION_TRANSLATE(pScreen, pGC->clientClip,
+ RegionTranslate(pGC->clientClip,
-(pWin->drawable.x + pGC->clipOrg.x),
-(pWin->drawable.y + pGC->clipOrg.y));
}
@@ -1919,7 +1919,7 @@ miOverlayCollectUnderlayRegions(
return FALSE;
}
- *region = REGION_CREATE(pWin->drawable.pScreen, NullBox, 0);
+ *region = RegionCreate(NullBox, 0);
CollectUnderlayChildrenRegions(pWin, *region);
@@ -2041,7 +2041,7 @@ CollectUnderlayChildrenRegions(WindowPtr pWin, RegionPtr pReg)
while(1) {
if((pTree = MIOVERLAY_GET_WINDOW_TREE(pChild))) {
- REGION_APPEND(pScreen, pReg, &pTree->borderClip);
+ RegionAppend(pReg, &pTree->borderClip);
hasUnderlay = TRUE;
} else
if(pChild->firstChild) {
@@ -2059,7 +2059,7 @@ CollectUnderlayChildrenRegions(WindowPtr pWin, RegionPtr pReg)
if(hasUnderlay) {
Bool overlap;
- REGION_VALIDATE(pScreen, pReg, &overlap);
+ RegionValidate(pReg, &overlap);
}
return hasUnderlay;
diff --git a/nx-X11/programs/Xserver/mi/miregion.c b/nx-X11/programs/Xserver/mi/miregion.c
deleted file mode 100644
index 1df0dcc46..000000000
--- a/nx-X11/programs/Xserver/mi/miregion.c
+++ /dev/null
@@ -1,2578 +0,0 @@
-/* $XFree86: xc/programs/Xserver/mi/miregion.c,v 1.9 2003/04/23 21:51:53 tsi Exp $ */
-/***********************************************************
-
-Copyright 1987, 1988, 1989, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987, 1988, 1989 by
-Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* $Xorg: miregion.c,v 1.4 2001/02/09 02:05:21 xorgcvs Exp $ */
-
-/* The panoramix components contained the following notice */
-/*****************************************************************
-
-Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
-IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "regionstr.h"
-#include <nx-X11/Xprotostr.h>
-#include "gc.h"
-#include "mi.h"
-#include "mispans.h"
-
-#if defined (__GNUC__) && !defined (NO_INLINES)
-#define INLINE __inline
-#else
-#define INLINE
-#endif
-
-#undef assert
-#ifdef DEBUG
-#define assert(expr) {if (!(expr)) \
- FatalError("Assertion failed file %s, line %d: expr\n", \
- __FILE__, __LINE__); }
-#else
-#define assert(expr)
-#endif
-
-#define good(reg) assert(miValidRegion(reg))
-
-/*
- * The functions in this file implement the Region abstraction used extensively
- * throughout the X11 sample server. A Region is simply a set of disjoint
- * (non-overlapping) rectangles, plus an "extent" rectangle which is the
- * smallest single rectangle that contains all the non-overlapping rectangles.
- *
- * A Region is implemented as a "y-x-banded" array of rectangles. This array
- * imposes two degrees of order. First, all rectangles are sorted by top side
- * y coordinate first (y1), and then by left side x coordinate (x1).
- *
- * Furthermore, the rectangles are grouped into "bands". Each rectangle in a
- * band has the same top y coordinate (y1), and each has the same bottom y
- * coordinate (y2). Thus all rectangles in a band differ only in their left
- * and right side (x1 and x2). Bands are implicit in the array of rectangles:
- * there is no separate list of band start pointers.
- *
- * The y-x band representation does not minimize rectangles. In particular,
- * if a rectangle vertically crosses a band (the rectangle has scanlines in
- * the y1 to y2 area spanned by the band), then the rectangle may be broken
- * down into two or more smaller rectangles stacked one atop the other.
- *
- * ----------- -----------
- * | | | | band 0
- * | | -------- ----------- --------
- * | | | | in y-x banded | | | | band 1
- * | | | | form is | | | |
- * ----------- | | ----------- --------
- * | | | | band 2
- * -------- --------
- *
- * An added constraint on the rectangles is that they must cover as much
- * horizontal area as possible: no two rectangles within a band are allowed
- * to touch.
- *
- * Whenever possible, bands will be merged together to cover a greater vertical
- * distance (and thus reduce the number of rectangles). Two bands can be merged
- * only if the bottom of one touches the top of the other and they have
- * rectangles in the same places (of the same width, of course).
- *
- * Adam de Boor wrote most of the original region code. Joel McCormack
- * substantially modified or rewrote most of the core arithmetic routines,
- * and added miRegionValidate in order to support several speed improvements
- * to miValidateTree. Bob Scheifler changed the representation to be more
- * compact when empty or a single rectangle, and did a bunch of gratuitous
- * reformatting.
- */
-
-/* true iff two Boxes overlap */
-#define EXTENTCHECK(r1,r2) \
- (!( ((r1)->x2 <= (r2)->x1) || \
- ((r1)->x1 >= (r2)->x2) || \
- ((r1)->y2 <= (r2)->y1) || \
- ((r1)->y1 >= (r2)->y2) ) )
-
-/* true iff (x,y) is in Box */
-#define INBOX(r,x,y) \
- ( ((r)->x2 > x) && \
- ((r)->x1 <= x) && \
- ((r)->y2 > y) && \
- ((r)->y1 <= y) )
-
-/* true iff Box r1 contains Box r2 */
-#define SUBSUMES(r1,r2) \
- ( ((r1)->x1 <= (r2)->x1) && \
- ((r1)->x2 >= (r2)->x2) && \
- ((r1)->y1 <= (r2)->y1) && \
- ((r1)->y2 >= (r2)->y2) )
-
-#define xfreeData(reg) if ((reg)->data && (reg)->data->size) xfree((reg)->data)
-
-#define RECTALLOC_BAIL(pReg,n,bail) \
-if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
- if (!miRectAlloc(pReg, n)) { goto bail; }
-
-#define RECTALLOC(pReg,n) \
-if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \
- if (!miRectAlloc(pReg, n)) { return FALSE; }
-
-#define ADDRECT(pNextRect,nx1,ny1,nx2,ny2) \
-{ \
- pNextRect->x1 = nx1; \
- pNextRect->y1 = ny1; \
- pNextRect->x2 = nx2; \
- pNextRect->y2 = ny2; \
- pNextRect++; \
-}
-
-#define NEWRECT(pReg,pNextRect,nx1,ny1,nx2,ny2) \
-{ \
- if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\
- { \
- if (!miRectAlloc(pReg, 1)) \
- return FALSE; \
- pNextRect = REGION_TOP(pReg); \
- } \
- ADDRECT(pNextRect,nx1,ny1,nx2,ny2); \
- pReg->data->numRects++; \
- assert(pReg->data->numRects<=pReg->data->size); \
-}
-
-
-#define DOWNSIZE(reg,numRects) \
-if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \
-{ \
- size_t NewSize = REGION_SZOF(numRects); \
- RegDataPtr NewData = \
- (NewSize > 0) ? (RegDataPtr)xrealloc((reg)->data, NewSize) : NULL; \
- if (NewData) \
- { \
- NewData->size = (numRects); \
- (reg)->data = NewData; \
- } \
-}
-
-
-BoxRec miEmptyBox = {0, 0, 0, 0};
-RegDataRec miEmptyData = {0, 0};
-
-RegDataRec miBrokenData = {0, 0};
-RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData };
-
-#ifdef DEBUG
-int
-miPrintRegion(rgn)
- RegionPtr rgn;
-{
- int num, size;
- register int i;
- BoxPtr rects;
-
- num = REGION_NUM_RECTS(rgn);
- size = REGION_SIZE(rgn);
- rects = REGION_RECTS(rgn);
- ErrorF("num: %d size: %d\n", num, size);
- ErrorF("extents: %d %d %d %d\n",
- rgn->extents.x1, rgn->extents.y1, rgn->extents.x2, rgn->extents.y2);
- for (i = 0; i < num; i++)
- ErrorF("%d %d %d %d \n",
- rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
- ErrorF("\n");
- return(num);
-}
-#endif /* DEBUG */
-
-Bool
-miRegionEqual(reg1, reg2)
- RegionPtr reg1;
- RegionPtr reg2;
-{
- int i, num;
- BoxPtr rects1, rects2;
-
- if (reg1->extents.x1 != reg2->extents.x1) return FALSE;
- if (reg1->extents.x2 != reg2->extents.x2) return FALSE;
- if (reg1->extents.y1 != reg2->extents.y1) return FALSE;
- if (reg1->extents.y2 != reg2->extents.y2) return FALSE;
-
- num = REGION_NUM_RECTS(reg1);
- if (num != REGION_NUM_RECTS(reg2)) return FALSE;
-
- rects1 = REGION_RECTS(reg1);
- rects2 = REGION_RECTS(reg2);
- for (i = 0; i != num; i++) {
- if (rects1[i].x1 != rects2[i].x1) return FALSE;
- if (rects1[i].x2 != rects2[i].x2) return FALSE;
- if (rects1[i].y1 != rects2[i].y1) return FALSE;
- if (rects1[i].y2 != rects2[i].y2) return FALSE;
- }
- return TRUE;
-}
-
-#ifdef DEBUG
-Bool
-miValidRegion(reg)
- RegionPtr reg;
-{
- register int i, numRects;
-
- if ((reg->extents.x1 > reg->extents.x2) ||
- (reg->extents.y1 > reg->extents.y2))
- return FALSE;
- numRects = REGION_NUM_RECTS(reg);
- if (!numRects)
- return ((reg->extents.x1 == reg->extents.x2) &&
- (reg->extents.y1 == reg->extents.y2) &&
- (reg->data->size || (reg->data == &miEmptyData)));
- else if (numRects == 1)
- return (!reg->data);
- else
- {
- register BoxPtr pboxP, pboxN;
- BoxRec box;
-
- pboxP = REGION_RECTS(reg);
- box = *pboxP;
- box.y2 = pboxP[numRects-1].y2;
- pboxN = pboxP + 1;
- for (i = numRects; --i > 0; pboxP++, pboxN++)
- {
- if ((pboxN->x1 >= pboxN->x2) ||
- (pboxN->y1 >= pboxN->y2))
- return FALSE;
- if (pboxN->x1 < box.x1)
- box.x1 = pboxN->x1;
- if (pboxN->x2 > box.x2)
- box.x2 = pboxN->x2;
- if ((pboxN->y1 < pboxP->y1) ||
- ((pboxN->y1 == pboxP->y1) &&
- ((pboxN->x1 < pboxP->x2) || (pboxN->y2 != pboxP->y2))))
- return FALSE;
- }
- return ((box.x1 == reg->extents.x1) &&
- (box.x2 == reg->extents.x2) &&
- (box.y1 == reg->extents.y1) &&
- (box.y2 == reg->extents.y2));
- }
-}
-
-#endif /* DEBUG */
-
-
-/*****************************************************************
- * RegionCreate(rect, size)
- * This routine does a simple malloc to make a structure of
- * REGION of "size" number of rectangles.
- *****************************************************************/
-
-RegionPtr
-miRegionCreate(rect, size)
- BoxPtr rect;
- int size;
-{
- register RegionPtr pReg;
- size_t newSize;
- pReg = (RegionPtr)xalloc(sizeof(RegionRec));
- if (!pReg)
- return &miBrokenRegion;
- if (rect)
- {
- pReg->extents = *rect;
- pReg->data = (RegDataPtr)NULL;
- }
- else
- {
- pReg->extents = miEmptyBox;
- newSize = REGION_SZOF(size);
- if ((size > 1) && (newSize > 0) &&
- (pReg->data = xalloc(newSize)))
- {
- pReg->data->size = size;
- pReg->data->numRects = 0;
- }
- else
- pReg->data = &miEmptyData;
- }
- return(pReg);
-}
-
-/*****************************************************************
- * RegionInit(pReg, rect, size)
- * Outer region rect is statically allocated.
- *****************************************************************/
-
-void
-miRegionInit(pReg, rect, size)
- RegionPtr pReg;
- BoxPtr rect;
- int size;
-{
- size_t newSize;
-
- if (rect)
- {
- pReg->extents = *rect;
- pReg->data = (RegDataPtr)NULL;
- }
- else
- {
- pReg->extents = miEmptyBox;
- newSize = REGION_SZOF(size);
- if ((size > 1) && (newSize > 0) &&
- (pReg->data = xalloc(newSize)))
- {
- pReg->data->size = size;
- pReg->data->numRects = 0;
- }
- else
- pReg->data = &miEmptyData;
- }
-}
-
-void
-miRegionDestroy(pReg)
- RegionPtr pReg;
-{
- good(pReg);
- xfreeData(pReg);
- if (pReg != &miBrokenRegion)
- xfree(pReg);
-}
-
-void
-miRegionUninit(pReg)
- RegionPtr pReg;
-{
- good(pReg);
- xfreeData(pReg);
-}
-
-Bool
-miRegionBreak (pReg)
- RegionPtr pReg;
-{
- xfreeData (pReg);
- pReg->extents = miEmptyBox;
- pReg->data = &miBrokenData;
- return FALSE;
-}
-
-Bool
-miRectAlloc(
- register RegionPtr pRgn,
- int n)
-{
- RegDataPtr data;
- size_t rgnSize;
-
- if (!pRgn->data)
- {
- n++;
- rgnSize = REGION_SZOF(n);
- pRgn->data = (rgnSize > 0) ? xalloc(rgnSize) : NULL;
- if (!pRgn->data)
- return miRegionBreak (pRgn);
- pRgn->data->numRects = 1;
- *REGION_BOXPTR(pRgn) = pRgn->extents;
- }
- else if (!pRgn->data->size)
- {
- rgnSize = REGION_SZOF(n);
- pRgn->data = (rgnSize > 0) ? xalloc(rgnSize) : NULL;
- if (!pRgn->data)
- return miRegionBreak (pRgn);
- pRgn->data->numRects = 0;
- }
- else
- {
- if (n == 1)
- {
- n = pRgn->data->numRects;
- if (n > 500) /* XXX pick numbers out of a hat */
- n = 250;
- }
- n += pRgn->data->numRects;
- rgnSize = REGION_SZOF(n);
- data = (rgnSize > 0) ? xrealloc(pRgn->data, rgnSize) : NULL;
- if (!data)
- return miRegionBreak (pRgn);
- pRgn->data = data;
- }
- pRgn->data->size = n;
- return TRUE;
-}
-
-Bool
-miRegionCopy(dst, src)
- register RegionPtr dst;
- register RegionPtr src;
-{
- good(dst);
- good(src);
- if (dst == src)
- return TRUE;
- dst->extents = src->extents;
- if (!src->data || !src->data->size)
- {
- xfreeData(dst);
- dst->data = src->data;
- return TRUE;
- }
- if (!dst->data || (dst->data->size < src->data->numRects))
- {
- size_t newSize = REGION_SZOF(src->data->numRects);
- xfreeData(dst);
-
- dst->data = newSize > 0 ? xalloc(newSize) : NULL;
- if (!dst->data)
- return miRegionBreak (dst);
- dst->data->size = src->data->numRects;
- }
- dst->data->numRects = src->data->numRects;
- memmove((char *)REGION_BOXPTR(dst),(char *)REGION_BOXPTR(src),
- dst->data->numRects * sizeof(BoxRec));
- return TRUE;
-}
-
-
-/*======================================================================
- * Generic Region Operator
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miCoalesce --
- * Attempt to merge the boxes in the current band with those in the
- * previous one. We are guaranteed that the current band extends to
- * the end of the rects array. Used only by miRegionOp.
- *
- * Results:
- * The new index for the previous band.
- *
- * Side Effects:
- * If coalescing takes place:
- * - rectangles in the previous band will have their y2 fields
- * altered.
- * - pReg->data->numRects will be decreased.
- *
- *-----------------------------------------------------------------------
- */
-INLINE static int
-miCoalesce (
- register RegionPtr pReg, /* Region to coalesce */
- int prevStart, /* Index of start of previous band */
- int curStart) /* Index of start of current band */
-{
- register BoxPtr pPrevBox; /* Current box in previous band */
- register BoxPtr pCurBox; /* Current box in current band */
- register int numRects; /* Number rectangles in both bands */
- register int y2; /* Bottom of current band */
- /*
- * Figure out how many rectangles are in the band.
- */
- numRects = curStart - prevStart;
- assert(numRects == pReg->data->numRects - curStart);
-
- if (!numRects) return curStart;
-
- /*
- * The bands may only be coalesced if the bottom of the previous
- * matches the top scanline of the current.
- */
- pPrevBox = REGION_BOX(pReg, prevStart);
- pCurBox = REGION_BOX(pReg, curStart);
- if (pPrevBox->y2 != pCurBox->y1) return curStart;
-
- /*
- * Make sure the bands have boxes in the same places. This
- * assumes that boxes have been added in such a way that they
- * cover the most area possible. I.e. two boxes in a band must
- * have some horizontal space between them.
- */
- y2 = pCurBox->y2;
-
- do {
- if ((pPrevBox->x1 != pCurBox->x1) || (pPrevBox->x2 != pCurBox->x2)) {
- return (curStart);
- }
- pPrevBox++;
- pCurBox++;
- numRects--;
- } while (numRects);
-
- /*
- * The bands may be merged, so set the bottom y of each box
- * in the previous band to the bottom y of the current band.
- */
- numRects = curStart - prevStart;
- pReg->data->numRects -= numRects;
- do {
- pPrevBox--;
- pPrevBox->y2 = y2;
- numRects--;
- } while (numRects);
- return prevStart;
-}
-
-
-/* Quicky macro to avoid trivial reject procedure calls to miCoalesce */
-
-#define Coalesce(newReg, prevBand, curBand) \
- if (curBand - prevBand == newReg->data->numRects - curBand) { \
- prevBand = miCoalesce(newReg, prevBand, curBand); \
- } else { \
- prevBand = curBand; \
- }
-
-/*-
- *-----------------------------------------------------------------------
- * miAppendNonO --
- * Handle a non-overlapping band for the union and subtract operations.
- * Just adds the (top/bottom-clipped) rectangles into the region.
- * Doesn't have to check for subsumption or anything.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * pReg->data->numRects is incremented and the rectangles overwritten
- * with the rectangles we're passed.
- *
- *-----------------------------------------------------------------------
- */
-
-INLINE static Bool
-miAppendNonO (
- register RegionPtr pReg,
- register BoxPtr r,
- BoxPtr rEnd,
- register int y1,
- register int y2)
-{
- register BoxPtr pNextRect;
- register int newRects;
-
- newRects = rEnd - r;
-
- assert(y1 < y2);
- assert(newRects != 0);
-
- /* Make sure we have enough space for all rectangles to be added */
- RECTALLOC(pReg, newRects);
- pNextRect = REGION_TOP(pReg);
- pReg->data->numRects += newRects;
- do {
- assert(r->x1 < r->x2);
- ADDRECT(pNextRect, r->x1, y1, r->x2, y2);
- r++;
- } while (r != rEnd);
-
- return TRUE;
-}
-
-#define FindBand(r, rBandEnd, rEnd, ry1) \
-{ \
- ry1 = r->y1; \
- rBandEnd = r+1; \
- while ((rBandEnd != rEnd) && (rBandEnd->y1 == ry1)) { \
- rBandEnd++; \
- } \
-}
-
-#define AppendRegions(newReg, r, rEnd) \
-{ \
- int newRects; \
- if ((newRects = rEnd - r)) { \
- RECTALLOC(newReg, newRects); \
- memmove((char *)REGION_TOP(newReg),(char *)r, \
- newRects * sizeof(BoxRec)); \
- newReg->data->numRects += newRects; \
- } \
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miRegionOp --
- * Apply an operation to two regions. Called by miUnion, miInverse,
- * miSubtract, miIntersect.... Both regions MUST have at least one
- * rectangle, and cannot be the same object.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * The new region is overwritten.
- * pOverlap set to TRUE if overlapFunc ever returns TRUE.
- *
- * Notes:
- * The idea behind this function is to view the two regions as sets.
- * Together they cover a rectangle of area that this function divides
- * into horizontal bands where points are covered only by one region
- * or by both. For the first case, the nonOverlapFunc is called with
- * each the band and the band's upper and lower extents. For the
- * second, the overlapFunc is called to process the entire band. It
- * is responsible for clipping the rectangles in the band, though
- * this function provides the boundaries.
- * At the end of each band, the new region is coalesced, if possible,
- * to reduce the number of rectangles in the region.
- *
- *-----------------------------------------------------------------------
- */
-
-typedef Bool (*OverlapProcPtr)(
- RegionPtr pReg,
- BoxPtr r1,
- BoxPtr r1End,
- BoxPtr r2,
- BoxPtr r2End,
- short y1,
- short y2,
- Bool *pOverlap);
-
-static Bool
-miRegionOp(
- RegionPtr newReg, /* Place to store result */
- RegionPtr reg1, /* First region in operation */
- RegionPtr reg2, /* 2d region in operation */
- OverlapProcPtr overlapFunc, /* Function to call for over-
- * lapping bands */
- Bool appendNon1, /* Append non-overlapping bands */
- /* in region 1 ? */
- Bool appendNon2, /* Append non-overlapping bands */
- /* in region 2 ? */
- Bool *pOverlap)
-{
- register BoxPtr r1; /* Pointer into first region */
- register BoxPtr r2; /* Pointer into 2d region */
- BoxPtr r1End; /* End of 1st region */
- BoxPtr r2End; /* End of 2d region */
- short ybot; /* Bottom of intersection */
- short ytop; /* Top of intersection */
- RegDataPtr oldData; /* Old data for newReg */
- int prevBand; /* Index of start of
- * previous band in newReg */
- int curBand; /* Index of start of current
- * band in newReg */
- register BoxPtr r1BandEnd; /* End of current band in r1 */
- register BoxPtr r2BandEnd; /* End of current band in r2 */
- short top; /* Top of non-overlapping band */
- short bot; /* Bottom of non-overlapping band*/
- register int r1y1; /* Temps for r1->y1 and r2->y1 */
- register int r2y1;
- int newSize;
- int numRects;
-
- /*
- * Break any region computed from a broken region
- */
- if (REGION_NAR (reg1) || REGION_NAR(reg2))
- return miRegionBreak (newReg);
-
- /*
- * Initialization:
- * set r1, r2, r1End and r2End appropriately, save the rectangles
- * of the destination region until the end in case it's one of
- * the two source regions, then mark the "new" region empty, allocating
- * another array of rectangles for it to use.
- */
-
- r1 = REGION_RECTS(reg1);
- newSize = REGION_NUM_RECTS(reg1);
- r1End = r1 + newSize;
- numRects = REGION_NUM_RECTS(reg2);
- r2 = REGION_RECTS(reg2);
- r2End = r2 + numRects;
- assert(r1 != r1End);
- assert(r2 != r2End);
-
- oldData = (RegDataPtr)NULL;
- if (((newReg == reg1) && (newSize > 1)) ||
- ((newReg == reg2) && (numRects > 1)))
- {
- oldData = newReg->data;
- newReg->data = &miEmptyData;
- }
- /* guess at new size */
- if (numRects > newSize)
- newSize = numRects;
- newSize <<= 1;
- if (!newReg->data)
- newReg->data = &miEmptyData;
- else if (newReg->data->size)
- newReg->data->numRects = 0;
- if (newSize > newReg->data->size)
- if (!miRectAlloc(newReg, newSize))
- return FALSE;
-
- /*
- * Initialize ybot.
- * In the upcoming loop, ybot and ytop serve different functions depending
- * on whether the band being handled is an overlapping or non-overlapping
- * band.
- * In the case of a non-overlapping band (only one of the regions
- * has points in the band), ybot is the bottom of the most recent
- * intersection and thus clips the top of the rectangles in that band.
- * ytop is the top of the next intersection between the two regions and
- * serves to clip the bottom of the rectangles in the current band.
- * For an overlapping band (where the two regions intersect), ytop clips
- * the top of the rectangles of both regions and ybot clips the bottoms.
- */
-
- ybot = min(r1->y1, r2->y1);
-
- /*
- * prevBand serves to mark the start of the previous band so rectangles
- * can be coalesced into larger rectangles. qv. miCoalesce, above.
- * In the beginning, there is no previous band, so prevBand == curBand
- * (curBand is set later on, of course, but the first band will always
- * start at index 0). prevBand and curBand must be indices because of
- * the possible expansion, and resultant moving, of the new region's
- * array of rectangles.
- */
- prevBand = 0;
-
- do {
- /*
- * This algorithm proceeds one source-band (as opposed to a
- * destination band, which is determined by where the two regions
- * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
- * rectangle after the last one in the current band for their
- * respective regions.
- */
- assert(r1 != r1End);
- assert(r2 != r2End);
-
- FindBand(r1, r1BandEnd, r1End, r1y1);
- FindBand(r2, r2BandEnd, r2End, r2y1);
-
- /*
- * First handle the band that doesn't intersect, if any.
- *
- * Note that attention is restricted to one band in the
- * non-intersecting region at once, so if a region has n
- * bands between the current position and the next place it overlaps
- * the other, this entire loop will be passed through n times.
- */
- if (r1y1 < r2y1) {
- if (appendNon1) {
- top = max(r1y1, ybot);
- bot = min(r1->y2, r2y1);
- if (top != bot) {
- curBand = newReg->data->numRects;
- miAppendNonO(newReg, r1, r1BandEnd, top, bot);
- Coalesce(newReg, prevBand, curBand);
- }
- }
- ytop = r2y1;
- } else if (r2y1 < r1y1) {
- if (appendNon2) {
- top = max(r2y1, ybot);
- bot = min(r2->y2, r1y1);
- if (top != bot) {
- curBand = newReg->data->numRects;
- miAppendNonO(newReg, r2, r2BandEnd, top, bot);
- Coalesce(newReg, prevBand, curBand);
- }
- }
- ytop = r1y1;
- } else {
- ytop = r1y1;
- }
-
- /*
- * Now see if we've hit an intersecting band. The two bands only
- * intersect if ybot > ytop
- */
- ybot = min(r1->y2, r2->y2);
- if (ybot > ytop) {
- curBand = newReg->data->numRects;
- (* overlapFunc)(newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot,
- pOverlap);
- Coalesce(newReg, prevBand, curBand);
- }
-
- /*
- * If we've finished with a band (y2 == ybot) we skip forward
- * in the region to the next band.
- */
- if (r1->y2 == ybot) r1 = r1BandEnd;
- if (r2->y2 == ybot) r2 = r2BandEnd;
-
- } while (r1 != r1End && r2 != r2End);
-
- /*
- * Deal with whichever region (if any) still has rectangles left.
- *
- * We only need to worry about banding and coalescing for the very first
- * band left. After that, we can just group all remaining boxes,
- * regardless of how many bands, into one final append to the list.
- */
-
- if ((r1 != r1End) && appendNon1) {
- /* Do first nonOverlap1Func call, which may be able to coalesce */
- FindBand(r1, r1BandEnd, r1End, r1y1);
- curBand = newReg->data->numRects;
- miAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2);
- Coalesce(newReg, prevBand, curBand);
- /* Just append the rest of the boxes */
- AppendRegions(newReg, r1BandEnd, r1End);
-
- } else if ((r2 != r2End) && appendNon2) {
- /* Do first nonOverlap2Func call, which may be able to coalesce */
- FindBand(r2, r2BandEnd, r2End, r2y1);
- curBand = newReg->data->numRects;
- miAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2);
- Coalesce(newReg, prevBand, curBand);
- /* Append rest of boxes */
- AppendRegions(newReg, r2BandEnd, r2End);
- }
-
- if (oldData)
- xfree(oldData);
-
- if (!(numRects = newReg->data->numRects))
- {
- xfreeData(newReg);
- newReg->data = &miEmptyData;
- }
- else if (numRects == 1)
- {
- newReg->extents = *REGION_BOXPTR(newReg);
- xfreeData(newReg);
- newReg->data = (RegDataPtr)NULL;
- }
- else
- {
- DOWNSIZE(newReg, numRects);
- }
-
- return TRUE;
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miSetExtents --
- * Reset the extents of a region to what they should be. Called by
- * miSubtract and miIntersect as they can't figure it out along the
- * way or do so easily, as miUnion can.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * The region's 'extents' structure is overwritten.
- *
- *-----------------------------------------------------------------------
- */
-void
-miSetExtents (pReg)
- register RegionPtr pReg;
-{
- register BoxPtr pBox, pBoxEnd;
-
- if (!pReg->data)
- return;
- if (!pReg->data->size)
- {
- pReg->extents.x2 = pReg->extents.x1;
- pReg->extents.y2 = pReg->extents.y1;
- return;
- }
-
- pBox = REGION_BOXPTR(pReg);
- pBoxEnd = REGION_END(pReg);
-
- /*
- * Since pBox is the first rectangle in the region, it must have the
- * smallest y1 and since pBoxEnd is the last rectangle in the region,
- * it must have the largest y2, because of banding. Initialize x1 and
- * x2 from pBox and pBoxEnd, resp., as good things to initialize them
- * to...
- */
- pReg->extents.x1 = pBox->x1;
- pReg->extents.y1 = pBox->y1;
- pReg->extents.x2 = pBoxEnd->x2;
- pReg->extents.y2 = pBoxEnd->y2;
-
- assert(pReg->extents.y1 < pReg->extents.y2);
- while (pBox <= pBoxEnd) {
- if (pBox->x1 < pReg->extents.x1)
- pReg->extents.x1 = pBox->x1;
- if (pBox->x2 > pReg->extents.x2)
- pReg->extents.x2 = pBox->x2;
- pBox++;
- };
-
- assert(pReg->extents.x1 < pReg->extents.x2);
-}
-
-/*======================================================================
- * Region Intersection
- *====================================================================*/
-/*-
- *-----------------------------------------------------------------------
- * miIntersectO --
- * Handle an overlapping band for miIntersect.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * Rectangles may be added to the region.
- *
- *-----------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static Bool
-miIntersectO (
- register RegionPtr pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- short y1,
- short y2,
- Bool *pOverlap)
-{
- register int x1;
- register int x2;
- register BoxPtr pNextRect;
-
- pNextRect = REGION_TOP(pReg);
-
- assert(y1 < y2);
- assert(r1 != r1End && r2 != r2End);
-
- do {
- x1 = max(r1->x1, r2->x1);
- x2 = min(r1->x2, r2->x2);
-
- /*
- * If there's any overlap between the two rectangles, add that
- * overlap to the new region.
- */
- if (x1 < x2)
- NEWRECT(pReg, pNextRect, x1, y1, x2, y2);
-
- /*
- * Advance the pointer(s) with the leftmost right side, since the next
- * rectangle on that list may still overlap the other region's
- * current rectangle.
- */
- if (r1->x2 == x2) {
- r1++;
- }
- if (r2->x2 == x2) {
- r2++;
- }
- } while ((r1 != r1End) && (r2 != r2End));
-
- return TRUE;
-}
-
-
-Bool
-miIntersect(newReg, reg1, reg2)
- register RegionPtr newReg; /* destination Region */
- register RegionPtr reg1;
- register RegionPtr reg2; /* source regions */
-{
- good(reg1);
- good(reg2);
- good(newReg);
- /* check for trivial reject */
- if (REGION_NIL(reg1) || REGION_NIL(reg2) ||
- !EXTENTCHECK(&reg1->extents, &reg2->extents))
- {
- /* Covers about 20% of all cases */
- xfreeData(newReg);
- newReg->extents.x2 = newReg->extents.x1;
- newReg->extents.y2 = newReg->extents.y1;
- if (REGION_NAR(reg1) || REGION_NAR(reg2))
- {
- newReg->data = &miBrokenData;
- return FALSE;
- }
- else
- newReg->data = &miEmptyData;
- }
- else if (!reg1->data && !reg2->data)
- {
- /* Covers about 80% of cases that aren't trivially rejected */
- newReg->extents.x1 = max(reg1->extents.x1, reg2->extents.x1);
- newReg->extents.y1 = max(reg1->extents.y1, reg2->extents.y1);
- newReg->extents.x2 = min(reg1->extents.x2, reg2->extents.x2);
- newReg->extents.y2 = min(reg1->extents.y2, reg2->extents.y2);
- xfreeData(newReg);
- newReg->data = (RegDataPtr)NULL;
- }
- else if (!reg2->data && SUBSUMES(&reg2->extents, &reg1->extents))
- {
- return miRegionCopy(newReg, reg1);
- }
- else if (!reg1->data && SUBSUMES(&reg1->extents, &reg2->extents))
- {
- return miRegionCopy(newReg, reg2);
- }
- else if (reg1 == reg2)
- {
- return miRegionCopy(newReg, reg1);
- }
- else
- {
- /* General purpose intersection */
- Bool overlap; /* result ignored */
- if (!miRegionOp(newReg, reg1, reg2, miIntersectO, FALSE, FALSE,
- &overlap))
- return FALSE;
- miSetExtents(newReg);
- }
-
- good(newReg);
- return(TRUE);
-}
-
-#define MERGERECT(r) \
-{ \
- if (r->x1 <= x2) { \
- /* Merge with current rectangle */ \
- if (r->x1 < x2) *pOverlap = TRUE; \
- if (x2 < r->x2) x2 = r->x2; \
- } else { \
- /* Add current rectangle, start new one */ \
- NEWRECT(pReg, pNextRect, x1, y1, x2, y2); \
- x1 = r->x1; \
- x2 = r->x2; \
- } \
- r++; \
-}
-
-/*======================================================================
- * Region Union
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miUnionO --
- * Handle an overlapping band for the union operation. Picks the
- * left-most rectangle each time and merges it into the region.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * pReg is overwritten.
- * pOverlap is set to TRUE if any boxes overlap.
- *
- *-----------------------------------------------------------------------
- */
-static Bool
-miUnionO (
- register RegionPtr pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- short y1,
- short y2,
- Bool *pOverlap)
-{
- register BoxPtr pNextRect;
- register int x1; /* left and right side of current union */
- register int x2;
-
- assert (y1 < y2);
- assert(r1 != r1End && r2 != r2End);
-
- pNextRect = REGION_TOP(pReg);
-
- /* Start off current rectangle */
- if (r1->x1 < r2->x1)
- {
- x1 = r1->x1;
- x2 = r1->x2;
- r1++;
- }
- else
- {
- x1 = r2->x1;
- x2 = r2->x2;
- r2++;
- }
- while (r1 != r1End && r2 != r2End)
- {
- if (r1->x1 < r2->x1) MERGERECT(r1) else MERGERECT(r2);
- }
-
- /* Finish off whoever (if any) is left */
- if (r1 != r1End)
- {
- do
- {
- MERGERECT(r1);
- } while (r1 != r1End);
- }
- else if (r2 != r2End)
- {
- do
- {
- MERGERECT(r2);
- } while (r2 != r2End);
- }
-
- /* Add current rectangle */
- NEWRECT(pReg, pNextRect, x1, y1, x2, y2);
-
- return TRUE;
-}
-
-Bool
-miUnion(newReg, reg1, reg2)
- RegionPtr newReg; /* destination Region */
- register RegionPtr reg1;
- register RegionPtr reg2; /* source regions */
-{
- Bool overlap; /* result ignored */
-
- /* Return TRUE if some overlap between reg1, reg2 */
- good(reg1);
- good(reg2);
- good(newReg);
- /* checks all the simple cases */
-
- /*
- * Region 1 and 2 are the same
- */
- if (reg1 == reg2)
- {
- return miRegionCopy(newReg, reg1);
- }
-
- /*
- * Region 1 is empty
- */
- if (REGION_NIL(reg1))
- {
- if (REGION_NAR(reg1))
- return miRegionBreak (newReg);
- if (newReg != reg2)
- return miRegionCopy(newReg, reg2);
- return TRUE;
- }
-
- /*
- * Region 2 is empty
- */
- if (REGION_NIL(reg2))
- {
- if (REGION_NAR(reg2))
- return miRegionBreak (newReg);
- if (newReg != reg1)
- return miRegionCopy(newReg, reg1);
- return TRUE;
- }
-
- /*
- * Region 1 completely subsumes region 2
- */
- if (!reg1->data && SUBSUMES(&reg1->extents, &reg2->extents))
- {
- if (newReg != reg1)
- return miRegionCopy(newReg, reg1);
- return TRUE;
- }
-
- /*
- * Region 2 completely subsumes region 1
- */
- if (!reg2->data && SUBSUMES(&reg2->extents, &reg1->extents))
- {
- if (newReg != reg2)
- return miRegionCopy(newReg, reg2);
- return TRUE;
- }
-
- if (!miRegionOp(newReg, reg1, reg2, miUnionO, TRUE, TRUE, &overlap))
- return FALSE;
-
- newReg->extents.x1 = min(reg1->extents.x1, reg2->extents.x1);
- newReg->extents.y1 = min(reg1->extents.y1, reg2->extents.y1);
- newReg->extents.x2 = max(reg1->extents.x2, reg2->extents.x2);
- newReg->extents.y2 = max(reg1->extents.y2, reg2->extents.y2);
- good(newReg);
- return TRUE;
-}
-
-
-/*======================================================================
- * Batch Rectangle Union
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miRegionAppend --
- *
- * "Append" the rgn rectangles onto the end of dstrgn, maintaining
- * knowledge of YX-banding when it's easy. Otherwise, dstrgn just
- * becomes a non-y-x-banded random collection of rectangles, and not
- * yet a true region. After a sequence of appends, the caller must
- * call miRegionValidate to ensure that a valid region is constructed.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * dstrgn is modified if rgn has rectangles.
- *
- */
-Bool
-miRegionAppend(dstrgn, rgn)
- register RegionPtr dstrgn;
- register RegionPtr rgn;
-{
- int numRects, dnumRects, size;
- BoxPtr new, old;
- Bool prepend;
-
- if (REGION_NAR(rgn))
- return miRegionBreak (dstrgn);
-
- if (!rgn->data && (dstrgn->data == &miEmptyData))
- {
- dstrgn->extents = rgn->extents;
- dstrgn->data = (RegDataPtr)NULL;
- return TRUE;
- }
-
- numRects = REGION_NUM_RECTS(rgn);
- if (!numRects)
- return TRUE;
- prepend = FALSE;
- size = numRects;
- dnumRects = REGION_NUM_RECTS(dstrgn);
- if (!dnumRects && (size < 200))
- size = 200; /* XXX pick numbers out of a hat */
- RECTALLOC(dstrgn, size);
- old = REGION_RECTS(rgn);
- if (!dnumRects)
- dstrgn->extents = rgn->extents;
- else if (dstrgn->extents.x2 > dstrgn->extents.x1)
- {
- register BoxPtr first, last;
-
- first = old;
- last = REGION_BOXPTR(dstrgn) + (dnumRects - 1);
- if ((first->y1 > last->y2) ||
- ((first->y1 == last->y1) && (first->y2 == last->y2) &&
- (first->x1 > last->x2)))
- {
- if (rgn->extents.x1 < dstrgn->extents.x1)
- dstrgn->extents.x1 = rgn->extents.x1;
- if (rgn->extents.x2 > dstrgn->extents.x2)
- dstrgn->extents.x2 = rgn->extents.x2;
- dstrgn->extents.y2 = rgn->extents.y2;
- }
- else
- {
- first = REGION_BOXPTR(dstrgn);
- last = old + (numRects - 1);
- if ((first->y1 > last->y2) ||
- ((first->y1 == last->y1) && (first->y2 == last->y2) &&
- (first->x1 > last->x2)))
- {
- prepend = TRUE;
- if (rgn->extents.x1 < dstrgn->extents.x1)
- dstrgn->extents.x1 = rgn->extents.x1;
- if (rgn->extents.x2 > dstrgn->extents.x2)
- dstrgn->extents.x2 = rgn->extents.x2;
- dstrgn->extents.y1 = rgn->extents.y1;
- }
- else
- dstrgn->extents.x2 = dstrgn->extents.x1;
- }
- }
- if (prepend)
- {
- new = REGION_BOX(dstrgn, numRects);
- if (dnumRects == 1)
- *new = *REGION_BOXPTR(dstrgn);
- else
- memmove((char *)new,(char *)REGION_BOXPTR(dstrgn),
- dnumRects * sizeof(BoxRec));
- new = REGION_BOXPTR(dstrgn);
- }
- else
- new = REGION_BOXPTR(dstrgn) + dnumRects;
- if (numRects == 1)
- *new = *old;
- else
- memmove((char *)new, (char *)old, numRects * sizeof(BoxRec));
- dstrgn->data->numRects += numRects;
- return TRUE;
-}
-
-
-#define ExchangeRects(a, b) \
-{ \
- BoxRec t; \
- t = rects[a]; \
- rects[a] = rects[b]; \
- rects[b] = t; \
-}
-
-static void
-QuickSortRects(
- register BoxRec rects[],
- register int numRects)
-{
- register int y1;
- register int x1;
- register int i, j;
- register BoxPtr r;
-
- /* Always called with numRects > 1 */
-
- do
- {
- if (numRects == 2)
- {
- if (rects[0].y1 > rects[1].y1 ||
- (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1))
- ExchangeRects(0, 1);
- return;
- }
-
- /* Choose partition element, stick in location 0 */
- ExchangeRects(0, numRects >> 1);
- y1 = rects[0].y1;
- x1 = rects[0].x1;
-
- /* Partition array */
- i = 0;
- j = numRects;
- do
- {
- r = &(rects[i]);
- do
- {
- r++;
- i++;
- } while (i != numRects &&
- (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1)));
- r = &(rects[j]);
- do
- {
- r--;
- j--;
- } while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1));
- if (i < j)
- ExchangeRects(i, j);
- } while (i < j);
-
- /* Move partition element back to middle */
- ExchangeRects(0, j);
-
- /* Recurse */
- if (numRects-j-1 > 1)
- QuickSortRects(&rects[j+1], numRects-j-1);
- numRects = j;
- } while (numRects > 1);
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miRegionValidate --
- *
- * Take a ``region'' which is a non-y-x-banded random collection of
- * rectangles, and compute a nice region which is the union of all the
- * rectangles.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * The passed-in ``region'' may be modified.
- * pOverlap set to TRUE if any retangles overlapped, else FALSE;
- *
- * Strategy:
- * Step 1. Sort the rectangles into ascending order with primary key y1
- * and secondary key x1.
- *
- * Step 2. Split the rectangles into the minimum number of proper y-x
- * banded regions. This may require horizontally merging
- * rectangles, and vertically coalescing bands. With any luck,
- * this step in an identity tranformation (ala the Box widget),
- * or a coalescing into 1 box (ala Menus).
- *
- * Step 3. Merge the separate regions down to a single region by calling
- * miUnion. Maximize the work each miUnion call does by using
- * a binary merge.
- *
- *-----------------------------------------------------------------------
- */
-
-Bool
-miRegionValidate(badreg, pOverlap)
- RegionPtr badreg;
- Bool *pOverlap;
-{
- /* Descriptor for regions under construction in Step 2. */
- typedef struct {
- RegionRec reg;
- int prevBand;
- int curBand;
- } RegionInfo;
-
- int numRects; /* Original numRects for badreg */
- RegionInfo *ri; /* Array of current regions */
- int numRI; /* Number of entries used in ri */
- int sizeRI; /* Number of entries available in ri */
- int i; /* Index into rects */
- register int j; /* Index into ri */
- register RegionInfo *rit; /* &ri[j] */
- register RegionPtr reg; /* ri[j].reg */
- register BoxPtr box; /* Current box in rects */
- register BoxPtr riBox; /* Last box in ri[j].reg */
- register RegionPtr hreg; /* ri[j_half].reg */
- Bool ret = TRUE;
-
- *pOverlap = FALSE;
- if (!badreg->data)
- {
- good(badreg);
- return TRUE;
- }
- numRects = badreg->data->numRects;
- if (!numRects)
- {
- if (REGION_NAR(badreg))
- return FALSE;
- good(badreg);
- return TRUE;
- }
- if (badreg->extents.x1 < badreg->extents.x2)
- {
- if ((numRects) == 1)
- {
- xfreeData(badreg);
- badreg->data = (RegDataPtr) NULL;
- }
- else
- {
- DOWNSIZE(badreg, numRects);
- }
- good(badreg);
- return TRUE;
- }
-
- /* Step 1: Sort the rects array into ascending (y1, x1) order */
- QuickSortRects(REGION_BOXPTR(badreg), numRects);
-
- /* Step 2: Scatter the sorted array into the minimum number of regions */
-
- /* Set up the first region to be the first rectangle in badreg */
- /* Note that step 2 code will never overflow the ri[0].reg rects array */
- ri = (RegionInfo *) xalloc(4 * sizeof(RegionInfo));
- if (!ri)
- return miRegionBreak (badreg);
- sizeRI = 4;
- numRI = 1;
- ri[0].prevBand = 0;
- ri[0].curBand = 0;
- ri[0].reg = *badreg;
- box = REGION_BOXPTR(&ri[0].reg);
- ri[0].reg.extents = *box;
- ri[0].reg.data->numRects = 1;
-
- /* Now scatter rectangles into the minimum set of valid regions. If the
- next rectangle to be added to a region would force an existing rectangle
- in the region to be split up in order to maintain y-x banding, just
- forget it. Try the next region. If it doesn't fit cleanly into any
- region, make a new one. */
-
- for (i = numRects; --i > 0;)
- {
- box++;
- /* Look for a region to append box to */
- for (j = numRI, rit = ri; --j >= 0; rit++)
- {
- reg = &rit->reg;
- riBox = REGION_END(reg);
-
- if (box->y1 == riBox->y1 && box->y2 == riBox->y2)
- {
- /* box is in same band as riBox. Merge or append it */
- if (box->x1 <= riBox->x2)
- {
- /* Merge it with riBox */
- if (box->x1 < riBox->x2) *pOverlap = TRUE;
- if (box->x2 > riBox->x2) riBox->x2 = box->x2;
- }
- else
- {
- RECTALLOC_BAIL(reg, 1, bail);
- *REGION_TOP(reg) = *box;
- reg->data->numRects++;
- }
- goto NextRect; /* So sue me */
- }
- else if (box->y1 >= riBox->y2)
- {
- /* Put box into new band */
- if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2;
- if (reg->extents.x1 > box->x1) reg->extents.x1 = box->x1;
- Coalesce(reg, rit->prevBand, rit->curBand);
- rit->curBand = reg->data->numRects;
- RECTALLOC_BAIL(reg, 1, bail);
- *REGION_TOP(reg) = *box;
- reg->data->numRects++;
- goto NextRect;
- }
- /* Well, this region was inappropriate. Try the next one. */
- } /* for j */
-
- /* Uh-oh. No regions were appropriate. Create a new one. */
- if (sizeRI == numRI)
- {
- /* Oops, allocate space for new region information */
- sizeRI <<= 1;
- rit = (RegionInfo *) xrealloc(ri, sizeRI * sizeof(RegionInfo));
- if (!rit)
- goto bail;
- ri = rit;
- rit = &ri[numRI];
- }
- numRI++;
- rit->prevBand = 0;
- rit->curBand = 0;
- rit->reg.extents = *box;
- rit->reg.data = (RegDataPtr)NULL;
- if (!miRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
- goto bail;
-NextRect: ;
- } /* for i */
-
- /* Make a final pass over each region in order to Coalesce and set
- extents.x2 and extents.y2 */
-
- for (j = numRI, rit = ri; --j >= 0; rit++)
- {
- reg = &rit->reg;
- riBox = REGION_END(reg);
- reg->extents.y2 = riBox->y2;
- if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2;
- Coalesce(reg, rit->prevBand, rit->curBand);
- if (reg->data->numRects == 1) /* keep unions happy below */
- {
- xfreeData(reg);
- reg->data = (RegDataPtr)NULL;
- }
- }
-
- /* Step 3: Union all regions into a single region */
- while (numRI > 1)
- {
- int half = numRI/2;
- for (j = numRI & 1; j < (half + (numRI & 1)); j++)
- {
- reg = &ri[j].reg;
- hreg = &ri[j+half].reg;
- if (!miRegionOp(reg, reg, hreg, miUnionO, TRUE, TRUE, pOverlap))
- ret = FALSE;
- if (hreg->extents.x1 < reg->extents.x1)
- reg->extents.x1 = hreg->extents.x1;
- if (hreg->extents.y1 < reg->extents.y1)
- reg->extents.y1 = hreg->extents.y1;
- if (hreg->extents.x2 > reg->extents.x2)
- reg->extents.x2 = hreg->extents.x2;
- if (hreg->extents.y2 > reg->extents.y2)
- reg->extents.y2 = hreg->extents.y2;
- xfreeData(hreg);
- }
- numRI -= half;
- }
- *badreg = ri[0].reg;
- xfree(ri);
- good(badreg);
- return ret;
-bail:
- for (i = 0; i < numRI; i++)
- xfreeData(&ri[i].reg);
- xfree (ri);
- return miRegionBreak (badreg);
-}
-
-RegionPtr
-miRectsToRegion(nrects, prect, ctype)
- int nrects;
- register xRectangle *prect;
- int ctype;
-{
- register RegionPtr pRgn;
- register RegDataPtr pData;
- register BoxPtr pBox;
- register int i;
- int x1, y1, x2, y2;
- size_t newSize;
-
- pRgn = miRegionCreate(NullBox, 0);
- if (REGION_NAR (pRgn))
- return pRgn;
- if (!nrects)
- return pRgn;
- if (nrects == 1)
- {
- x1 = prect->x;
- y1 = prect->y;
- if ((x2 = x1 + (int) prect->width) > MAXSHORT)
- x2 = MAXSHORT;
- if ((y2 = y1 + (int) prect->height) > MAXSHORT)
- y2 = MAXSHORT;
- if (x1 != x2 && y1 != y2)
- {
- pRgn->extents.x1 = x1;
- pRgn->extents.y1 = y1;
- pRgn->extents.x2 = x2;
- pRgn->extents.y2 = y2;
- pRgn->data = (RegDataPtr)NULL;
- }
- return pRgn;
- }
- newSize = REGION_SZOF(nrects);
- pData = newSize > 0 ? xalloc(newSize) : NULL;
- if (!pData)
- {
- miRegionBreak (pRgn);
- return pRgn;
- }
- pBox = (BoxPtr) (pData + 1);
- for (i = nrects; --i >= 0; prect++)
- {
- x1 = prect->x;
- y1 = prect->y;
- if ((x2 = x1 + (int) prect->width) > MAXSHORT)
- x2 = MAXSHORT;
- if ((y2 = y1 + (int) prect->height) > MAXSHORT)
- y2 = MAXSHORT;
- if (x1 != x2 && y1 != y2)
- {
- pBox->x1 = x1;
- pBox->y1 = y1;
- pBox->x2 = x2;
- pBox->y2 = y2;
- pBox++;
- }
- }
- if (pBox != (BoxPtr) (pData + 1))
- {
- pData->size = nrects;
- pData->numRects = pBox - (BoxPtr) (pData + 1);
- pRgn->data = pData;
- if (ctype != CT_YXBANDED)
- {
- Bool overlap; /* result ignored */
- pRgn->extents.x1 = pRgn->extents.x2 = 0;
- miRegionValidate(pRgn, &overlap);
- }
- else
- miSetExtents(pRgn);
- good(pRgn);
- }
- else
- {
- xfree (pData);
- }
- return pRgn;
-}
-
-/*======================================================================
- * Region Subtraction
- *====================================================================*/
-
-
-/*-
- *-----------------------------------------------------------------------
- * miSubtractO --
- * Overlapping band subtraction. x1 is the left-most point not yet
- * checked.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * pReg may have rectangles added to it.
- *
- *-----------------------------------------------------------------------
- */
-/*ARGSUSED*/
-static Bool
-miSubtractO (
- register RegionPtr pReg,
- register BoxPtr r1,
- BoxPtr r1End,
- register BoxPtr r2,
- BoxPtr r2End,
- register short y1,
- short y2,
- Bool *pOverlap)
-{
- register BoxPtr pNextRect;
- register int x1;
-
- x1 = r1->x1;
-
- assert(y1<y2);
- assert(r1 != r1End && r2 != r2End);
-
- pNextRect = REGION_TOP(pReg);
-
- do
- {
- if (r2->x2 <= x1)
- {
- /*
- * Subtrahend entirely to left of minuend: go to next subtrahend.
- */
- r2++;
- }
- else if (r2->x1 <= x1)
- {
- /*
- * Subtrahend preceeds minuend: nuke left edge of minuend.
- */
- x1 = r2->x2;
- if (x1 >= r1->x2)
- {
- /*
- * Minuend completely covered: advance to next minuend and
- * reset left fence to edge of new minuend.
- */
- r1++;
- if (r1 != r1End)
- x1 = r1->x1;
- }
- else
- {
- /*
- * Subtrahend now used up since it doesn't extend beyond
- * minuend
- */
- r2++;
- }
- }
- else if (r2->x1 < r1->x2)
- {
- /*
- * Left part of subtrahend covers part of minuend: add uncovered
- * part of minuend to region and skip to next subtrahend.
- */
- assert(x1<r2->x1);
- NEWRECT(pReg, pNextRect, x1, y1, r2->x1, y2);
-
- x1 = r2->x2;
- if (x1 >= r1->x2)
- {
- /*
- * Minuend used up: advance to new...
- */
- r1++;
- if (r1 != r1End)
- x1 = r1->x1;
- }
- else
- {
- /*
- * Subtrahend used up
- */
- r2++;
- }
- }
- else
- {
- /*
- * Minuend used up: add any remaining piece before advancing.
- */
- if (r1->x2 > x1)
- NEWRECT(pReg, pNextRect, x1, y1, r1->x2, y2);
- r1++;
- if (r1 != r1End)
- x1 = r1->x1;
- }
- } while ((r1 != r1End) && (r2 != r2End));
-
-
- /*
- * Add remaining minuend rectangles to region.
- */
- while (r1 != r1End)
- {
- assert(x1<r1->x2);
- NEWRECT(pReg, pNextRect, x1, y1, r1->x2, y2);
- r1++;
- if (r1 != r1End)
- x1 = r1->x1;
- }
- return TRUE;
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miSubtract --
- * Subtract regS from regM and leave the result in regD.
- * S stands for subtrahend, M for minuend and D for difference.
- *
- * Results:
- * TRUE if successful.
- *
- * Side Effects:
- * regD is overwritten.
- *
- *-----------------------------------------------------------------------
- */
-Bool
-miSubtract(regD, regM, regS)
- register RegionPtr regD;
- register RegionPtr regM;
- register RegionPtr regS;
-{
- Bool overlap; /* result ignored */
-
- good(regM);
- good(regS);
- good(regD);
- /* check for trivial rejects */
- if (REGION_NIL(regM) || REGION_NIL(regS) ||
- !EXTENTCHECK(&regM->extents, &regS->extents))
- {
- if (REGION_NAR (regS))
- return miRegionBreak (regD);
- return miRegionCopy(regD, regM);
- }
- else if (regM == regS)
- {
- xfreeData(regD);
- regD->extents.x2 = regD->extents.x1;
- regD->extents.y2 = regD->extents.y1;
- regD->data = &miEmptyData;
- return TRUE;
- }
-
- /* Add those rectangles in region 1 that aren't in region 2,
- do yucky substraction for overlaps, and
- just throw away rectangles in region 2 that aren't in region 1 */
- if (!miRegionOp(regD, regM, regS, miSubtractO, TRUE, FALSE, &overlap))
- return FALSE;
-
- /*
- * Can't alter RegD's extents before we call miRegionOp because
- * it might be one of the source regions and miRegionOp depends
- * on the extents of those regions being unaltered. Besides, this
- * way there's no checking against rectangles that will be nuked
- * due to coalescing, so we have to examine fewer rectangles.
- */
- miSetExtents(regD);
- good(regD);
- return TRUE;
-}
-
-/*======================================================================
- * Region Inversion
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miInverse --
- * Take a region and a box and return a region that is everything
- * in the box but not in the region. The careful reader will note
- * that this is the same as subtracting the region from the box...
- *
- * Results:
- * TRUE.
- *
- * Side Effects:
- * newReg is overwritten.
- *
- *-----------------------------------------------------------------------
- */
-Bool
-miInverse(newReg, reg1, invRect)
- RegionPtr newReg; /* Destination region */
- RegionPtr reg1; /* Region to invert */
- BoxPtr invRect; /* Bounding box for inversion */
-{
- RegionRec invReg; /* Quick and dirty region made from the
- * bounding box */
- Bool overlap; /* result ignored */
-
- good(reg1);
- good(newReg);
- /* check for trivial rejects */
- if (REGION_NIL(reg1) || !EXTENTCHECK(invRect, &reg1->extents))
- {
- if (REGION_NAR(reg1))
- return miRegionBreak (newReg);
- newReg->extents = *invRect;
- xfreeData(newReg);
- newReg->data = (RegDataPtr)NULL;
- return TRUE;
- }
-
- /* Add those rectangles in region 1 that aren't in region 2,
- do yucky substraction for overlaps, and
- just throw away rectangles in region 2 that aren't in region 1 */
- invReg.extents = *invRect;
- invReg.data = (RegDataPtr)NULL;
- if (!miRegionOp(newReg, &invReg, reg1, miSubtractO, TRUE, FALSE, &overlap))
- return FALSE;
-
- /*
- * Can't alter newReg's extents before we call miRegionOp because
- * it might be one of the source regions and miRegionOp depends
- * on the extents of those regions being unaltered. Besides, this
- * way there's no checking against rectangles that will be nuked
- * due to coalescing, so we have to examine fewer rectangles.
- */
- miSetExtents(newReg);
- good(newReg);
- return TRUE;
-}
-
-/*
- * RectIn(region, rect)
- * This routine takes a pointer to a region and a pointer to a box
- * and determines if the box is outside/inside/partly inside the region.
- *
- * The idea is to travel through the list of rectangles trying to cover the
- * passed box with them. Anytime a piece of the rectangle isn't covered
- * by a band of rectangles, partOut is set TRUE. Any time a rectangle in
- * the region covers part of the box, partIn is set TRUE. The process ends
- * when either the box has been completely covered (we reached a band that
- * doesn't overlap the box, partIn is TRUE and partOut is false), the
- * box has been partially covered (partIn == partOut == TRUE -- because of
- * the banding, the first time this is true we know the box is only
- * partially in the region) or is outside the region (we reached a band
- * that doesn't overlap the box at all and partIn is false)
- */
-
-int
-miRectIn(region, prect)
- register RegionPtr region;
- register BoxPtr prect;
-{
- register int x;
- register int y;
- register BoxPtr pbox;
- register BoxPtr pboxEnd;
- int partIn, partOut;
- int numRects;
-
- good(region);
- numRects = REGION_NUM_RECTS(region);
- /* useful optimization */
- if (!numRects || !EXTENTCHECK(&region->extents, prect))
- return(rgnOUT);
-
- if (numRects == 1)
- {
- /* We know that it must be rgnIN or rgnPART */
- if (SUBSUMES(&region->extents, prect))
- return(rgnIN);
- else
- return(rgnPART);
- }
-
- partOut = FALSE;
- partIn = FALSE;
-
- /* (x,y) starts at upper left of rect, moving to the right and down */
- x = prect->x1;
- y = prect->y1;
-
- /* can stop when both partOut and partIn are TRUE, or we reach prect->y2 */
- for (pbox = REGION_BOXPTR(region), pboxEnd = pbox + numRects;
- pbox != pboxEnd;
- pbox++)
- {
-
- if (pbox->y2 <= y)
- continue; /* getting up to speed or skipping remainder of band */
-
- if (pbox->y1 > y)
- {
- partOut = TRUE; /* missed part of rectangle above */
- if (partIn || (pbox->y1 >= prect->y2))
- break;
- y = pbox->y1; /* x guaranteed to be == prect->x1 */
- }
-
- if (pbox->x2 <= x)
- continue; /* not far enough over yet */
-
- if (pbox->x1 > x)
- {
- partOut = TRUE; /* missed part of rectangle to left */
- if (partIn)
- break;
- }
-
- if (pbox->x1 < prect->x2)
- {
- partIn = TRUE; /* definitely overlap */
- if (partOut)
- break;
- }
-
- if (pbox->x2 >= prect->x2)
- {
- y = pbox->y2; /* finished with this band */
- if (y >= prect->y2)
- break;
- x = prect->x1; /* reset x out to left again */
- }
- else
- {
- /*
- * Because boxes in a band are maximal width, if the first box
- * to overlap the rectangle doesn't completely cover it in that
- * band, the rectangle must be partially out, since some of it
- * will be uncovered in that band. partIn will have been set true
- * by now...
- */
- partOut = TRUE;
- break;
- }
- }
-
- return(partIn ? ((y < prect->y2) ? rgnPART : rgnIN) : rgnOUT);
-}
-
-/* TranslateRegion(pReg, x, y)
- translates in place
-*/
-
-void
-miTranslateRegion(pReg, x, y)
- register RegionPtr pReg;
- register int x;
- register int y;
-{
- int x1, x2, y1, y2;
- register int nbox;
- register BoxPtr pbox;
-
- good(pReg);
- pReg->extents.x1 = x1 = pReg->extents.x1 + x;
- pReg->extents.y1 = y1 = pReg->extents.y1 + y;
- pReg->extents.x2 = x2 = pReg->extents.x2 + x;
- pReg->extents.y2 = y2 = pReg->extents.y2 + y;
- if (((x1 - MINSHORT)|(y1 - MINSHORT)|(MAXSHORT - x2)|(MAXSHORT - y2)) >= 0)
- {
- if (pReg->data && (nbox = pReg->data->numRects))
- {
- for (pbox = REGION_BOXPTR(pReg); nbox--; pbox++)
- {
- pbox->x1 += x;
- pbox->y1 += y;
- pbox->x2 += x;
- pbox->y2 += y;
- }
- }
- return;
- }
- if (((x2 - MINSHORT)|(y2 - MINSHORT)|(MAXSHORT - x1)|(MAXSHORT - y1)) <= 0)
- {
- pReg->extents.x2 = pReg->extents.x1;
- pReg->extents.y2 = pReg->extents.y1;
- xfreeData(pReg);
- pReg->data = &miEmptyData;
- return;
- }
- if (x1 < MINSHORT)
- pReg->extents.x1 = MINSHORT;
- else if (x2 > MAXSHORT)
- pReg->extents.x2 = MAXSHORT;
- if (y1 < MINSHORT)
- pReg->extents.y1 = MINSHORT;
- else if (y2 > MAXSHORT)
- pReg->extents.y2 = MAXSHORT;
- if (pReg->data && (nbox = pReg->data->numRects))
- {
- register BoxPtr pboxout;
-
- for (pboxout = pbox = REGION_BOXPTR(pReg); nbox--; pbox++)
- {
- pboxout->x1 = x1 = pbox->x1 + x;
- pboxout->y1 = y1 = pbox->y1 + y;
- pboxout->x2 = x2 = pbox->x2 + x;
- pboxout->y2 = y2 = pbox->y2 + y;
- if (((x2 - MINSHORT)|(y2 - MINSHORT)|
- (MAXSHORT - x1)|(MAXSHORT - y1)) <= 0)
- {
- pReg->data->numRects--;
- continue;
- }
- if (x1 < MINSHORT)
- pboxout->x1 = MINSHORT;
- else if (x2 > MAXSHORT)
- pboxout->x2 = MAXSHORT;
- if (y1 < MINSHORT)
- pboxout->y1 = MINSHORT;
- else if (y2 > MAXSHORT)
- pboxout->y2 = MAXSHORT;
- pboxout++;
- }
- if (pboxout != pbox)
- {
- if (pReg->data->numRects == 1)
- {
- pReg->extents = *REGION_BOXPTR(pReg);
- xfreeData(pReg);
- pReg->data = (RegDataPtr)NULL;
- }
- else
- miSetExtents(pReg);
- }
- }
-}
-
-Bool
-miRegionDataCopy(
- register RegionPtr dst,
- register RegionPtr src)
-{
- good(dst);
- good(src);
- if (dst->data)
- return TRUE;
- if (dst == src)
- return TRUE;
- if (!src->data || !src->data->size)
- {
- xfreeData(dst);
- dst->data = (RegDataPtr)NULL;
- return TRUE;
- }
- if (!dst->data || (dst->data->size < src->data->numRects))
- {
- size_t newSize = REGION_SZOF(src->data->numRects);
- xfreeData(dst);
- dst->data = newSize > 0 ? xalloc(newSize) : NULL;
- if (!dst->data)
- return miRegionBreak (dst);
- }
- dst->data->size = src->data->size;
- dst->data->numRects = src->data->numRects;
- return TRUE;
-}
-
-void
-miRegionReset(pReg, pBox)
- RegionPtr pReg;
- BoxPtr pBox;
-{
- good(pReg);
- assert(pBox->x1<=pBox->x2);
- assert(pBox->y1<=pBox->y2);
- pReg->extents = *pBox;
- xfreeData(pReg);
- pReg->data = (RegDataPtr)NULL;
-}
-
-Bool
-miPointInRegion(pReg, x, y, box)
- register RegionPtr pReg;
- register int x, y;
- BoxPtr box; /* "return" value */
-{
- register BoxPtr pbox, pboxEnd;
- int numRects;
-
- good(pReg);
- numRects = REGION_NUM_RECTS(pReg);
- if (!numRects || !INBOX(&pReg->extents, x, y))
- return(FALSE);
- if (numRects == 1)
- {
- *box = pReg->extents;
- return(TRUE);
- }
- for (pbox = REGION_BOXPTR(pReg), pboxEnd = pbox + numRects;
- pbox != pboxEnd;
- pbox++)
- {
- if (y >= pbox->y2)
- continue; /* not there yet */
- if ((y < pbox->y1) || (x < pbox->x1))
- break; /* missed it */
- if (x >= pbox->x2)
- continue; /* not there yet */
- *box = *pbox;
- return(TRUE);
- }
- return(FALSE);
-}
-
-Bool
-miRegionNotEmpty(pReg)
- RegionPtr pReg;
-{
- good(pReg);
- return(!REGION_NIL(pReg));
-}
-
-Bool
-miRegionBroken(RegionPtr pReg)
-{
- good(pReg);
- return (REGION_NAR(pReg));
-}
-
-void
-miRegionEmpty(pReg)
- RegionPtr pReg;
-{
- good(pReg);
- xfreeData(pReg);
- pReg->extents.x2 = pReg->extents.x1;
- pReg->extents.y2 = pReg->extents.y1;
- pReg->data = &miEmptyData;
-}
-
-BoxPtr
-miRegionExtents(pReg)
- RegionPtr pReg;
-{
- good(pReg);
- return(&pReg->extents);
-}
-
-#define ExchangeSpans(a, b) \
-{ \
- DDXPointRec tpt; \
- register int tw; \
- \
- tpt = spans[a]; spans[a] = spans[b]; spans[b] = tpt; \
- tw = widths[a]; widths[a] = widths[b]; widths[b] = tw; \
-}
-
-/* ||| I should apply the merge sort code to rectangle sorting above, and see
- if mapping time can be improved. But right now I've been at work 12 hours,
- so forget it.
-*/
-
-static void QuickSortSpans(
- register DDXPointRec spans[],
- register int widths[],
- register int numSpans)
-{
- register int y;
- register int i, j, m;
- register DDXPointPtr r;
-
- /* Always called with numSpans > 1 */
- /* Sorts only by y, doesn't bother to sort by x */
-
- do
- {
- if (numSpans < 9)
- {
- /* Do insertion sort */
- register int yprev;
-
- yprev = spans[0].y;
- i = 1;
- do
- { /* while i != numSpans */
- y = spans[i].y;
- if (yprev > y)
- {
- /* spans[i] is out of order. Move into proper location. */
- DDXPointRec tpt;
- int tw, k;
-
- for (j = 0; y >= spans[j].y; j++) {}
- tpt = spans[i];
- tw = widths[i];
- for (k = i; k != j; k--)
- {
- spans[k] = spans[k-1];
- widths[k] = widths[k-1];
- }
- spans[j] = tpt;
- widths[j] = tw;
- y = spans[i].y;
- } /* if out of order */
- yprev = y;
- i++;
- } while (i != numSpans);
- return;
- }
-
- /* Choose partition element, stick in location 0 */
- m = numSpans / 2;
- if (spans[m].y > spans[0].y) ExchangeSpans(m, 0);
- if (spans[m].y > spans[numSpans-1].y) ExchangeSpans(m, numSpans-1);
- if (spans[m].y > spans[0].y) ExchangeSpans(m, 0);
- y = spans[0].y;
-
- /* Partition array */
- i = 0;
- j = numSpans;
- do
- {
- r = &(spans[i]);
- do
- {
- r++;
- i++;
- } while (i != numSpans && r->y < y);
- r = &(spans[j]);
- do
- {
- r--;
- j--;
- } while (y < r->y);
- if (i < j)
- ExchangeSpans(i, j);
- } while (i < j);
-
- /* Move partition element back to middle */
- ExchangeSpans(0, j);
-
- /* Recurse */
- if (numSpans-j-1 > 1)
- QuickSortSpans(&spans[j+1], &widths[j+1], numSpans-j-1);
- numSpans = j;
- } while (numSpans > 1);
-}
-
-#define NextBand() \
-{ \
- clipy1 = pboxBandStart->y1; \
- clipy2 = pboxBandStart->y2; \
- pboxBandEnd = pboxBandStart + 1; \
- while (pboxBandEnd != pboxLast && pboxBandEnd->y1 == clipy1) { \
- pboxBandEnd++; \
- } \
- for (; ppt != pptLast && ppt->y < clipy1; ppt++, pwidth++) {} \
-}
-
-/*
- Clip a list of scanlines to a region. The caller has allocated the
- space. FSorted is non-zero if the scanline origins are in ascending
- order.
- returns the number of new, clipped scanlines.
-*/
-
-int
-miClipSpans(
- RegionPtr prgnDst,
- register DDXPointPtr ppt,
- register int *pwidth,
- int nspans,
- register DDXPointPtr pptNew,
- int *pwidthNew,
- int fSorted)
-{
- register DDXPointPtr pptLast;
- int *pwidthNewStart; /* the vengeance of Xerox! */
- register int y, x1, x2;
- register int numRects;
-
- good(prgnDst);
- pptLast = ppt + nspans;
- pwidthNewStart = pwidthNew;
-
- if (!prgnDst->data)
- {
- /* Do special fast code with clip boundaries in registers(?) */
- /* It doesn't pay much to make use of fSorted in this case,
- so we lump everything together. */
-
- register int clipx1, clipx2, clipy1, clipy2;
-
- clipx1 = prgnDst->extents.x1;
- clipy1 = prgnDst->extents.y1;
- clipx2 = prgnDst->extents.x2;
- clipy2 = prgnDst->extents.y2;
-
- for (; ppt != pptLast; ppt++, pwidth++)
- {
- y = ppt->y;
- x1 = ppt->x;
- if (clipy1 <= y && y < clipy2)
- {
- x2 = x1 + *pwidth;
- if (x1 < clipx1) x1 = clipx1;
- if (x2 > clipx2) x2 = clipx2;
- if (x1 < x2)
- {
- /* part of span in clip rectangle */
- pptNew->x = x1;
- pptNew->y = y;
- *pwidthNew = x2 - x1;
- pptNew++;
- pwidthNew++;
- }
- }
- } /* end for */
-
- }
- else if ((numRects = prgnDst->data->numRects))
- {
- /* Have to clip against many boxes */
- BoxPtr pboxBandStart, pboxBandEnd;
- register BoxPtr pbox;
- register BoxPtr pboxLast;
- register int clipy1, clipy2;
-
- /* In this case, taking advantage of sorted spans gains more than
- the sorting costs. */
- if ((! fSorted) && (nspans > 1))
- QuickSortSpans(ppt, pwidth, nspans);
-
- pboxBandStart = REGION_BOXPTR(prgnDst);
- pboxLast = pboxBandStart + numRects;
-
- NextBand();
-
- for (; ppt != pptLast; )
- {
- y = ppt->y;
- if (y < clipy2)
- {
- /* span is in the current band */
- pbox = pboxBandStart;
- x1 = ppt->x;
- x2 = x1 + *pwidth;
- do
- { /* For each box in band */
- register int newx1, newx2;
-
- newx1 = x1;
- newx2 = x2;
- if (newx1 < pbox->x1) newx1 = pbox->x1;
- if (newx2 > pbox->x2) newx2 = pbox->x2;
- if (newx1 < newx2)
- {
- /* Part of span in clip rectangle */
- pptNew->x = newx1;
- pptNew->y = y;
- *pwidthNew = newx2 - newx1;
- pptNew++;
- pwidthNew++;
- }
- pbox++;
- } while (pbox != pboxBandEnd);
- ppt++;
- pwidth++;
- }
- else
- {
- /* Move to next band, adjust ppt as needed */
- pboxBandStart = pboxBandEnd;
- if (pboxBandStart == pboxLast)
- break; /* We're completely done */
- NextBand();
- }
- }
- }
- return (pwidthNew - pwidthNewStart);
-}
-
-/* find the band in a region with the most rectangles */
-int
-miFindMaxBand(prgn)
- RegionPtr prgn;
-{
- register int nbox;
- register BoxPtr pbox;
- register int nThisBand;
- register int nMaxBand = 0;
- short yThisBand;
-
- good(prgn);
- nbox = REGION_NUM_RECTS(prgn);
- pbox = REGION_RECTS(prgn);
-
- while(nbox > 0)
- {
- yThisBand = pbox->y1;
- nThisBand = 0;
- while((nbox > 0) && (pbox->y1 == yThisBand))
- {
- nbox--;
- pbox++;
- nThisBand++;
- }
- if (nThisBand > nMaxBand)
- nMaxBand = nThisBand;
- }
- return (nMaxBand);
-}
diff --git a/nx-X11/programs/Xserver/mi/miscrinit.c b/nx-X11/programs/Xserver/mi/miscrinit.c
index 4950eaa93..addd5dd64 100644
--- a/nx-X11/programs/Xserver/mi/miscrinit.c
+++ b/nx-X11/programs/Xserver/mi/miscrinit.c
@@ -267,31 +267,31 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
/* CreateColormap, DestroyColormap, InstallColormap, UninstallColormap */
/* ListInstalledColormaps, StoreColors, ResolveColor */
#ifdef NEED_SCREEN_REGIONS
- pScreen->RegionCreate = miRegionCreate;
- pScreen->RegionInit = miRegionInit;
- pScreen->RegionCopy = miRegionCopy;
- pScreen->RegionDestroy = miRegionDestroy;
- pScreen->RegionUninit = miRegionUninit;
- pScreen->Intersect = miIntersect;
- pScreen->Union = miUnion;
- pScreen->Subtract = miSubtract;
- pScreen->Inverse = miInverse;
- pScreen->RegionReset = miRegionReset;
- pScreen->TranslateRegion = miTranslateRegion;
- pScreen->RectIn = miRectIn;
- pScreen->PointInRegion = miPointInRegion;
- pScreen->RegionNotEmpty = miRegionNotEmpty;
- pScreen->RegionEqual = miRegionEqual;
- pScreen->RegionBroken = miRegionBroken;
- pScreen->RegionBreak = miRegionBreak;
- pScreen->RegionEmpty = miRegionEmpty;
- pScreen->RegionExtents = miRegionExtents;
- pScreen->RegionAppend = miRegionAppend;
- pScreen->RegionValidate = miRegionValidate;
+ pScreen->RegionCreate = RegionCreate;
+ pScreen->RegionInit = RegionInit;
+ pScreen->RegionCopy = RegionCopy;
+ pScreen->RegionDestroy = RegionDestroy;
+ pScreen->RegionUninit = RegionUninit;
+ pScreen->Intersect = RegionIntersect;
+ pScreen->Union = RegionUnion;
+ pScreen->Subtract = RegionSubtract;
+ pScreen->Inverse = RegionInverse;
+ pScreen->RegionReset = RegionReset;
+ pScreen->TranslateRegion = RegionTranslate;
+ pScreen->RectIn = RegionContainsRect;
+ pScreen->PointInRegion = RegionContainsPoint;
+ pScreen->RegionNotEmpty = RegionNotEmpty;
+ pScreen->RegionEqual = RegionEqual;
+ pScreen->RegionBroken = RegionBroken;
+ pScreen->RegionBreak = RegionBreak;
+ pScreen->RegionEmpty = RegionEmpty;
+ pScreen->RegionExtents = RegionExtents;
+ pScreen->RegionAppend = RegionAppend;
+ pScreen->RegionValidate = RegionValidate;
#endif /* NEED_SCREEN_REGIONS */
/* BitmapToRegion */
#ifdef NEED_SCREEN_REGIONS
- pScreen->RectsToRegion = miRectsToRegion;
+ pScreen->RectsToRegion = RegionFromRects;
#endif /* NEED_SCREEN_REGIONS */
pScreen->SendGraphicsExpose = miSendGraphicsExpose;
pScreen->BlockHandler = (ScreenBlockHandlerProcPtr)NoopDDA;
diff --git a/nx-X11/programs/Xserver/mi/mispans.h b/nx-X11/programs/Xserver/mi/mispans.h
index b6e97e2b4..0db0afc1c 100644
--- a/nx-X11/programs/Xserver/mi/mispans.h
+++ b/nx-X11/programs/Xserver/mi/mispans.h
@@ -101,7 +101,7 @@ extern void miDisposeSpanGroup(
SpanGroup * /*spanGroup*/
);
-extern int miClipSpans(
+extern int RegionClipSpans(
RegionPtr /*prgnDst*/,
DDXPointPtr /*ppt*/,
int * /*pwidth*/,
diff --git a/nx-X11/programs/Xserver/mi/misprite.c b/nx-X11/programs/Xserver/mi/misprite.c
index a5e3f9ccf..c854984fc 100644
--- a/nx-X11/programs/Xserver/mi/misprite.c
+++ b/nx-X11/programs/Xserver/mi/misprite.c
@@ -136,7 +136,7 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
pScreenPriv = (miSpriteScreenPtr) pScreen->devPrivates[miSpriteScreenIndex].ptr;
if (pScreenPriv->isUp &&
- RECT_IN_REGION (pScreen, pRegion, &pScreenPriv->saved) != rgnOUT)
+ RegionContainsRect(pRegion, &pScreenPriv->saved) != rgnOUT)
{
SPRITE_DEBUG(("Damage remove\n"));
miSpriteRemoveCursor (pScreen);
@@ -389,7 +389,7 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
* Damage will take care of destination check
*/
if (pScreenPriv->isUp &&
- RECT_IN_REGION (pScreen, prgnSrc, &pScreenPriv->saved) != rgnOUT)
+ RegionContainsRect(prgnSrc, &pScreenPriv->saved) != rgnOUT)
{
SPRITE_DEBUG (("CopyWindow remove\n"));
miSpriteRemoveCursor (pScreen);
@@ -589,7 +589,7 @@ miSpriteSaveDoomedAreas (pWin, pObscured, dx, dy)
cursorBox.x2 += dx;
cursorBox.y2 += dy;
}
- if (RECT_IN_REGION( pScreen, pObscured, &cursorBox) != rgnOUT)
+ if (RegionContainsRect(pObscured, &cursorBox) != rgnOUT)
miSpriteRemoveCursor (pScreen);
}
diff --git a/nx-X11/programs/Xserver/mi/mivaltree.c b/nx-X11/programs/Xserver/mi/mivaltree.c
index b9a42472f..73028a074 100644
--- a/nx-X11/programs/Xserver/mi/mivaltree.c
+++ b/nx-X11/programs/Xserver/mi/mivaltree.c
@@ -123,8 +123,8 @@ miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
Bool someIn, someOut;
register int t, x1, y1, x2, y2;
- nbox = REGION_NUM_RECTS (bounding);
- boundBox = REGION_RECTS (bounding);
+ nbox = RegionNumRects (bounding);
+ boundBox = RegionRects (bounding);
someIn = someOut = FALSE;
x1 = rect->x1;
y1 = rect->y1;
@@ -148,7 +148,7 @@ miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
box.x2 = box.x1;
if (box.y1 > box.y2)
box.y2 = box.y1;
- switch (RECT_IN_REGION(pScreen, universe, &box))
+ switch (RegionContainsRect(universe, &box))
{
case rgnIN:
if (someOut)
@@ -241,7 +241,7 @@ miComputeClips (
borderSize.y2 = dy;
oldVis = pParent->visibility;
- switch (RECT_IN_REGION( pScreen, universe, &borderSize))
+ switch (RegionContainsRect(universe, &borderSize))
{
case rgnIN:
newVis = VisibilityUnobscured;
@@ -287,7 +287,7 @@ miComputeClips (
{
if (miSetRedirectBorderClipProc)
(*miSetRedirectBorderClipProc) (pParent, universe);
- REGION_COPY(pScreen, universe, &pParent->borderSize);
+ RegionCopy(universe, &pParent->borderSize);
}
#endif
@@ -315,9 +315,9 @@ miComputeClips (
{
if (pChild->visibility != VisibilityFullyObscured)
{
- REGION_TRANSLATE( pScreen, &pChild->borderClip,
+ RegionTranslate(&pChild->borderClip,
dx, dy);
- REGION_TRANSLATE( pScreen, &pChild->clipList,
+ RegionTranslate(&pChild->clipList,
dx, dy);
pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
if (pScreen->ClipNotify)
@@ -326,16 +326,16 @@ miComputeClips (
}
if (pChild->valdata)
{
- REGION_NULL(pScreen,
+ RegionNull(
&pChild->valdata->after.borderExposed);
if (HasParentRelativeBorder(pChild))
{
- REGION_SUBTRACT(pScreen,
+ RegionSubtract(
&pChild->valdata->after.borderExposed,
&pChild->borderClip,
&pChild->winSize);
}
- REGION_NULL(pScreen, &pChild->valdata->after.exposed);
+ RegionNull(&pChild->valdata->after.exposed);
}
if (pChild->firstChild)
{
@@ -364,20 +364,20 @@ miComputeClips (
* We translate the old clipList because that will be exposed or copied
* if gravity is right.
*/
- REGION_TRANSLATE( pScreen, &pParent->borderClip, dx, dy);
- REGION_TRANSLATE( pScreen, &pParent->clipList, dx, dy);
+ RegionTranslate(&pParent->borderClip, dx, dy);
+ RegionTranslate(&pParent->clipList, dx, dy);
}
break;
case VTBroken:
- REGION_EMPTY (pScreen, &pParent->borderClip);
- REGION_EMPTY (pScreen, &pParent->clipList);
+ RegionEmpty(&pParent->borderClip);
+ RegionEmpty(&pParent->clipList);
break;
}
borderVisible = pParent->valdata->before.borderVisible;
resized = pParent->valdata->before.resized;
- REGION_NULL(pScreen, &pParent->valdata->after.borderExposed);
- REGION_NULL(pScreen, &pParent->valdata->after.exposed);
+ RegionNull(&pParent->valdata->after.borderExposed);
+ RegionNull(&pParent->valdata->after.exposed);
/*
* Since the borderClip must not be clipped by the children, we do
@@ -397,22 +397,22 @@ miComputeClips (
* of the border will be saved by DIX in borderVisible --
* use that region and destroy it
*/
- REGION_SUBTRACT( pScreen, exposed, universe, borderVisible);
- REGION_DESTROY( pScreen, borderVisible);
+ RegionSubtract(exposed, universe, borderVisible);
+ RegionDestroy(borderVisible);
}
else
{
- REGION_SUBTRACT( pScreen, exposed, universe, &pParent->borderClip);
+ RegionSubtract(exposed, universe, &pParent->borderClip);
}
if (HasParentRelativeBorder(pParent) && (dx || dy))
- REGION_SUBTRACT( pScreen, &pParent->valdata->after.borderExposed,
+ RegionSubtract(&pParent->valdata->after.borderExposed,
universe,
&pParent->winSize);
else
- REGION_SUBTRACT( pScreen, &pParent->valdata->after.borderExposed,
+ RegionSubtract(&pParent->valdata->after.borderExposed,
exposed, &pParent->winSize);
- REGION_COPY( pScreen, &pParent->borderClip, universe);
+ RegionCopy(&pParent->borderClip, universe);
/*
* To get the right clipList for the parent, and to make doubly sure
@@ -420,15 +420,15 @@ miComputeClips (
* border from the universe before proceeding.
*/
- REGION_INTERSECT( pScreen, universe, universe, &pParent->winSize);
+ RegionIntersect(universe, universe, &pParent->winSize);
}
else
- REGION_COPY( pScreen, &pParent->borderClip, universe);
+ RegionCopy(&pParent->borderClip, universe);
if ((pChild = pParent->firstChild) && pParent->mapped)
{
- REGION_NULL(pScreen, &childUniverse);
- REGION_NULL(pScreen, &childUnion);
+ RegionNull(&childUniverse);
+ RegionNull(&childUnion);
if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
((pChild->drawable.y == pParent->lastChild->drawable.y) &&
(pChild->drawable.x < pParent->lastChild->drawable.x)))
@@ -436,7 +436,7 @@ miComputeClips (
for (; pChild; pChild = pChild->nextSib)
{
if (pChild->viewable)
- REGION_APPEND( pScreen, &childUnion, &pChild->borderSize);
+ RegionAppend(&childUnion, &pChild->borderSize);
}
}
else
@@ -444,10 +444,10 @@ miComputeClips (
for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib)
{
if (pChild->viewable)
- REGION_APPEND( pScreen, &childUnion, &pChild->borderSize);
+ RegionAppend(&childUnion, &pChild->borderSize);
}
}
- REGION_VALIDATE( pScreen, &childUnion, &overlap);
+ RegionValidate(&childUnion, &overlap);
for (pChild = pParent->firstChild;
pChild;
@@ -464,7 +464,7 @@ miComputeClips (
* Figure out the new universe from the child's
* perspective and recurse.
*/
- REGION_INTERSECT( pScreen, &childUniverse,
+ RegionIntersect(&childUniverse,
universe,
&pChild->borderSize);
miComputeClips (pChild, pScreen, &childUniverse, kind,
@@ -476,14 +476,14 @@ miComputeClips (
* other sibling.
*/
if (overlap)
- REGION_SUBTRACT( pScreen, universe, universe,
+ RegionSubtract(universe, universe,
&pChild->borderSize);
}
}
if (!overlap)
- REGION_SUBTRACT( pScreen, universe, universe, &childUnion);
- REGION_UNINIT( pScreen, &childUnion);
- REGION_UNINIT( pScreen, &childUniverse);
+ RegionSubtract(universe, universe, &childUnion);
+ RegionUninit(&childUnion);
+ RegionUninit(&childUniverse);
} /* if any children */
/*
@@ -496,12 +496,12 @@ miComputeClips (
if (oldVis == VisibilityFullyObscured ||
oldVis == VisibilityNotViewable)
{
- REGION_COPY( pScreen, &pParent->valdata->after.exposed, universe);
+ RegionCopy(&pParent->valdata->after.exposed, universe);
}
else if (newVis != VisibilityFullyObscured &&
newVis != VisibilityNotViewable)
{
- REGION_SUBTRACT( pScreen, &pParent->valdata->after.exposed,
+ RegionSubtract(&pParent->valdata->after.exposed,
universe, &pParent->clipList);
}
@@ -513,7 +513,7 @@ miComputeClips (
*/
if (pParent->backStorage && !resized)
{
- REGION_SUBTRACT( pScreen, exposed, &pParent->clipList, universe);
+ RegionSubtract(exposed, &pParent->clipList, universe);
(* pScreen->SaveDoomedAreas)(pParent, exposed, dx, dy);
}
@@ -527,7 +527,7 @@ miComputeClips (
}
#ifdef NOTDEF
- REGION_COPY( pScreen, &pParent->clipList, universe);
+ RegionCopy(&pParent->clipList, universe);
#endif
pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
@@ -622,8 +622,8 @@ miValidateTree (pParent, pChild, kind)
if (pChild == NullWindow)
pChild = pParent->firstChild;
- REGION_NULL(pScreen, &childClip);
- REGION_NULL(pScreen, &exposed);
+ RegionNull(&childClip);
+ RegionNull(&exposed);
/*
* compute the area of the parent window occupied
@@ -631,10 +631,10 @@ miValidateTree (pParent, pChild, kind)
* is the area which can be divied up among the marked
* children in their new configuration.
*/
- REGION_NULL(pScreen, &totalClip);
+ RegionNull(&totalClip);
viewvals = 0;
- if (REGION_BROKEN (pScreen, &pParent->clipList) &&
- !REGION_BROKEN (pScreen, &pParent->borderClip))
+ if (RegionBroken(&pParent->clipList) &&
+ !RegionBroken(&pParent->borderClip))
{
kind = VTBroken;
/*
@@ -642,19 +642,19 @@ miValidateTree (pParent, pChild, kind)
* assume everything is busted.
*/
forward = TRUE;
- REGION_COPY (pScreen, &totalClip, &pParent->borderClip);
- REGION_INTERSECT (pScreen, &totalClip, &totalClip, &pParent->winSize);
+ RegionCopy(&totalClip, &pParent->borderClip);
+ RegionIntersect(&totalClip, &totalClip, &pParent->winSize);
for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib)
{
if (pWin->viewable)
- REGION_SUBTRACT (pScreen, &totalClip, &totalClip, &pWin->borderSize);
+ RegionSubtract(&totalClip, &totalClip, &pWin->borderSize);
}
for (pWin = pChild; pWin; pWin = pWin->nextSib)
if (pWin->valdata && pWin->viewable)
viewvals++;
- REGION_EMPTY (pScreen, &pParent->clipList);
+ RegionEmpty(&pParent->clipList);
}
else
{
@@ -672,7 +672,7 @@ miValidateTree (pParent, pChild, kind)
if (pWin->redirectDraw && miGetRedirectBorderClipProc)
pBorderClip = (*miGetRedirectBorderClipProc)(pWin);
#endif
- REGION_APPEND( pScreen, &totalClip, pBorderClip );
+ RegionAppend(&totalClip, pBorderClip );
if (pWin->viewable)
viewvals++;
}
@@ -691,7 +691,7 @@ miValidateTree (pParent, pChild, kind)
if (pWin->redirectDraw && miGetRedirectBorderClipProc)
pBorderClip = (*miGetRedirectBorderClipProc)(pWin);
#endif
- REGION_APPEND( pScreen, &totalClip, pBorderClip );
+ RegionAppend(&totalClip, pBorderClip );
if (pWin->viewable)
viewvals++;
}
@@ -700,7 +700,7 @@ miValidateTree (pParent, pChild, kind)
pWin = pWin->prevSib;
}
}
- REGION_VALIDATE( pScreen, &totalClip, &overlap);
+ RegionValidate(&totalClip, &overlap);
}
/*
@@ -713,7 +713,7 @@ miValidateTree (pParent, pChild, kind)
overlap = TRUE;
if (kind != VTStack)
{
- REGION_UNION( pScreen, &totalClip, &totalClip, &pParent->clipList);
+ RegionUnion(&totalClip, &totalClip, &pParent->clipList);
if (viewvals > 1)
{
/*
@@ -723,12 +723,12 @@ miValidateTree (pParent, pChild, kind)
* lower than the cost of multiple Subtracts in the
* loop below.
*/
- REGION_NULL(pScreen, &childUnion);
+ RegionNull(&childUnion);
if (forward)
{
for (pWin = pChild; pWin; pWin = pWin->nextSib)
if (pWin->valdata && pWin->viewable)
- REGION_APPEND( pScreen, &childUnion,
+ RegionAppend(&childUnion,
&pWin->borderSize);
}
else
@@ -737,16 +737,16 @@ miValidateTree (pParent, pChild, kind)
while (1)
{
if (pWin->valdata && pWin->viewable)
- REGION_APPEND( pScreen, &childUnion,
+ RegionAppend(&childUnion,
&pWin->borderSize);
if (pWin == pChild)
break;
pWin = pWin->prevSib;
}
}
- REGION_VALIDATE(pScreen, &childUnion, &overlap);
+ RegionValidate(&childUnion, &overlap);
if (overlap)
- REGION_UNINIT(pScreen, &childUnion);
+ RegionUninit(&childUnion);
}
}
@@ -756,13 +756,13 @@ miValidateTree (pParent, pChild, kind)
{
if (pWin->viewable) {
if (pWin->valdata) {
- REGION_INTERSECT( pScreen, &childClip,
+ RegionIntersect(&childClip,
&totalClip,
&pWin->borderSize);
miComputeClips (pWin, pScreen, &childClip, kind, &exposed);
if (overlap)
{
- REGION_SUBTRACT( pScreen, &totalClip,
+ RegionSubtract(&totalClip,
&totalClip,
&pWin->borderSize);
}
@@ -771,24 +771,24 @@ miValidateTree (pParent, pChild, kind)
}
} else {
if (pWin->valdata) {
- REGION_EMPTY( pScreen, &pWin->clipList);
+ RegionEmpty(&pWin->clipList);
if (pScreen->ClipNotify)
(* pScreen->ClipNotify) (pWin, 0, 0);
- REGION_EMPTY( pScreen, &pWin->borderClip);
+ RegionEmpty(&pWin->borderClip);
pWin->valdata = (ValidatePtr)NULL;
}
}
}
- REGION_UNINIT( pScreen, &childClip);
+ RegionUninit(&childClip);
if (!overlap)
{
- REGION_SUBTRACT(pScreen, &totalClip, &totalClip, &childUnion);
- REGION_UNINIT(pScreen, &childUnion);
+ RegionSubtract(&totalClip, &totalClip, &childUnion);
+ RegionUninit(&childUnion);
}
- REGION_NULL(pScreen, &pParent->valdata->after.exposed);
- REGION_NULL(pScreen, &pParent->valdata->after.borderExposed);
+ RegionNull(&pParent->valdata->after.exposed);
+ RegionNull(&pParent->valdata->after.borderExposed);
/*
* each case below is responsible for updating the
@@ -804,22 +804,22 @@ miValidateTree (pParent, pChild, kind)
* exposures and obscures as per miComputeClips and reset the parent's
* clipList.
*/
- REGION_SUBTRACT( pScreen, &pParent->valdata->after.exposed,
+ RegionSubtract(&pParent->valdata->after.exposed,
&totalClip, &pParent->clipList);
/* fall through */
case VTMap:
if (pParent->backStorage) {
- REGION_SUBTRACT( pScreen, &exposed, &pParent->clipList, &totalClip);
+ RegionSubtract(&exposed, &pParent->clipList, &totalClip);
(* pScreen->SaveDoomedAreas)(pParent, &exposed, 0, 0);
}
- REGION_COPY( pScreen, &pParent->clipList, &totalClip);
+ RegionCopy(&pParent->clipList, &totalClip);
pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
break;
}
- REGION_UNINIT( pScreen, &totalClip);
- REGION_UNINIT( pScreen, &exposed);
+ RegionUninit(&totalClip);
+ RegionUninit(&exposed);
if (pScreen->ClipNotify)
(*pScreen->ClipNotify) (pParent, 0, 0);
return (1);
diff --git a/nx-X11/programs/Xserver/mi/miwindow.c b/nx-X11/programs/Xserver/mi/miwindow.c
index 44b7ada60..198f765dd 100644
--- a/nx-X11/programs/Xserver/mi/miwindow.c
+++ b/nx-X11/programs/Xserver/mi/miwindow.c
@@ -114,7 +114,7 @@ miClearToBackground(pWin, x, y, w, h, generateExposures)
box.y2 = y2;
pScreen = pWin->drawable.pScreen;
- REGION_INIT(pScreen, &reg, &box, 1);
+ RegionInit(&reg, &box, 1);
if (pWin->backStorage)
{
/*
@@ -128,14 +128,14 @@ miClearToBackground(pWin, x, y, w, h, generateExposures)
generateExposures);
}
- REGION_INTERSECT(pScreen, &reg, &reg, &pWin->clipList);
+ RegionIntersect(&reg, &reg, &pWin->clipList);
if (generateExposures)
(*pScreen->WindowExposures)(pWin, &reg, pBSReg);
else if (pWin->backgroundState != None)
(*pScreen->PaintWindowBackground)(pWin, &reg, PW_BACKGROUND);
- REGION_UNINIT(pScreen, &reg);
+ RegionUninit(&reg);
if (pBSReg)
- REGION_DESTROY(pScreen, pBSReg);
+ RegionDestroy(pBSReg);
}
/*
@@ -181,7 +181,7 @@ miCheckSubSaveUnder(
for (; pChild != pFirst; pChild = pChild->nextSib)
if (pChild->viewable && pChild->saveUnder)
- REGION_UNION(pScreen, pRegion, pRegion, &pChild->borderSize);
+ RegionUnion(pRegion, pRegion, &pChild->borderSize);
/*
* check region below and including first changed window
@@ -200,10 +200,10 @@ miCheckSubSaveUnder(
{
if (!subInited)
{
- REGION_NULL(pScreen, &SubRegion);
+ RegionNull(&SubRegion);
subInited = TRUE;
}
- REGION_COPY(pScreen, &SubRegion, pRegion);
+ RegionCopy(&SubRegion, pRegion);
res |= miCheckSubSaveUnder(pChild, pChild->firstChild,
&SubRegion);
}
@@ -214,12 +214,12 @@ miCheckSubSaveUnder(
}
if (pChild->saveUnder)
- REGION_UNION(pScreen, pRegion, pRegion, &pChild->borderSize);
+ RegionUnion(pRegion, pRegion, &pChild->borderSize);
}
}
if (subInited)
- REGION_UNINIT(pScreen, &SubRegion);
+ RegionUninit(&SubRegion);
}
/*
@@ -230,8 +230,8 @@ miCheckSubSaveUnder(
if (pParent->viewable &&
((pParent->eventMask | wOtherEventMasks(pParent)) & ExposureMask) &&
- REGION_NOTEMPTY(pScreen, &pParent->borderSize) &&
- RECT_IN_REGION(pScreen, pRegion, REGION_EXTENTS(pScreen,
+ RegionNotEmpty(&pParent->borderSize) &&
+ RegionContainsRect(pRegion, RegionExtents(
&pParent->borderSize)) != rgnOUT)
{
if (!pParent->DIXsaveUnder)
@@ -283,11 +283,11 @@ miChangeSaveUnder(pWin, first)
numSaveUndersViewable += deltaSaveUndersViewable;
deltaSaveUndersViewable = 0;
pScreen = pWin->drawable.pScreen;
- REGION_NULL(pScreen, &rgn);
+ RegionNull(&rgn);
res = miCheckSubSaveUnder (pWin->parent,
pWin->saveUnder ? first : pWin->nextSib,
&rgn);
- REGION_UNINIT(pScreen, &rgn);
+ RegionUninit(&rgn);
return res;
}
@@ -386,9 +386,9 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
{
if (pChild->viewable)
{
- if (REGION_BROKEN (pScreen, &pChild->winSize))
+ if (RegionBroken(&pChild->winSize))
SetWinSize (pChild);
- if (REGION_BROKEN (pScreen, &pChild->borderSize))
+ if (RegionBroken(&pChild->borderSize))
SetBorderSize (pChild);
(* MarkWindow)(pChild);
if (pChild->firstChild)
@@ -408,17 +408,17 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
}
if ( (pChild = pFirst) )
{
- box = REGION_EXTENTS(pChild->drawable.pScreen, &pWin->borderSize);
+ box = RegionExtents(&pWin->borderSize);
pLast = pChild->parent->lastChild;
while (1)
{
if (pChild->viewable)
{
- if (REGION_BROKEN (pScreen, &pChild->winSize))
+ if (RegionBroken(&pChild->winSize))
SetWinSize (pChild);
- if (REGION_BROKEN (pScreen, &pChild->borderSize))
+ if (RegionBroken(&pChild->borderSize))
SetBorderSize (pChild);
- if (RECT_IN_REGION(pScreen, &pChild->borderSize, box))
+ if (RegionContainsRect(&pChild->borderSize, box))
{
(* MarkWindow)(pChild);
anyMarked = TRUE;
@@ -464,13 +464,13 @@ miHandleValidateExposures(pWin)
{
if ( (val = pChild->valdata) )
{
- if (REGION_NOTEMPTY(pScreen, &val->after.borderExposed))
+ if (RegionNotEmpty(&val->after.borderExposed))
(*pChild->drawable.pScreen->PaintWindowBorder)(pChild,
&val->after.borderExposed,
PW_BORDER);
- REGION_UNINIT(pScreen, &val->after.borderExposed);
+ RegionUninit(&val->after.borderExposed);
(*WindowExposures)(pChild, &val->after.exposed, NullRegion);
- REGION_UNINIT(pScreen, &val->after.exposed);
+ RegionUninit(&val->after.exposed);
xfree(val);
pChild->valdata = (ValidatePtr)NULL;
if (pChild->firstChild)
@@ -517,8 +517,8 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
oldpt.y = pWin->drawable.y;
if (WasViewable)
{
- oldRegion = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldRegion, &pWin->borderClip);
+ oldRegion = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion, &pWin->borderClip);
anyMarked = (*pScreen->MarkOverlappedWindows)(pWin, pWin, &pLayerWin);
}
pWin->origin.x = x + (int)bw;
@@ -555,7 +555,7 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
{
(*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, kind);
(* pWin->drawable.pScreen->CopyWindow)(pWin, oldpt, oldRegion);
- REGION_DESTROY(pScreen, oldRegion);
+ RegionDestroy(oldRegion);
/* XXX need to retile border if ParentRelative origin */
(*pScreen->HandleExposures)(pLayerWin->parent);
}
@@ -590,14 +590,14 @@ miRecomputeExposures (
/*
* compute exposed regions of this window
*/
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed,
+ RegionSubtract(&pWin->valdata->after.exposed,
&pWin->clipList, pValid);
/*
* compute exposed regions of the border
*/
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.borderExposed,
+ RegionSubtract(&pWin->valdata->after.borderExposed,
&pWin->borderClip, &pWin->winSize);
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.borderExposed,
+ RegionSubtract(&pWin->valdata->after.borderExposed,
&pWin->valdata->after.borderExposed, pValid);
return WT_WALKCHILDREN;
}
@@ -654,8 +654,8 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
/*
* save the visible region of the window
*/
- oldRegion = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldRegion, &pWin->winSize);
+ oldRegion = RegionCreate(NullBox, 1);
+ RegionCopy(oldRegion, &pWin->winSize);
/*
* categorize child windows into regions to be moved
@@ -668,8 +668,8 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
if (g != UnmapGravity)
{
if (!gravitate[g])
- gravitate[g] = REGION_CREATE(pScreen, NullBox, 1);
- REGION_UNION(pScreen, gravitate[g],
+ gravitate[g] = RegionCreate(NullBox, 1);
+ RegionUnion(gravitate[g],
gravitate[g], &pChild->borderClip);
}
else
@@ -684,8 +684,8 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
oldWinClip = NULL;
if (pWin->bitGravity != ForgetGravity)
{
- oldWinClip = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, oldWinClip, &pWin->clipList);
+ oldWinClip = RegionCreate(NullBox, 1);
+ RegionCopy(oldWinClip, &pWin->clipList);
}
/*
* if the window is changing size, borderExposed
@@ -700,16 +700,16 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
if ((pWin->drawable.height != h || pWin->drawable.width != w) &&
HasBorder (pWin))
{
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
+ borderVisible = RegionCreate(NullBox, 1);
/* for tiled borders, we punt and draw the whole thing */
if (pWin->borderIsPixel || !moved)
{
if (shrunk || moved)
- REGION_SUBTRACT(pScreen, borderVisible,
+ RegionSubtract(borderVisible,
&pWin->borderClip,
&pWin->winSize);
else
- REGION_COPY(pScreen, borderVisible,
+ RegionCopy(borderVisible,
&pWin->borderClip);
}
}
@@ -736,9 +736,9 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
if (WasViewable)
{
- pRegion = REGION_CREATE(pScreen, NullBox, 1);
+ pRegion = RegionCreate(NullBox, 1);
if (pWin->backStorage)
- REGION_COPY(pScreen, pRegion, &pWin->clipList);
+ RegionCopy(pRegion, &pWin->clipList);
if (pLayerWin == pWin)
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pFirstChange,
@@ -766,7 +766,7 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
* the entire window is trashed unless bitGravity
* recovers portions of it
*/
- REGION_COPY(pScreen, &pWin->valdata->after.exposed, &pWin->clipList);
+ RegionCopy(&pWin->valdata->after.exposed, &pWin->clipList);
}
GravityTranslate (x, y, oldx, oldy, dw, dh, pWin->bitGravity, &nx, &ny);
@@ -810,16 +810,16 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
dy = (oldy - ny) - offy;
if (dx || dy)
{
- REGION_TRANSLATE(pScreen, &pWin->winSize, dx, dy);
+ RegionTranslate(&pWin->winSize, dx, dy);
offx += dx;
offy += dy;
}
- REGION_INTERSECT(pScreen, gravitate[g], gravitate[g],
+ RegionIntersect(gravitate[g], gravitate[g],
&pWin->winSize);
}
/* get winSize back where it belongs */
if (offx || offy)
- REGION_TRANSLATE(pScreen, &pWin->winSize, -offx, -offy);
+ RegionTranslate(&pWin->winSize, -offx, -offy);
}
/*
* add screen bits to the appropriate bucket
@@ -830,9 +830,9 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
/*
* clip to new clipList
*/
- REGION_COPY(pScreen, pRegion, oldWinClip);
- REGION_TRANSLATE(pScreen, pRegion, nx - oldx, ny - oldy);
- REGION_INTERSECT(pScreen, oldWinClip, pRegion, &pWin->clipList);
+ RegionCopy(pRegion, oldWinClip);
+ RegionTranslate(pRegion, nx - oldx, ny - oldy);
+ RegionIntersect(oldWinClip, pRegion, &pWin->clipList);
/*
* don't step on any gravity bits which will be copied after this
* region. Note -- this assumes that the regions will be copied
@@ -841,17 +841,17 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
for (g = pWin->bitGravity + 1; g <= StaticGravity; g++)
{
if (gravitate[g])
- REGION_SUBTRACT(pScreen, oldWinClip, oldWinClip,
+ RegionSubtract(oldWinClip, oldWinClip,
gravitate[g]);
}
- REGION_TRANSLATE(pScreen, oldWinClip, oldx - nx, oldy - ny);
+ RegionTranslate(oldWinClip, oldx - nx, oldy - ny);
g = pWin->bitGravity;
if (!gravitate[g])
gravitate[g] = oldWinClip;
else
{
- REGION_UNION(pScreen, gravitate[g], gravitate[g], oldWinClip);
- REGION_DESTROY(pScreen, oldWinClip);
+ RegionUnion(gravitate[g], gravitate[g], oldWinClip);
+ RegionDestroy(oldWinClip);
}
}
@@ -875,14 +875,14 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
/* only copy the remaining useful bits */
- REGION_INTERSECT(pScreen, gravitate[g], gravitate[g], oldRegion);
+ RegionIntersect(gravitate[g], gravitate[g], oldRegion);
/* clip to not overwrite already copied areas */
if (destClip) {
- REGION_TRANSLATE(pScreen, destClip, oldpt.x - x, oldpt.y - y);
- REGION_SUBTRACT(pScreen, gravitate[g], gravitate[g], destClip);
- REGION_TRANSLATE(pScreen, destClip, x - oldpt.x, y - oldpt.y);
+ RegionTranslate(destClip, oldpt.x - x, oldpt.y - y);
+ RegionSubtract(gravitate[g], gravitate[g], destClip);
+ RegionTranslate(destClip, x - oldpt.x, y - oldpt.y);
}
/* and move those bits */
@@ -898,7 +898,7 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
/* remove any overwritten bits from the remaining useful bits */
- REGION_SUBTRACT(pScreen, oldRegion, oldRegion, gravitate[g]);
+ RegionSubtract(oldRegion, oldRegion, gravitate[g]);
/*
* recompute exposed regions of child windows
@@ -908,7 +908,7 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
{
if (pChild->winGravity != g)
continue;
- REGION_INTERSECT(pScreen, pRegion,
+ RegionIntersect(pRegion,
&pChild->borderClip, gravitate[g]);
TraverseTree (pChild, miRecomputeExposures, (void *)pRegion);
}
@@ -919,21 +919,21 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
*/
if (g == pWin->bitGravity)
- REGION_SUBTRACT(pScreen, &pWin->valdata->after.exposed,
+ RegionSubtract(&pWin->valdata->after.exposed,
&pWin->valdata->after.exposed, gravitate[g]);
if (!destClip)
destClip = gravitate[g];
else
{
- REGION_UNION(pScreen, destClip, destClip, gravitate[g]);
- REGION_DESTROY(pScreen, gravitate[g]);
+ RegionUnion(destClip, destClip, gravitate[g]);
+ RegionDestroy(gravitate[g]);
}
}
- REGION_DESTROY(pScreen, oldRegion);
- REGION_DESTROY(pScreen, pRegion);
+ RegionDestroy(oldRegion);
+ RegionDestroy(pRegion);
if (destClip)
- REGION_DESTROY(pScreen, destClip);
+ RegionDestroy(destClip);
if (bsExposed)
{
RegionPtr valExposed = NullRegion;
@@ -942,8 +942,8 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
valExposed = &pWin->valdata->after.exposed;
(*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
if (valExposed)
- REGION_EMPTY(pScreen, valExposed);
- REGION_DESTROY(pScreen, bsExposed);
+ RegionEmpty(valExposed);
+ RegionDestroy(bsExposed);
}
if (anyMarked)
(*pScreen->HandleExposures)(pLayerWin->parent);
@@ -960,7 +960,7 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
else if (bsExposed)
{
(*pScreen->WindowExposures) (pWin, NullRegion, bsExposed);
- REGION_DESTROY(pScreen, bsExposed);
+ RegionDestroy(bsExposed);
}
if (pWin->realized)
WindowsRestructured ();
@@ -1004,8 +1004,8 @@ miSetShape(pWin)
{
RegionPtr borderVisible;
- borderVisible = REGION_CREATE(pScreen, NullBox, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
+ borderVisible = RegionCreate(NullBox, 1);
+ RegionSubtract(borderVisible,
&pWin->borderClip, &pWin->winSize);
pWin->valdata->before.borderVisible = borderVisible;
}
@@ -1022,8 +1022,8 @@ miSetShape(pWin)
{
if (pWin->backStorage)
{
- pOldClip = REGION_CREATE(pScreen, NullBox, 1);
- REGION_COPY(pScreen, pOldClip, &pWin->clipList);
+ pOldClip = RegionCreate(NullBox, 1);
+ RegionCopy(pOldClip, &pWin->clipList);
}
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
@@ -1049,7 +1049,7 @@ miSetShape(pWin)
(pWin, 0, 0, pOldClip,
pWin->drawable.x, pWin->drawable.y);
if (WasViewable)
- REGION_DESTROY(pScreen, pOldClip);
+ RegionDestroy(pOldClip);
if (bsExposed)
{
RegionPtr valExposed = NullRegion;
@@ -1058,8 +1058,8 @@ miSetShape(pWin)
valExposed = &pWin->valdata->after.exposed;
(*pScreen->WindowExposures) (pWin, valExposed, bsExposed);
if (valExposed)
- REGION_EMPTY(pScreen, valExposed);
- REGION_DESTROY(pScreen, bsExposed);
+ RegionEmpty(valExposed);
+ RegionDestroy(bsExposed);
}
}
if (WasViewable)
@@ -1120,8 +1120,8 @@ miChangeBorderWidth(pWin, width)
if (pWin->valdata && HadBorder)
{
RegionPtr borderVisible;
- borderVisible = REGION_CREATE(pScreen, NULL, 1);
- REGION_SUBTRACT(pScreen, borderVisible,
+ borderVisible = RegionCreate(NULL, 1);
+ RegionSubtract(borderVisible,
&pWin->borderClip, &pWin->winSize);
pWin->valdata->before.borderVisible = borderVisible;
}
@@ -1158,10 +1158,10 @@ miMarkUnrealizedWindow(pChild, pWin, fromConfigure)
{
if ((pChild != pWin) || fromConfigure)
{
- REGION_EMPTY(pChild->drawable.pScreen, &pChild->clipList);
+ RegionEmpty(&pChild->clipList);
if (pChild->drawable.pScreen->ClipNotify)
(* pChild->drawable.pScreen->ClipNotify)(pChild, 0, 0);
- REGION_EMPTY(pChild->drawable.pScreen, &pChild->borderClip);
+ RegionEmpty(&pChild->borderClip);
}
}
@@ -1176,7 +1176,7 @@ miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth)
for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib)
{
if (pChild->drawable.depth == depth)
- REGION_UNION(pScreen, pReg, pReg, &pChild->borderClip);
+ RegionUnion(pReg, pReg, &pChild->borderClip);
if (pChild->firstChild)
miSegregateChildren(pChild, pReg, depth);