From eaa19eb55ca9cf513e274a5775ea23d993448263 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 16 Mar 2016 08:05:01 +0100 Subject: NXwindow.c: Don't set w and h, not used later on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warnings: ``` NXwindow.c: In function ‘nxagentClearSplash’: NXwindow.c:342:12: warning: variable ‘h’ set but not used [-Wunused-but-set-variable] int w, h; ^ NXwindow.c:342:9: warning: variable ‘w’ set but not used [-Wunused-but-set-variable] int w, h; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 4552ad563..013f26e28 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -339,12 +339,8 @@ SetWindowToDefaults(register WindowPtr pWin) void nxagentClearSplash(WindowPtr pW) { - int w, h; ScreenPtr pScreen; - w = pW->drawable.width; - h = pW->drawable.height; - pScreen = pW->drawable.pScreen; if (pW->backgroundState == BackgroundPixmap) -- cgit v1.2.3 From 101c895e6a0d1f9a91878043ad2684971efaebdf Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 16 Mar 2016 11:08:49 +0100 Subject: fix-patch-whitepspace: Copy script from X.Org's xserver Git repo. --- fix-patch-whitespace | 4 ++++ 1 file changed, 4 insertions(+) create mode 100755 fix-patch-whitespace diff --git a/fix-patch-whitespace b/fix-patch-whitespace new file mode 100755 index 000000000..2d06d8ea8 --- /dev/null +++ b/fix-patch-whitespace @@ -0,0 +1,4 @@ +#!/bin/sh +git diff --check | +sed -n 's!^\([^:]*\):\([^:]*\):.*!sed -i "\2 s/[ \t]*$//; \2 s/ *\t/\t/g" \1!p' | +sh -- cgit v1.2.3 From 28ba877803d8383eac282b873b8e0bb50c8db46b Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 4 Mar 2016 16:12:12 +0100 Subject: gcc: Build using -std=c99 instead of -ansi. --- nx-X11/config/cf/xorg.cf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/config/cf/xorg.cf b/nx-X11/config/cf/xorg.cf index 8e2604c4a..a6eaddc72 100644 --- a/nx-X11/config/cf/xorg.cf +++ b/nx-X11/config/cf/xorg.cf @@ -786,9 +786,9 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese # endif # ifndef DefaultCCOptions # if defined(UseInstalled) -# define DefaultCCOptions /* -ansi */ +# define DefaultCCOptions /* -std=c99 */ # else -# define DefaultCCOptions -ansi GccWarningOptions +# define DefaultCCOptions -std=c99 GccWarningOptions # endif # endif # if defined(UseInstalled) -- cgit v1.2.3 From 63f1fff8fe1e7f94ebc0a72df773c6f77531f7a4 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 16 Mar 2016 11:11:43 +0100 Subject: Rename region macros to eliminate screen argument This is a huge mechanical patch and a few small fixups required to finish the job. They were reviewed separately, but because the server does not build without both pieces, I've merged them together at this time. The mechanical changes were performed by running the included 'fix-region' script over the whole nx-X11/programs/Xserver tree: $ cd nx-X11/programs/Xserver && ( git ls-files | grep -v '^fix-' | xargs ./fix-region; ) And then, the white space errors in the resulting patch were fixed using the provided fix-patch-whitespace script. $ sh ./fix-patch-whitespace Thanks to Jamey Sharp for the mighty fine sed-generating sed script. v1: Keith Packard (X.Org xserver commit: 2dc138922b7588515d5f2447e4b9dcdc0bef15e0) v2: Mike Gabriel (apply fix-region script to nx-libs) --- nx-X11/programs/Xserver/Xext/mbuf.c | 20 +- nx-X11/programs/Xserver/Xext/mbufbf.c | 78 ++--- nx-X11/programs/Xserver/Xext/mbufpx.c | 26 +- nx-X11/programs/Xserver/Xext/panoramiX.c | 34 +- nx-X11/programs/Xserver/Xext/panoramiXprocs.c | 24 +- nx-X11/programs/Xserver/Xext/security.c | 14 +- nx-X11/programs/Xserver/Xext/shape.c | 48 +-- nx-X11/programs/Xserver/Xext/xtest.c | 4 +- nx-X11/programs/Xserver/composite/compalloc.c | 6 +- nx-X11/programs/Xserver/composite/compext.c | 2 +- nx-X11/programs/Xserver/composite/compwindow.c | 42 +-- nx-X11/programs/Xserver/damageext/damageext.c | 8 +- nx-X11/programs/Xserver/dix/dispatch.c | 12 +- nx-X11/programs/Xserver/dix/events.c | 62 ++-- nx-X11/programs/Xserver/dix/window.c | 112 +++---- nx-X11/programs/Xserver/fb/fb.h | 2 +- nx-X11/programs/Xserver/fb/fb24_32.c | 8 +- nx-X11/programs/Xserver/fb/fbarc.c | 2 +- nx-X11/programs/Xserver/fb/fbbits.h | 4 +- nx-X11/programs/Xserver/fb/fbbstore.c | 8 +- nx-X11/programs/Xserver/fb/fbcompose.c | 36 +- nx-X11/programs/Xserver/fb/fbcopy.c | 26 +- nx-X11/programs/Xserver/fb/fbfill.c | 2 +- nx-X11/programs/Xserver/fb/fbfillrect.c | 6 +- nx-X11/programs/Xserver/fb/fbfillsp.c | 6 +- nx-X11/programs/Xserver/fb/fbgc.c | 2 +- nx-X11/programs/Xserver/fb/fbglyph.c | 4 +- nx-X11/programs/Xserver/fb/fbimage.c | 8 +- nx-X11/programs/Xserver/fb/fbline.c | 4 +- nx-X11/programs/Xserver/fb/fboverlay.c | 42 +-- nx-X11/programs/Xserver/fb/fbpict.c | 6 +- nx-X11/programs/Xserver/fb/fbpixmap.c | 10 +- nx-X11/programs/Xserver/fb/fbpoint.c | 2 +- nx-X11/programs/Xserver/fb/fbpseudocolor.c | 130 ++++---- nx-X11/programs/Xserver/fb/fbpush.c | 4 +- nx-X11/programs/Xserver/fb/fbseg.c | 4 +- nx-X11/programs/Xserver/fb/fbsetsp.c | 4 +- nx-X11/programs/Xserver/fb/fbwindow.c | 18 +- nx-X11/programs/Xserver/fix-region | 40 +++ nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 232 ++++++------- nx-X11/programs/Xserver/hw/nxagent/Drawable.h | 8 +- nx-X11/programs/Xserver/hw/nxagent/Events.c | 74 ++--- nx-X11/programs/Xserver/hw/nxagent/GC.c | 44 +-- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 68 ++-- nx-X11/programs/Xserver/hw/nxagent/Image.c | 4 +- nx-X11/programs/Xserver/hw/nxagent/NXdamage.c | 86 ++--- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 12 +- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 62 ++-- nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c | 114 +++---- nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c | 156 ++++----- nx-X11/programs/Xserver/hw/nxagent/NXpicture.c | 18 +- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 112 +++---- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 10 +- nx-X11/programs/Xserver/hw/nxagent/Render.c | 18 +- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 118 +++---- nx-X11/programs/Xserver/hw/nxagent/Split.c | 14 +- nx-X11/programs/Xserver/hw/nxagent/Window.c | 124 +++---- nx-X11/programs/Xserver/include/regionstr.h | 114 +++---- nx-X11/programs/Xserver/mi/mibank.c | 92 ++--- nx-X11/programs/Xserver/mi/mibitblt.c | 32 +- nx-X11/programs/Xserver/mi/mibstore.c | 288 ++++++++-------- nx-X11/programs/Xserver/mi/miexpose.c | 112 +++---- nx-X11/programs/Xserver/mi/migc.c | 44 +-- nx-X11/programs/Xserver/mi/mioverlay.c | 424 ++++++++++++------------ nx-X11/programs/Xserver/mi/miregion.c | 154 ++++----- nx-X11/programs/Xserver/mi/misprite.c | 6 +- nx-X11/programs/Xserver/mi/mivaltree.c | 140 ++++---- nx-X11/programs/Xserver/mi/miwindow.c | 154 ++++----- nx-X11/programs/Xserver/miext/cw/cw.c | 30 +- nx-X11/programs/Xserver/miext/cw/cw_ops.c | 4 +- nx-X11/programs/Xserver/miext/damage/damage.c | 86 ++--- nx-X11/programs/Xserver/render/mipict.c | 80 ++--- nx-X11/programs/Xserver/render/mirect.c | 4 +- nx-X11/programs/Xserver/render/picture.c | 18 +- nx-X11/programs/Xserver/xfixes/region.c | 60 ++-- nx-X11/programs/Xserver/xkb/ddxFakeMtn.c | 8 +- 76 files changed, 2017 insertions(+), 1977 deletions(-) create mode 100755 nx-X11/programs/Xserver/fix-region diff --git a/nx-X11/programs/Xserver/Xext/mbuf.c b/nx-X11/programs/Xserver/Xext/mbuf.c index e6dec8f6f..5379f2656 100644 --- a/nx-X11/programs/Xserver/Xext/mbuf.c +++ b/nx-X11/programs/Xserver/Xext/mbuf.c @@ -903,9 +903,9 @@ ProcClearImageBufferArea (client) box.y1 = clearRect.y; box.x2 = clearRect.x + clearRect.width; box.y2 = clearRect.y + clearRect.height; - REGION_INIT(pScreen, ®ion, &box, 1); + RegionInit(®ion, &box, 1); MultibufferExpose(pMultibuffer, ®ion); - REGION_UNINIT(pScreen, ®ion); + RegionUninit(®ion); } return Success; } @@ -1202,13 +1202,13 @@ PerformDisplayRequest (ppMultibuffers, pMultibuffer, nbuf) * window-relative so that region ops involving * pExposed and pWinSize behave sensibly. */ - REGION_TRANSLATE(pWin->drawable.pScreen, pWinSize, + RegionTranslate(pWinSize, -pWin->drawable.x, -pWin->drawable.y); - REGION_INTERSECT(pWin->drawable.pScreen, pExposed, + RegionIntersect(pExposed, pExposed, pWinSize); - REGION_DESTROY(pWin->drawable.pScreen, pWinSize); + RegionDestroy(pWinSize); MultibufferExpose (pPrevMultibuffer, pExposed); - REGION_DESTROY(pWin->drawable.pScreen, pExposed); + RegionDestroy(pExposed); } graphicsExpose = FALSE; DoChangeGC (pGC, GCGraphicsExposures, &graphicsExpose, FALSE); @@ -1371,7 +1371,7 @@ MultibufferExpose (pMultibuffer, pRegion) MultibufferPtr pMultibuffer; RegionPtr pRegion; { - if (pRegion && !REGION_NIL(pRegion)) + if (pRegion && !RegionNil(pRegion)) { xEvent *pEvent; PixmapPtr pPixmap; @@ -1381,11 +1381,11 @@ MultibufferExpose (pMultibuffer, pRegion) int numRects; pPixmap = pMultibuffer->pPixmap; - REGION_TRANSLATE(pPixmap->drawable.pScreen, pRegion, + RegionTranslate(pRegion, -pPixmap->drawable.x, -pPixmap->drawable.y); /* XXX MultibufferExpose "knows" the region representation */ - numRects = REGION_NUM_RECTS(pRegion); - pBox = REGION_RECTS(pRegion); + numRects = RegionNumRects(pRegion); + pBox = RegionRects(pRegion); pEvent = (xEvent *) ALLOCATE_LOCAL(numRects * sizeof(xEvent)); if (pEvent) { diff --git a/nx-X11/programs/Xserver/Xext/mbufbf.c b/nx-X11/programs/Xserver/Xext/mbufbf.c index 318fa6756..359fb63aa 100644 --- a/nx-X11/programs/Xserver/Xext/mbufbf.c +++ b/nx-X11/programs/Xserver/Xext/mbufbf.c @@ -245,9 +245,9 @@ bufMultibufferInit(pScreen, pMBScreen) box.y2 = pScreen->height; pMBPriv->rgnChanged = TRUE; - REGION_INIT(pScreen, &pMBPriv->backBuffer, &box, 1); - REGION_INIT(pScreen, &pMBPriv->subtractRgn, &box, 1); - REGION_NULL(pScreen, &pMBPriv->unionRgn); + RegionInit(&pMBPriv->backBuffer, &box, 1); + RegionInit(&pMBPriv->subtractRgn, &box, 1); + RegionNull(&pMBPriv->unionRgn); /* Misc functions */ pMBPriv->CopyBufferBits = bufCopyBufferBitsFunc[pScreen->myNum]; @@ -374,10 +374,10 @@ bufCreateImageBuffers (pWin, nbuf, ids, action, hint) pMBScreen = MB_SCREEN_PRIV(pScreen); pMBWindow = MB_WINDOW_PRIV(pWin); - pMBWindow->devPrivate.ptr = (void *) REGION_CREATE(pScreen, 0,0); + pMBWindow->devPrivate.ptr = (void *) RegionCreate(0,0); if (!pMBWindow->devPrivate.ptr) return(0); - REGION_COPY(pScreen, (RegionPtr) pMBWindow->devPrivate.ptr, + RegionCopy((RegionPtr) pMBWindow->devPrivate.ptr, &pWin->clipList); for (i = 0; i < nbuf; i++) @@ -429,7 +429,7 @@ bufDestroyImageBuffers(pWin) if (pWin->realized && (pMBWindow->displayedMultibuffer == BACK_BUFFER)) { (* pMBPriv->CopyBufferBits)(pMBWindow, BACK_BUFFER, FRONT_BUFFER); - REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer, + RegionSubtract(&pMBPriv->backBuffer, &pMBPriv->backBuffer, &pWin->clipList); (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane, &pWin->clipList, FRONT_BUFFER); @@ -439,7 +439,7 @@ bufDestroyImageBuffers(pWin) pWin->devPrivates[frameWindowPrivateIndex] = pMBPriv->frameBuffer[FRONT_BUFFER]; - REGION_DESTROY(pScreen, (RegionPtr) pMBWindow->devPrivate.ptr); + RegionDestroy((RegionPtr) pMBWindow->devPrivate.ptr); pMBWindow->devPrivate.ptr = NULL; } } @@ -506,7 +506,7 @@ bufClearImageBufferArea(pMBBuffer, x,y, w,h, generateExposures) box.y2 = y2; pScreen = pBuffer->drawable.pScreen; - REGION_INIT(pScreen, ®, &box, 1); + RegionInit(®, &box, 1); if (pBuffer->backStorage) { /* @@ -520,7 +520,7 @@ bufClearImageBufferArea(pMBBuffer, x,y, w,h, generateExposures) generateExposures); } - REGION_INTERSECT(pScreen, ®, ®, &pBuffer->clipList); + RegionIntersect(®, ®, &pBuffer->clipList); if (pBuffer->backgroundState != None) (*pScreen->PaintWindowBackground)(pBuffer, ®, PW_BACKGROUND); if (generateExposures) @@ -537,9 +537,9 @@ bufClearImageBufferArea(pMBBuffer, x,y, w,h, generateExposures) else if (pBuffer->backgroundState != None) (*pScreen->PaintWindowBackground)(pBuffer, ®, PW_BACKGROUND); #endif - REGION_UNINIT(pScreen, ®); + RegionUninit(®); if (pBSReg) - REGION_DESTROY(pScreen, pBSReg); + RegionDestroy(pBSReg); } static void @@ -567,9 +567,9 @@ bufResetProc(pScreen) * whoever called RegisterDoubleBufferHardware */ - REGION_UNINIT(pScreen, &pMBPriv->backBuffer); - REGION_UNINIT(pScreen, &pMBPriv->subtractRgn); - REGION_UNINIT(pScreen, &pMBPriv->unionRgn); + RegionUninit(&pMBPriv->backBuffer); + RegionUninit(&pMBPriv->subtractRgn); + RegionUninit(&pMBPriv->unionRgn); xfree(pMBPriv); } @@ -624,7 +624,7 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum) int numRects; XID value; - if (REGION_NUM_RECTS(prgn) == 0) + if (RegionNumRects(prgn) == 0) return; pDrawable = (DrawablePtr) selectPlane.ptr; @@ -632,7 +632,7 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum) if (!pGC) return; - prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) * + prect = (xRectangle *)ALLOCATE_LOCAL(RegionNumRects(prgn) * sizeof(xRectangle)); if (!prect) { @@ -644,8 +644,8 @@ bufDrawSelectPlane(pScreen, selectPlane, prgn, bufferNum) DoChangeGC(pGC, GCForeground, &value, 0); ValidateGC(pDrawable, 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; @@ -697,10 +697,10 @@ bufDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf) &pWin->clipList, number); if (number == BACK_BUFFER) - REGION_UNION(pScreen, backBuffer, backBuffer, + RegionUnion(backBuffer, backBuffer, &pWin->clipList); else - REGION_SUBTRACT(pScreen, backBuffer, backBuffer, + RegionSubtract(backBuffer, backBuffer, &pWin->clipList); /* Switch which framebuffer the window draws into */ @@ -764,36 +764,36 @@ bufPostValidateTree(pParent, pChild, kind) pSubtractRgn = &pMBPriv->subtractRgn; pUnionRgn = &pMBPriv->unionRgn; - REGION_VALIDATE(pScreen, pSubtractRgn, &overlap); + RegionValidate(pSubtractRgn, &overlap); #ifdef DEBUG if (overlap) FatalError("bufPostValidateTree: subtractRgn overlaps"); #endif - REGION_VALIDATE(pScreen, pUnionRgn, &overlap); + RegionValidate(pUnionRgn, &overlap); #ifdef DEBUG if (overlap) FatalError("bufPostValidateTree: unionRgn overlaps"); #endif /* Update backBuffer: subtract must come before union */ - REGION_SUBTRACT(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer, + RegionSubtract(&pMBPriv->backBuffer, &pMBPriv->backBuffer, pSubtractRgn); - REGION_UNION(pScreen, &pMBPriv->backBuffer, &pMBPriv->backBuffer, + RegionUnion(&pMBPriv->backBuffer, &pMBPriv->backBuffer, pUnionRgn); /* Paint gained and lost backbuffer areas in select plane */ - REGION_NULL(pScreen, &exposed); - REGION_SUBTRACT(pScreen, &exposed, pSubtractRgn, pUnionRgn); + RegionNull(&exposed); + RegionSubtract(&exposed, pSubtractRgn, pUnionRgn); (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane, &exposed, FRONT_BUFFER); - REGION_SUBTRACT(pScreen, &exposed, pUnionRgn, pSubtractRgn); + RegionSubtract(&exposed, pUnionRgn, pSubtractRgn); (* pMBPriv->DrawSelectPlane)(pScreen, pMBPriv->selectPlane, &exposed, BACK_BUFFER); - REGION_UNINIT(pScreen, &exposed); - REGION_EMPTY(pScreen, pSubtractRgn); - REGION_EMPTY(pScreen, pUnionRgn); + RegionUninit(&exposed); + RegionEmpty(pSubtractRgn); + RegionEmpty(pUnionRgn); } } @@ -826,16 +826,16 @@ bufClipNotify(pWin, dx,dy) { RegionPtr pOldClipList = (RegionPtr) pMBWindow->devPrivate.ptr; - if (! REGION_EQUAL(pScreen, pOldClipList, &pWin->clipList)) + if (! RegionEqual(pOldClipList, &pWin->clipList)) { if (pMBWindow->displayedMultibuffer == BACK_BUFFER) { pMBPriv->rgnChanged = TRUE; - REGION_APPEND(pScreen, &pMBPriv->subtractRgn, pOldClipList); - REGION_APPEND(pScreen, &pMBPriv->unionRgn, &pWin->clipList); + RegionAppend(&pMBPriv->subtractRgn, pOldClipList); + RegionAppend(&pMBPriv->unionRgn, &pWin->clipList); } - REGION_COPY(pScreen, pOldClipList,&pWin->clipList); + RegionCopy(pOldClipList,&pWin->clipList); } /* Update buffer x,y,w,h, and clipList */ @@ -912,13 +912,13 @@ bufWindowExposures(pWin, prgn, other_exposed) handleBuffers = (!pMBPriv->inClearToBackground) && (pWin->drawable.type == DRAWABLE_WINDOW) && - pMBWindow && (prgn && !REGION_NIL(prgn)); + pMBWindow && (prgn && !RegionNil(prgn)); /* miWindowExposures munges prgn and other_exposed. */ if (handleBuffers) { - REGION_NULL(pScreen, &tmp_rgn); - REGION_COPY(pScreen, &tmp_rgn, prgn); + RegionNull(&tmp_rgn); + RegionCopy(&tmp_rgn, prgn); } UNWRAP_SCREEN_FUNC(pScreen, pMBPriv, void, WindowExposures); @@ -950,7 +950,7 @@ bufWindowExposures(pWin, prgn, other_exposed) MultibufferExpose(pMBBuffer, &tmp_rgn); } - REGION_UNINIT(pScreen, &tmp_rgn); + RegionUninit(&tmp_rgn); } /* @@ -1018,7 +1018,7 @@ bufCopyWindow(pWin, ptOldOrg, prgnSrc) */ /* CopyWindow translates prgnSrc... translate it back for 2nd call. */ - REGION_TRANSLATE(pScreen, prgnSrc, + RegionTranslate(prgnSrc, ptOldOrg.x - pWin->drawable.x, ptOldOrg.y - pWin->drawable.y); pwinroot->devPrivates[frameWindowPrivateIndex] = diff --git a/nx-X11/programs/Xserver/Xext/mbufpx.c b/nx-X11/programs/Xserver/Xext/mbufpx.c index 0e9ae1628..3d28d3ff3 100644 --- a/nx-X11/programs/Xserver/Xext/mbufpx.c +++ b/nx-X11/programs/Xserver/Xext/mbufpx.c @@ -262,8 +262,8 @@ MultibufferPaintBackgroundRegion(pWin, pDrawable, pRegion) RegionPtr pRegion; { xRectangle *pRects; - int nrects = REGION_NUM_RECTS(pRegion); - BoxPtr pbox = REGION_RECTS(pRegion); + int nrects = RegionNumRects(pRegion); + BoxPtr pbox = RegionRects(pRegion); pRects = (xRectangle *)ALLOCATE_LOCAL(nrects * sizeof(xRectangle)); if (pRects) @@ -390,13 +390,13 @@ pixDisplayImageBuffers(pScreen, ppMBWindow, ppMBBuffer, nbuf) * window-relative so that region ops involving * pExposed and pWinSize behave sensibly. */ - REGION_TRANSLATE(pScreen, pWinSize, + RegionTranslate(pWinSize, -pWin->drawable.x, -pWin->drawable.y); - REGION_INTERSECT(pScreen, pExposed, pExposed, pWinSize); - REGION_DESTROY(pScreen, pWinSize); + RegionIntersect(pExposed, pExposed, pWinSize); + RegionDestroy(pWinSize); MultibufferExpose (pPrevMBBuffer, pExposed); - REGION_DESTROY(pScreen, pExposed); + RegionDestroy(pExposed); } bool = FALSE; DoChangeGC (pGC, GCGraphicsExposures, &bool, FALSE); @@ -522,7 +522,7 @@ pixPositionWindow (pWin, x, y) box.x1 = box.y1 = 0; box.x2 = width; box.y2 = height; - REGION_INIT(pScreen, &exposedRegion, &box, 1); + RegionInit(&exposedRegion, &box, 1); if (pWin->bitGravity != ForgetGravity) { RegionRec preservedRegion; @@ -530,9 +530,9 @@ pixPositionWindow (pWin, x, y) box.y1 = desty; box.x2 = destx + savewidth; box.y2 = desty + saveheight; - REGION_INIT(pScreen, &preservedRegion, &box, 1); - REGION_SUBTRACT(pScreen, &exposedRegion, &exposedRegion, &preservedRegion); - REGION_UNINIT(pScreen, &preservedRegion); + RegionInit(&preservedRegion, &box, 1); + RegionSubtract(&exposedRegion, &exposedRegion, &preservedRegion); + RegionUninit(&preservedRegion); } } /* end if (clear) */ @@ -575,7 +575,7 @@ pixPositionWindow (pWin, x, y) } FreeScratchGC (pGC); if (clear) - REGION_UNINIT(pScreen, &exposedRegion); + RegionUninit(&exposedRegion); return TRUE; } @@ -628,7 +628,7 @@ pixClearImageBufferArea(pMBBuffer, x,y, width,height, exposures) if (box.x2 > w_width) box.x2 = w_width; if (box.y2 > w_height) box.y2 = w_height; - REGION_INIT(pScreen, ®ion, &box, 1); + RegionInit(®ion, &box, 1); if (pMBBuffer->number == pMBBuffer->pMBWindow->displayedMultibuffer) pDrawable = (DrawablePtr) pWin; @@ -640,7 +640,7 @@ pixClearImageBufferArea(pMBBuffer, x,y, width,height, exposures) if (exposures) MultibufferExpose(pMBBuffer, ®ion); - REGION_UNINIT(pScreen, ®ion); + RegionUninit(®ion); } static void diff --git a/nx-X11/programs/Xserver/Xext/panoramiX.c b/nx-X11/programs/Xserver/Xext/panoramiX.c index 000c4bf04..2671ba0d3 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiX.c +++ b/nx-X11/programs/Xserver/Xext/panoramiX.c @@ -161,9 +161,9 @@ XineramaCloseScreen (int i, ScreenPtr pScreen) pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->CreateGC = pScreenPriv->CreateGC; - REGION_UNINIT(pScreen, &XineramaScreenRegions[pScreen->myNum]); + RegionUninit(&XineramaScreenRegions[pScreen->myNum]); if (pScreen->myNum == 0) - REGION_UNINIT(pScreen, &PanoramiXScreenRegion); + RegionUninit(&PanoramiXScreenRegion); xfree ((void *) pScreenPriv); @@ -434,7 +434,7 @@ static void XineramaInitData(ScreenPtr pScreen) { int i, w, h; - REGION_NULL(pScreen, &PanoramiXScreenRegion) + RegionNull(&PanoramiXScreenRegion); for (i = 0; i < PanoramiXNumScreens; i++) { BoxRec TheBox; @@ -450,8 +450,8 @@ static void XineramaInitData(ScreenPtr pScreen) TheBox.y1 = panoramiXdataPtr[i].y; TheBox.y2 = TheBox.y1 + panoramiXdataPtr[i].height; - REGION_INIT(pScreen, &XineramaScreenRegions[i], &TheBox, 1); - REGION_UNION(pScreen, &PanoramiXScreenRegion, &PanoramiXScreenRegion, + RegionInit(&XineramaScreenRegions[i], &TheBox, 1); + RegionUnion(&PanoramiXScreenRegion, &PanoramiXScreenRegion, &XineramaScreenRegions[i]); } @@ -473,9 +473,9 @@ void XineramaReinitData(ScreenPtr pScreen) { int i; - REGION_UNINIT(pScreen, &PanoramiXScreenRegion); + RegionUninit(&PanoramiXScreenRegion); for (i = 0; i < PanoramiXNumScreens; i++) - REGION_UNINIT(pScreen, &XineramaScreenRegions[i]); + RegionUninit(&XineramaScreenRegions[i]); XineramaInitData(pScreen); } @@ -1182,15 +1182,15 @@ XineramaGetImageData( SrcBox.x2 = SrcBox.x1 + width; SrcBox.y2 = SrcBox.y1 + height; - REGION_INIT(pScreen, &SrcRegion, &SrcBox, 1); - REGION_NULL(pScreen, &GrabRegion); + RegionInit(&SrcRegion, &SrcBox, 1); + RegionNull(&GrabRegion); depth = (format == XYPixmap) ? 1 : pDraw->depth; for(i = 0; i < PanoramiXNumScreens; i++) { pDraw = pDrawables[i]; - inOut = RECT_IN_REGION(pScreen,&XineramaScreenRegions[i],&SrcBox); + inOut = RegionContainsRect(&XineramaScreenRegions[i],&SrcBox); if(inOut == rgnIN) { (*pDraw->pScreen->GetImage)(pDraw, @@ -1201,13 +1201,13 @@ XineramaGetImageData( } else if (inOut == rgnOUT) continue; - REGION_INTERSECT(pScreen, &GrabRegion, &SrcRegion, + RegionIntersect(&GrabRegion, &SrcRegion, &XineramaScreenRegions[i]); - nbox = REGION_NUM_RECTS(&GrabRegion); + nbox = RegionNumRects(&GrabRegion); if(nbox) { - pbox = REGION_RECTS(&GrabRegion); + pbox = RegionRects(&GrabRegion); while(nbox--) { w = pbox->x2 - pbox->x1; @@ -1284,8 +1284,8 @@ XineramaGetImageData( pbox++; } - REGION_SUBTRACT(pScreen, &SrcRegion, &SrcRegion, &GrabRegion); - if(!REGION_NOTEMPTY(pScreen, &SrcRegion)) + RegionSubtract(&SrcRegion, &SrcRegion, &GrabRegion); + if(!RegionNotEmpty(&SrcRegion)) break; } @@ -1294,6 +1294,6 @@ XineramaGetImageData( if(ScratchMem) xfree(ScratchMem); - REGION_UNINIT(pScreen, &SrcRegion); - REGION_UNINIT(pScreen, &GrabRegion); + RegionUninit(&SrcRegion); + RegionUninit(&GrabRegion); } diff --git a/nx-X11/programs/Xserver/Xext/panoramiXprocs.c b/nx-X11/programs/Xserver/Xext/panoramiXprocs.c index 2f2b2c63e..8078e2bd0 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiXprocs.c +++ b/nx-X11/programs/Xserver/Xext/panoramiXprocs.c @@ -621,7 +621,7 @@ int PanoramiXTranslateCoords(ClientPtr client) * borderSize */ && (!wBoundingShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( wBoundingShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box)) @@ -1109,21 +1109,21 @@ int PanoramiXCopyArea(ClientPtr client) RegionRec totalReg; Bool overlap; - REGION_NULL(pScreen, &totalReg); + RegionNull(&totalReg); FOR_NSCREENS_BACKWARD(j) { if(pRgn[j]) { if(srcIsRoot) { - REGION_TRANSLATE(pScreen, pRgn[j], + RegionTranslate(pRgn[j], panoramiXdataPtr[j].x, panoramiXdataPtr[j].y); } - REGION_APPEND(pScreen, &totalReg, pRgn[j]); - REGION_DESTROY(pScreen, pRgn[j]); + RegionAppend(&totalReg, pRgn[j]); + RegionDestroy(pRgn[j]); } } - REGION_VALIDATE(pScreen, &totalReg, &overlap); + RegionValidate(&totalReg, &overlap); (*pScreen->SendGraphicsExpose)( client, &totalReg, stuff->dstDrawable, X_CopyArea, 0); - REGION_UNINIT(pScreen, &totalReg); + RegionUninit(&totalReg); } result = client->noClientException; @@ -1220,17 +1220,17 @@ int PanoramiXCopyPlane(ClientPtr client) RegionRec totalReg; Bool overlap; - REGION_NULL(pScreen, &totalReg); + RegionNull(&totalReg); FOR_NSCREENS_BACKWARD(j) { if(pRgn[j]) { - REGION_APPEND(pScreen, &totalReg, pRgn[j]); - REGION_DESTROY(pScreen, pRgn[j]); + RegionAppend(&totalReg, pRgn[j]); + RegionDestroy(pRgn[j]); } } - REGION_VALIDATE(pScreen, &totalReg, &overlap); + RegionValidate(&totalReg, &overlap); (*pScreen->SendGraphicsExpose)( client, &totalReg, stuff->dstDrawable, X_CopyPlane, 0); - REGION_UNINIT(pScreen, &totalReg); + RegionUninit(&totalReg); } return (client->noClientException); diff --git a/nx-X11/programs/Xserver/Xext/security.c b/nx-X11/programs/Xserver/Xext/security.c index bcc8574cb..ccf80b401 100644 --- a/nx-X11/programs/Xserver/Xext/security.c +++ b/nx-X11/programs/Xserver/Xext/security.c @@ -1400,12 +1400,12 @@ SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h, imageBox.y1 = y; imageBox.x2 = x + w; imageBox.y2 = y + h; - REGION_INIT(pScreen, &imageRegion, &imageBox, 1); - REGION_NULL(pScreen, &censorRegion); + RegionInit(&imageRegion, &imageBox, 1); + RegionNull(&censorRegion); /* censorRegion = imageRegion - visibleRegion */ - REGION_SUBTRACT(pScreen, &censorRegion, &imageRegion, pVisibleRegion); - nRects = REGION_NUM_RECTS(&censorRegion); + RegionSubtract(&censorRegion, &imageRegion, pVisibleRegion); + nRects = RegionNumRects(&censorRegion); if (nRects > 0) { /* we have something to censor */ GCPtr pScratchGC = NULL; @@ -1425,7 +1425,7 @@ SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h, failed = TRUE; goto failSafe; } - for (pBox = REGION_RECTS(&censorRegion), i = 0; + for (pBox = RegionRects(&censorRegion), i = 0; i < nRects; i++, pBox++) { @@ -1475,8 +1475,8 @@ SecurityCensorImage(client, pVisibleRegion, widthBytesLine, pDraw, x, y, w, h, if (pScratchGC) FreeScratchGC(pScratchGC); if (pPix) FreeScratchPixmapHeader(pPix); } - REGION_UNINIT(pScreen, &imageRegion); - REGION_UNINIT(pScreen, &censorRegion); + RegionUninit(&imageRegion); + RegionUninit(&censorRegion); } /* SecurityCensorImage */ /**********************************************************************/ diff --git a/nx-X11/programs/Xserver/Xext/shape.c b/nx-X11/programs/Xserver/Xext/shape.c index 78d3be319..8516192c0 100644 --- a/nx-X11/programs/Xserver/Xext/shape.c +++ b/nx-X11/programs/Xserver/Xext/shape.c @@ -186,11 +186,11 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create) ScreenPtr pScreen = pWin->drawable.pScreen; if (srcRgn && (xoff || yoff)) - REGION_TRANSLATE(pScreen, srcRgn, xoff, yoff); + RegionTranslate(srcRgn, xoff, yoff); if (!pWin->parent) { if (srcRgn) - REGION_DESTROY(pScreen, srcRgn); + RegionDestroy(srcRgn); return Success; } @@ -201,7 +201,7 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create) */ if (srcRgn == NULL) { if (*destRgnp != NULL) { - REGION_DESTROY (pScreen, *destRgnp); + RegionDestroy(*destRgnp); *destRgnp = 0; /* go on to remove shape and generate ShapeNotify */ } @@ -220,17 +220,17 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create) else switch (op) { case ShapeSet: if (*destRgnp) - REGION_DESTROY(pScreen, *destRgnp); + RegionDestroy(*destRgnp); *destRgnp = srcRgn; srcRgn = 0; break; case ShapeUnion: if (*destRgnp) - REGION_UNION(pScreen, *destRgnp, *destRgnp, srcRgn); + RegionUnion(*destRgnp, *destRgnp, srcRgn); break; case ShapeIntersect: if (*destRgnp) - REGION_INTERSECT(pScreen, *destRgnp, *destRgnp, srcRgn); + RegionIntersect(*destRgnp, *destRgnp, srcRgn); else { *destRgnp = srcRgn; srcRgn = 0; @@ -239,20 +239,20 @@ RegionOperate (client, pWin, kind, destRgnp, srcRgn, op, xoff, yoff, create) case ShapeSubtract: if (!*destRgnp) *destRgnp = (*create)(pWin); - REGION_SUBTRACT(pScreen, *destRgnp, *destRgnp, srcRgn); + RegionSubtract(*destRgnp, *destRgnp, srcRgn); break; case ShapeInvert: if (!*destRgnp) - *destRgnp = REGION_CREATE(pScreen, (BoxPtr) 0, 0); + *destRgnp = RegionCreate((BoxPtr) 0, 0); else - REGION_SUBTRACT(pScreen, *destRgnp, srcRgn, *destRgnp); + RegionSubtract(*destRgnp, srcRgn, *destRgnp); break; default: client->errorValue = op; return BadValue; } if (srcRgn) - REGION_DESTROY(pScreen, srcRgn); + RegionDestroy(srcRgn); (*pScreen->SetShape) (pWin); SendShapeNotify (pWin, kind); return Success; @@ -268,7 +268,7 @@ CreateBoundingShape (pWin) extents.y1 = -wBorderWidth (pWin); extents.x2 = pWin->drawable.width + wBorderWidth (pWin); extents.y2 = pWin->drawable.height + wBorderWidth (pWin); - return REGION_CREATE(pWin->drawable.pScreen, &extents, 1); + return RegionCreate(&extents, 1); } RegionPtr @@ -281,7 +281,7 @@ CreateClipShape (pWin) extents.y1 = 0; extents.x2 = pWin->drawable.width; extents.y2 = pWin->drawable.height; - return REGION_CREATE(pWin->drawable.pScreen, &extents, 1); + return RegionCreate(&extents, 1); } static int @@ -360,7 +360,7 @@ ProcShapeRectangles (client) ctype = VerifyRectOrder(nrects, prects, (int)stuff->ordering); if (ctype < 0) return BadMatch; - srcRgn = RECTS_TO_REGION(pScreen, nrects, prects, ctype); + srcRgn = RegionFromRects(nrects, prects, ctype); if (!pWin->optional) MakeWindowOptional (pWin); @@ -455,7 +455,7 @@ ProcShapeMask (client) if (pPixmap->drawable.pScreen != pScreen || pPixmap->drawable.depth != 1) return BadMatch; - srcRgn = BITMAP_TO_REGION(pScreen, pPixmap); + srcRgn = BitmapToRegion(pScreen, pPixmap); if (!srcRgn) return BadAlloc; } @@ -581,8 +581,8 @@ ProcShapeCombine (client) } if (srcRgn) { - tmp = REGION_CREATE(pScreen, (BoxPtr) 0, 0); - REGION_COPY(pScreen, tmp, srcRgn); + tmp = RegionCreate((BoxPtr) 0, 0); + RegionCopy(tmp, srcRgn); srcRgn = tmp; } else srcRgn = (*createSrc) (pSrcWin); @@ -673,7 +673,7 @@ ProcShapeOffset (client) pScreen = pWin->drawable.pScreen; if (srcRgn) { - REGION_TRANSLATE(pScreen, srcRgn, stuff->xOff, stuff->yOff); + RegionTranslate(srcRgn, stuff->xOff, stuff->yOff); (*pScreen->SetShape) (pWin); } SendShapeNotify (pWin, (int)stuff->destKind); @@ -729,7 +729,7 @@ ProcShapeQueryExtents (client) rep.clipShaped = (wClipShape(pWin) != 0); if ((region = wBoundingShape(pWin))) { /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */ - pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region); + pExtents = RegionExtents(region); extents = *pExtents; } else { extents.x1 = -wBorderWidth (pWin); @@ -743,7 +743,7 @@ ProcShapeQueryExtents (client) rep.heightBoundingShape = extents.y2 - extents.y1; if ((region = wClipShape(pWin))) { /* this is done in two steps because of a compiler bug on SunOS 4.1.3 */ - pExtents = REGION_EXTENTS(pWin->drawable.pScreen, region); + pExtents = RegionExtents(region); extents = *pExtents; } else { extents.x1 = 0; @@ -932,7 +932,7 @@ SendShapeNotify (pWin, which) case ShapeBounding: region = wBoundingShape(pWin); if (region) { - extents = *REGION_EXTENTS(pWin->drawable.pScreen, region); + extents = *RegionExtents(region); shaped = xTrue; } else { extents.x1 = -wBorderWidth (pWin); @@ -945,7 +945,7 @@ SendShapeNotify (pWin, which) case ShapeClip: region = wClipShape(pWin); if (region) { - extents = *REGION_EXTENTS(pWin->drawable.pScreen, region); + extents = *RegionExtents(region); shaped = xTrue; } else { extents.x1 = 0; @@ -958,7 +958,7 @@ SendShapeNotify (pWin, which) case ShapeInput: region = wInputShape(pWin); if (region) { - extents = *REGION_EXTENTS(pWin->drawable.pScreen, region); + extents = *RegionExtents(region); shaped = xTrue; } else { extents.x1 = -wBorderWidth (pWin); @@ -1087,8 +1087,8 @@ ProcShapeGetRectangles (client) } } else { BoxPtr box; - nrects = REGION_NUM_RECTS(region); - box = REGION_RECTS(region); + nrects = RegionNumRects(region); + box = RegionRects(region); rects = (xRectangle *) ALLOCATE_LOCAL (nrects * sizeof (xRectangle)); if (!rects && nrects) return BadAlloc; diff --git a/nx-X11/programs/Xserver/Xext/xtest.c b/nx-X11/programs/Xserver/Xext/xtest.c index 482ad91d4..8a03db5f9 100644 --- a/nx-X11/programs/Xserver/Xext/xtest.c +++ b/nx-X11/programs/Xserver/Xext/xtest.c @@ -402,11 +402,11 @@ ProcXTestFakeInput(client) int i; int x = ev->u.keyButtonPointer.rootX + panoramiXdataPtr[0].x; int y = ev->u.keyButtonPointer.rootY + panoramiXdataPtr[0].y; - if (!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum], + if (!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum], x, y, &box)) { FOR_NSCREENS(i) { if (i == pScreen->myNum) continue; - if (POINT_IN_REGION(pScreen, + if (RegionContainsPoint( &XineramaScreenRegions[i], x, y, &box)) { root = WindowTable[i]; diff --git a/nx-X11/programs/Xserver/composite/compalloc.c b/nx-X11/programs/Xserver/composite/compalloc.c index d496ee9ba..f66a90989 100644 --- a/nx-X11/programs/Xserver/composite/compalloc.c +++ b/nx-X11/programs/Xserver/composite/compalloc.c @@ -103,7 +103,7 @@ compRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update) if (wasMapped) UnmapWindow (pWin, FALSE); - REGION_NULL (pScreen, &cw->borderClip); + RegionNull(&cw->borderClip); cw->update = CompositeRedirectAutomatic; cw->clients = 0; cw->oldx = COMP_ORIGIN_INVALID; @@ -177,7 +177,7 @@ compFreeClientWindow (WindowPtr pWin, XID id) if (cw->damage) DamageDestroy (cw->damage); - REGION_UNINIT (pScreen, &cw->borderClip); + RegionUninit(&cw->borderClip); pWin->devPrivates[CompWindowPrivateIndex].ptr = 0; xfree (cw); @@ -503,7 +503,7 @@ compFreePixmap (WindowPtr pWin) * case correctly. Unmap adds the window borderClip to the * parent exposed area; regions beyond the parent cause crashes */ - REGION_COPY (pScreen, &pWin->borderClip, &cw->borderClip); + RegionCopy(&pWin->borderClip, &cw->borderClip); pRedirectPixmap = (*pScreen->GetWindowPixmap) (pWin); pParentPixmap = (*pScreen->GetWindowPixmap) (pWin->parent); pWin->redirectDraw = FALSE; diff --git a/nx-X11/programs/Xserver/composite/compext.c b/nx-X11/programs/Xserver/composite/compext.c index d182da1fd..f57235d46 100644 --- a/nx-X11/programs/Xserver/composite/compext.c +++ b/nx-X11/programs/Xserver/composite/compext.c @@ -201,7 +201,7 @@ ProcCompositeCreateRegionFromBorderClip (ClientPtr client) pRegion = XFixesRegionCopy (pBorderClip); if (!pRegion) return BadAlloc; - REGION_TRANSLATE (pScreen, pRegion, -pWin->drawable.x, -pWin->drawable.y); + RegionTranslate(pRegion, -pWin->drawable.x, -pWin->drawable.y); if (!AddResource (stuff->region, RegionResType, (void *) pRegion)) return BadAlloc; diff --git a/nx-X11/programs/Xserver/composite/compwindow.c b/nx-X11/programs/Xserver/composite/compwindow.c index 2bb581329..fbdc44420 100644 --- a/nx-X11/programs/Xserver/composite/compwindow.c +++ b/nx-X11/programs/Xserver/composite/compwindow.c @@ -79,10 +79,10 @@ compRepaintBorder (ClientPtr pClient, void * closure) { RegionRec exposed; - REGION_NULL(pScreen, &exposed); - REGION_SUBTRACT(pScreen, &exposed, &pWindow->borderClip, &pWindow->winSize); + RegionNull(&exposed); + RegionSubtract(&exposed, &pWindow->borderClip, &pWindow->winSize); (*pWindow->drawable.pScreen->PaintWindowBorder)(pWindow, &exposed, PW_BORDER); - REGION_UNINIT(pScreen, &exposed); + RegionUninit(&exposed); } return TRUE; } @@ -245,7 +245,7 @@ compClipNotify (WindowPtr pWin, int dx, int dy) if (cw->borderClipX != pWin->drawable.x || cw->borderClipY != pWin->drawable.y) { - REGION_TRANSLATE (pScreen, &cw->borderClip, + RegionTranslate(&cw->borderClip, pWin->drawable.x - cw->borderClipX, pWin->drawable.y - cw->borderClipY); cw->borderClipX = pWin->drawable.x; @@ -492,14 +492,14 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); + RegionTranslate(prgnSrc, -dx, -dy); - REGION_NULL (pWin->drawable.pScreen, &rgnDst); + RegionNull(&rgnDst); - REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, + RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); - REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst, + RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y); dx = dx + pPixmap->screen_x - cw->oldx; @@ -507,8 +507,8 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) pGC = GetScratchGC (pPixmap->drawable.depth, pScreen); if (pGC) { - BoxPtr pBox = REGION_RECTS (&rgnDst); - int nBox = REGION_NUM_RECTS (&rgnDst); + BoxPtr pBox = RegionRects (&rgnDst); + int nBox = RegionNumRects (&rgnDst); ValidateGC(&pPixmap->drawable, pGC); while (nBox--) @@ -536,16 +536,16 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y) { if (dx || dy) - REGION_TRANSLATE (pScreen, prgnSrc, dx, dy); + RegionTranslate(prgnSrc, dx, dy); (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc); if (dx || dy) - REGION_TRANSLATE (pScreen, prgnSrc, -dx, -dy); + RegionTranslate(prgnSrc, -dx, -dy); } else { ptOldOrg.x -= dx; ptOldOrg.y -= dy; - REGION_TRANSLATE (prgnSrc, prgnSrc, + RegionTranslate(prgnSrc, pWin->drawable.x - ptOldOrg.x, pWin->drawable.y - ptOldOrg.y); DamageDamageRegion (&pWin->drawable, prgnSrc); @@ -613,26 +613,26 @@ compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion) CompWindowPtr cw = GetCompWindow (pWin); RegionRec damage; - REGION_NULL (pScreen, &damage); + RegionNull(&damage); /* * Align old border clip with new border clip */ - REGION_TRANSLATE (pScreen, &cw->borderClip, + RegionTranslate(&cw->borderClip, pWin->drawable.x - cw->borderClipX, pWin->drawable.y - cw->borderClipY); /* * Compute newly visible portion of window for repaint */ - REGION_SUBTRACT (pScreen, &damage, pRegion, &cw->borderClip); + RegionSubtract(&damage, pRegion, &cw->borderClip); /* * Report that as damaged so it will be redrawn */ DamageDamageRegion (&pWin->drawable, &damage); - REGION_UNINIT (pScreen, &damage); + RegionUninit(&damage); /* * Save the new border clip region */ - REGION_COPY (pScreen, &cw->borderClip, pRegion); + RegionCopy(&cw->borderClip, pRegion); cw->borderClipX = pWin->drawable.x; cw->borderClipY = pWin->drawable.y; } @@ -694,18 +694,18 @@ compWindowUpdateAutomatic (WindowPtr pWin) /* * First move the region from window to screen coordinates */ - REGION_TRANSLATE (pScreen, pRegion, + RegionTranslate(pRegion, pWin->drawable.x, pWin->drawable.y); /* * Clip against the "real" border clip */ - REGION_INTERSECT (pScreen, pRegion, pRegion, &cw->borderClip); + RegionIntersect(pRegion, pRegion, &cw->borderClip); /* * Now translate from screen to dest coordinates */ - REGION_TRANSLATE (pScreen, pRegion, + RegionTranslate(pRegion, -pParent->drawable.x, -pParent->drawable.y); /* diff --git a/nx-X11/programs/Xserver/damageext/damageext.c b/nx-X11/programs/Xserver/damageext/damageext.c index 33cbb5f7b..8d03dfed5 100755 --- a/nx-X11/programs/Xserver/damageext/damageext.c +++ b/nx-X11/programs/Xserver/damageext/damageext.c @@ -99,10 +99,10 @@ DamageExtReport (DamagePtr pDamage, RegionPtr pRegion, void *closure) switch (pDamageExt->level) { case DamageReportRawRegion: case DamageReportDeltaRegion: - DamageExtNotify (pDamageExt, REGION_RECTS(pRegion), REGION_NUM_RECTS(pRegion)); + DamageExtNotify (pDamageExt, RegionRects(pRegion), RegionNumRects(pRegion)); break; case DamageReportBoundingBox: - DamageExtNotify (pDamageExt, REGION_EXTENTS(prScreen, pRegion), 1); + DamageExtNotify (pDamageExt, RegionExtents(pRegion), 1); break; case DamageReportNonEmpty: DamageExtNotify (pDamageExt, NullBox, 0); @@ -261,14 +261,14 @@ ProcDamageSubtract (ClientPtr client) if (pRepair) { if (pParts) - REGION_INTERSECT (prScreen, pParts, DamageRegion (pDamage), pRepair); + RegionIntersect(pParts, DamageRegion (pDamage), pRepair); if (DamageSubtract (pDamage, pRepair)) DamageExtReport (pDamage, DamageRegion (pDamage), (void *) pDamageExt); } else { if (pParts) - REGION_COPY (prScreen, pParts, DamageRegion (pDamage)); + RegionCopy(pParts, DamageRegion (pDamage)); DamageEmpty (pDamage); } } diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index b6010e627..009e1ac08 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -1266,11 +1266,11 @@ ProcTranslateCoords(register ClientPtr client) * borderSize */ && (!wBoundingShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( &pWin->borderSize, x, y, &box)) && (!wInputShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box)) @@ -1758,7 +1758,7 @@ ProcCopyArea(register ClientPtr client) (*pDst->pScreen->SendGraphicsExpose) (client, pRgn, stuff->dstDrawable, X_CopyArea, 0); if (pRgn) - REGION_DESTROY(pDst->pScreen, pRgn); + RegionDestroy(pRgn); } return(client->noClientException); @@ -1806,7 +1806,7 @@ ProcCopyPlane(register ClientPtr client) (*pdstDraw->pScreen->SendGraphicsExpose) (client, pRgn, stuff->dstDrawable, X_CopyPlane, 0); if (pRgn) - REGION_DESTROY(pdstDraw->pScreen, pRgn); + RegionDestroy(pRgn); } return(client->noClientException); } @@ -2228,7 +2228,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw); if (pVisibleRegion) { - REGION_TRANSLATE(pDraw->pScreen, pVisibleRegion, -pDraw->x, -pDraw->y); + RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y); } } #endif @@ -2322,7 +2322,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, } #ifdef XCSECURITY if (pVisibleRegion) - REGION_DESTROY(pDraw->pScreen, pVisibleRegion); + RegionDestroy(pVisibleRegion); #endif if (!im_return) DEALLOCATE_LOCAL(pBuf); diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c index 1166bf84b..3163270f4 100644 --- a/nx-X11/programs/Xserver/dix/events.c +++ b/nx-X11/programs/Xserver/dix/events.c @@ -346,14 +346,14 @@ XineramaSetCursorPosition( x += panoramiXdataPtr[0].x; y += panoramiXdataPtr[0].y; - if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum], + if(!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum], x, y, &box)) { FOR_NSCREENS(i) { if(i == pScreen->myNum) continue; - if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], x, y, &box)) + if(RegionContainsPoint(&XineramaScreenRegions[i], x, y, &box)) { pScreen = screenInfo.screens[i]; break; @@ -483,7 +483,7 @@ XineramaCheckVirtualMotion( i = PanoramiXNumScreens - 1; - REGION_COPY(sprite.screen, &sprite.Reg2, + RegionCopy(&sprite.Reg2, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; @@ -493,16 +493,16 @@ XineramaCheckVirtualMotion( y = off_y - panoramiXdataPtr[i].y; if(x || y) - REGION_TRANSLATE(sprite.screen, &sprite.Reg2, x, y); + RegionTranslate(&sprite.Reg2, x, y); - REGION_UNION(sprite.screen, &sprite.Reg2, &sprite.Reg2, + RegionUnion(&sprite.Reg2, &sprite.Reg2, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; } - lims = *REGION_EXTENTS(sprite.screen, &sprite.Reg2); + lims = *RegionExtents(&sprite.Reg2); if (sprite.hot.x < lims.x1) #ifdef XEVIE @@ -525,7 +525,7 @@ XineramaCheckVirtualMotion( #endif sprite.hot.y = lims.y2 - 1; - if (REGION_NUM_RECTS(&sprite.Reg2) > 1) + if (RegionNumRects(&sprite.Reg2) > 1) ConfineToShape(&sprite.Reg2, &sprite.hot.x, &sprite.hot.y); if (qe) @@ -632,7 +632,7 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) i = PanoramiXNumScreens - 1; - REGION_COPY(sprite.screen, &sprite.Reg1, + RegionCopy(&sprite.Reg1, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; @@ -642,18 +642,18 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) y = off_y - panoramiXdataPtr[i].y; if(x || y) - REGION_TRANSLATE(sprite.screen, &sprite.Reg1, x, y); + RegionTranslate(&sprite.Reg1, x, y); - REGION_UNION(sprite.screen, &sprite.Reg1, &sprite.Reg1, + RegionUnion(&sprite.Reg1, &sprite.Reg1, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; } - sprite.hotLimits = *REGION_EXTENTS(sprite.screen, &sprite.Reg1); + sprite.hotLimits = *RegionExtents(&sprite.Reg1); - if(REGION_NUM_RECTS(&sprite.Reg1) > 1) + if(RegionNumRects(&sprite.Reg1) > 1) sprite.hotShape = &sprite.Reg1; else sprite.hotShape = NullRegion; @@ -732,9 +732,9 @@ ConfineToShape(RegionPtr shape, int *px, int *py) int x = *px, y = *py; int incx = 1, incy = 1; - if (POINT_IN_REGION(sprite.hot.pScreen, shape, x, y, &box)) + if (RegionContainsPoint(shape, x, y, &box)) return; - box = *REGION_EXTENTS(sprite.hot.pScreen, shape); + box = *RegionExtents(shape); /* this is rather crude */ do { x += incx; @@ -756,7 +756,7 @@ ConfineToShape(RegionPtr shape, int *px, int *py) else if (y < box.y1) return; /* should never get here! */ } - } while (!POINT_IN_REGION(sprite.hot.pScreen, shape, x, y, &box)); + } while (!RegionContainsPoint(shape, x, y, &box)); *px = x; *py = y; } @@ -844,7 +844,7 @@ CheckVirtualMotion( #endif sprite.hot.x = sprite.hot.y = 0; } - lims = *REGION_EXTENTS(pWin->drawable.pScreen, &pWin->borderSize); + lims = *RegionExtents(&pWin->borderSize); if (sprite.hot.x < lims.x1) #ifdef XEVIE xeviehot.x = @@ -898,7 +898,7 @@ ConfineCursorToWindow(WindowPtr pWin, Bool generateEvents, Bool confineToScreen) } else { - sprite.hotLimits = *REGION_EXTENTS( pScreen, &pWin->borderSize); + sprite.hotLimits = *RegionExtents(&pWin->borderSize); #ifdef SHAPE sprite.hotShape = wBoundingShape(pWin) ? &pWin->borderSize : NullRegion; @@ -1972,7 +1972,7 @@ PointInBorderSize(WindowPtr pWin, int x, int y) { BoxRec box; - if(POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderSize, x, y, &box)) + if(RegionContainsPoint(&pWin->borderSize, x, y, &box)) return TRUE; #ifdef PANORAMIX @@ -1980,7 +1980,7 @@ PointInBorderSize(WindowPtr pWin, int x, int y) int i; for(i = 1; i < PanoramiXNumScreens; i++) { - if(POINT_IN_REGION(sprite.screen, + if(RegionContainsPoint( &sprite.windows[i]->borderSize, x + panoramiXdataPtr[0].x - panoramiXdataPtr[i].x, y + panoramiXdataPtr[0].y - panoramiXdataPtr[i].y, @@ -2016,7 +2016,7 @@ XYToWindow(int x, int y) */ && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y)) && (!wInputShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box)) @@ -2156,10 +2156,10 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) sprite.hotLimits.x2 -= xoff; sprite.hotLimits.y2 -= yoff; - if (REGION_NOTEMPTY(sprite.screen, &sprite.Reg1)) - REGION_TRANSLATE(sprite.screen, &sprite.Reg1, xoff, yoff); - if (REGION_NOTEMPTY(sprite.screen, &sprite.Reg2)) - REGION_TRANSLATE(sprite.screen, &sprite.Reg2, xoff, yoff); + if (RegionNotEmpty(&sprite.Reg1)) + RegionTranslate(&sprite.Reg1, xoff, yoff); + if (RegionNotEmpty(&sprite.Reg2)) + RegionTranslate(&sprite.Reg2, xoff, yoff); /* FIXME: if we call ConfineCursorToWindow, must we do anything else? */ if ((grab = inputInfo.pointer->grab) && grab->confineTo) { @@ -2211,8 +2211,8 @@ DefineInitialRootWindow(register WindowPtr win) #endif sprite.screen = pScreen; /* gotta UNINIT these someplace */ - REGION_NULL(pScreen, &sprite.Reg1); - REGION_NULL(pScreen, &sprite.Reg2); + RegionNull(&sprite.Reg1); + RegionNull(&sprite.Reg2); } #endif } @@ -2278,7 +2278,7 @@ XineramaPointInWindowIsVisible( if (!pWin->realized) return FALSE; - if (POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box)) + if (RegionContainsPoint(&pWin->borderClip, x, y, &box)) return TRUE; if(!XineramaSetWindowPntrs(pWin)) return FALSE; @@ -2292,9 +2292,9 @@ XineramaPointInWindowIsVisible( x = xoff - panoramiXdataPtr[i].x; y = yoff - panoramiXdataPtr[i].y; - if(POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box) + if(RegionContainsPoint(&pWin->borderClip, x, y, &box) && (!wInputShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box))) @@ -2470,7 +2470,7 @@ ProcWarpPointer(ClientPtr client) static Bool BorderSizeNotEmpty(WindowPtr pWin) { - if(REGION_NOTEMPTY(sprite.hotPhys.pScreen, &pWin->borderSize)) + if(RegionNotEmpty(&pWin->borderSize)) return TRUE; #ifdef PANORAMIX @@ -2478,7 +2478,7 @@ BorderSizeNotEmpty(WindowPtr pWin) int i; for(i = 1; i < PanoramiXNumScreens; i++) { - if(REGION_NOTEMPTY(sprite.screen, &sprite.windows[i]->borderSize)) + if(RegionNotEmpty(&sprite.windows[i]->borderSize)) return TRUE; } } diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index 5854f2e95..ce94dc8a5 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -439,10 +439,10 @@ CreateRootWindow(ScreenPtr pScreen) box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; - REGION_INIT(pScreen, &pWin->clipList, &box, 1); - REGION_INIT(pScreen, &pWin->winSize, &box, 1); - REGION_INIT(pScreen, &pWin->borderSize, &box, 1); - REGION_INIT(pScreen, &pWin->borderClip, &box, 1); + RegionInit(&pWin->clipList, &box, 1); + RegionInit(&pWin->winSize, &box, 1); + RegionInit(&pWin->borderSize, &box, 1); + RegionInit(&pWin->borderClip, &box, 1); pWin->drawable.class = InputOutput; pWin->optional->visual = pScreen->rootVisual; @@ -515,7 +515,7 @@ ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn, ScreenPtr pScreen = pWin->drawable.pScreen; BoxRec box; - box = *(REGION_EXTENTS(pScreen, &pWin->winSize)); + box = *(RegionExtents(&pWin->winSize)); /* we do these calculations to avoid overflows */ if (x > box.x1) box.x1 = x; @@ -531,8 +531,8 @@ ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn, box.x2 = box.x1; if (box.y1 > box.y2) box.y2 = box.y1; - REGION_RESET(pScreen, Rgn, &box); - REGION_INTERSECT(pScreen, Rgn, Rgn, &pWin->winSize); + RegionReset(Rgn, &box); + RegionIntersect(Rgn, Rgn, &pWin->winSize); } WindowPtr @@ -713,10 +713,10 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w, pWin->drawable.y = pParent->drawable.y + y + (int)bw; /* set up clip list correctly for unobscured WindowPtr */ - REGION_NULL(pScreen, &pWin->clipList); - REGION_NULL(pScreen, &pWin->borderClip); - REGION_NULL(pScreen, &pWin->winSize); - REGION_NULL(pScreen, &pWin->borderSize); + RegionNull(&pWin->clipList); + RegionNull(&pWin->borderClip); + RegionNull(&pWin->winSize); + RegionNull(&pWin->borderSize); pHead = RealChildHead(pParent); if (pHead) @@ -797,17 +797,17 @@ FreeWindowResources(register WindowPtr pWin) DeleteWindowFromAnySaveSet(pWin); DeleteWindowFromAnySelections(pWin); DeleteWindowFromAnyEvents(pWin, TRUE); - REGION_UNINIT(pScreen, &pWin->clipList); - REGION_UNINIT(pScreen, &pWin->winSize); - REGION_UNINIT(pScreen, &pWin->borderClip); - REGION_UNINIT(pScreen, &pWin->borderSize); + RegionUninit(&pWin->clipList); + RegionUninit(&pWin->winSize); + RegionUninit(&pWin->borderClip); + RegionUninit(&pWin->borderSize); #ifdef SHAPE if (wBoundingShape (pWin)) - REGION_DESTROY(pScreen, wBoundingShape (pWin)); + RegionDestroy(wBoundingShape (pWin)); if (wClipShape (pWin)) - REGION_DESTROY(pScreen, wClipShape (pWin)); + RegionDestroy(wClipShape (pWin)); if (wInputShape (pWin)) - REGION_DESTROY(pScreen, wInputShape (pWin)); + RegionDestroy(wInputShape (pWin)); #endif if (pWin->borderIsPixel == FALSE) (*pScreen->DestroyPixmap)(pWin->border.pixmap); @@ -1467,10 +1467,10 @@ PatchUp: { RegionRec exposed; - REGION_NULL(pScreen, &exposed); - REGION_SUBTRACT(pScreen, &exposed, &pWin->borderClip, &pWin->winSize); + RegionNull(&exposed); + RegionSubtract(&exposed, &pWin->borderClip, &pWin->winSize); (*pWin->drawable.pScreen->PaintWindowBorder)(pWin, &exposed, PW_BORDER); - REGION_UNINIT(pScreen, &exposed); + RegionUninit(&exposed); } return error; } @@ -1611,18 +1611,18 @@ CreateUnclippedWinSize (register WindowPtr pWin) box.y1 = pWin->drawable.y; box.x2 = pWin->drawable.x + (int) pWin->drawable.width; box.y2 = pWin->drawable.y + (int) pWin->drawable.height; - pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1); + pRgn = RegionCreate(&box, 1); #ifdef SHAPE if (wBoundingShape (pWin) || wClipShape (pWin)) { ScreenPtr pScreen = pWin->drawable.pScreen; - REGION_TRANSLATE(pScreen, pRgn, - pWin->drawable.x, + RegionTranslate(pRgn, - pWin->drawable.x, - pWin->drawable.y); if (wBoundingShape (pWin)) - REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin)); + RegionIntersect(pRgn, pRgn, wBoundingShape (pWin)); if (wClipShape (pWin)) - REGION_INTERSECT(pScreen, pRgn, pRgn, wClipShape (pWin)); - REGION_TRANSLATE(pScreen, pRgn, pWin->drawable.x, pWin->drawable.y); + RegionIntersect(pRgn, pRgn, wClipShape (pWin)); + RegionTranslate(pRgn, pWin->drawable.x, pWin->drawable.y); } #endif return pRgn; @@ -1640,7 +1640,7 @@ SetWinSize (register WindowPtr pWin) box.y1 = pWin->drawable.y; box.x2 = pWin->drawable.x + pWin->drawable.width; box.y2 = pWin->drawable.y + pWin->drawable.height; - REGION_RESET (pScreen, &pWin->winSize, &box); + RegionReset(&pWin->winSize, &box); } else #endif @@ -1652,15 +1652,15 @@ SetWinSize (register WindowPtr pWin) if (wBoundingShape (pWin) || wClipShape (pWin)) { ScreenPtr pScreen = pWin->drawable.pScreen; - REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x, + RegionTranslate(&pWin->winSize, - pWin->drawable.x, - pWin->drawable.y); if (wBoundingShape (pWin)) - REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize, + RegionIntersect(&pWin->winSize, &pWin->winSize, wBoundingShape (pWin)); if (wClipShape (pWin)) - REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize, + RegionIntersect(&pWin->winSize, &pWin->winSize, wClipShape (pWin)); - REGION_TRANSLATE(pScreen, &pWin->winSize, pWin->drawable.x, + RegionTranslate(&pWin->winSize, pWin->drawable.x, pWin->drawable.y); } #endif @@ -1682,7 +1682,7 @@ SetBorderSize (register WindowPtr pWin) box.y1 = pWin->drawable.y - bw; box.x2 = pWin->drawable.x + pWin->drawable.width + bw; box.y2 = pWin->drawable.y + pWin->drawable.height + bw; - REGION_RESET (pScreen, &pWin->borderSize, &box); + RegionReset(&pWin->borderSize, &box); } else #endif @@ -1694,18 +1694,18 @@ SetBorderSize (register WindowPtr pWin) if (wBoundingShape (pWin)) { ScreenPtr pScreen = pWin->drawable.pScreen; - REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x, + RegionTranslate(&pWin->borderSize, - pWin->drawable.x, - pWin->drawable.y); - REGION_INTERSECT(pScreen, &pWin->borderSize, &pWin->borderSize, + RegionIntersect(&pWin->borderSize, &pWin->borderSize, wBoundingShape (pWin)); - REGION_TRANSLATE(pScreen, &pWin->borderSize, pWin->drawable.x, + RegionTranslate(&pWin->borderSize, pWin->drawable.x, pWin->drawable.y); - REGION_UNION(pScreen, &pWin->borderSize, &pWin->borderSize, + RegionUnion(&pWin->borderSize, &pWin->borderSize, &pWin->winSize); } #endif } else { - REGION_COPY(pWin->drawable.pScreen, &pWin->borderSize, + RegionCopy(&pWin->borderSize, &pWin->winSize); } } @@ -1905,12 +1905,12 @@ MakeBoundingRegion ( RegionPtr pRgn; ScreenPtr pScreen = pWin->drawable.pScreen; - pRgn = REGION_CREATE(pScreen, pBox, 1); + pRgn = RegionCreate(pBox, 1); if (wBoundingShape (pWin)) { - REGION_TRANSLATE(pScreen, pRgn, -pWin->origin.x, + RegionTranslate(pRgn, -pWin->origin.x, -pWin->origin.y); - REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin)); - REGION_TRANSLATE(pScreen, pRgn, pWin->origin.x, + RegionIntersect(pRgn, pRgn, wBoundingShape (pWin)); + RegionTranslate(pRgn, pWin->origin.x, pWin->origin.y); } return pRgn; @@ -1932,10 +1932,10 @@ ShapeOverlap ( pScreen = pWin->drawable.pScreen; pWinRgn = MakeBoundingRegion (pWin, pWinBox); pSibRgn = MakeBoundingRegion (pSib, pSibBox); - REGION_INTERSECT(pScreen, pWinRgn, pWinRgn, pSibRgn); - ret = REGION_NOTEMPTY(pScreen, pWinRgn); - REGION_DESTROY(pScreen, pWinRgn); - REGION_DESTROY(pScreen, pSibRgn); + RegionIntersect(pWinRgn, pWinRgn, pSibRgn); + ret = RegionNotEmpty(pWinRgn); + RegionDestroy(pWinRgn); + RegionDestroy(pSibRgn); return ret; } #endif @@ -2066,7 +2066,7 @@ WhereDoIGoInTheStack( else if (pSib) { if ((IsSiblingAboveMe(pWin, pSib) == Above) && - (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT)) + (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT)) return(pFirst); else return(pWin->nextSib); @@ -2081,7 +2081,7 @@ WhereDoIGoInTheStack( else if (pSib) { if ((IsSiblingAboveMe(pWin, pSib) == Below) && - (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT)) + (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT)) return NullWindow; else return(pWin->nextSib); @@ -2095,7 +2095,7 @@ WhereDoIGoInTheStack( return(pWin->nextSib); else if (pSib) { - if (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT) + if (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT) { if (IsSiblingAboveMe(pWin, pSib) == Above) return(pFirst); @@ -2785,10 +2785,10 @@ MapWindow(register WindowPtr pWin, ClientPtr client) (*pScreen->ClipNotify) (pWin, 0, 0); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap); - REGION_NULL(pScreen, &temp); - REGION_COPY(pScreen, &temp, &pWin->clipList); + RegionNull(&temp); + RegionCopy(&temp, &pWin->clipList); (*pScreen->WindowExposures) (pWin, &temp, NullRegion); - REGION_UNINIT(pScreen, &temp); + RegionUninit(&temp); } return(Success); @@ -3184,7 +3184,7 @@ VisibleBoundingBoxFromPoint(register WindowPtr pWin, int x, int y, BoxPtr box) { if (!pWin->realized) return (FALSE); - if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->clipList, x, y, box)) + if (RegionContainsPoint(&pWin->clipList, x, y, box)) return(TRUE); return(FALSE); } @@ -3200,10 +3200,10 @@ PointInWindowIsVisible(register WindowPtr pWin, int x, int y) if (!pWin->realized) return (FALSE); - if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderClip, + if (RegionContainsPoint(&pWin->borderClip, x, y, &box) && (!wInputShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box))) @@ -3219,12 +3219,12 @@ NotClippedByChildren(register WindowPtr pWin) RegionPtr pReg; pScreen = pWin->drawable.pScreen; - pReg = REGION_CREATE(pScreen, NullBox, 1); + pReg = RegionCreate(NullBox, 1); if (pWin->parent || screenIsSaved != SCREEN_SAVER_ON || !HasSaverWindow (pWin->drawable.pScreen->myNum)) { - REGION_INTERSECT(pScreen, pReg, &pWin->borderClip, &pWin->winSize); + RegionIntersect(pReg, &pWin->borderClip, &pWin->winSize); } return(pReg); } diff --git a/nx-X11/programs/Xserver/fb/fb.h b/nx-X11/programs/Xserver/fb/fb.h index b64f3a227..1da5d2470 100644 --- a/nx-X11/programs/Xserver/fb/fb.h +++ b/nx-X11/programs/Xserver/fb/fb.h @@ -703,7 +703,7 @@ typedef struct { */ #define fbWindowEnabled(pWin) \ - REGION_NOTEMPTY((pWin)->drawable.pScreen, \ + RegionNotEmpty(\ &WindowTable[(pWin)->drawable.pScreen->myNum]->borderClip) #define fbDrawableEnabled(pDrawable) \ diff --git a/nx-X11/programs/Xserver/fb/fb24_32.c b/nx-X11/programs/Xserver/fb/fb24_32.c index 68e0ef84d..350055c14 100644 --- a/nx-X11/programs/Xserver/fb/fb24_32.c +++ b/nx-X11/programs/Xserver/fb/fb24_32.c @@ -338,8 +338,8 @@ fb24_32SetSpans (DrawablePtr pDrawable, { d = dst + (ppt->y + dstYoff) * dstStride; s = (CARD8 *) src; - n = REGION_NUM_RECTS(pClip); - pbox = REGION_RECTS (pClip); + n = RegionNumRects(pClip); + pbox = RegionRects (pClip); while (n--) { if (pbox->y1 > ppt->y) @@ -400,8 +400,8 @@ fb24_32PutZImage (DrawablePtr pDrawable, dstStride *= sizeof(FbBits); dst = (CARD8 *) dstBits; - for (nbox = REGION_NUM_RECTS (pClip), - pbox = REGION_RECTS(pClip); + for (nbox = RegionNumRects (pClip), + pbox = RegionRects(pClip); nbox--; pbox++) { diff --git a/nx-X11/programs/Xserver/fb/fbarc.c b/nx-X11/programs/Xserver/fb/fbarc.c index 315aa181c..0b386f70e 100644 --- a/nx-X11/programs/Xserver/fb/fbarc.c +++ b/nx-X11/programs/Xserver/fb/fbarc.c @@ -101,7 +101,7 @@ fbPolyArc (DrawablePtr pDrawable, y2 = box.y1 + (int)parcs->height + 1; box.y2 = y2; if ( (x2 <= MAXSHORT) && (y2 <= MAXSHORT) && - (RECT_IN_REGION(pDrawable->pScreen, cclip, &box) == rgnIN) ) + (RegionContainsRect(cclip, &box) == rgnIN) ) (*arc) (dst, dstStride, dstBpp, parcs, pDrawable->x + dstXoff, pDrawable->y + dstYoff, pPriv->and, pPriv->xor); diff --git a/nx-X11/programs/Xserver/fb/fbbits.h b/nx-X11/programs/Xserver/fb/fbbits.h index 7dfff58b4..5cd7ae70f 100644 --- a/nx-X11/programs/Xserver/fb/fbbits.h +++ b/nx-X11/programs/Xserver/fb/fbbits.h @@ -668,7 +668,7 @@ POLYLINE (DrawablePtr pDrawable, int xoff = pDrawable->x; int yoff = pDrawable->y; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - BoxPtr pBox = REGION_EXTENTS (pDrawable->pScreen, fbGetCompositeClip (pGC)); + BoxPtr pBox = RegionExtents(fbGetCompositeClip (pGC)); FbBits *dst; int dstStride; @@ -800,7 +800,7 @@ POLYSEGMENT (DrawablePtr pDrawable, int xoff = pDrawable->x; int yoff = pDrawable->y; unsigned int bias = miGetZeroLineBias(pDrawable->pScreen); - BoxPtr pBox = REGION_EXTENTS (pDrawable->pScreen, fbGetCompositeClip (pGC)); + BoxPtr pBox = RegionExtents(fbGetCompositeClip (pGC)); FbBits *dst; int dstStride; diff --git a/nx-X11/programs/Xserver/fb/fbbstore.c b/nx-X11/programs/Xserver/fb/fbbstore.c index 01ec9b7e0..e9eedde5b 100644 --- a/nx-X11/programs/Xserver/fb/fbbstore.c +++ b/nx-X11/programs/Xserver/fb/fbbstore.c @@ -39,8 +39,8 @@ fbSaveAreas(PixmapPtr pPixmap, fbCopyWindowProc (&pWin->drawable, &pPixmap->drawable, 0, - REGION_RECTS(prgnSave), - REGION_NUM_RECTS(prgnSave), + RegionRects(prgnSave), + RegionNumRects(prgnSave), xorg, yorg, FALSE, FALSE, @@ -57,8 +57,8 @@ fbRestoreAreas(PixmapPtr pPixmap, fbCopyWindowProc (&pPixmap->drawable, &pWin->drawable, 0, - REGION_RECTS(prgnRestore), - REGION_NUM_RECTS(prgnRestore), + RegionRects(prgnRestore), + RegionNumRects(prgnRestore), -xorg, -yorg, FALSE, FALSE, diff --git a/nx-X11/programs/Xserver/fb/fbcompose.c b/nx-X11/programs/Xserver/fb/fbcompose.c index f8169995f..07ae9490f 100644 --- a/nx-X11/programs/Xserver/fb/fbcompose.c +++ b/nx-X11/programs/Xserver/fb/fbcompose.c @@ -2896,7 +2896,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 if (pict->filter == PictFilterNearest) { if (pict->repeatType == RepeatNormal) { - if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { + if (RegionNumRects(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!v.vector[2]) { @@ -2927,7 +2927,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 y = MOD(v.vector[1]>>16, pict->pDrawable->height); x = MOD(v.vector[0]>>16, pict->pDrawable->width); } - if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box)) + if (RegionContainsPoint(pict->pCompositeClip, x, y, &box)) buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed); else buffer[i] = 0; @@ -2938,7 +2938,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 } } } else { - if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { + if (RegionNumRects(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!v.vector[2]) { @@ -2970,7 +2970,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 y = v.vector[1]>>16; x = v.vector[0]>>16; } - if (POINT_IN_REGION (0, pict->pCompositeClip, x, y, &box)) + if (RegionContainsPoint(pict->pCompositeClip, x, y, &box)) buffer[i] = fetch(bits + (y + pict->pDrawable->y)*stride, x + pict->pDrawable->x, indexed); else buffer[i] = 0; @@ -2983,7 +2983,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 } } else if (pict->filter == PictFilterBilinear) { if (pict->repeatType == RepeatNormal) { - if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { + if (RegionNumRects(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!v.vector[2]) { @@ -3082,14 +3082,14 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 b = bits + (y1 + pict->pDrawable->y)*stride; - tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box) + tl = RegionContainsPoint(pict->pCompositeClip, x1, y1, &box) ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0; - tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box) + tr = RegionContainsPoint(pict->pCompositeClip, x2, y1, &box) ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0; b = bits + (y2 + pict->pDrawable->y)*stride; - bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box) + bl = RegionContainsPoint(pict->pCompositeClip, x1, y2, &box) ? fetch(b, x1 + pict->pDrawable->x, indexed) : 0; - br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box) + br = RegionContainsPoint(pict->pCompositeClip, x2, y2, &box) ? fetch(b, x2 + pict->pDrawable->x, indexed) : 0; ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; @@ -3112,7 +3112,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 } } } else { - if (REGION_NUM_RECTS(pict->pCompositeClip) == 1) { + if (RegionNumRects(pict->pCompositeClip) == 1) { box = pict->pCompositeClip->extents; for (i = 0; i < width; ++i) { if (!v.vector[2]) { @@ -3209,14 +3209,14 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 b = bits + (y1 + pict->pDrawable->y)*stride; x_off = x1 + pict->pDrawable->x; - tl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y1, &box) + tl = RegionContainsPoint(pict->pCompositeClip, x1, y1, &box) ? fetch(b, x_off, indexed) : 0; - tr = POINT_IN_REGION(0, pict->pCompositeClip, x2, y1, &box) + tr = RegionContainsPoint(pict->pCompositeClip, x2, y1, &box) ? fetch(b, x_off + 1, indexed) : 0; b += stride; - bl = POINT_IN_REGION(0, pict->pCompositeClip, x1, y2, &box) + bl = RegionContainsPoint(pict->pCompositeClip, x1, y2, &box) ? fetch(b, x_off, indexed) : 0; - br = POINT_IN_REGION(0, pict->pCompositeClip, x2, y2, &box) + br = RegionContainsPoint(pict->pCompositeClip, x2, y2, &box) ? fetch(b, x_off + 1, indexed) : 0; ft = FbGet8(tl,0) * idistx + FbGet8(tr,0) * distx; @@ -3274,7 +3274,7 @@ static void fbFetchTransformed(PicturePtr pict, int x, int y, int width, CARD32 for (x = x1; x < x2; x++) { if (*p) { int tx = (pict->repeatType == RepeatNormal) ? MOD (x, pict->pDrawable->width) : x; - if (POINT_IN_REGION (0, pict->pCompositeClip, tx, ty, &box)) { + if (RegionContainsPoint(pict->pCompositeClip, tx, ty, &box)) { FbBits *b = bits + (ty + pict->pDrawable->y)*stride; CARD32 c = fetch(b, tx + pict->pDrawable->x, indexed); @@ -3563,8 +3563,8 @@ fbCompositeGeneral (CARD8 op, if (width > SCANLINE_BUFFER_LENGTH) scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32)); - n = REGION_NUM_RECTS (®ion); - pbox = REGION_RECTS (®ion); + n = RegionNumRects (®ion); + pbox = RegionRects (®ion); while (n--) { h = pbox->y2 - pbox->y1; @@ -3618,7 +3618,7 @@ fbCompositeGeneral (CARD8 op, } pbox++; } - REGION_UNINIT (pDst->pDrawable->pScreen, ®ion); + RegionUninit(®ion); if (scanline_buffer != _scanline_buffer) free(scanline_buffer); diff --git a/nx-X11/programs/Xserver/fb/fbcopy.c b/nx-X11/programs/Xserver/fb/fbcopy.c index 1e7b93435..f68811ebb 100644 --- a/nx-X11/programs/Xserver/fb/fbcopy.c +++ b/nx-X11/programs/Xserver/fb/fbcopy.c @@ -306,8 +306,8 @@ fbCopyRegion (DrawablePtr pSrcDrawable, int nbox; BoxPtr pboxNew1, pboxNew2, pboxBase, pboxNext, pboxTmp; - pbox = REGION_RECTS(pDstRegion); - nbox = REGION_NUM_RECTS(pDstRegion); + pbox = RegionRects(pDstRegion); + nbox = RegionNumRects(pDstRegion); /* XXX we have to err on the side of safety when both are windows, * because we don't know if IncludeInferiors is being used. @@ -466,7 +466,7 @@ fbDoCopy (DrawablePtr pSrcDrawable, * VT is inactive, make sure the region isn't empty */ if (!((WindowPtr) pSrcDrawable)->parent && - REGION_NOTEMPTY (pSrcDrawable->pScreen, + RegionNotEmpty( &((WindowPtr) pSrcDrawable)->borderClip)) { /* @@ -548,9 +548,9 @@ fbDoCopy (DrawablePtr pSrcDrawable, blown region and call intersect */ cclip = fbGetCompositeClip(pGC); - if (REGION_NUM_RECTS(cclip) == 1) + if (RegionNumRects(cclip) == 1) { - BoxPtr pBox = REGION_RECTS(cclip); + BoxPtr pBox = RegionRects(cclip); if (box_x1 < pBox->x1) box_x1 = pBox->x1; if (box_x2 > pBox->x2) box_x2 = pBox->x2; @@ -563,7 +563,7 @@ fbDoCopy (DrawablePtr pSrcDrawable, /* Check to see if the region is empty */ if (box_x1 >= box_x2 || box_y1 >= box_y2) { - REGION_NULL(pGC->pScreen, &rgnDst); + RegionNull(&rgnDst); } else { @@ -572,25 +572,25 @@ fbDoCopy (DrawablePtr pSrcDrawable, box.y1 = box_y1; box.x2 = box_x2; box.y2 = box_y2; - REGION_INIT(pGC->pScreen, &rgnDst, &box, 1); + RegionInit(&rgnDst, &box, 1); } /* Clip against complex source if needed */ if (!fastSrc) { - REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip); - REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy); + RegionIntersect(&rgnDst, &rgnDst, prgnSrcClip); + RegionTranslate(&rgnDst, -dx, -dy); } /* Clip against complex dest if needed */ if (!fastDst) { - REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, + RegionIntersect(&rgnDst, &rgnDst, fbGetCompositeClip(pGC)); } /* Do bit blitting */ - numRects = REGION_NUM_RECTS(&rgnDst); + numRects = RegionNumRects(&rgnDst); if (numRects && widthSrc && heightSrc) fbCopyRegion (pSrcDrawable, pDstDrawable, pGC, &rgnDst, dx, dy, copyProc, bitPlane, closure); @@ -604,9 +604,9 @@ fbDoCopy (DrawablePtr pSrcDrawable, xOut - pDstDrawable->x, yOut - pDstDrawable->y, (unsigned long) bitPlane); - REGION_UNINIT(pGC->pScreen, &rgnDst); + RegionUninit(&rgnDst); if (freeSrcClip) - REGION_DESTROY(pGC->pScreen, prgnSrcClip); + RegionDestroy(prgnSrcClip); fbValidateDrawable (pDstDrawable); return prgnExposed; } diff --git a/nx-X11/programs/Xserver/fb/fbfill.c b/nx-X11/programs/Xserver/fb/fbfill.c index c61ff3b4c..be6723c01 100644 --- a/nx-X11/programs/Xserver/fb/fbfill.c +++ b/nx-X11/programs/Xserver/fb/fbfill.c @@ -184,7 +184,7 @@ fbSolidBoxClipped (DrawablePtr pDrawable, fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); - for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); + for (nbox = RegionNumRects(pClip), pbox = RegionRects(pClip); nbox--; pbox++) { diff --git a/nx-X11/programs/Xserver/fb/fbfillrect.c b/nx-X11/programs/Xserver/fb/fbfillrect.c index 2a60da165..37a7b20f7 100644 --- a/nx-X11/programs/Xserver/fb/fbfillrect.c +++ b/nx-X11/programs/Xserver/fb/fbfillrect.c @@ -47,7 +47,7 @@ fbPolyFillRect(DrawablePtr pDrawable, xorg = pDrawable->x; yorg = pDrawable->y; - pextent = REGION_EXTENTS(pGC->pScreen, pClip); + pextent = RegionExtents(pClip); extentX1 = pextent->x1; extentY1 = pextent->y1; extentX2 = pextent->x2; @@ -74,7 +74,7 @@ fbPolyFillRect(DrawablePtr pDrawable, if ((fullX1 >= fullX2) || (fullY1 >= fullY2)) continue; - n = REGION_NUM_RECTS (pClip); + n = RegionNumRects (pClip); if (n == 1) { fbFill (pDrawable, @@ -83,7 +83,7 @@ fbPolyFillRect(DrawablePtr pDrawable, } else { - pbox = REGION_RECTS(pClip); + pbox = RegionRects(pClip); /* * clip the rectangle to each box in the clip region * this is logically equivalent to calling Intersect() diff --git a/nx-X11/programs/Xserver/fb/fbfillsp.c b/nx-X11/programs/Xserver/fb/fbfillsp.c index e2bb71e3a..5d465482f 100644 --- a/nx-X11/programs/Xserver/fb/fbfillsp.c +++ b/nx-X11/programs/Xserver/fb/fbfillsp.c @@ -44,7 +44,7 @@ fbFillSpans (DrawablePtr pDrawable, int fullX1, fullX2, fullY1; int partX1, partX2; - pextent = REGION_EXTENTS(pGC->pScreen, pClip); + pextent = RegionExtents(pClip); extentX1 = pextent->x1; extentY1 = pextent->y1; extentX2 = pextent->x2; @@ -69,7 +69,7 @@ fbFillSpans (DrawablePtr pDrawable, if (fullX1 >= fullX2) continue; - nbox = REGION_NUM_RECTS (pClip); + nbox = RegionNumRects (pClip); if (nbox == 1) { fbFill (pDrawable, @@ -78,7 +78,7 @@ fbFillSpans (DrawablePtr pDrawable, } else { - pbox = REGION_RECTS(pClip); + pbox = RegionRects(pClip); while(nbox--) { if (pbox->y1 <= fullY1 && fullY1 < pbox->y2) diff --git a/nx-X11/programs/Xserver/fb/fbgc.c b/nx-X11/programs/Xserver/fb/fbgc.c index fdd7a319c..a980023ef 100644 --- a/nx-X11/programs/Xserver/fb/fbgc.c +++ b/nx-X11/programs/Xserver/fb/fbgc.c @@ -211,7 +211,7 @@ fbValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) ) { miComputeCompositeClip (pGC, pDrawable); - pPriv->oneRect = REGION_NUM_RECTS(fbGetCompositeClip(pGC)) == 1; + pPriv->oneRect = RegionNumRects(fbGetCompositeClip(pGC)) == 1; } #ifdef FB_24_32BIT diff --git a/nx-X11/programs/Xserver/fb/fbglyph.c b/nx-X11/programs/Xserver/fb/fbglyph.c index bb0dda669..3c0913cf8 100644 --- a/nx-X11/programs/Xserver/fb/fbglyph.c +++ b/nx-X11/programs/Xserver/fb/fbglyph.c @@ -41,7 +41,7 @@ fbGlyphIn (RegionPtr pRegion, int height) { BoxRec box; - BoxPtr pExtents = REGION_EXTENTS (dummyScreen, pRegion); + BoxPtr pExtents = RegionExtents(pRegion); /* * Check extents by hand to avoid 16 bit overflows @@ -58,7 +58,7 @@ fbGlyphIn (RegionPtr pRegion, box.x2 = x + width; box.y1 = y; box.y2 = y + height; - return RECT_IN_REGION (dummyScreen, pRegion, &box) == rgnIN; + return RegionContainsRect(pRegion, &box) == rgnIN; } #ifdef FB_24BIT diff --git a/nx-X11/programs/Xserver/fb/fbimage.c b/nx-X11/programs/Xserver/fb/fbimage.c index 96bd8cf95..06b501b41 100644 --- a/nx-X11/programs/Xserver/fb/fbimage.c +++ b/nx-X11/programs/Xserver/fb/fbimage.c @@ -140,8 +140,8 @@ fbPutZImage (DrawablePtr pDrawable, fbGetStipDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); - for (nbox = REGION_NUM_RECTS (pClip), - pbox = REGION_RECTS(pClip); + for (nbox = RegionNumRects (pClip), + pbox = RegionRects(pClip); nbox--; pbox++) { @@ -228,8 +228,8 @@ fbPutXYImage (DrawablePtr pDrawable, } } - for (nbox = REGION_NUM_RECTS (pClip), - pbox = REGION_RECTS(pClip); + for (nbox = RegionNumRects (pClip), + pbox = RegionRects(pClip); nbox--; pbox++) { diff --git a/nx-X11/programs/Xserver/fb/fbline.c b/nx-X11/programs/Xserver/fb/fbline.c index 8e99dd99f..0a9954998 100644 --- a/nx-X11/programs/Xserver/fb/fbline.c +++ b/nx-X11/programs/Xserver/fb/fbline.c @@ -119,7 +119,7 @@ fbPolyLine (DrawablePtr pDrawable, #ifndef FBNOPIXADDR if (pGC->fillStyle == FillSolid && pGC->lineStyle == LineSolid && - REGION_NUM_RECTS (fbGetCompositeClip(pGC)) == 1) + RegionNumRects (fbGetCompositeClip(pGC)) == 1) { switch (pDrawable->bitsPerPixel) { case 8: line = fbPolyline8; break; @@ -156,7 +156,7 @@ fbPolySegment (DrawablePtr pDrawable, #ifndef FBNOPIXADDR if (pGC->fillStyle == FillSolid && pGC->lineStyle == LineSolid && - REGION_NUM_RECTS (fbGetCompositeClip(pGC)) == 1) + RegionNumRects (fbGetCompositeClip(pGC)) == 1) { switch (pDrawable->bitsPerPixel) { case 8: seg = fbPolySegment8; break; diff --git a/nx-X11/programs/Xserver/fb/fboverlay.c b/nx-X11/programs/Xserver/fb/fboverlay.c index 81c54316f..49623ba4f 100644 --- a/nx-X11/programs/Xserver/fb/fboverlay.c +++ b/nx-X11/programs/Xserver/fb/fboverlay.c @@ -74,7 +74,7 @@ fbOverlayCreateWindow(WindowPtr pWin) */ if (!pWin->parent) { - REGION_EMPTY (pWin->drawable.pScreen, + RegionEmpty( &pScrPriv->layer[i].u.run.region); } return TRUE; @@ -92,7 +92,7 @@ fbOverlayCloseScreen (int iScreen, ScreenPtr pScreen) for (i = 0; i < pScrPriv->nlayers; i++) { (*pScreen->DestroyPixmap)(pScrPriv->layer[i].u.run.pixmap); - REGION_UNINIT (pScreen, &pScrPriv->layer[i].u.run.region); + RegionUninit(&pScrPriv->layer[i].u.run.region); } return TRUE; } @@ -146,7 +146,7 @@ fbOverlayCreateScreenResources(ScreenPtr pScreen) pbits)) return FALSE; pScrPriv->layer[i].u.run.pixmap = pPixmap; - REGION_INIT(pScreen, &pScrPriv->layer[i].u.run.region, &box, 0); + RegionInit(&pScrPriv->layer[i].u.run.region, &box, 0); } pScreen->devPrivate = pScrPriv->layer[0].u.run.pixmap; return TRUE; @@ -174,24 +174,24 @@ fbOverlayUpdateLayerRegion (ScreenPtr pScreen, int i; RegionRec rgnNew; - if (!prgn || !REGION_NOTEMPTY(pScreen, prgn)) + if (!prgn || !RegionNotEmpty(prgn)) return; for (i = 0; i < pScrPriv->nlayers; i++) { if (i == layer) { /* add new piece to this fb */ - REGION_UNION (pScreen, + RegionUnion( &pScrPriv->layer[i].u.run.region, &pScrPriv->layer[i].u.run.region, prgn); } - else if (REGION_NOTEMPTY (pScreen, + else if (RegionNotEmpty( &pScrPriv->layer[i].u.run.region)) { /* paint new piece with chroma key */ - REGION_NULL (pScreen, &rgnNew); - REGION_INTERSECT (pScreen, + RegionNull(&rgnNew); + RegionIntersect( &rgnNew, prgn, &pScrPriv->layer[i].u.run.region); @@ -199,9 +199,9 @@ fbOverlayUpdateLayerRegion (ScreenPtr pScreen, &rgnNew, pScrPriv->layer[i].key, i); - REGION_UNINIT(pScreen, &rgnNew); + RegionUninit(&rgnNew); /* remove piece from other fbs */ - REGION_SUBTRACT (pScreen, + RegionSubtract( &pScrPriv->layer[i].u.run.region, &pScrPriv->layer[i].u.run.region, prgn); @@ -231,21 +231,21 @@ fbOverlayCopyWindow(WindowPtr pWin, /* * Clip to existing bits */ - REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy); - REGION_NULL (pScreen, &rgnDst); - REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc); - REGION_TRANSLATE(pScreen, &rgnDst, dx, dy); + RegionTranslate(prgnSrc, -dx, -dy); + RegionNull(&rgnDst); + RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); + RegionTranslate(&rgnDst, dx, dy); /* * Compute the portion of each fb affected by this copy */ for (i = 0; i < pScrPriv->nlayers; i++) { - REGION_NULL (pScreen, &layerRgn[i]); - REGION_INTERSECT(pScreen, &layerRgn[i], &rgnDst, + RegionNull(&layerRgn[i]); + RegionIntersect(&layerRgn[i], &rgnDst, &pScrPriv->layer[i].u.run.region); - if (REGION_NOTEMPTY (pScreen, &layerRgn[i])) + if (RegionNotEmpty(&layerRgn[i])) { - REGION_TRANSLATE(pScreen, &layerRgn[i], -dx, -dy); + RegionTranslate(&layerRgn[i], -dx, -dy); pPixmap = pScrPriv->layer[i].u.run.pixmap; fbCopyRegion (&pPixmap->drawable, &pPixmap->drawable, 0, @@ -258,12 +258,12 @@ fbOverlayCopyWindow(WindowPtr pWin, */ for (i = 0; i < pScrPriv->nlayers; i++) { - if (REGION_NOTEMPTY (pScreen, &layerRgn[i])) + if (RegionNotEmpty(&layerRgn[i])) fbOverlayUpdateLayerRegion (pScreen, i, &layerRgn[i]); - REGION_UNINIT(pScreen, &layerRgn[i]); + RegionUninit(&layerRgn[i]); } - REGION_UNINIT(pScreen, &rgnDst); + RegionUninit(&rgnDst); } void diff --git a/nx-X11/programs/Xserver/fb/fbpict.c b/nx-X11/programs/Xserver/fb/fbpict.c index 5ab3756b9..330c55de3 100644 --- a/nx-X11/programs/Xserver/fb/fbpict.c +++ b/nx-X11/programs/Xserver/fb/fbpict.c @@ -1248,8 +1248,8 @@ fbComposite (CARD8 op, height)) return; - n = REGION_NUM_RECTS (®ion); - pbox = REGION_RECTS (®ion); + n = RegionNumRects (®ion); + pbox = RegionRects (®ion); while (n--) { h = pbox->y2 - pbox->y1; @@ -1309,7 +1309,7 @@ fbComposite (CARD8 op, } pbox++; } - REGION_UNINIT (pDst->pDrawable->pScreen, ®ion); + RegionUninit(®ion); } #endif /* RENDER */ diff --git a/nx-X11/programs/Xserver/fb/fbpixmap.c b/nx-X11/programs/Xserver/fb/fbpixmap.c index 7ea288cb1..6c2cafd94 100644 --- a/nx-X11/programs/Xserver/fb/fbpixmap.c +++ b/nx-X11/programs/Xserver/fb/fbpixmap.c @@ -119,7 +119,7 @@ if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \ if ((reg)->data->numRects == (reg)->data->size) \ { \ miRectAlloc(reg, 1); \ - fr = REGION_BOXPTR(reg); \ + fr = RegionBoxptr(reg); \ r = fr + (reg)->data->numRects; \ } \ r->x1 = (rx1); \ @@ -156,10 +156,10 @@ fbPixmapToRegion(PixmapPtr pPix) FbBits *pwLine; int nWidth; - pReg = REGION_CREATE(pPix->drawable.pScreen, NULL, 1); + pReg = RegionCreate(NULL, 1); if(!pReg) return NullRegion; - FirstRect = REGION_BOXPTR(pReg); + FirstRect = RegionBoxptr(pReg); rects = FirstRect; pwLine = (FbBits *) pPix->devPrivate.ptr; @@ -305,8 +305,8 @@ fbPixmapToRegion(PixmapPtr pPix) pReg->extents.x1 = pReg->extents.x2 = 0; else { - pReg->extents.y1 = REGION_BOXPTR(pReg)->y1; - pReg->extents.y2 = REGION_END(pReg)->y2; + pReg->extents.y1 = RegionBoxptr(pReg)->y1; + pReg->extents.y2 = RegionEnd(pReg)->y2; if (pReg->data->numRects == 1) { xfree(pReg->data); diff --git a/nx-X11/programs/Xserver/fb/fbpoint.c b/nx-X11/programs/Xserver/fb/fbpoint.c index 5229d6970..06d8662ba 100644 --- a/nx-X11/programs/Xserver/fb/fbpoint.c +++ b/nx-X11/programs/Xserver/fb/fbpoint.c @@ -157,7 +157,7 @@ fbPolyPoint (DrawablePtr pDrawable, case 32: dots = fbDots32; break; } #endif - for (nBox = REGION_NUM_RECTS (pClip), pBox = REGION_RECTS (pClip); + for (nBox = RegionNumRects (pClip), pBox = RegionRects (pClip); nBox--; pBox++) (*dots) (dst, dstStride, dstBpp, pBox, pptInit, nptInit, pDrawable->x, pDrawable->y, dstXoff, dstYoff, and, xor); diff --git a/nx-X11/programs/Xserver/fb/fbpseudocolor.c b/nx-X11/programs/Xserver/fb/fbpseudocolor.c index 469f3ea08..51f21ed21 100644 --- a/nx-X11/programs/Xserver/fb/fbpseudocolor.c +++ b/nx-X11/programs/Xserver/fb/fbpseudocolor.c @@ -166,10 +166,10 @@ int xxGeneration; # define PRINT_RECTS(rec) {\ int i;\ BoxPtr box;\ - ErrorF("RECTS: %i\n",REGION_NUM_RECTS(&rec));\ - if (REGION_NUM_RECTS(&rec) > 1) { \ - for (i = 0; i < REGION_NUM_RECTS(&rec); i++ ) {\ - box = REGION_BOX(&rec,i);\ + ErrorF("RECTS: %i\n",RegionNumRects(&rec));\ + if (RegionNumRects(&rec) > 1) { \ + for (i = 0; i < RegionNumRects(&rec); i++ ) {\ + box = RegionBox(&rec,i);\ ErrorF("x1: %hi x2: %hi y1: %hi y2: %hi\n", \ box->x1,box->x2,box->y1,box->y2);\ }\ @@ -308,8 +308,8 @@ xxCreateScreenResources(ScreenPtr pScreen) box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; - REGION_NULL(pScreen, &pScrPriv->region); - REGION_INIT(pScreen, &pScrPriv->bRegion, &box, 0); + RegionNull(&pScrPriv->region); + RegionInit(&pScrPriv->bRegion, &box, 0); return TRUE; } @@ -323,7 +323,7 @@ xxCloseScreen (int iScreen, ScreenPtr pScreen) (*pScreen->DestroyPixmap)(pScrPriv->pPixmap); /* We don't need to free the baseColormap as FreeClientResourcess will have taken care of it. */ - REGION_UNINIT (pScreen, &pScrPriv->region); + RegionUninit(&pScrPriv->region); unwrap (pScrPriv,pScreen, CloseScreen); ret = pScreen->CloseScreen(iScreen,pScreen); @@ -678,7 +678,7 @@ xxCreateWindow(WindowPtr pWin) pWin->devPrivates[fbWinPrivateIndex].ptr = (void *) pScrPriv->pPixmap; PRINT_RECTS(pScrPriv->region); if (!pWin->parent) { - REGION_EMPTY (pWin->drawable.pScreen, &pScrPriv->region); + RegionEmpty(&pScrPriv->region); } PRINT_RECTS(pScrPriv->region); @@ -694,11 +694,11 @@ xxWalkChildren(WindowPtr pWin, RegionPtr pReg, PixmapPtr pPixmap) do { if (fbGetWindowPixmap(pCurWin) == pPixmap) { DBG("WalkWindow Add\n"); - REGION_UNION(pWin->drawable.pScreen,pReg,pReg, + RegionUnion(pReg,pReg, &pCurWin->borderClip); } else { DBG("WalkWindow Sub\n"); - REGION_SUBTRACT(pWin->drawable.pScreen,pReg,pReg, + RegionSubtract(pReg,pReg, &pCurWin->borderClip); } if (pCurWin->lastChild) @@ -713,7 +713,7 @@ xxPickMyWindows(WindowPtr pWin, RegionPtr pRgn) xxScrPriv(pScreen); if (fbGetWindowPixmap(pWin) == pScrPriv->pPixmap) { - REGION_UNION(pWin->drawable.pScreen,pRgn,pRgn,&pWin->borderClip); + RegionUnion(pRgn,pRgn,&pWin->borderClip); } if (pWin->lastChild) xxWalkChildren(pWin->lastChild,pRgn,pScrPriv->pPixmap); @@ -736,11 +736,11 @@ xxCopyWindow(WindowPtr pWin, dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; - REGION_NULL(pScreen, &rgn_new); - REGION_UNION(pScreen, &rgn_new,&rgn_new,prgnSrc); - REGION_TRANSLATE(pScreen,&rgn_new,-dx,-dy); + RegionNull(&rgn_new); + RegionUnion(&rgn_new,&rgn_new,prgnSrc); + RegionTranslate(&rgn_new,-dx,-dy); - REGION_NULL(pScreen, &rgn); + RegionNull(&rgn); xxPickMyWindows(pWin,&rgn); unwrap (pScrPriv, pScreen, CopyWindow); @@ -749,19 +749,19 @@ xxCopyWindow(WindowPtr pWin, pWin->devPrivates[fbWinPrivateIndex].ptr = pPixmap; wrap(pScrPriv, pScreen, CopyWindow, xxCopyWindow); - REGION_INTERSECT(pScreen,&rgn,&rgn,&rgn_new); - if (REGION_NOTEMPTY (pScreen,&rgn)) { + RegionIntersect(&rgn,&rgn,&rgn_new); + if (RegionNotEmpty(&rgn)) { fbCopyRegion(&pScrPriv->pPixmap->drawable,&pScrPriv->pPixmap->drawable, 0,&rgn,dx,dy,fbCopyWindowProc,0,(void*)0); - REGION_TRANSLATE(pScreen,&rgn,dx,dy); - REGION_INTERSECT(pScreen,&rgn_new,&pScrPriv->region,&rgn); - REGION_SUBTRACT(pScreen,&pScrPriv->region,&pScrPriv->region,&rgn); - REGION_TRANSLATE(pScreen,&rgn_new,-dx,-dy); - REGION_UNION(pScreen,&pScrPriv->region,&pScrPriv->region,&rgn_new); + RegionTranslate(&rgn,dx,dy); + RegionIntersect(&rgn_new,&pScrPriv->region,&rgn); + RegionSubtract(&pScrPriv->region,&pScrPriv->region,&rgn); + RegionTranslate(&rgn_new,-dx,-dy); + RegionUnion(&pScrPriv->region,&pScrPriv->region,&rgn_new); } #if 1 - REGION_UNINIT(pScreen,&rgn_new); - REGION_UNINIT(pScreen,&rgn); + RegionUninit(&rgn_new); + RegionUninit(&rgn); #endif } @@ -775,14 +775,14 @@ xxWindowExposures (WindowPtr pWin, if (fbGetWindowPixmap(pWin) == pScrPriv->pPixmap) { DBG("WindowExposures\n"); PRINT_RECTS(pScrPriv->region); - REGION_UNION(pWin->drawable.pScreen,&pScrPriv->region, + RegionUnion(&pScrPriv->region, &pScrPriv->region, prgn); PRINT_RECTS(pScrPriv->region); } else { DBG("WindowExposures NonPseudo\n"); PRINT_RECTS(pScrPriv->region); - REGION_SUBTRACT(pWin->drawable.pScreen,&pScrPriv->region, + RegionSubtract(&pScrPriv->region, &pScrPriv->region, prgn); PRINT_RECTS(pScrPriv->region); @@ -800,23 +800,23 @@ xxPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) DBG("xxPaintWindow\n"); - REGION_NULL (pWin->drawable.pScreen, &rgni); + RegionNull(&rgni); #if 0 - REGION_UNION (pWin->drawable.pScreen, &rgni, &rgni, &pWin->borderClip); - REGION_INTERSECT(pWin->drawable.pScreen, &rgni, &rgni, pRegion); + RegionUnion(&rgni, &rgni, &pWin->borderClip); + RegionIntersect(&rgni, &rgni, pRegion); #else - REGION_UNION (pWin->drawable.pScreen, &rgni, &rgni, pRegion); + RegionUnion(&rgni, &rgni, pRegion); #endif switch (what) { case PW_BORDER: - REGION_SUBTRACT (pWin->drawable.pScreen, &rgni, &rgni, &pWin->winSize); + RegionSubtract(&rgni, &rgni, &pWin->winSize); if (fbGetWindowPixmap(pWin) == pScrPriv->pPixmap) { DBG("PaintWindowBorder\n"); - REGION_UNION (pWin->drawable.pScreen, &pScrPriv->region, + RegionUnion(&pScrPriv->region, &pScrPriv->region, &rgni); } else { DBG("PaintWindowBorder NoOverlay\n"); - REGION_SUBTRACT (pWin->drawable.pScreen, &pScrPriv->region, + RegionSubtract(&pScrPriv->region, &pScrPriv->region, &rgni); } unwrap (pScrPriv, pWin->drawable.pScreen, PaintWindowBorder); @@ -829,15 +829,15 @@ xxPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) case None: break; default: - REGION_INTERSECT (pWin->drawable.pScreen, &rgni, + RegionIntersect(&rgni, &rgni,&pWin->winSize); if (fbGetWindowPixmap(pWin) == pScrPriv->pPixmap) { DBG("PaintWindowBackground\n"); - REGION_UNION (pWin->drawable.pScreen, &pScrPriv->region, + RegionUnion(&pScrPriv->region, &pScrPriv->region, &rgni); } else { DBG("PaintWindowBackground NoOverlay\n"); - REGION_SUBTRACT (pWin->drawable.pScreen, &pScrPriv->region, + RegionSubtract(&pScrPriv->region, &pScrPriv->region, &rgni); } break; @@ -852,7 +852,7 @@ xxPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) PRINT_RECTS(rgni); PRINT_RECTS(pScrPriv->region); #if 1 - REGION_UNINIT(pWin->drawable.pScreen,&rgni); + RegionUninit(&rgni); #endif } @@ -862,8 +862,8 @@ xxCopyPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg, { xxScrPriv(pScreen); CARD32 mask = (1 << pScrPriv->myDepth) - 1; - int num = REGION_NUM_RECTS(pReg); - BoxPtr pbox = REGION_RECTS(pReg); + int num = RegionNumRects(pReg); + BoxPtr pbox = RegionRects(pReg); int width, height; CARD8 *src; CARD16 *dst, *dst_base; @@ -905,8 +905,8 @@ xxUpdateCmapPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg, { xxScrPriv(pScreen); CARD32 mask = (1 << pScrPriv->myDepth) - 1; - int num = REGION_NUM_RECTS(pReg); - BoxPtr pbox = REGION_RECTS(pReg); + int num = RegionNumRects(pReg); + BoxPtr pbox = RegionRects(pReg); int width, height; CARD8 *src; CARD16 *dst, *dst_base; @@ -950,14 +950,14 @@ xxUpdateCmapPseudocolorRegion(ScreenPtr pScreen, RegionPtr pReg, static void xxGetWindowRegion(WindowPtr pWin,RegionPtr winreg) { - REGION_NULL(pWin->drawable.pScreen,winreg); + RegionNull(winreg); /* get visible part of the border ...Argh */ - REGION_SUBTRACT(pWin->drawable.pScreen,winreg,&pWin->borderSize, + RegionSubtract(winreg,&pWin->borderSize, &pWin->winSize); - REGION_INTERSECT(pWin->drawable.pScreen,winreg,winreg, + RegionIntersect(winreg,winreg, &pWin->borderClip); /* add window interior excluding children */ - REGION_UNION(pWin->drawable.pScreen,winreg,winreg, + RegionUnion(winreg,winreg, &pWin->clipList); } @@ -985,18 +985,18 @@ xxUpdateRegion(WindowPtr pWin, void * unused) if (!pCmapPriv->dirty) goto CONTINUE; - REGION_NULL (pScreen, &rgni); + RegionNull(&rgni); /* This will be taken care of when damaged regions are updated */ - REGION_SUBTRACT(pScreen, &rgni, &winreg, &pScrPriv->region); - if (REGION_NOTEMPTY (pScreen,&rgni)) + RegionSubtract(&rgni, &winreg, &pScrPriv->region); + if (RegionNotEmpty(&rgni)) xxUpdateCmapPseudocolorRegion(pScreen,&rgni, pCmapPriv); } CONTINUE: - REGION_NULL (pScreen, &rgni); - REGION_INTERSECT (pScreen, &rgni, &winreg, &pScrPriv->region); + RegionNull(&rgni); + RegionIntersect(&rgni, &winreg, &pScrPriv->region); - if (REGION_NOTEMPTY (pScreen,&rgni)) { + if (RegionNotEmpty(&rgni)) { if (pmap == (void *) -1) { pmap = (ColormapPtr)LookupIDByType(wColormap(pWin),RT_COLORMAP); @@ -1008,12 +1008,12 @@ xxUpdateRegion(WindowPtr pWin, void * unused) if (pCmapPriv != (void *)-1) xxCopyPseudocolorRegion(pScreen,&rgni, pCmapPriv); - REGION_SUBTRACT(pScreen, &pScrPriv->region, &pScrPriv->region, + RegionSubtract(&pScrPriv->region, &pScrPriv->region, &rgni); } #if 1 - REGION_UNINIT(pScreen,&rgni); - REGION_UNINIT(pScreen,&winreg); + RegionUninit(&rgni); + RegionUninit(&winreg); #endif } return WT_WALKCHILDREN; @@ -1033,7 +1033,7 @@ xxUpdateFb(ScreenPtr pScreen) WalkTree(pScreen,xxUpdateRegion,NULL); #if 0 - if (REGION_NOTEMPTY (pScreen,&pScrPriv->region)) { + if (RegionNotEmpty(&pScrPriv->region)) { ColormapPtr pmap = (void *) -1; xxCmapPrivPtr pCmapPriv; @@ -1042,7 +1042,7 @@ xxUpdateFb(ScreenPtr pScreen) pCmapPriv = xxGetCmapPriv(pmap); if (pCmapPriv != (void *)-1) xxCopyPseudocolorRegion(pScreen,&pScrPriv->region, pCmapPriv); - REGION_SUBTRACT(pScreen, &pScrPriv->region, &pScrPriv->region, + RegionSubtract(&pScrPriv->region, &pScrPriv->region, &pScrPriv->region); } #endif @@ -1071,7 +1071,7 @@ xxBlockHandler (void * data, ScreenPtr pScreen = (ScreenPtr) data; xxScrPriv(pScreen); - if (REGION_NOTEMPTY (pScreen,&pScrPriv->region) || pScrPriv->colormapDirty) + if (RegionNotEmpty(&pScrPriv->region) || pScrPriv->colormapDirty) xxUpdateFb (pScreen); } @@ -1241,15 +1241,15 @@ GCOps xxGCOps = { if (BOX_NOT_EMPTY(box)) { \ RegionRec region; \ ScreenPtr pScreen = pGC->pScreen;\ - REGION_INIT (pScreen, ®ion, &box, 1); \ - REGION_INTERSECT(pScreen,®ion,®ion,\ + RegionInit(®ion, &box, 1); \ + RegionIntersect(®ion,®ion,\ (pGC)->pCompositeClip);\ - if (REGION_NOTEMPTY(pScreen,®ion)) { \ + if (RegionNotEmpty(®ion)) { \ xxScrPriv(pScreen);\ PRINT_RECTS(pScrPriv->region);\ - REGION_UNION(pScreen,&pScrPriv->region,&pScrPriv->region,®ion);\ + RegionUnion(&pScrPriv->region,&pScrPriv->region,®ion);\ PRINT_RECTS(pScrPriv->region);\ - REGION_UNINIT(pScreen,®ion);\ + RegionUninit(®ion);\ }\ }\ } @@ -2234,11 +2234,11 @@ xxPushPixels( RegionRec region; \ xxScrPriv(pScreen);\ ScreenPtr pScreen = pScreen;\ - REGION_INIT (pScreen, ®ion, &box, 1); \ + RegionInit(®ion, &box, 1); \ PRINT_RECTS(pScrPriv->region);\ - REGION_UNION(pScreen,&pScrPriv->region,&pScrPriv->region,®ion);\ + RegionUnion(&pScrPriv->region,&pScrPriv->region,®ion);\ PRINT_RECTS(pScrPriv->region);\ - REGION_UNINIT(pScreen,®ion);\ + RegionUninit(®ion);\ }\ } diff --git a/nx-X11/programs/Xserver/fb/fbpush.c b/nx-X11/programs/Xserver/fb/fbpush.c index 8f1336963..78d2e450d 100644 --- a/nx-X11/programs/Xserver/fb/fbpush.c +++ b/nx-X11/programs/Xserver/fb/fbpush.c @@ -192,8 +192,8 @@ fbPushImage (DrawablePtr pDrawable, BoxPtr pbox; int x1, y1, x2, y2; - for (nbox = REGION_NUM_RECTS (pClip), - pbox = REGION_RECTS(pClip); + for (nbox = RegionNumRects (pClip), + pbox = RegionRects(pClip); nbox--; pbox++) { diff --git a/nx-X11/programs/Xserver/fb/fbseg.c b/nx-X11/programs/Xserver/fb/fbseg.c index 18a996e0c..2947992a6 100644 --- a/nx-X11/programs/Xserver/fb/fbseg.c +++ b/nx-X11/programs/Xserver/fb/fbseg.c @@ -615,8 +615,8 @@ fbSegment (DrawablePtr pDrawable, unsigned int oc1; /* outcode of point 1 */ unsigned int oc2; /* outcode of point 2 */ - nBox = REGION_NUM_RECTS (pClip); - pBox = REGION_RECTS (pClip); + nBox = RegionNumRects (pClip); + pBox = RegionRects (pClip); bres = fbSelectBres (pDrawable, pGC); diff --git a/nx-X11/programs/Xserver/fb/fbsetsp.c b/nx-X11/programs/Xserver/fb/fbsetsp.c index eefc2da82..c7074f036 100644 --- a/nx-X11/programs/Xserver/fb/fbsetsp.c +++ b/nx-X11/programs/Xserver/fb/fbsetsp.c @@ -63,8 +63,8 @@ fbSetSpans (DrawablePtr pDrawable, xoff = (int) (((long) src) & (FB_MASK >> 3)); s = (FbBits *) (src - xoff); xoff <<= 3; - n = REGION_NUM_RECTS(pClip); - pbox = REGION_RECTS (pClip); + n = RegionNumRects(pClip); + pbox = RegionRects (pClip); while (n--) { if (pbox->y1 > ppt->y) diff --git a/nx-X11/programs/Xserver/fb/fbwindow.c b/nx-X11/programs/Xserver/fb/fbwindow.c index 1269902b9..5ce7ba729 100644 --- a/nx-X11/programs/Xserver/fb/fbwindow.c +++ b/nx-X11/programs/Xserver/fb/fbwindow.c @@ -132,15 +132,15 @@ fbCopyWindow(WindowPtr pWin, dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; - REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); + RegionTranslate(prgnSrc, -dx, -dy); - REGION_NULL (pWin->drawable.pScreen, &rgnDst); + RegionNull(&rgnDst); - REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, prgnSrc); + RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc); #ifdef COMPOSITE if (pPixmap->screen_x || pPixmap->screen_y) - REGION_TRANSLATE (pWin->drawable.pScreen, &rgnDst, + RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y); #endif @@ -148,7 +148,7 @@ fbCopyWindow(WindowPtr pWin, 0, &rgnDst, dx, dy, fbCopyWindowProc, 0, 0); - REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); + RegionUninit(&rgnDst); fbValidateDrawable (&pWin->drawable); } @@ -215,8 +215,8 @@ fbFillRegionSolid (DrawablePtr pDrawable, FbStride dstStride; int dstBpp; int dstXoff, dstYoff; - int n = REGION_NUM_RECTS(pRegion); - BoxPtr pbox = REGION_RECTS(pRegion); + int n = RegionNumRects(pRegion); + BoxPtr pbox = RegionRects(pRegion); fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); @@ -253,8 +253,8 @@ fbFillRegionTiled (DrawablePtr pDrawable, int tileBpp; int tileXoff, tileYoff; /* XXX assumed to be zero */ int tileWidth, tileHeight; - int n = REGION_NUM_RECTS(pRegion); - BoxPtr pbox = REGION_RECTS(pRegion); + int n = RegionNumRects(pRegion); + BoxPtr pbox = RegionRects(pRegion); int xRot = pDrawable->x; int yRot = pDrawable->y; diff --git a/nx-X11/programs/Xserver/fix-region b/nx-X11/programs/Xserver/fix-region new file mode 100755 index 000000000..61fe6e0fb --- /dev/null +++ b/nx-X11/programs/Xserver/fix-region @@ -0,0 +1,40 @@ +#!/bin/sh +sed -i \ + -e 's/REGION_NIL\b/RegionNil/g' \ + -e 's/REGION_NAR\b/RegionNar/g' \ + -e 's/REGION_NUM_RECTS\b/RegionNumRects/g' \ + -e 's/REGION_SIZE\b/RegionSize/g' \ + -e 's/REGION_RECTS\b/RegionRects/g' \ + -e 's/REGION_BOXPTR\b/RegionBoxptr/g' \ + -e 's/REGION_BOX\b/RegionBox/g' \ + -e 's/REGION_TOP\b/RegionTop/g' \ + -e 's/REGION_END\b/RegionEnd/g' \ + -e 's/REGION_SZOF\b/RegionSizeof/g' \ + -e 's/REGION_CREATE *([^,]*, */RegionCreate(/g' \ + -e 's/REGION_COPY *([^,]*, */RegionCopy(/g' \ + -e 's/REGION_DESTROY *([^,]*, */RegionDestroy(/g' \ + -e 's/REGION_INTERSECT *([^,]*, */RegionIntersect(/g' \ + -e 's/REGION_UNION *([^,]*, */RegionUnion(/g' \ + -e 's/REGION_SUBTRACT *([^,]*, */RegionSubtract(/g' \ + -e 's/REGION_INVERSE *([^,]*, */RegionInverse(/g' \ + -e 's/REGION_TRANSLATE *([^,]*, */RegionTranslate(/g' \ + -e 's/RECT_IN_REGION *([^,]*, */RegionContainsRect(/g' \ + -e 's/POINT_IN_REGION *([^,]*, */RegionContainsPoint(/g' \ + -e 's/REGION_EQUAL *([^,]*, */RegionEqual(/g' \ + -e 's/REGION_APPEND *([^,]*, */RegionAppend(/g' \ + -e 's/REGION_VALIDATE *([^,]*, */RegionValidate(/g' \ + -e 's/BITMAP_TO_REGION\b/BitmapToRegion/g' \ + -e 's/RECTS_TO_REGION *([^,]*, */RegionFromRects(/g' \ + -e 's/REGION_BREAK *([^,]*, */RegionBreak(/g' \ + -e 's/REGION_INIT *([^,]*, */RegionInit(/g' \ + -e 's/REGION_UNINIT *([^,]*, */RegionUninit(/g' \ + -e 's/REGION_RESET *([^,]*, */RegionReset(/g' \ + -e 's/REGION_NOTEMPTY *([^,]*, */RegionNotEmpty(/g' \ + -e 's/REGION_BROKEN *([^,]*, */RegionBroken(/g' \ + -e 's/REGION_EMPTY *([^,]*, */RegionEmpty(/g' \ + -e 's/REGION_EXTENTS *([^,]*, */RegionExtents(/g' \ + -e 's/REGION_NUM_RECTS *([^,]*, */RegionNumRects(/g' \ + -e 's/REGION_RECTS *([^,]*, */RegionRects(/g' \ + -e 's/REGION_NULL *([^,]*, */RegionNull(/g' \ + -e 's/REGION_NULL$/RegionNull/g' \ + "$@" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 34781e816..7fa984eee 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -47,7 +47,7 @@ /* * The list of rectangles composing a region * s returned by nxagentGetOptimizedRegion- - * Boxes() instead of REGION_RECTS(). + * Boxes() instead of RegionRects(). */ #define USE_OPTIMIZED_BOXES @@ -412,10 +412,10 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned clipRegion = NullRegion; #ifdef COLLECTED_UPDATES - REGION_INIT(pDrawable -> pScreen, &collectedUpdates, NullBox, 1); + RegionInit(&collectedUpdates, NullBox, 1); #endif - REGION_INIT(pDrawable -> pScreen, &exposeRegion, NullBox, 1); + RegionInit(&exposeRegion, NullBox, 1); if (nxagentDrawableBitmap(pDrawable) != NullPixmap && nxagentDrawableStatus((DrawablePtr) nxagentDrawableBitmap(pDrawable)) == Synchronized) @@ -447,7 +447,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y1, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.x2, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)) -> extents.y2, - REGION_NUM_RECTS(nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)))); + RegionNumRects(nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable)))); #endif clipRegion = nxagentCreateRegion(pDrawable, NULL, 0, 0, pDrawable -> width, pDrawable -> height); @@ -458,7 +458,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned * a previous loop. */ - REGION_INTERSECT(pDrawable -> pScreen, clipRegion, clipRegion, + RegionIntersect(clipRegion, clipRegion, nxagentCorruptedRegion((DrawablePtr) nxagentDrawableBitmap(pDrawable))); /* @@ -470,14 +470,14 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned * ronization will fix the error. */ - REGION_INTERSECT(pDrawable -> pScreen, clipRegion, clipRegion, + RegionIntersect(clipRegion, clipRegion, nxagentCorruptedRegion(pDrawable)); /* * The bitmap to synchronize is clipped. */ - if (REGION_NIL(clipRegion) == 1) + if (RegionNil(clipRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: The bitmap region [%d,%d,%d,%d] is not viewable. " @@ -499,7 +499,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned } else { - if (pRegion != NullRegion && REGION_NIL(pRegion) == 1) + if (pRegion != NullRegion && RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Region [%d,%d,%d,%d] is nil. Skipping synchronization.\n", @@ -531,9 +531,9 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned * can skip the synchronization. */ - REGION_INTERSECT(pDrawable -> pScreen, clipRegion, clipRegion, nxagentCorruptedRegion(pDrawable)); + RegionIntersect(clipRegion, clipRegion, nxagentCorruptedRegion(pDrawable)); - if (REGION_NIL(clipRegion) == 1) + if (RegionNil(clipRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: The corrupted region [%d,%d,%d,%d] is not viewable " @@ -554,9 +554,9 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned if (pRegion != NullRegion) { - REGION_INTERSECT(pDrawable -> pScreen, clipRegion, clipRegion, pRegion); + RegionIntersect(clipRegion, clipRegion, pRegion); - if (REGION_NIL(clipRegion) == 1) + if (RegionNil(clipRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Region requested [%d,%d,%d,%d] already " @@ -604,7 +604,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned #ifdef TEST fprintf(stderr, "nxagentSynchronizeRegion: Going to synchronize [%ld] rects of [%s] at [%p].\n", - REGION_NUM_RECTS(clipRegion), nxagentDrawableType(pDrawable), (void *) pDrawable); + RegionNumRects(clipRegion), nxagentDrawableType(pDrawable), (void *) pDrawable); fprintf(stderr, "nxagentSynchronizeRegion: Extents geometry [%d,%d,%d,%d].\n", clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2); @@ -648,7 +648,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned if (length == 0) { fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] with region geometry [%ld][%d,%d,%d,%d].\n", - nxagentDrawableType(pDrawable), (void *) pDrawable, REGION_NUM_RECTS(clipRegion), + nxagentDrawableType(pDrawable), (void *) pDrawable, RegionNumRects(clipRegion), clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2); } @@ -660,7 +660,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned #ifndef USE_OPTIMIZED_BOXES - pBox = REGION_RECTS(clipRegion); + pBox = RegionRects(clipRegion); #else @@ -668,7 +668,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned #endif /* USE_OPTIMIZED_BOXES */ - nBox = REGION_NUM_RECTS(clipRegion); + nBox = RegionNumRects(clipRegion); now = GetTimeInMillis(); @@ -794,12 +794,12 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned * region. */ - REGION_INIT(pDrawable -> pScreen, &tileRegion, &tileBox, 1); + RegionInit(&tileRegion, &tileBox, 1); - REGION_UNION(pDrawable -> pScreen, &exposeRegion, &exposeRegion, &tileRegion); + RegionUnion(&exposeRegion, &exposeRegion, &tileRegion); #ifdef COLLECTED_UPDATES - REGION_APPEND(pDrawable -> pScreen, &collectedUpdates, &tileRegion); + RegionAppend(&collectedUpdates, &tileRegion); #endif if (useStoredBitmap != 0) @@ -812,7 +812,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned * associated to this pixmap. */ - REGION_SUBTRACT(pDrawable -> pScreen, nxagentPixmapCorruptedRegion(nxagentDrawableBitmap(pDrawable)), + RegionSubtract(nxagentPixmapCorruptedRegion(nxagentDrawableBitmap(pDrawable)), nxagentPixmapCorruptedRegion(nxagentDrawableBitmap(pDrawable)), &tileRegion); /* @@ -875,7 +875,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned (void *) nxagentDrawableBitmap(pDrawable)); #endif - REGION_SUBTRACT(pDrawable -> pScreen, nxagentPixmapCorruptedRegion(nxagentDrawableBitmap(pDrawable)), + RegionSubtract(nxagentPixmapCorruptedRegion(nxagentDrawableBitmap(pDrawable)), nxagentPixmapCorruptedRegion(nxagentDrawableBitmap(pDrawable)), &tileRegion); } } @@ -888,7 +888,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned nxagentRealizeImage(pDrawable, pGC, pDrawable -> depth, x, y, w, h, leftPad, format, data); - REGION_UNINIT(pDrawable -> pScreen, &tileRegion); + RegionUninit(&tileRegion); #if !defined(COLLECTED_UPDATES) @@ -990,7 +990,7 @@ nxagentSynchronizeRegionStop: if (pDrawable -> type == DRAWABLE_PIXMAP && nxagentIsCorruptedBackground((PixmapPtr) pDrawable) == 1 && - REGION_NIL(&exposeRegion) == 0) + RegionNil(&exposeRegion) == 0) { struct nxagentExposeBackground eb; @@ -1016,14 +1016,14 @@ nxagentSynchronizeRegionStop: { int overlap = 0; - REGION_VALIDATE(pDrawable -> pScreen, &collectedUpdates, &overlap); + RegionValidate(&collectedUpdates, &overlap); - for (i = 0; i < REGION_NUM_RECTS(&collectedUpdates); i++) + for (i = 0; i < RegionNumRects(&collectedUpdates); i++) { - x = REGION_RECTS(&collectedUpdates)[i].x1; - y = REGION_RECTS(&collectedUpdates)[i].y1; - w = REGION_RECTS(&collectedUpdates)[i].x2 - REGION_RECTS(&collectedUpdates)[i].x1; - h = REGION_RECTS(&collectedUpdates)[i].y2 - REGION_RECTS(&collectedUpdates)[i].y1; + x = RegionRects(&collectedUpdates)[i].x1; + y = RegionRects(&collectedUpdates)[i].y1; + w = RegionRects(&collectedUpdates)[i].x2 - RegionRects(&collectedUpdates)[i].x1; + h = RegionRects(&collectedUpdates)[i].y2 - RegionRects(&collectedUpdates)[i].y1; if (nxagentOption(Shadow) == 1 && (nxagentOption(XRatio) != DONT_SCALE || @@ -1063,11 +1063,11 @@ nxagentSynchronizeRegionFree: xfree(data); } - REGION_UNINIT(pDrawable -> pScreen, &exposeRegion); + RegionUninit(&exposeRegion); #ifdef COLLECTED_UPDATES - REGION_UNINIT(pDrawable -> pScreen, &collectedUpdates); + RegionUninit(&collectedUpdates); #endif /* #ifdef COLLECTED_UPDATES */ @@ -1108,7 +1108,7 @@ void nxagentSynchronizeBox(DrawablePtr pDrawable, BoxPtr pBox, unsigned int brea pBox -> x2 - pBox -> x1, pBox -> y2 - pBox -> y1); - if (REGION_NIL(pRegion) == 1) + if (RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeBox: Resulting region [%d,%d,%d,%d] is nil. Skipping synchronization.\n", @@ -1273,7 +1273,7 @@ FIXME: This condition sounds only as a "with [%ld] rects.\n", nxagentCorruptedRegion(pDrawable) -> extents.x1, nxagentCorruptedRegion(pDrawable) -> extents.y1, nxagentCorruptedRegion(pDrawable) -> extents.x2, nxagentCorruptedRegion(pDrawable) -> extents.y2, - REGION_NUM_RECTS(nxagentCorruptedRegion(pDrawable))); + RegionNumRects(nxagentCorruptedRegion(pDrawable))); #endif /* @@ -1518,7 +1518,7 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, box.x2 = x + width; box.y2 = y + height; - pRegion = REGION_CREATE(pDrawable -> pScreen, &box, 1); + pRegion = RegionCreate(&box, 1); /* * Clipping the region. @@ -1543,11 +1543,11 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, tmpBox.x2 = pDrawable -> width; tmpBox.y2 = pDrawable -> height; - REGION_INIT(pDrawable -> pScreen, &tmpRegion, &tmpBox, 1); + RegionInit(&tmpRegion, &tmpBox, 1); - REGION_INTERSECT(pDrawable -> pScreen, pRegion, &tmpRegion, pRegion); + RegionIntersect(pRegion, &tmpRegion, pRegion); - REGION_UNINIT(pDrawable -> pScreen, &tmpRegion); + RegionUninit(&tmpRegion); } } else @@ -1558,19 +1558,19 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, * by its children. */ - REGION_TRANSLATE(pDrawable -> pScreen, pRegion, + RegionTranslate(pRegion, pDrawable -> x, pDrawable -> y); if (nxagentWindowPriv((WindowPtr) pDrawable) -> hasTransparentChildren == 1) { - REGION_INTERSECT(pDrawable -> pScreen, pRegion, pRegion, &((WindowPtr) pDrawable) -> borderClip); + RegionIntersect(pRegion, pRegion, &((WindowPtr) pDrawable) -> borderClip); } else { - REGION_INTERSECT(pDrawable -> pScreen, pRegion, pRegion, &((WindowPtr) pDrawable) -> clipList); + RegionIntersect(pRegion, pRegion, &((WindowPtr) pDrawable) -> clipList); } - REGION_TRANSLATE(pDrawable -> pScreen, pRegion, + RegionTranslate(pRegion, -pDrawable -> x, -pDrawable -> y); } @@ -1585,15 +1585,15 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, * to intersect it with the GC's clipmask. */ - if (REGION_NIL(pRegion) == 0 && + if (RegionNil(pRegion) == 0 && pGC != NULL && pGC -> clientClip != NULL && pGC -> clientClipType == CT_REGION) { RegionRec clipRegion; - REGION_INIT(pDrawable -> pScreen, &clipRegion, NullBox, 1); + RegionInit(&clipRegion, NullBox, 1); - REGION_COPY(pDrawable -> pScreen, &clipRegion, (RegionPtr) pGC -> clientClip); + RegionCopy(&clipRegion, (RegionPtr) pGC -> clientClip); /* * The clip origin is relative to the origin of @@ -1603,7 +1603,7 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, if (pGC -> clipOrg.x != 0 || pGC -> clipOrg.y != 0) { - REGION_TRANSLATE(pDrawable -> pScreen, &clipRegion, pGC -> clipOrg.x, pGC -> clipOrg.y); + RegionTranslate(&clipRegion, pGC -> clipOrg.x, pGC -> clipOrg.y); } #ifdef TEST @@ -1612,9 +1612,9 @@ RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, int y, clipRegion.extents.x2, clipRegion.extents.y2); #endif - REGION_INTERSECT(pDrawable -> pScreen, pRegion, pRegion, &clipRegion); + RegionIntersect(pRegion, pRegion, &clipRegion); - REGION_UNINIT(pDrawable -> pScreen, &clipRegion); + RegionUninit(&clipRegion); } return pRegion; @@ -1627,7 +1627,7 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) int width; int height; - if (pRegion != NullRegion && REGION_NIL(pRegion) == 1) + if (pRegion != NullRegion && RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentMarkCorruptedRegion: Region [%d,%d,%d,%d] is nil. Skipping operation.\n", @@ -1672,7 +1672,7 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) nxagentValidateSplit(pDrawable, pRegion); - REGION_UNION(pDrawable -> pScreen, nxagentCorruptedRegion(pDrawable), + RegionUnion(nxagentCorruptedRegion(pDrawable), nxagentCorruptedRegion(pDrawable), pRegion); nxagentFreeRegion(pDrawable, pRegion); @@ -1695,7 +1695,7 @@ void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) nxagentValidateSplit(pDrawable, pRegion); - REGION_UNION(pDrawable -> pScreen, nxagentCorruptedRegion(pDrawable), + RegionUnion(nxagentCorruptedRegion(pDrawable), nxagentCorruptedRegion(pDrawable), pRegion); } } @@ -1704,7 +1704,7 @@ void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) { int oldStatus; - if (pRegion != NullRegion && REGION_NIL(pRegion) == 1) + if (pRegion != NullRegion && RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentUnmarkCorruptedRegion: Region [%d,%d,%d,%d] is nil. Skipping operation.\n", @@ -1735,7 +1735,7 @@ void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) nxagentValidateSplit(pDrawable, NULL); - REGION_EMPTY(pDrawable -> pScreen, nxagentCorruptedRegion(pDrawable)); + RegionEmpty(nxagentCorruptedRegion(pDrawable)); } else { @@ -1749,7 +1749,7 @@ void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) nxagentValidateSplit(pDrawable, pRegion); - REGION_SUBTRACT(pDrawable -> pScreen, nxagentCorruptedRegion(pDrawable), + RegionSubtract(nxagentCorruptedRegion(pDrawable), nxagentCorruptedRegion(pDrawable), pRegion); } @@ -1817,7 +1817,7 @@ void nxagentMoveCorruptedRegion(WindowPtr pWin, unsigned int mask) nx, ny, (void *) pWin); #endif - REGION_TRANSLATE(pWin -> pScreen, nxagentCorruptedRegion((DrawablePtr) pWin), + RegionTranslate(nxagentCorruptedRegion((DrawablePtr) pWin), nx, ny); /* @@ -1886,9 +1886,9 @@ BoxPtr nxagentGetOptimizedRegionBoxes(RegionPtr pRegion) int nBoxOptim; #endif - pBox = REGION_RECTS(pRegion); + pBox = RegionRects(pRegion); - nBox = REGION_NUM_RECTS(pRegion); + nBox = RegionNumRects(pRegion); #ifdef TEST fprintf(stderr, "nxagentGetOptimizedRegionBoxes: Going to optimize region at [%p] with [%d] rects.\n", @@ -2183,7 +2183,7 @@ unsigned long nxagentGetRegionColor(DrawablePtr pDrawable, RegionPtr pRegion) { int xPicker, yPicker; - if (REGION_NIL(pRegion) == 1) + if (RegionNil(pRegion) == 1) { return nxagentGetDrawableColor(pDrawable); } @@ -2251,7 +2251,7 @@ void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion) return; } - if (pRegion == NullRegion || REGION_NIL(pRegion) == 1) + if (pRegion == NullRegion || RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentClearRegion: The region is empty. Exiting.\n"); @@ -2306,7 +2306,7 @@ void nxagentClearRegion(DrawablePtr pDrawable, RegionPtr pRegion) pBox = nxagentGetOptimizedRegionBoxes(pRegion); - nBox = REGION_NUM_RECTS(pRegion); + nBox = RegionNumRects(pRegion); for (i = 0; i < nBox; i++) { @@ -2348,14 +2348,14 @@ void nxagentFillRemoteRegion(DrawablePtr pDrawable, RegionPtr pRegion) int nrects; int i; - if (REGION_NIL(pRegion) == 1) + if (RegionNil(pRegion) == 1) { return; } pGC = nxagentGetGraphicContext(pDrawable); - nrects = REGION_NUM_RECTS(pRegion); + nrects = RegionNumRects(pRegion); #ifdef TEST fprintf(stderr, "nxagentFillRemoteRegion: Going to fill remote region [%d,%d,%d,%d] rects [%d] with color [%lu].\n", @@ -2372,7 +2372,7 @@ void nxagentFillRemoteRegion(DrawablePtr pDrawable, RegionPtr pRegion) } else { - pBox = REGION_RECTS(pRegion); + pBox = RegionRects(pRegion); pRects = xalloc(nrects * sizeof(XRectangle)); @@ -2440,7 +2440,7 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode, np = nPoints; xp = pPoints; - pRegion = REGION_CREATE(pDrawable -> pScreen, NullBox, 1); + pRegion = RegionCreate(NullBox, 1); while (np--) { @@ -2465,28 +2465,28 @@ void nxagentPointsToDirtyRegion(DrawablePtr pDrawable, int mode, * this loop could become less expensive. */ - REGION_INIT(pDrawable -> pScreen, &tmpRegion, &box, 1); + RegionInit(&tmpRegion, &box, 1); - REGION_UNION(pDrawable -> pScreen, pRegion, pRegion, &tmpRegion); + RegionUnion(pRegion, pRegion, &tmpRegion); - REGION_UNINIT(pDrawable -> pScreen, &tmpRegion); + RegionUninit(&tmpRegion); xp++; } - extents = *REGION_EXTENTS(pDrawable -> pScreen, pRegion); + extents = *RegionExtents(pRegion); - REGION_RESET(pDrawable -> pScreen, pRegion, &extents); + RegionReset(pRegion, &extents); #ifdef TEST fprintf(stderr, "nxagentPointsToDirtyRegion: The resulting dirty region has [%ld] rects and" - " extents (%d,%d,%d,%d).\n", REGION_NUM_RECTS(pRegion), extents.x1, + " extents (%d,%d,%d,%d).\n", RegionNumRects(pRegion), extents.x1, extents.y1, extents.x2, extents.y2); #endif nxagentMarkCorruptedRegion(pDrawable, pRegion); - REGION_DESTROY(pDrawable -> pScreen, pRegion); + RegionDestroy(pRegion); } #ifdef DUMP @@ -2533,20 +2533,20 @@ void nxagentCorruptedRegionOnWindow(void *p0, XID x, void *p2) clipRegion = nxagentCreateRegion((DrawablePtr) pWin, NULL, 0, 0, pWin -> drawable.width, pWin -> drawable.height); - REGION_INIT(pWin -> drawable.pScreen, &visRegion, NullBox, 1); + RegionInit(&visRegion, NullBox, 1); - REGION_INTERSECT(pWin -> drawable.pScreen, &visRegion, clipRegion, nxagentCorruptedRegion((DrawablePtr) pWin)); + RegionIntersect(&visRegion, clipRegion, nxagentCorruptedRegion((DrawablePtr) pWin)); nxagentFreeRegion(pWin -> drawable.pScreen, clipRegion); - if (REGION_NIL(&visRegion) == 1) + if (RegionNil(&visRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentCorruptedRegionOnWindow: The corrupted region of window at [%p] is hidden.\n", (void *) pWin); #endif - REGION_UNINIT(pWin -> drawable.pScreen, &visRegion); + RegionUninit(&visRegion); return; } @@ -2569,7 +2569,7 @@ void nxagentCorruptedRegionOnWindow(void *p0, XID x, void *p2) gc = XCreateGC(nxagentDisplay, nxagentWindow(pWin), GCForeground | GCSubwindowMode, &value); - nrectangles = REGION_NUM_RECTS(&visRegion); + nrectangles = RegionNumRects(&visRegion); #ifdef TEST fprintf(stderr, "nxagentCorruptedRegionOnWindow: Going to draw the region with extents [%d,%d,%d,%d] and [%d] rects.\n", @@ -2594,7 +2594,7 @@ void nxagentCorruptedRegionOnWindow(void *p0, XID x, void *p2) XFreeGC(nxagentDisplay, gc); - REGION_UNINIT(pWin -> drawable.pScreen, &visRegion); + RegionUninit(&visRegion); } void nxagentRegionsOnScreen() @@ -2673,9 +2673,9 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) pClipRegion = nxagentCreateRegion(pDrawable, NULL, 0, 0, pDrawable -> width, pDrawable -> height); - REGION_INTERSECT(pDrawable -> pScreen, pClipRegion, pClipRegion, nxagentCorruptedRegion(pDrawable)); + RegionIntersect(pClipRegion, pClipRegion, nxagentCorruptedRegion(pDrawable)); - if (REGION_NIL(pClipRegion) == 1) + if (RegionNil(pClipRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentCreateDrawableBitmap: The corrupted region is not visible. Skipping bitmap creation.\n"); @@ -2716,7 +2716,7 @@ void nxagentCreateDrawableBitmap(DrawablePtr pDrawable) nxagentCopyArea(pDrawable, (DrawablePtr) pBitmap, pGC, x, y, w, h, x, y); - REGION_UNION(pDrawable -> pScreen, nxagentCorruptedRegion((DrawablePtr) pBitmap), + RegionUnion(nxagentCorruptedRegion((DrawablePtr) pBitmap), nxagentCorruptedRegion((DrawablePtr) pBitmap), pClipRegion); if (pDrawable -> type == DRAWABLE_PIXMAP) @@ -3002,19 +3002,19 @@ void nxagentUnmarkExposedRegion(WindowPtr pWin, RegionPtr pRegion, RegionPtr pOt { RegionRec clipRegion; - if (pRegion != NullRegion && REGION_NIL(pRegion) == 0 && + if (pRegion != NullRegion && RegionNil(pRegion) == 0 && nxagentDrawableStatus((DrawablePtr) pWin) == NotSynchronized) { - REGION_INIT(pWin -> drawable.pScreen, &clipRegion, NullBox, 1); + RegionInit(&clipRegion, NullBox, 1); - REGION_COPY(pWin -> drawable.pScreen, &clipRegion, pRegion); + RegionCopy(&clipRegion, pRegion); - if (pOther != NullRegion && REGION_NIL(pOther) == 0) + if (pOther != NullRegion && RegionNil(pOther) == 0) { - REGION_UNION(pWin -> drawable.pScreen, &clipRegion, &clipRegion, pOther); + RegionUnion(&clipRegion, &clipRegion, pOther); } - REGION_TRANSLATE(pWin -> drawable.pScreen, &clipRegion, -pWin -> drawable.x, -pWin -> drawable.y); + RegionTranslate(&clipRegion, -pWin -> drawable.x, -pWin -> drawable.y); #ifdef TEST fprintf(stderr, "nxagentUnmarkExposedRegion: Validating expose region [%d,%d,%d,%d] " @@ -3024,7 +3024,7 @@ void nxagentUnmarkExposedRegion(WindowPtr pWin, RegionPtr pRegion, RegionPtr pOt nxagentUnmarkCorruptedRegion((DrawablePtr) pWin, &clipRegion); - REGION_UNINIT(pWin -> drawable.pScreen, &clipRegion); + RegionUninit(&clipRegion); } } @@ -3061,7 +3061,7 @@ void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPt RegionRec expose; miBSWindowPtr pBackingStore; - REGION_INIT(pWin -> pScreen, &expose, NullBox, 1); + RegionInit(&expose, NullBox, 1); #ifdef DEBUG fprintf(stderr, "nxagentSendBackgroundExpose: Original expose region is [%d,%d,%d,%d].\n", @@ -3084,25 +3084,25 @@ void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPt pWin -> drawable.width, pWin -> drawable.height); #endif - REGION_COPY(pWin -> pScreen, &expose, &pWin -> winSize); + RegionCopy(&expose, &pWin -> winSize); } else { - REGION_COPY(pWin -> pScreen, &expose, pExpose); + RegionCopy(&expose, pExpose); - REGION_TRANSLATE(pWin -> pScreen, &expose, pWin -> drawable.x, pWin -> drawable.y); + RegionTranslate(&expose, pWin -> drawable.x, pWin -> drawable.y); } - REGION_SUBTRACT(pWin -> pScreen, &expose, &expose, nxagentCorruptedRegion((DrawablePtr) pWin)); + RegionSubtract(&expose, &expose, nxagentCorruptedRegion((DrawablePtr) pWin)); - if (REGION_NIL(&pWin -> clipList) != 0) + if (RegionNil(&pWin -> clipList) != 0) { #ifdef TEST fprintf(stderr, "nxagentSendBackgroundExpose: Exposures deferred because the window " "is hidden.\n"); #endif - REGION_UNION(pWin -> pScreen, nxagentDeferredBackgroundExposures, + RegionUnion(nxagentDeferredBackgroundExposures, nxagentDeferredBackgroundExposures, &expose); nxagentWindowPriv(pWin) -> deferredBackgroundExpose = 1; @@ -3121,32 +3121,32 @@ void nxagentSendBackgroundExpose(WindowPtr pWin, PixmapPtr pBackground, RegionPt pBackingStore = (miBSWindowPtr)pWin->backStorage; - if ((pBackingStore != NULL) && (REGION_NIL(&pBackingStore->SavedRegion) == 0)) + if ((pBackingStore != NULL) && (RegionNil(&pBackingStore->SavedRegion) == 0)) { - REGION_TRANSLATE(pWin -> pScreen, &expose, -pWin -> drawable.x, -pWin -> drawable.y); + RegionTranslate(&expose, -pWin -> drawable.x, -pWin -> drawable.y); - REGION_SUBTRACT(pWin -> pScreen, &expose, &expose, &pBackingStore -> SavedRegion); + RegionSubtract(&expose, &expose, &pBackingStore -> SavedRegion); - REGION_TRANSLATE(pWin -> pScreen, &expose, pWin -> drawable.x, pWin -> drawable.y); + RegionTranslate(&expose, pWin -> drawable.x, pWin -> drawable.y); } - REGION_INTERSECT(pWin -> pScreen, &expose, &expose, &pWin -> clipList); + RegionIntersect(&expose, &expose, &pWin -> clipList); /* * Reduce the overall region to expose. */ - REGION_TRANSLATE(pWin -> pScreen, &expose, -pWin -> drawable.x, -pWin -> drawable.y); + RegionTranslate(&expose, -pWin -> drawable.x, -pWin -> drawable.y); - REGION_SUBTRACT(pWin -> pScreen, pExpose, pExpose, &expose); + RegionSubtract(pExpose, pExpose, &expose); - REGION_TRANSLATE(pWin -> pScreen, &expose, pWin -> drawable.x, pWin -> drawable.y); + RegionTranslate(&expose, pWin -> drawable.x, pWin -> drawable.y); miWindowExposures(pWin, &expose, &expose); nxagentSendBackgroundExposeEnd: - REGION_UNINIT(pWin -> pScreen, &expose); + RegionUninit(&expose); } void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2) @@ -3156,7 +3156,7 @@ void nxagentExposeBackgroundPredicate(void *p0, XID x1, void *p2) struct nxagentExposeBackground *pPair = p2; - if (REGION_NIL(pPair -> pExpose) != 0) + if (RegionNil(pPair -> pExpose) != 0) { return; } @@ -3217,21 +3217,21 @@ int nxagentClipAndSendClearExpose(WindowPtr pWin, void * ptr) if (nxagentWindowPriv(pWin) -> deferredBackgroundExpose == 1) { - exposeRgn = REGION_CREATE(pWin -> drawable.pScreen, NULL, 1); + exposeRgn = RegionCreate(NULL, 1); #ifdef DEBUG - box = *REGION_EXTENTS(pWin->drawable.pScreen, remoteExposeRgn); + box = *RegionExtents(remoteExposeRgn); fprintf(stderr, "nxagentClipAndSendClearExpose: Background expose extents: [%d,%d,%d,%d].\n", box.x1, box.y1, box.x2, box.y2); - box = *REGION_EXTENTS(pWin->drawable.pScreen, &pWin -> clipList); + box = *RegionExtents(&pWin -> clipList); fprintf(stderr, "nxagentClipAndSendClearExpose: Clip list extents for window at [%p]: [%d,%d,%d,%d].\n", (void *) pWin, box.x1, box.y1, box.x2, box.y2); #endif - REGION_INTERSECT(pWin -> drawable.pScreen, exposeRgn, remoteExposeRgn, &pWin -> clipList); + RegionIntersect(exposeRgn, remoteExposeRgn, &pWin -> clipList); /* * If the region will be synchronized, @@ -3239,28 +3239,28 @@ int nxagentClipAndSendClearExpose(WindowPtr pWin, void * ptr) * be ignored. */ - REGION_SUBTRACT(pWin -> drawable.pScreen, exposeRgn, exposeRgn, nxagentCorruptedRegion((DrawablePtr) pWin)); + RegionSubtract(exposeRgn, exposeRgn, nxagentCorruptedRegion((DrawablePtr) pWin)); - if (REGION_NOTEMPTY(pWin -> drawable.pScreen, exposeRgn)) + if (RegionNotEmpty(exposeRgn)) { #ifdef DEBUG - box = *REGION_EXTENTS(pWin->drawable.pScreen, exposeRgn); + box = *RegionExtents(exposeRgn); fprintf(stderr, "nxagentClipAndSendClearExpose: Forwarding expose [%d,%d,%d,%d] to window at [%p] pWin.\n", box.x1, box.y1, box.x2, box.y2, (void *) pWin); #endif - REGION_SUBTRACT(pWin -> drawable.pScreen, remoteExposeRgn, remoteExposeRgn, exposeRgn); + RegionSubtract(remoteExposeRgn, remoteExposeRgn, exposeRgn); miWindowExposures(pWin, exposeRgn, exposeRgn); } - REGION_DESTROY(pWin -> drawable.pScreen, exposeRgn); + RegionDestroy(exposeRgn); nxagentWindowPriv(pWin) -> deferredBackgroundExpose = 0; } - if (REGION_NOTEMPTY(pWin -> drawable.pScreen, remoteExposeRgn)) + if (RegionNotEmpty(remoteExposeRgn)) { #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendClearExpose: Region not empty. Walk children.\n"); @@ -3283,10 +3283,10 @@ void nxagentSendDeferredBackgroundExposures(void) { if (nxagentDeferredBackgroundExposures == NullRegion) { - nxagentDeferredBackgroundExposures = REGION_CREATE(WindowTable[0] -> drawable.pScreen, NullBox, 1); + nxagentDeferredBackgroundExposures = RegionCreate(NullBox, 1); } - if (REGION_NOTEMPTY(WindowTable[0] -> drawable.pScreen, nxagentDeferredBackgroundExposures) != 0) + if (RegionNotEmpty(nxagentDeferredBackgroundExposures) != 0) { #ifdef TEST fprintf(stderr, "nxagentSendDeferredBackgroundExposures: Going to send deferred exposures to the root window.\n"); @@ -3294,7 +3294,7 @@ void nxagentSendDeferredBackgroundExposures(void) TraverseTree(WindowTable[0], nxagentClipAndSendClearExpose, (void *) nxagentDeferredBackgroundExposures); - REGION_EMPTY(WindowTable[0] -> drawable.pScreen, nxagentDeferredBackgroundExposures); + RegionEmpty(nxagentDeferredBackgroundExposures); } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.h b/nx-X11/programs/Xserver/hw/nxagent/Drawable.h index 4ebbc928e..d05eebf19 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.h @@ -107,7 +107,7 @@ enum SynchronizationPredicate nxagentWindowCorruptedRegion((WindowPtr) pDrawable)) #define nxagentDrawableStatus(pDrawable) \ - (REGION_NIL(nxagentCorruptedRegion(pDrawable)) ? \ + (RegionNil(nxagentCorruptedRegion(pDrawable)) ? \ Synchronized : NotSynchronized) #define nxagentDrawableContainGlyphs(pDrawable) \ @@ -155,7 +155,7 @@ extern RegionPtr nxagentCreateRegion(DrawablePtr pDrawable, GCPtr pGC, int x, in int width, int height); #define nxagentFreeRegion(pDrawable, pRegion) \ - REGION_DESTROY((pDrawable) -> pScreen, pRegion); + RegionDestroy(pRegion); extern void nxagentMarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion); extern void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion); @@ -204,8 +204,8 @@ do \ break; \ } \ \ - numRects = REGION_NUM_RECTS(pRegion); \ - pBox = REGION_RECTS(pRegion); \ + numRects = RegionNumRects(pRegion); \ + pBox = RegionRects(pRegion); \ \ fprintf(stderr, "printRegionBoxes:: Region " strRegion " at [%p] has [%d] boxes:\n", \ (void *) (pRegion), numRects); \ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index c04481c92..d1d1a5f59 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2414,7 +2414,7 @@ int nxagentHandleExposeEvent(XEvent *X) if (pWin != NULL) { - REGION_INIT(pWin -> drawable.pScreen, &sum, (BoxRec *) NULL, 1); + RegionInit(&sum, (BoxRec *) NULL, 1); /* FIXME: This can be maybe optimized by consuming the events that do not match the predicate. @@ -2445,11 +2445,11 @@ FIXME: This can be maybe optimized by consuming the box.x2 = box.x1 + X -> xexpose.width; box.y2 = box.y1 + X -> xexpose.height; - REGION_INIT(pWin -> drawable.pScreen, &add, &box, 1); + RegionInit(&add, &box, 1); - REGION_APPEND(pWin -> drawable.pScreen, &sum, &add); + RegionAppend(&sum, &add); - REGION_UNINIT(pWin -> drawable.pScreen, &add); + RegionUninit(&add); if (X -> xexpose.count == 0) { @@ -2459,9 +2459,9 @@ FIXME: This can be maybe optimized by consuming the while (nxagentCheckEvents(nxagentDisplay, X, nxagentExposurePredicate, (XPointer) &window) == 1); - REGION_VALIDATE(pWin -> drawable.pScreen, &sum, &overlap); + RegionValidate(&sum, &overlap); - REGION_INTERSECT(pWin->drawable.pScreen, &sum, &sum, + RegionIntersect(&sum, &sum, &WindowTable[pWin->drawable.pScreen->myNum]->winSize); #ifdef DEBUG @@ -2482,14 +2482,14 @@ FIXME: This can be maybe optimized by consuming the } else { - REGION_TRANSLATE(pWin -> drawable.pScreen, &sum, -pWin -> drawable.x, -pWin -> drawable.y); + RegionTranslate(&sum, -pWin -> drawable.x, -pWin -> drawable.y); if (nxagentExposeQueue.exposures[index].remoteRegion == NullRegion) { - nxagentExposeQueue.exposures[index].remoteRegion = REGION_CREATE(pwin -> drawable.pScreen, NULL, 1); + nxagentExposeQueue.exposures[index].remoteRegion = RegionCreate(NULL, 1); } - REGION_UNION(pWin -> drawable.pScreen, nxagentExposeQueue.exposures[index].remoteRegion, + RegionUnion(nxagentExposeQueue.exposures[index].remoteRegion, nxagentExposeQueue.exposures[index].remoteRegion, &sum); #ifdef TEST @@ -2521,7 +2521,7 @@ FIXME: This can be maybe optimized by consuming the } } - REGION_UNINIT(pWin -> drawable.pScreen, &sum); + RegionUninit(&sum); } return 1; @@ -2593,7 +2593,7 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) rect.x2 = rect.x1 + X -> xgraphicsexpose.width; rect.y2 = rect.y1 + X -> xgraphicsexpose.height; - exposeRegion = REGION_CREATE(pScreen, &rect, 0); + exposeRegion = RegionCreate(&rect, 0); if (drawableType == DRAWABLE_PIXMAP) { @@ -2610,7 +2610,7 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) * window. */ - REGION_TRANSLATE(pScreen, exposeRegion, pStoringPixmapRec -> backingStoreX, + RegionTranslate(exposeRegion, pStoringPixmapRec -> backingStoreX, pStoringPixmapRec -> backingStoreY); /* @@ -2618,7 +2618,7 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) * affected by the GraphicsExpose event. */ - REGION_SUBTRACT(pScreen, &(pBSwindow -> SavedRegion), &(pBSwindow -> SavedRegion), + RegionSubtract(&(pBSwindow -> SavedRegion), &(pBSwindow -> SavedRegion), exposeRegion); } @@ -2628,11 +2628,11 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) * must be relative to the screen. */ - REGION_TRANSLATE(pScreen, exposeRegion, pWin -> drawable.x, pWin -> drawable.y); + RegionTranslate(exposeRegion, pWin -> drawable.x, pWin -> drawable.y); - REGION_UNION(pScreen, nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, exposeRegion); + RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, exposeRegion); - REGION_DESTROY(pScreen, exposeRegion); + RegionDestroy(exposeRegion); return 1; } @@ -4091,30 +4091,30 @@ void nxagentSynchronizeExpose(void) { if ((nxagentExposeQueueHead.localRegion) != NullRegion) { - REGION_TRANSLATE(pWin -> drawable.pScreen, (nxagentExposeQueueHead.localRegion), + RegionTranslate((nxagentExposeQueueHead.localRegion), pWin -> drawable.x, pWin -> drawable.y); } if ((nxagentExposeQueueHead.remoteRegion) != NullRegion) { - REGION_TRANSLATE(pWin -> drawable.pScreen, (nxagentExposeQueueHead.remoteRegion), + RegionTranslate((nxagentExposeQueueHead.remoteRegion), pWin -> drawable.x, pWin -> drawable.y); } if ((nxagentExposeQueueHead.localRegion) != NullRegion && (nxagentExposeQueueHead.remoteRegion) != NullRegion) { - REGION_SUBTRACT(pWin -> drawable.pScreen, (nxagentExposeQueueHead.remoteRegion), + RegionSubtract((nxagentExposeQueueHead.remoteRegion), (nxagentExposeQueueHead.remoteRegion), (nxagentExposeQueueHead.localRegion)); - if (REGION_NIL(nxagentExposeQueueHead.remoteRegion) == 0 && + if (RegionNil(nxagentExposeQueueHead.remoteRegion) == 0 && ((pWin -> eventMask|wOtherEventMasks(pWin)) & ExposureMask)) { #ifdef TEST fprintf(stderr, "nxagentSynchronizeExpose: Going to call miWindowExposures" " for window [%ld] - rects [%ld].\n", nxagentWindow(pWin), - REGION_NUM_RECTS(nxagentExposeQueueHead.remoteRegion)); + RegionNumRects(nxagentExposeQueueHead.remoteRegion)); #endif miWindowExposures(pWin, nxagentExposeQueueHead.remoteRegion, NullRegion); @@ -4126,14 +4126,14 @@ void nxagentSynchronizeExpose(void) if (nxagentExposeQueueHead.localRegion != NullRegion) { - REGION_DESTROY(nxagentDefaultScreen, nxagentExposeQueueHead.localRegion); + RegionDestroy(nxagentExposeQueueHead.localRegion); } nxagentExposeQueueHead.localRegion = NullRegion; if (nxagentExposeQueueHead.remoteRegion != NullRegion) { - REGION_DESTROY(nxagentDefaultScreen, nxagentExposeQueueHead.remoteRegion); + RegionDestroy(nxagentExposeQueueHead.remoteRegion); } nxagentExposeQueueHead.remoteRegion = NullRegion; @@ -4260,7 +4260,7 @@ void nxagentInitRemoteExposeRegion(void) { if (nxagentRemoteExposeRegion == NULL) { - nxagentRemoteExposeRegion = REGION_CREATE(pWin -> drawable.pScreen, NULL, 1); + nxagentRemoteExposeRegion = RegionCreate(NULL, 1); if (nxagentRemoteExposeRegion == NULL) { @@ -4273,7 +4273,7 @@ void nxagentInitRemoteExposeRegion(void) void nxagentForwardRemoteExpose(void) { - if (REGION_NOTEMPTY(WindowTable[0] -> drawable.pScreen, nxagentRemoteExposeRegion)) + if (RegionNotEmpty(nxagentRemoteExposeRegion)) { #ifdef DEBUG fprintf(stderr, "nxagentForwardRemoteExpose: Going to forward events.\n"); @@ -4285,7 +4285,7 @@ void nxagentForwardRemoteExpose(void) * Now this region should be empty. */ - REGION_EMPTY(WindowTable[0] -> drawable.pScreen, nxagentRemoteExposeRegion); + RegionEmpty(nxagentRemoteExposeRegion); } } @@ -4298,12 +4298,12 @@ void nxagentAddRectToRemoteExposeRegion(BoxPtr rect) return; } - REGION_INIT(nxagentDefaultScreen, &exposeRegion, rect, 1); + RegionInit(&exposeRegion, rect, 1); - REGION_UNION(nxagentDefaultScreen, nxagentRemoteExposeRegion, + RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, &exposeRegion); - REGION_UNINIT(nxagentDefaultScreen, &exposeRegion); + RegionUninit(&exposeRegion); } int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) @@ -4320,25 +4320,25 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) if (pWin -> drawable.class != InputOnly) { - exposeRgn = REGION_CREATE(pWin -> drawable.pScreen, NULL, 1); + exposeRgn = RegionCreate(NULL, 1); - box = *REGION_EXTENTS(pWin->drawable.pScreen, remoteExposeRgn); + box = *RegionExtents(remoteExposeRgn); #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Root expose extents: [%d] [%d] [%d] [%d].\n", box.x1, box.y1, box.x2, box.y2); #endif - box = *REGION_EXTENTS(pWin->drawable.pScreen, &pWin -> clipList); + box = *RegionExtents(&pWin -> clipList); #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Clip list extents for window at [%p]: [%d] [%d] [%d] [%d].\n", pWin, box.x1, box.y1, box.x2, box.y2); #endif - REGION_INTERSECT(pWin -> drawable.pScreen, exposeRgn, remoteExposeRgn, &pWin -> clipList); + RegionIntersect(exposeRgn, remoteExposeRgn, &pWin -> clipList); - if (REGION_NOTEMPTY(pWin -> drawable.pScreen, exposeRgn)) + if (RegionNotEmpty(exposeRgn)) { #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Forwarding expose to window at [%p] pWin.\n", @@ -4351,15 +4351,15 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) * ration must be done before calling it. */ - REGION_SUBTRACT(pWin -> drawable.pScreen, remoteExposeRgn, remoteExposeRgn, exposeRgn); + RegionSubtract(remoteExposeRgn, remoteExposeRgn, exposeRgn); miWindowExposures(pWin, exposeRgn, NullRegion); } - REGION_DESTROY(pWin -> drawable.pScreen, exposeRgn); + RegionDestroy(exposeRgn); } - if (REGION_NOTEMPTY(pWin -> drawable.pScreen, remoteExposeRgn)) + if (RegionNotEmpty(remoteExposeRgn)) { #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Region not empty. Walk children.\n"); diff --git a/nx-X11/programs/Xserver/hw/nxagent/GC.c b/nx-X11/programs/Xserver/hw/nxagent/GC.c index 808220346..c06e56a00 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GC.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GC.c @@ -633,11 +633,11 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) case CT_YXSORTED: case CT_YXBANDED: { - RegionPtr pReg = RECTS_TO_REGION(pGC->pScreen, nRects, (xRectangle *)pValue, type); + RegionPtr pReg = RegionFromRects(nRects, (xRectangle *)pValue, type); clipsMatch = nxagentCompareRegions(pGC -> clientClip, pReg); - REGION_DESTROY(pGC->pScreen, pReg); + RegionDestroy(pReg); break; } @@ -671,10 +671,10 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) { if (clipsMatch == 0 && nxagentGCTrap == 0) { - nRects = REGION_NUM_RECTS((RegionPtr)pValue); + nRects = RegionNumRects((RegionPtr)pValue); size = nRects * sizeof(*pRects); pRects = (XRectangle *) xalloc(size); - pBox = REGION_RECTS((RegionPtr)pValue); + pBox = RegionRects((RegionPtr)pValue); for (i = nRects; i-- > 0;) { @@ -768,7 +768,7 @@ void nxagentChangeClip(GCPtr pGC, int type, void * pValue, int nRects) * CT_REGION client clips. */ - pGC->clientClip = (void *) RECTS_TO_REGION(pGC->pScreen, nRects, + pGC->clientClip = (void *) RegionFromRects(nRects, (xRectangle *)pValue, type); xfree(pValue); @@ -820,7 +820,7 @@ void nxagentDestroyClipHelper(GCPtr pGC) case CT_NONE: break; case CT_REGION: - REGION_DESTROY(pGC->pScreen, pGC->clientClip); + RegionDestroy(pGC->clientClip); break; case CT_PIXMAP: nxagentDestroyPixmap((PixmapPtr)pGC->clientClip); @@ -848,8 +848,8 @@ void nxagentCopyClip(GCPtr pGCDst, GCPtr pGCSrc) case CT_REGION: if (nxagentGCPriv(pGCSrc)->pPixmap == NULL) { - pRgn = REGION_CREATE(pGCDst->pScreen, NULL, 1); - REGION_COPY(pGCDst->pScreen, pRgn, pGCSrc->clientClip); + pRgn = RegionCreate(NULL, 1); + RegionCopy(pRgn, pGCSrc->clientClip); nxagentChangeClip(pGCDst, CT_REGION, pRgn, 0); } else @@ -1281,10 +1281,10 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects) case CT_REGION: if (nxagentGCPriv(pGC)->pPixmap == NULL) { - nRects = REGION_NUM_RECTS((RegionPtr)pValue); + nRects = RegionNumRects((RegionPtr)pValue); size = nRects * sizeof(*pRects); pRects = (XRectangle *) xalloc(size); - pBox = REGION_RECTS((RegionPtr)pValue); + pBox = RegionRects((RegionPtr)pValue); for (i = nRects; i-- > 0;) { pRects[i].x = pBox[i].x1; pRects[i].y = pBox[i].y1; @@ -1370,7 +1370,7 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects) * CT_PIXMAP and CT_REGION client clips. */ - pGC->clientClip = (void *) RECTS_TO_REGION(pGC->pScreen, nRects, + pGC->clientClip = (void *) RegionFromRects(nRects, (xRectangle *)pValue, type); xfree(pValue); pValue = pGC->clientClip; @@ -1403,26 +1403,26 @@ static int nxagentCompareRegions(RegionPtr r1, RegionPtr r2) return 0; } - if (REGION_NUM_RECTS(r1) != REGION_NUM_RECTS(r2)) + if (RegionNumRects(r1) != RegionNumRects(r2)) { return 0; } - else if (REGION_NUM_RECTS(r1) == 0) + else if (RegionNumRects(r1) == 0) { return 1; } - else if ((*REGION_EXTENTS(pScreen, r1)).x1 != (*REGION_EXTENTS(pScreen, r2)).x1) return 0; - else if ((*REGION_EXTENTS(pScreen, r1)).x2 != (*REGION_EXTENTS(pScreen, r2)).x2) return 0; - else if ((*REGION_EXTENTS(pScreen, r1)).y1 != (*REGION_EXTENTS(pScreen, r2)).y1) return 0; - else if ((*REGION_EXTENTS(pScreen, r1)).y2 != (*REGION_EXTENTS(pScreen, r2)).y2) return 0; + else if ((*RegionExtents(r1)).x1 != (*RegionExtents(r2)).x1) return 0; + else if ((*RegionExtents(r1)).x2 != (*RegionExtents(r2)).x2) return 0; + else if ((*RegionExtents(r1)).y1 != (*RegionExtents(r2)).y1) return 0; + else if ((*RegionExtents(r1)).y2 != (*RegionExtents(r2)).y2) return 0; else { - for (i = 0; i < REGION_NUM_RECTS(r1); i++) + for (i = 0; i < RegionNumRects(r1); i++) { - if (REGION_RECTS(r1)[i].x1 != REGION_RECTS(r2)[i].x1) return 0; - else if (REGION_RECTS(r1)[i].x2 != REGION_RECTS(r2)[i].x2) return 0; - else if (REGION_RECTS(r1)[i].y1 != REGION_RECTS(r2)[i].y1) return 0; - else if (REGION_RECTS(r1)[i].y2 != REGION_RECTS(r2)[i].y2) return 0; + if (RegionRects(r1)[i].x1 != RegionRects(r2)[i].x1) return 0; + else if (RegionRects(r1)[i].x2 != RegionRects(r2)[i].x2) return 0; + else if (RegionRects(r1)[i].y1 != RegionRects(r2)[i].y1) return 0; + else if (RegionRects(r1)[i].y2 != RegionRects(r2)[i].y2) return 0; } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 25f5fa6d7..604b1d85a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -306,12 +306,12 @@ FIXME: The popup could be synchronized with one pSrcRegion -> extents.x2, pSrcRegion -> extents.y2); #endif - REGION_INIT(pSrcDrawable -> pScreen, &corruptedRegion, NullBox, 1); + RegionInit(&corruptedRegion, NullBox, 1); - REGION_INTERSECT(pSrcDrawable -> pScreen, &corruptedRegion, + RegionIntersect(&corruptedRegion, pSrcRegion, nxagentCorruptedRegion(pSrcDrawable)); - if (REGION_NIL(&corruptedRegion) == 0) + if (RegionNil(&corruptedRegion) == 0) { #ifdef TEST fprintf(stderr, "nxagentDeferCopyArea: Forcing the synchronization of source drawable at [%p].\n", @@ -321,7 +321,7 @@ FIXME: The popup could be synchronized with one nxagentSynchronizeRegion(pSrcDrawable, &corruptedRegion, EVENT_BREAK, NULL); } - REGION_UNINIT(pSrcDrawable -> pScreen, &corruptedRegion); + RegionUninit(&corruptedRegion); nxagentFreeRegion(pSrcDrawable, pSrcRegion); @@ -361,7 +361,7 @@ FIXME: The popup could be synchronized with one pClipRegion -> extents.x2, pClipRegion -> extents.y2); #endif - REGION_SUBTRACT(pSrcDrawable -> pScreen, pClipRegion, pClipRegion, nxagentCorruptedRegion(pSrcDrawable)); + RegionSubtract(pClipRegion, pClipRegion, nxagentCorruptedRegion(pSrcDrawable)); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Usable copy area source region is [%d,%d,%d,%d].\n", @@ -381,11 +381,11 @@ FIXME: The popup could be synchronized with one #endif - REGION_TRANSLATE(pSrcDrawable -> pScreen, pClipRegion, dstx - srcx, dsty - srcy); + RegionTranslate(pClipRegion, dstx - srcx, dsty - srcy); } else { - REGION_INIT(pDstDrawable -> pScreen, &tmpRegion, NullBox, 1); + RegionInit(&tmpRegion, NullBox, 1); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Going to modify the original GC [%p] with clip mask " @@ -396,18 +396,18 @@ FIXME: The popup could be synchronized with one pGC -> clipOrg.x, pGC -> clipOrg.y); #endif - REGION_COPY(pDstDrawable -> pScreen, &tmpRegion, (RegionPtr) pGC -> clientClip); + RegionCopy(&tmpRegion, (RegionPtr) pGC -> clientClip); if (pGC -> clipOrg.x != 0 || pGC -> clipOrg.y != 0) { - REGION_TRANSLATE(pDstDrawable -> pScreen, &tmpRegion, pGC -> clipOrg.x, pGC -> clipOrg.y); + RegionTranslate(&tmpRegion, pGC -> clipOrg.x, pGC -> clipOrg.y); } - REGION_TRANSLATE(pSrcDrawable -> pScreen, pClipRegion, dstx - srcx, dsty - srcy); + RegionTranslate(pClipRegion, dstx - srcx, dsty - srcy); - REGION_INTERSECT(pSrcDrawable -> pScreen, pClipRegion, &tmpRegion, pClipRegion); + RegionIntersect(pClipRegion, &tmpRegion, pClipRegion); - REGION_UNINIT(pSrcDrawable -> pScreen, &tmpRegion); + RegionUninit(&tmpRegion); } /* @@ -416,18 +416,18 @@ FIXME: The popup could be synchronized with one * destination that we are not going to copy. */ - REGION_SUBTRACT(pSrcDrawable -> pScreen, pCorruptedRegion, pCorruptedRegion, pClipRegion); + RegionSubtract(pCorruptedRegion, pCorruptedRegion, pClipRegion); #ifdef DEBUG fprintf(stderr, "nxagentDeferCopyArea: Recomputed clip region is [%d,%d,%d,%d][%ld].\n", pClipRegion -> extents.x1, pClipRegion -> extents.y1, pClipRegion -> extents.x2, pClipRegion -> extents.y2, - REGION_NUM_RECTS(pClipRegion)); + RegionNumRects(pClipRegion)); fprintf(stderr, "nxagentDeferCopyArea: Inherited corrupted region is [%d,%d,%d,%d][%ld].\n", pCorruptedRegion -> extents.x1, pCorruptedRegion -> extents.y1, pCorruptedRegion -> extents.x2, pCorruptedRegion -> extents.y2, - REGION_NUM_RECTS(pCorruptedRegion)); + RegionNumRects(pCorruptedRegion)); #endif /* @@ -435,17 +435,17 @@ FIXME: The popup could be synchronized with one * synchronized and the corrupted region. */ - if (REGION_NIL(pClipRegion) == 0) + if (RegionNil(pClipRegion) == 0) { nxagentUnmarkCorruptedRegion(pDstDrawable, pClipRegion); } - if (REGION_NIL(pCorruptedRegion) == 0) + if (RegionNil(pCorruptedRegion) == 0) { nxagentMarkCorruptedRegion(pDstDrawable, pCorruptedRegion); } - if (REGION_NIL(pClipRegion) == 0) + if (RegionNil(pClipRegion) == 0) { GCPtr targetGC; @@ -468,7 +468,7 @@ FIXME: The popup could be synchronized with one GCClipXOrigin | GCClipYOrigin | GCClipMask | GCForeground | GCBackground | GCGraphicsExposures); - if (REGION_NUM_RECTS(pClipRegion) == 1) + if (RegionNumRects(pClipRegion) == 1) { /* * If the region to copy is formed by one @@ -563,12 +563,12 @@ FIXME: The popup could be synchronized with one pSrcRegion -> extents.x2, pSrcRegion -> extents.y2); #endif - REGION_INIT(pSrcDrawable -> pScreen, &corruptedRegion, NullBox, 1); + RegionInit(&corruptedRegion, NullBox, 1); - REGION_INTERSECT(pSrcDrawable -> pScreen, &corruptedRegion, + RegionIntersect(&corruptedRegion, pSrcRegion, nxagentCorruptedRegion(pSrcDrawable)); - if (REGION_NIL(&corruptedRegion) == 0) + if (RegionNil(&corruptedRegion) == 0) { #ifdef TEST fprintf(stderr, "nxagentDeferCopyArea: Forcing the synchronization of source drawable at [%p].\n", @@ -578,7 +578,7 @@ FIXME: The popup could be synchronized with one nxagentSynchronizeRegion(pSrcDrawable, &corruptedRegion /*pSrcRegion*/, NEVER_BREAK, NULL); } - REGION_UNINIT(pSrcDrawable -> pScreen, &corruptedRegion); + RegionUninit(&corruptedRegion); nxagentFreeRegion(pSrcDrawable, pSrcRegion); } @@ -1032,12 +1032,12 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, { pSrcRegion = nxagentCreateRegion(pSrcDrawable, NULL, srcx, srcy, width, height); - REGION_INIT(pSrcDrawable -> pScreen, &corruptedRegion, NullBox, 1); + RegionInit(&corruptedRegion, NullBox, 1); - REGION_INTERSECT(pSrcDrawable -> pScreen, &corruptedRegion, + RegionIntersect(&corruptedRegion, pSrcRegion, nxagentCorruptedRegion(pSrcDrawable)); - if (REGION_NIL(&corruptedRegion) == 0) + if (RegionNil(&corruptedRegion) == 0) { #ifdef TEST fprintf(stderr, "nxagentCopyPlane: Forcing the synchronization of source drawable at [%p].\n", @@ -1053,7 +1053,7 @@ RegionPtr nxagentCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, nxagentFreeRegion(pDstDrawable, pDstRegion); } - REGION_UNINIT(pSrcDrawable -> pScreen, &corruptedRegion); + RegionUninit(&corruptedRegion); nxagentFreeRegion(pSrcDrawable, pSrcRegion); } @@ -1615,24 +1615,24 @@ void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, if (inheritCorruptedRegion == 1 || nxagentDrawableStatus(pDrawable) == NotSynchronized) { - rectRegion = RECTS_TO_REGION(pDrawable -> pScreen, nRectangles, pRectangles, CT_REGION); + rectRegion = RegionFromRects(nRectangles, pRectangles, CT_REGION); if (pGC -> clientClip != NULL) { RegionRec tmpRegion; - REGION_INIT(pDrawable -> pScreen, &tmpRegion, NullBox, 1); + RegionInit(&tmpRegion, NullBox, 1); - REGION_COPY(pDrawable -> pScreen, &tmpRegion, ((RegionPtr) pGC -> clientClip)); + RegionCopy(&tmpRegion, ((RegionPtr) pGC -> clientClip)); if (pGC -> clipOrg.x != 0 || pGC -> clipOrg.y != 0) { - REGION_TRANSLATE(pDrawable -> pScreen, &tmpRegion, pGC -> clipOrg.x, pGC -> clipOrg.y); + RegionTranslate(&tmpRegion, pGC -> clipOrg.x, pGC -> clipOrg.y); } - REGION_INTERSECT(pDrawable -> pScreen, rectRegion, rectRegion, &tmpRegion); + RegionIntersect(rectRegion, rectRegion, &tmpRegion); - REGION_UNINIT(pDrawable -> pScreen, &tmpRegion); + RegionUninit(&tmpRegion); } if (inheritCorruptedRegion == 1) @@ -1672,7 +1672,7 @@ void nxagentPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, } } - REGION_DESTROY(pDrawable -> pScreen, rectRegion); + RegionDestroy(rectRegion); } if ((pDrawable)->type == DRAWABLE_PIXMAP) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index 1f0b735b0..c84d3b7ed 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -566,7 +566,7 @@ void nxagentPutImage(DrawablePtr pDrawable, GCPtr pGC, int depth, pRegion = nxagentCreateRegion(pDrawable, pGC, dstX, dstY, dstWidth, dstHeight); - if (REGION_NIL(pRegion) == 1) + if (RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentPutImage: WARNING! Prevented operation on fully clipped " @@ -1036,7 +1036,7 @@ void nxagentRealizeImage(DrawablePtr pDrawable, GCPtr pGC, int depth, clipRegion = nxagentCreateRegion(pDrawable, pGC, x, y, w, h); } - if (clipRegion == NullRegion || REGION_NIL(clipRegion) == 0) + if (clipRegion == NullRegion || RegionNil(clipRegion) == 0) { nxagentPutSubImage(pDrawable, pGC, depth, x, y, w, h, leftPad, format, data, pVisual); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c b/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c index d18840dad..278e0727c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdamage.c @@ -154,7 +154,7 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, #endif /* short circuit for empty regions */ - if (!REGION_NOTEMPTY(pScreen, pRegion)) + if (!RegionNotEmpty(pRegion)) return; #ifdef COMPOSITE @@ -169,7 +169,7 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, screen_y = ((PixmapPtr) pDrawable)->screen_y - pDrawable->y; } if (screen_x || screen_y) - REGION_TRANSLATE (pScreen, pRegion, screen_x, screen_y); + RegionTranslate(pRegion, screen_x, screen_y); #endif if (pDrawable->type == DRAWABLE_WINDOW && @@ -177,22 +177,22 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, { if (subWindowMode == ClipByChildren) { - REGION_INTERSECT(pScreen, pRegion, pRegion, + RegionIntersect(pRegion, pRegion, &((WindowPtr)(pDrawable))->clipList); } else if (subWindowMode == IncludeInferiors) { RegionPtr pTempRegion = NotClippedByChildren((WindowPtr)(pDrawable)); - REGION_INTERSECT(pScreen, pRegion, pRegion, pTempRegion); - REGION_DESTROY(pScreen, pTempRegion); + RegionIntersect(pRegion, pRegion, pTempRegion); + RegionDestroy(pTempRegion); } /* If subWindowMode is set to an invalid value, don't perform * any drawable-based clipping. */ } - REGION_NULL (pScreen, &clippedRec); + RegionNull(&clippedRec); for (; pDamage; pDamage = pNext) { pNext = pDamage->pNext; @@ -240,7 +240,7 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, { pDamageRegion = &clippedRec; if (pDamage->pDrawable->type == DRAWABLE_WINDOW) { - REGION_INTERSECT (pScreen, pDamageRegion, pRegion, + RegionIntersect(pDamageRegion, pRegion, &((WindowPtr)(pDamage->pDrawable))->borderClip); } else { BoxRec box; @@ -248,14 +248,14 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, box.y1 = draw_y; box.x2 = draw_x + pDamage->pDrawable->width; box.y2 = draw_y + pDamage->pDrawable->height; - REGION_INIT(pScreen, &pixClip, &box, 1); - REGION_INTERSECT (pScreen, pDamageRegion, pRegion, &pixClip); - REGION_UNINIT(pScreen, &pixClip); + RegionInit(&pixClip, &box, 1); + RegionIntersect(pDamageRegion, pRegion, &pixClip); + RegionUninit(&pixClip); } /* * Short circuit empty results */ - if (!REGION_NOTEMPTY(pScreen, pDamageRegion)) + if (!RegionNotEmpty(pDamageRegion)) continue; } @@ -270,39 +270,39 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, * Move region to target coordinate space */ if (draw_x || draw_y) - REGION_TRANSLATE (pScreen, pDamageRegion, -draw_x, -draw_y); + RegionTranslate(pDamageRegion, -draw_x, -draw_y); switch (pDamage->damageLevel) { case DamageReportRawRegion: (*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure); break; case DamageReportDeltaRegion: - REGION_NULL (pScreen, &tmpRegion); - REGION_SUBTRACT (pScreen, &tmpRegion, pDamageRegion, &pDamage->damage); - if (REGION_NOTEMPTY (pScreen, &tmpRegion)) + RegionNull(&tmpRegion); + RegionSubtract(&tmpRegion, pDamageRegion, &pDamage->damage); + if (RegionNotEmpty(&tmpRegion)) { - REGION_UNION(pScreen, &pDamage->damage, + RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); (*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure); } - REGION_UNINIT(pScreen, &tmpRegion); + RegionUninit(&tmpRegion); break; case DamageReportBoundingBox: - tmpBox = *REGION_EXTENTS (pScreen, &pDamage->damage); - REGION_UNION(pScreen, &pDamage->damage, + tmpBox = *RegionExtents(&pDamage->damage); + RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); - if (!BOX_SAME (&tmpBox, REGION_EXTENTS (pScreen, &pDamage->damage))) + if (!BOX_SAME (&tmpBox, RegionExtents(&pDamage->damage))) (*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure); break; case DamageReportNonEmpty: - was_empty = !REGION_NOTEMPTY(pScreen, &pDamage->damage); - REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage, + was_empty = !RegionNotEmpty(&pDamage->damage); + RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); - if (was_empty && REGION_NOTEMPTY(pScreen, &pDamage->damage)) + if (was_empty && RegionNotEmpty(&pDamage->damage)) (*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure); break; case DamageReportNone: - REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage, + RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); break; } @@ -310,14 +310,14 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, * translate original region back */ if (pDamageRegion == pRegion && (draw_x || draw_y)) - REGION_TRANSLATE (pScreen, pDamageRegion, draw_x, draw_y); + RegionTranslate(pDamageRegion, draw_x, draw_y); } #ifdef COMPOSITE if (screen_x || screen_y) - REGION_TRANSLATE (pScreen, pRegion, -screen_x, -screen_y); + RegionTranslate(pRegion, -screen_x, -screen_y); #endif - REGION_UNINIT (pScreen, &clippedRec); + RegionUninit(&clippedRec); } #if DAMAGE_DEBUG_ENABLE @@ -331,13 +331,13 @@ damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode) { RegionRec region; - REGION_INIT (pDrawable->pScreen, ®ion, pBox, 1); + RegionInit(®ion, pBox, 1); #if DAMAGE_DEBUG_ENABLE _damageDamageRegion (pDrawable, ®ion, TRUE, subWindowMode, where); #else damageDamageRegion (pDrawable, ®ion, TRUE, subWindowMode); #endif - REGION_UNINIT (pDrawable->pScreen, ®ion); + RegionUninit(®ion); } static void damageValidateGC(GCPtr, unsigned long, DrawablePtr); @@ -506,7 +506,7 @@ damageDestroyClip(GCPtr pGC) #define checkGCDamage(d,g) (getDrawableDamage(d) && \ (!g->pCompositeClip ||\ - REGION_NOTEMPTY(d->pScreen, \ + RegionNotEmpty(\ g->pCompositeClip))) #ifdef RENDER @@ -520,7 +520,7 @@ damageDestroyClip(GCPtr pGC) } #define checkPictureDamage(p) (getDrawableDamage(p->pDrawable) && \ - REGION_NOTEMPTY(pScreen, p->pCompositeClip)) + RegionNotEmpty(p->pCompositeClip)) static void damageComposite (CARD8 op, @@ -1722,9 +1722,9 @@ damageCopyWindow(WindowPtr pWindow, * The region comes in source relative, but the damage occurs * at the destination location. Translate back and forth. */ - REGION_TRANSLATE (pScreen, prgnSrc, dx, dy); + RegionTranslate(prgnSrc, dx, dy); damageDamageRegion (&pWindow->drawable, prgnSrc, FALSE, -1); - REGION_TRANSLATE (pScreen, prgnSrc, -dx, -dy); + RegionTranslate(prgnSrc, -dx, -dy); } unwrap (pScrPriv, pScreen, CopyWindow); (*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc); @@ -1927,7 +1927,7 @@ DamageCreate (DamageReportFunc damageReport, return 0; pDamage->pNext = 0; pDamage->pNextWin = 0; - REGION_NULL(pScreen, &pDamage->damage); + RegionNull(&pDamage->damage); pDamage->damageLevel = damageLevel; pDamage->isInternal = isInternal; @@ -2016,7 +2016,7 @@ DamageDestroy (DamagePtr pDamage) { if (pDamage->damageDestroy) (*pDamage->damageDestroy) (pDamage, pDamage->closure); - REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->damage); + RegionUninit(&pDamage->damage); xfree (pDamage); } @@ -2028,7 +2028,7 @@ DamageSubtract (DamagePtr pDamage, RegionRec pixmapClip; DrawablePtr pDrawable = pDamage->pDrawable; - REGION_SUBTRACT (pDrawable->pScreen, &pDamage->damage, &pDamage->damage, pRegion); + RegionSubtract(&pDamage->damage, &pDamage->damage, pRegion); if (pDrawable) { if (pDrawable->type == DRAWABLE_WINDOW) @@ -2041,22 +2041,22 @@ DamageSubtract (DamagePtr pDamage, box.y1 = pDrawable->y; box.x2 = pDrawable->x + pDrawable->width; box.y2 = pDrawable->y + pDrawable->height; - REGION_INIT (pDrawable->pScreen, &pixmapClip, &box, 1); + RegionInit(&pixmapClip, &box, 1); pClip = &pixmapClip; } - REGION_TRANSLATE (pDrawable->pScreen, &pDamage->damage, pDrawable->x, pDrawable->y); - REGION_INTERSECT (pDrawable->pScreen, &pDamage->damage, &pDamage->damage, pClip); - REGION_TRANSLATE (pDrawable->pScreen, &pDamage->damage, -pDrawable->x, -pDrawable->y); + RegionTranslate(&pDamage->damage, pDrawable->x, pDrawable->y); + RegionIntersect(&pDamage->damage, &pDamage->damage, pClip); + RegionTranslate(&pDamage->damage, -pDrawable->x, -pDrawable->y); if (pDrawable->type != DRAWABLE_WINDOW) - REGION_UNINIT(pDrawable->pScreen, &pixmapClip); + RegionUninit(&pixmapClip); } - return REGION_NOTEMPTY (pDrawable->pScreen, &pDamage->damage); + return RegionNotEmpty(&pDamage->damage); } void DamageEmpty (DamagePtr pDamage) { - REGION_EMPTY (pDamage->pDrawable->pScreen, &pDamage->damage); + RegionEmpty(&pDamage->damage); } RegionPtr diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 704bfcc0d..6a1f2ac6a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -1669,11 +1669,11 @@ ProcTranslateCoords(register ClientPtr client) * borderSize */ && (!wBoundingShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( &pWin->borderSize, x, y, &box)) && (!wInputShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box)) @@ -2291,7 +2291,7 @@ ProcCopyArea(register ClientPtr client) (*pDst->pScreen->SendGraphicsExpose) (client, pRgn, stuff->dstDrawable, X_CopyArea, 0); if (pRgn) - REGION_DESTROY(pDst->pScreen, pRgn); + RegionDestroy(pRgn); } return(client->noClientException); @@ -2339,7 +2339,7 @@ ProcCopyPlane(register ClientPtr client) (*pdstDraw->pScreen->SendGraphicsExpose) (client, pRgn, stuff->dstDrawable, X_CopyPlane, 0); if (pRgn) - REGION_DESTROY(pdstDraw->pScreen, pRgn); + RegionDestroy(pRgn); } return(client->noClientException); } @@ -2777,7 +2777,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw); if (pVisibleRegion) { - REGION_TRANSLATE(pDraw->pScreen, pVisibleRegion, -pDraw->x, -pDraw->y); + RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y); } } #endif @@ -2871,7 +2871,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, } #ifdef XCSECURITY if (pVisibleRegion) - REGION_DESTROY(pDraw->pScreen, pVisibleRegion); + RegionDestroy(pVisibleRegion); #endif if (!im_return) DEALLOCATE_LOCAL(pBuf); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 11ff62947..117203103 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -379,14 +379,14 @@ XineramaSetCursorPosition( x += panoramiXdataPtr[0].x; y += panoramiXdataPtr[0].y; - if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum], + if(!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum], x, y, &box)) { FOR_NSCREENS(i) { if(i == pScreen->myNum) continue; - if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], x, y, &box)) + if(RegionContainsPoint(&XineramaScreenRegions[i], x, y, &box)) { pScreen = screenInfo.screens[i]; break; @@ -516,7 +516,7 @@ XineramaCheckVirtualMotion( i = PanoramiXNumScreens - 1; - REGION_COPY(sprite.screen, &sprite.Reg2, + RegionCopy(&sprite.Reg2, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; @@ -526,16 +526,16 @@ XineramaCheckVirtualMotion( y = off_y - panoramiXdataPtr[i].y; if(x || y) - REGION_TRANSLATE(sprite.screen, &sprite.Reg2, x, y); + RegionTranslate(&sprite.Reg2, x, y); - REGION_UNION(sprite.screen, &sprite.Reg2, &sprite.Reg2, + RegionUnion(&sprite.Reg2, &sprite.Reg2, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; } - lims = *REGION_EXTENTS(sprite.screen, &sprite.Reg2); + lims = *RegionExtents(&sprite.Reg2); if (sprite.hot.x < lims.x1) #ifdef XEVIE @@ -558,7 +558,7 @@ XineramaCheckVirtualMotion( #endif sprite.hot.y = lims.y2 - 1; - if (REGION_NUM_RECTS(&sprite.Reg2) > 1) + if (RegionNumRects(&sprite.Reg2) > 1) ConfineToShape(&sprite.Reg2, &sprite.hot.x, &sprite.hot.y); if (qe) @@ -665,7 +665,7 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) i = PanoramiXNumScreens - 1; - REGION_COPY(sprite.screen, &sprite.Reg1, + RegionCopy(&sprite.Reg1, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; @@ -675,18 +675,18 @@ XineramaConfineCursorToWindow(WindowPtr pWin, Bool generateEvents) y = off_y - panoramiXdataPtr[i].y; if(x || y) - REGION_TRANSLATE(sprite.screen, &sprite.Reg1, x, y); + RegionTranslate(&sprite.Reg1, x, y); - REGION_UNION(sprite.screen, &sprite.Reg1, &sprite.Reg1, + RegionUnion(&sprite.Reg1, &sprite.Reg1, &sprite.windows[i]->borderSize); off_x = panoramiXdataPtr[i].x; off_y = panoramiXdataPtr[i].y; } - sprite.hotLimits = *REGION_EXTENTS(sprite.screen, &sprite.Reg1); + sprite.hotLimits = *RegionExtents(&sprite.Reg1); - if(REGION_NUM_RECTS(&sprite.Reg1) > 1) + if(RegionNumRects(&sprite.Reg1) > 1) sprite.hotShape = &sprite.Reg1; else sprite.hotShape = NullRegion; @@ -765,9 +765,9 @@ ConfineToShape(RegionPtr shape, int *px, int *py) int x = *px, y = *py; int incx = 1, incy = 1; - if (POINT_IN_REGION(sprite.hot.pScreen, shape, x, y, &box)) + if (RegionContainsPoint(shape, x, y, &box)) return; - box = *REGION_EXTENTS(sprite.hot.pScreen, shape); + box = *RegionExtents(shape); /* this is rather crude */ do { x += incx; @@ -789,7 +789,7 @@ ConfineToShape(RegionPtr shape, int *px, int *py) else if (y < box.y1) return; /* should never get here! */ } - } while (!POINT_IN_REGION(sprite.hot.pScreen, shape, x, y, &box)); + } while (!RegionContainsPoint(shape, x, y, &box)); *px = x; *py = y; } @@ -877,7 +877,7 @@ CheckVirtualMotion( #endif sprite.hot.x = sprite.hot.y = 0; } - lims = *REGION_EXTENTS(pWin->drawable.pScreen, &pWin->borderSize); + lims = *RegionExtents(&pWin->borderSize); if (sprite.hot.x < lims.x1) #ifdef XEVIE xeviehot.x = @@ -931,7 +931,7 @@ ConfineCursorToWindow(WindowPtr pWin, Bool generateEvents, Bool confineToScreen) } else { - sprite.hotLimits = *REGION_EXTENTS( pScreen, &pWin->borderSize); + sprite.hotLimits = *RegionExtents(&pWin->borderSize); #ifdef SHAPE sprite.hotShape = wBoundingShape(pWin) ? &pWin->borderSize : NullRegion; @@ -2117,7 +2117,7 @@ PointInBorderSize(WindowPtr pWin, int x, int y) { BoxRec box; - if(POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderSize, x, y, &box)) + if(RegionContainsPoint(&pWin->borderSize, x, y, &box)) return TRUE; #ifdef PANORAMIX @@ -2125,7 +2125,7 @@ PointInBorderSize(WindowPtr pWin, int x, int y) int i; for(i = 1; i < PanoramiXNumScreens; i++) { - if(POINT_IN_REGION(sprite.screen, + if(RegionContainsPoint( &sprite.windows[i]->borderSize, x + panoramiXdataPtr[0].x - panoramiXdataPtr[i].x, y + panoramiXdataPtr[0].y - panoramiXdataPtr[i].y, @@ -2180,7 +2180,7 @@ XYToWindow(int x, int y) */ && (!wBoundingShape(pWin) || PointInBorderSize(pWin, x, y)) && (!wInputShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box)) @@ -2329,10 +2329,10 @@ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) sprite.hotLimits.x2 -= xoff; sprite.hotLimits.y2 -= yoff; - if (REGION_NOTEMPTY(sprite.screen, &sprite.Reg1)) - REGION_TRANSLATE(sprite.screen, &sprite.Reg1, xoff, yoff); - if (REGION_NOTEMPTY(sprite.screen, &sprite.Reg2)) - REGION_TRANSLATE(sprite.screen, &sprite.Reg2, xoff, yoff); + if (RegionNotEmpty(&sprite.Reg1)) + RegionTranslate(&sprite.Reg1, xoff, yoff); + if (RegionNotEmpty(&sprite.Reg2)) + RegionTranslate(&sprite.Reg2, xoff, yoff); /* FIXME: if we call ConfineCursorToWindow, must we do anything else? */ if ((grab = inputInfo.pointer->grab) && grab->confineTo) { @@ -2388,8 +2388,8 @@ DefineInitialRootWindow(register WindowPtr win) #endif sprite.screen = pScreen; /* gotta UNINIT these someplace */ - REGION_NULL(pScreen, &sprite.Reg1); - REGION_NULL(pScreen, &sprite.Reg2); + RegionNull(&sprite.Reg1); + RegionNull(&sprite.Reg2); } #endif @@ -2467,7 +2467,7 @@ XineramaPointInWindowIsVisible( if (!pWin->realized) return FALSE; - if (POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box)) + if (RegionContainsPoint(&pWin->borderClip, x, y, &box)) return TRUE; if(!XineramaSetWindowPntrs(pWin)) return FALSE; @@ -2481,9 +2481,9 @@ XineramaPointInWindowIsVisible( x = xoff - panoramiXdataPtr[i].x; y = yoff - panoramiXdataPtr[i].y; - if(POINT_IN_REGION(pScreen, &pWin->borderClip, x, y, &box) + if(RegionContainsPoint(&pWin->borderClip, x, y, &box) && (!wInputShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box))) @@ -2659,7 +2659,7 @@ ProcWarpPointer(ClientPtr client) static Bool BorderSizeNotEmpty(WindowPtr pWin) { - if(REGION_NOTEMPTY(sprite.hotPhys.pScreen, &pWin->borderSize)) + if(RegionNotEmpty(&pWin->borderSize)) return TRUE; #ifdef PANORAMIX @@ -2667,7 +2667,7 @@ BorderSizeNotEmpty(WindowPtr pWin) int i; for(i = 1; i < PanoramiXNumScreens; i++) { - if(REGION_NOTEMPTY(sprite.screen, &sprite.windows[i]->borderSize)) + if(RegionNotEmpty(&sprite.windows[i]->borderSize)) return TRUE; } } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c index aa3c606f8..201d6d83b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c @@ -222,21 +222,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 @@ -253,7 +253,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; } @@ -270,11 +270,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 @@ -286,14 +286,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) { @@ -311,10 +311,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 @@ -324,7 +324,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) @@ -337,7 +337,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 @@ -345,8 +345,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)( @@ -363,53 +363,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; } } @@ -424,7 +424,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; @@ -432,8 +432,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; @@ -479,8 +479,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)); @@ -554,8 +554,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; @@ -568,11 +568,11 @@ 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; } @@ -583,12 +583,12 @@ miWindowExposures(pWin, prgn, other_exposed) * than 4, let the function decide. */ - total = REGION_NUM_RECTS(exposures); + total = RegionNumRects(exposures); if (clientInterested && exposures && (total > RECTLIMIT || (total > 4 && nxagentExtentsPredicate(total) == 1))) #else - if (clientInterested && exposures && (REGION_NUM_RECTS(exposures) > RECTLIMIT)) + if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT)) #endif { /* @@ -599,17 +599,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)( @@ -620,22 +620,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); } @@ -779,7 +779,7 @@ int what; } } - prect = (xRectangle *)ALLOCATE_LOCAL(REGION_NUM_RECTS(prgn) * + prect = (xRectangle *)ALLOCATE_LOCAL(RegionNumRects(prgn) * sizeof(xRectangle)); if (!prect) return; @@ -822,7 +822,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; @@ -925,8 +925,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; @@ -945,7 +945,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/hw/nxagent/NXmiwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c index a720cafbf..08c052294 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c @@ -131,7 +131,7 @@ miClearToBackground(pWin, x, y, w, h, generateExposures) box.y2 = y2; pScreen = pWin->drawable.pScreen; - REGION_INIT(pScreen, ®, &box, 1); + RegionInit(®, &box, 1); if (pWin->backStorage) { /* @@ -145,14 +145,14 @@ miClearToBackground(pWin, x, y, w, h, generateExposures) generateExposures); } - REGION_INTERSECT(pScreen, ®, ®, &pWin->clipList); + RegionIntersect(®, ®, &pWin->clipList); if (generateExposures) (*pScreen->WindowExposures)(pWin, ®, pBSReg); else if (pWin->backgroundState != None) (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); - REGION_UNINIT(pScreen, ®); + RegionUninit(®); if (pBSReg) - REGION_DESTROY(pScreen, pBSReg); + RegionDestroy(pBSReg); } /* @@ -198,7 +198,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 @@ -217,10 +217,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); } @@ -231,12 +231,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); } /* @@ -247,8 +247,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) @@ -300,11 +300,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; } @@ -403,9 +403,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) @@ -425,17 +425,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; @@ -481,13 +481,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) @@ -534,8 +534,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; @@ -572,7 +572,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); } @@ -607,14 +607,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; } @@ -671,8 +671,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 @@ -685,8 +685,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 @@ -701,8 +701,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 @@ -717,16 +717,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); } } @@ -753,9 +753,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, @@ -783,7 +783,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); @@ -827,16 +827,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 @@ -847,9 +847,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 @@ -858,17 +858,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); } } @@ -892,14 +892,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 */ @@ -915,7 +915,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 @@ -925,7 +925,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); } @@ -936,21 +936,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; @@ -959,8 +959,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); @@ -977,7 +977,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 (); @@ -1021,8 +1021,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; } @@ -1039,8 +1039,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, @@ -1083,10 +1083,10 @@ miSetShape(pWin) */ if (WasViewable && pOldClip) - REGION_DESTROY(pScreen, pOldClip); + RegionDestroy(pOldClip); #else if (WasViewable) - REGION_DESTROY(pScreen, pOldClip); + RegionDestroy(pOldClip); #endif if (bsExposed) { @@ -1096,8 +1096,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) @@ -1158,8 +1158,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; } @@ -1196,10 +1196,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); } } @@ -1214,7 +1214,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); diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c index 9c438394a..725f5137e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c @@ -1537,7 +1537,7 @@ SetPictureClipRects (PicturePtr pPicture, RegionPtr clientClip; int result; - clientClip = RECTS_TO_REGION(pScreen, + clientClip = RegionFromRects( nRect, rects, CT_UNSORTED); if (!clientClip) return BadAlloc; @@ -1568,14 +1568,14 @@ SetPictureClipRegion (PicturePtr pPicture, if (pRegion) { type = CT_REGION; - clientClip = REGION_CREATE (pScreen, - REGION_EXTENTS(pScreen, pRegion), - REGION_NUM_RECTS(pRegion)); + clientClip = RegionCreate( + RegionExtents(pRegion), + RegionNumRects(pRegion)); if (!clientClip) return BadAlloc; - if (!REGION_COPY (pSCreen, clientClip, pRegion)) + if (!RegionCopy(clientClip, pRegion)) { - REGION_DESTROY (pScreen, clientClip); + RegionDestroy(clientClip); return BadAlloc; } } @@ -1685,9 +1685,9 @@ CopyPicture (PicturePtr pSrc, RegionPtr clientClip; RegionPtr srcClientClip = (RegionPtr)pSrc->clientClip; - clientClip = REGION_CREATE(pSrc->pDrawable->pScreen, - REGION_EXTENTS(pSrc->pDrawable->pScreen, srcClientClip), - REGION_NUM_RECTS(srcClientClip)); + clientClip = RegionCreate( + RegionExtents(srcClientClip), + RegionNumRects(srcClientClip)); (*ps->ChangePictureClip)(pDst, CT_REGION, clientClip, 0); } break; diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 013f26e28..a3d791ff8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -509,10 +509,10 @@ CreateRootWindow(ScreenPtr pScreen) box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; - REGION_INIT(pScreen, &pWin->clipList, &box, 1); - REGION_INIT(pScreen, &pWin->winSize, &box, 1); - REGION_INIT(pScreen, &pWin->borderSize, &box, 1); - REGION_INIT(pScreen, &pWin->borderClip, &box, 1); + RegionInit(&pWin->clipList, &box, 1); + RegionInit(&pWin->winSize, &box, 1); + RegionInit(&pWin->borderSize, &box, 1); + RegionInit(&pWin->borderClip, &box, 1); pWin->drawable.class = InputOutput; pWin->optional->visual = pScreen->rootVisual; @@ -697,7 +697,7 @@ ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn, #endif /* NXAGENT_SERVER */ BoxRec box; - box = *(REGION_EXTENTS(pScreen, &pWin->winSize)); + box = *(RegionExtents(&pWin->winSize)); /* we do these calculations to avoid overflows */ if (x > box.x1) box.x1 = x; @@ -713,8 +713,8 @@ ClippedRegionFromBox(register WindowPtr pWin, RegionPtr Rgn, box.x2 = box.x1; if (box.y1 > box.y2) box.y2 = box.y1; - REGION_RESET(pScreen, Rgn, &box); - REGION_INTERSECT(pScreen, Rgn, Rgn, &pWin->winSize); + RegionReset(Rgn, &box); + RegionIntersect(Rgn, Rgn, &pWin->winSize); } WindowPtr @@ -895,10 +895,10 @@ CreateWindow(Window wid, register WindowPtr pParent, int x, int y, unsigned w, pWin->drawable.y = pParent->drawable.y + y + (int)bw; /* set up clip list correctly for unobscured WindowPtr */ - REGION_NULL(pScreen, &pWin->clipList); - REGION_NULL(pScreen, &pWin->borderClip); - REGION_NULL(pScreen, &pWin->winSize); - REGION_NULL(pScreen, &pWin->borderSize); + RegionNull(&pWin->clipList); + RegionNull(&pWin->borderClip); + RegionNull(&pWin->winSize); + RegionNull(&pWin->borderSize); pHead = RealChildHead(pParent); if (pHead) @@ -979,17 +979,17 @@ FreeWindowResources(register WindowPtr pWin) DeleteWindowFromAnySaveSet(pWin); DeleteWindowFromAnySelections(pWin); DeleteWindowFromAnyEvents(pWin, TRUE); - REGION_UNINIT(pScreen, &pWin->clipList); - REGION_UNINIT(pScreen, &pWin->winSize); - REGION_UNINIT(pScreen, &pWin->borderClip); - REGION_UNINIT(pScreen, &pWin->borderSize); + RegionUninit(&pWin->clipList); + RegionUninit(&pWin->winSize); + RegionUninit(&pWin->borderClip); + RegionUninit(&pWin->borderSize); #ifdef SHAPE if (wBoundingShape (pWin)) - REGION_DESTROY(pScreen, wBoundingShape (pWin)); + RegionDestroy(wBoundingShape (pWin)); if (wClipShape (pWin)) - REGION_DESTROY(pScreen, wClipShape (pWin)); + RegionDestroy(wClipShape (pWin)); if (wInputShape (pWin)) - REGION_DESTROY(pScreen, wInputShape (pWin)); + RegionDestroy(wInputShape (pWin)); #endif if (pWin->borderIsPixel == FALSE) (*pScreen->DestroyPixmap)(pWin->border.pixmap); @@ -1679,10 +1679,10 @@ PatchUp: { RegionRec exposed; - REGION_NULL(pScreen, &exposed); - REGION_SUBTRACT(pScreen, &exposed, &pWin->borderClip, &pWin->winSize); + RegionNull(&exposed); + RegionSubtract(&exposed, &pWin->borderClip, &pWin->winSize); (*pWin->drawable.pScreen->PaintWindowBorder)(pWin, &exposed, PW_BORDER); - REGION_UNINIT(pScreen, &exposed); + RegionUninit(&exposed); } return error; } @@ -1823,19 +1823,19 @@ CreateUnclippedWinSize (register WindowPtr pWin) box.y1 = pWin->drawable.y; box.x2 = pWin->drawable.x + (int) pWin->drawable.width; box.y2 = pWin->drawable.y + (int) pWin->drawable.height; - pRgn = REGION_CREATE(pWin->drawable.pScreen, &box, 1); + pRgn = RegionCreate(&box, 1); #ifdef SHAPE if (wBoundingShape (pWin) || wClipShape (pWin)) { #ifndef NXAGENT_SERVER ScreenPtr pScreen = pWin->drawable.pScreen; #endif /* NXAGENT_SERVER */ - REGION_TRANSLATE(pScreen, pRgn, - pWin->drawable.x, + RegionTranslate(pRgn, - pWin->drawable.x, - pWin->drawable.y); if (wBoundingShape (pWin)) - REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin)); + RegionIntersect(pRgn, pRgn, wBoundingShape (pWin)); if (wClipShape (pWin)) - REGION_INTERSECT(pScreen, pRgn, pRgn, wClipShape (pWin)); - REGION_TRANSLATE(pScreen, pRgn, pWin->drawable.x, pWin->drawable.y); + RegionIntersect(pRgn, pRgn, wClipShape (pWin)); + RegionTranslate(pRgn, pWin->drawable.x, pWin->drawable.y); } #endif return pRgn; @@ -1853,7 +1853,7 @@ SetWinSize (register WindowPtr pWin) box.y1 = pWin->drawable.y; box.x2 = pWin->drawable.x + pWin->drawable.width; box.y2 = pWin->drawable.y + pWin->drawable.height; - REGION_RESET (pScreen, &pWin->winSize, &box); + RegionReset(&pWin->winSize, &box); } else #endif @@ -1866,15 +1866,15 @@ SetWinSize (register WindowPtr pWin) #ifndef NXAGENT_SERVER ScreenPtr pScreen = pWin->drawable.pScreen; #endif /* NXAGENT_SERVER */ - REGION_TRANSLATE(pScreen, &pWin->winSize, - pWin->drawable.x, + RegionTranslate(&pWin->winSize, - pWin->drawable.x, - pWin->drawable.y); if (wBoundingShape (pWin)) - REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize, + RegionIntersect(&pWin->winSize, &pWin->winSize, wBoundingShape (pWin)); if (wClipShape (pWin)) - REGION_INTERSECT(pScreen, &pWin->winSize, &pWin->winSize, + RegionIntersect(&pWin->winSize, &pWin->winSize, wClipShape (pWin)); - REGION_TRANSLATE(pScreen, &pWin->winSize, pWin->drawable.x, + RegionTranslate(&pWin->winSize, pWin->drawable.x, pWin->drawable.y); } #endif @@ -1896,7 +1896,7 @@ SetBorderSize (register WindowPtr pWin) box.y1 = pWin->drawable.y - bw; box.x2 = pWin->drawable.x + pWin->drawable.width + bw; box.y2 = pWin->drawable.y + pWin->drawable.height + bw; - REGION_RESET (pScreen, &pWin->borderSize, &box); + RegionReset(&pWin->borderSize, &box); } else #endif @@ -1909,18 +1909,18 @@ SetBorderSize (register WindowPtr pWin) #ifndef NXAGENT_SERVER ScreenPtr pScreen = pWin->drawable.pScreen; #endif /* NXAGENT_SERVER */ - REGION_TRANSLATE(pScreen, &pWin->borderSize, - pWin->drawable.x, + RegionTranslate(&pWin->borderSize, - pWin->drawable.x, - pWin->drawable.y); - REGION_INTERSECT(pScreen, &pWin->borderSize, &pWin->borderSize, + RegionIntersect(&pWin->borderSize, &pWin->borderSize, wBoundingShape (pWin)); - REGION_TRANSLATE(pScreen, &pWin->borderSize, pWin->drawable.x, + RegionTranslate(&pWin->borderSize, pWin->drawable.x, pWin->drawable.y); - REGION_UNION(pScreen, &pWin->borderSize, &pWin->borderSize, + RegionUnion(&pWin->borderSize, &pWin->borderSize, &pWin->winSize); } #endif } else { - REGION_COPY(pWin->drawable.pScreen, &pWin->borderSize, + RegionCopy(&pWin->borderSize, &pWin->winSize); } } @@ -2135,12 +2135,12 @@ MakeBoundingRegion ( #ifndef NXAGENT_SERVER ScreenPtr pScreen = pWin->drawable.pScreen; #endif /* NXAGENT_SERVER */ - pRgn = REGION_CREATE(pScreen, pBox, 1); + pRgn = RegionCreate(pBox, 1); if (wBoundingShape (pWin)) { - REGION_TRANSLATE(pScreen, pRgn, -pWin->origin.x, + RegionTranslate(pRgn, -pWin->origin.x, -pWin->origin.y); - REGION_INTERSECT(pScreen, pRgn, pRgn, wBoundingShape (pWin)); - REGION_TRANSLATE(pScreen, pRgn, pWin->origin.x, + RegionIntersect(pRgn, pRgn, wBoundingShape (pWin)); + RegionTranslate(pRgn, pWin->origin.x, pWin->origin.y); } return pRgn; @@ -2162,10 +2162,10 @@ ShapeOverlap ( pScreen = pWin->drawable.pScreen; pWinRgn = MakeBoundingRegion (pWin, pWinBox); pSibRgn = MakeBoundingRegion (pSib, pSibBox); - REGION_INTERSECT(pScreen, pWinRgn, pWinRgn, pSibRgn); - ret = REGION_NOTEMPTY(pScreen, pWinRgn); - REGION_DESTROY(pScreen, pWinRgn); - REGION_DESTROY(pScreen, pSibRgn); + RegionIntersect(pWinRgn, pWinRgn, pSibRgn); + ret = RegionNotEmpty(pWinRgn); + RegionDestroy(pWinRgn); + RegionDestroy(pSibRgn); return ret; } #endif @@ -2296,7 +2296,7 @@ WhereDoIGoInTheStack( else if (pSib) { if ((IsSiblingAboveMe(pWin, pSib) == Above) && - (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT)) + (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT)) return(pFirst); else return(pWin->nextSib); @@ -2311,7 +2311,7 @@ WhereDoIGoInTheStack( else if (pSib) { if ((IsSiblingAboveMe(pWin, pSib) == Below) && - (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT)) + (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT)) return NullWindow; else return(pWin->nextSib); @@ -2325,7 +2325,7 @@ WhereDoIGoInTheStack( return(pWin->nextSib); else if (pSib) { - if (RECT_IN_REGION(pScreen, &pSib->borderSize, &box) != rgnOUT) + if (RegionContainsRect(&pSib->borderSize, &box) != rgnOUT) { if (IsSiblingAboveMe(pWin, pSib) == Above) return(pFirst); @@ -3069,10 +3069,10 @@ MapWindow(register WindowPtr pWin, ClientPtr client) (*pScreen->ClipNotify) (pWin, 0, 0); if (pScreen->PostValidateTree) (*pScreen->PostValidateTree)(NullWindow, pWin, VTMap); - REGION_NULL(pScreen, &temp); - REGION_COPY(pScreen, &temp, &pWin->clipList); + RegionNull(&temp); + RegionCopy(&temp, &pWin->clipList); (*pScreen->WindowExposures) (pWin, &temp, NullRegion); - REGION_UNINIT(pScreen, &temp); + RegionUninit(&temp); } nxagentFlushConfigureWindow(); @@ -3478,7 +3478,7 @@ VisibleBoundingBoxFromPoint(register WindowPtr pWin, int x, int y, BoxPtr box) { if (!pWin->realized) return (FALSE); - if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->clipList, x, y, box)) + if (RegionContainsPoint(&pWin->clipList, x, y, box)) return(TRUE); return(FALSE); } @@ -3494,10 +3494,10 @@ PointInWindowIsVisible(register WindowPtr pWin, int x, int y) if (!pWin->realized) return (FALSE); - if (POINT_IN_REGION(pWin->drawable.pScreen, &pWin->borderClip, + if (RegionContainsPoint(&pWin->borderClip, x, y, &box) && (!wInputShape(pWin) || - POINT_IN_REGION(pWin->drawable.pScreen, + RegionContainsPoint( wInputShape(pWin), x - pWin->drawable.x, y - pWin->drawable.y, &box))) @@ -3513,12 +3513,12 @@ NotClippedByChildren(register WindowPtr pWin) RegionPtr pReg; pScreen = pWin->drawable.pScreen; - pReg = REGION_CREATE(pScreen, NullBox, 1); + pReg = RegionCreate(NullBox, 1); if (pWin->parent || screenIsSaved != SCREEN_SAVER_ON || !HasSaverWindow (pWin->drawable.pScreen->myNum)) { - REGION_INTERSECT(pScreen, pReg, &pWin->borderClip, &pWin->winSize); + RegionIntersect(pReg, &pWin->borderClip, &pWin->winSize); } return(pReg); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index 1dbd059ac..cd2234492 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -160,11 +160,11 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, box.x2 = width; box.y2 = height; - pPixmapPriv -> corruptedRegion = REGION_CREATE(pPixmap -> drawable.pScreen, &box, 1); + pPixmapPriv -> corruptedRegion = RegionCreate(&box, 1); } else { - pPixmapPriv -> corruptedRegion = REGION_CREATE(pPixmap -> drawable.pScreen, (BoxRec *) NULL, 1); + pPixmapPriv -> corruptedRegion = RegionCreate((BoxRec *) NULL, 1); } pPixmapPriv -> corruptedBackground = 0; @@ -269,7 +269,7 @@ PixmapPtr nxagentCreatePixmap(ScreenPtr pScreen, int width, pVirtualPriv -> isVirtual = True; pVirtualPriv -> isShared = nxagentShmPixmapTrap; - pVirtualPriv -> corruptedRegion = REGION_CREATE(pVirtual -> drawable.pScreen, (BoxRec *) NULL, 1); + pVirtualPriv -> corruptedRegion = RegionCreate((BoxRec *) NULL, 1); pVirtualPriv -> corruptedBackground = 0; @@ -444,7 +444,7 @@ Bool nxagentDestroyPixmap(PixmapPtr pPixmap) if (pPixmapPriv -> corruptedRegion != NullRegion) { - REGION_DESTROY(pPixmap -> drawable.pScreen, pPixmapPriv -> corruptedRegion); + RegionDestroy(pPixmapPriv -> corruptedRegion); pPixmapPriv -> corruptedRegion = NullRegion; } @@ -512,7 +512,7 @@ Bool nxagentDestroyVirtualPixmap(PixmapPtr pPixmap) if (pVirtualPriv -> corruptedRegion != NullRegion) { - REGION_DESTROY(pVirtual -> drawable.pScreen, pVirtualPriv -> corruptedRegion); + RegionDestroy(pVirtualPriv -> corruptedRegion); pVirtualPriv -> corruptedRegion = NullRegion; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 8bf1ac0bf..de1ad1207 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -1240,7 +1240,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, pRegion = nxagentCreateRegion(pDst -> pDrawable, NULL, glyphBox.x1, glyphBox.y1, glyphBox.x2 - glyphBox.x1, glyphBox.y2 - glyphBox.y1); - if (REGION_NIL(pRegion) == 1) + if (RegionNil(pRegion) == 1) { #ifdef TEST fprintf(stderr, "nxagentGlyphs: WARNING! Glyphs prevented on hidden window at [%p].\n", @@ -1602,24 +1602,24 @@ void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, (op == PictOpSrc || (op == PictOpOver && color -> alpha == 0xffff))) { - rectRegion = RECTS_TO_REGION(pDst -> pDrawable -> pScreen, nRect, rects, CT_REGION); + rectRegion = RegionFromRects(nRect, rects, CT_REGION); if (pDst -> clientClipType != CT_NONE) { RegionRec tmpRegion; - REGION_INIT(pDst -> pDrawable -> pScreen, &tmpRegion, NullBox, 1); + RegionInit(&tmpRegion, NullBox, 1); - REGION_COPY(pDst -> pDrawable -> pScreen, &tmpRegion, (RegionPtr) pDst -> clientClip); + RegionCopy(&tmpRegion, (RegionPtr) pDst -> clientClip); if (pDst -> clipOrigin.x != 0 || pDst -> clipOrigin.y != 0) { - REGION_TRANSLATE(pDst -> pDrawable -> pScreen, &tmpRegion, pDst -> clipOrigin.x, pDst -> clipOrigin.y); + RegionTranslate(&tmpRegion, pDst -> clipOrigin.x, pDst -> clipOrigin.y); } - REGION_INTERSECT(pDst -> pDrawable -> pScreen, rectRegion, rectRegion, &tmpRegion); + RegionIntersect(rectRegion, rectRegion, &tmpRegion); - REGION_UNINIT(pDst -> pDrawable -> pScreen, &tmpRegion); + RegionUninit(&tmpRegion); } #ifdef TEST @@ -1629,7 +1629,7 @@ void nxagentCompositeRects(CARD8 op, PicturePtr pDst, xRenderColor *color, nxagentUnmarkCorruptedRegion(pDst -> pDrawable, rectRegion); - REGION_DESTROY(pDrawable -> pScreen, rectRegion); + RegionDestroy(rectRegion); } XRenderFillRectangles(nxagentDisplay, @@ -1716,7 +1716,7 @@ FIXME: Is this useful or just a waste of bandwidth? */ if (nxagentDrawableStatus(pDst -> pDrawable) == NotSynchronized && - RECT_IN_REGION(pDst -> pDrawable -> pScreen, nxagentCorruptedRegion(pDst -> pDrawable), + RegionContainsRect(nxagentCorruptedRegion(pDst -> pDrawable), nxagentTrapezoidExtents) == rgnIN) { #ifdef TEST diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index a677b7eb4..6131775d9 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -2147,8 +2147,8 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) { 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; } @@ -2167,18 +2167,18 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) box.y1 = 0; box.x2 = pScreen->width; box.y2 = pScreen->height; - REGION_INIT (pScreen, &pWin->winSize, &box, 1); - REGION_INIT (pScreen, &pWin->borderSize, &box, 1); + RegionInit(&pWin->winSize, &box, 1); + RegionInit(&pWin->borderSize, &box, 1); if (WasViewable) - REGION_RESET(pScreen, &pWin->borderClip, &box); + RegionReset(&pWin->borderClip, &box); pWin->drawable.width = pScreen->width; pWin->drawable.height = pScreen->height; - REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + RegionBreak(&pWin->clipList); } else { - REGION_EMPTY(pScreen, &pWin->borderClip); - REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + RegionEmpty(&pWin->borderClip); + RegionBreak(&pWin->clipList); } ResizeChildrenWinSize (pWin, 0, 0, 0, 0); @@ -2187,8 +2187,8 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) { if (pWin->backStorage) { - pOldClip = REGION_CREATE(pScreen, NullBox, 1); - REGION_COPY(pScreen, pOldClip, &pWin->clipList); + pOldClip = RegionCreate(NullBox, 1); + RegionCopy(pOldClip, &pWin->clipList); } if (pWin->firstChild) @@ -2223,7 +2223,7 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) (pWin, 0, 0, pOldClip, pWin->drawable.x, pWin->drawable.y); if (WasViewable) - REGION_DESTROY(pScreen, pOldClip); + RegionDestroy(pOldClip); if (bsExposed) { RegionPtr valExposed = NullRegion; @@ -2232,8 +2232,8 @@ static void nxagentSetRootClip (ScreenPtr pScreen, Bool enable) 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) @@ -2418,10 +2418,10 @@ FIXME: We should try to restore the previously WindowTable[pScreen -> myNum] -> drawable.x = 0; WindowTable[pScreen -> myNum] -> drawable.y = 0; - REGION_INIT(pScreen, &WindowTable[pScreen -> myNum] -> borderSize, &box, 1); - REGION_INIT(pScreen, &WindowTable[pScreen -> myNum] -> winSize, &box, 1); - REGION_INIT(pScreen, &WindowTable[pScreen -> myNum] -> clipList, &box, 1); - REGION_INIT(pScreen, &WindowTable[pScreen -> myNum] -> borderClip, &box, 1); + RegionInit(&WindowTable[pScreen -> myNum] -> borderSize, &box, 1); + RegionInit(&WindowTable[pScreen -> myNum] -> winSize, &box, 1); + RegionInit(&WindowTable[pScreen -> myNum] -> clipList, &box, 1); + RegionInit(&WindowTable[pScreen -> myNum] -> borderClip, &box, 1); (*pScreen -> PositionWindow)(WindowTable[pScreen -> myNum], 0, 0); @@ -2819,7 +2819,7 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin) XFreeGC(nxagentDisplay, gc); - REGION_INIT(pScreen, &nxagentShadowUpdateRegion, (BoxRec*)NULL, 1); + RegionInit(&nxagentShadowUpdateRegion, (BoxRec*)NULL, 1); return 0; } @@ -2973,14 +2973,14 @@ int nxagentShadowSendUpdates(int *suspended) { *suspended = 0; - if (REGION_NIL(&nxagentShadowUpdateRegion) == 1) + if (RegionNil(&nxagentShadowUpdateRegion) == 1) { return 0; } nxagentMarkCorruptedRegion((DrawablePtr)nxagentShadowPixmapPtr, &nxagentShadowUpdateRegion); - REGION_EMPTY(nxagentShadowPixmapPtr -> drawable.pScreen, &nxagentShadowUpdateRegion); + RegionEmpty(&nxagentShadowUpdateRegion); return 1; } @@ -3002,9 +3002,9 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr int overlap; - REGION_NULL(pScreen, &updateRegion); + RegionNull(&updateRegion); - REGION_NULL(pScreen, &tempRegion); + RegionNull(&tempRegion); #ifdef __CYGWIN32__ @@ -3116,15 +3116,15 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr box.y1 = y; box.y2 = y + height; - REGION_INIT(pScreen, &tempRegion, &box, 1); + RegionInit(&tempRegion, &box, 1); - REGION_APPEND(pScreen, &updateRegion, &tempRegion); + RegionAppend(&updateRegion, &tempRegion); - REGION_UNINIT(pScreen, &tempRegion); + RegionUninit(&tempRegion); - REGION_VALIDATE(pScreen, &updateRegion, &overlap); + RegionValidate(&updateRegion, &overlap); - REGION_UNION(pScreen, &nxagentShadowUpdateRegion, &nxagentShadowUpdateRegion, &updateRegion); + RegionUnion(&nxagentShadowUpdateRegion, &nxagentShadowUpdateRegion, &updateRegion); } if (tBuffer) @@ -3132,7 +3132,7 @@ int nxagentShadowPoll(PixmapPtr nxagentShadowPixmapPtr, GCPtr nxagentShadowGCPtr xfree(tBuffer); } - REGION_UNINIT(pScreen, &updateRegion); + RegionUninit(&updateRegion); } else if (result == -1) { @@ -4131,8 +4131,8 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, pPrivPixmap -> isBackingPixmap = 1; - fbCopyWindowProc(&pWin -> drawable, &pVirtualPixmap -> drawable, 0, REGION_RECTS(prgnSave), - REGION_NUM_RECTS(prgnSave), xorg, yorg, FALSE, FALSE, 0, 0); + fbCopyWindowProc(&pWin -> drawable, &pVirtualPixmap -> drawable, 0, RegionRects(prgnSave), + RegionNumRects(prgnSave), xorg, yorg, FALSE, FALSE, 0, 0); pDrawable = &pWin -> drawable; @@ -4145,34 +4145,34 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, * Coordinates are relative to the window. */ - REGION_INIT(pWin -> pScreen, &cleanRegion, NullBox, 1); + RegionInit(&cleanRegion, NullBox, 1); - REGION_COPY(pWin -> pScreen, &cleanRegion, nxagentCorruptedRegion((DrawablePtr) pWin)); + RegionCopy(&cleanRegion, nxagentCorruptedRegion((DrawablePtr) pWin)); /* * Subtract the corrupted region from the saved region. */ - REGION_SUBTRACT(pWin -> pScreen, &pBackingStore -> SavedRegion, &pBackingStore -> SavedRegion, &cleanRegion); + RegionSubtract(&pBackingStore -> SavedRegion, &pBackingStore -> SavedRegion, &cleanRegion); /* * Translate the corrupted region. Coordinates * are relative to the backing store pixmap. */ - REGION_TRANSLATE(pWin -> pScreen, &cleanRegion, -pBackingStore -> x, -pBackingStore -> y); + RegionTranslate(&cleanRegion, -pBackingStore -> x, -pBackingStore -> y); /* * Compute the clean region to be saved: subtract * the corrupted region from the region to be saved. */ - REGION_SUBTRACT(pWin -> pScreen, &cleanRegion, prgnSave, &cleanRegion); + RegionSubtract(&cleanRegion, prgnSave, &cleanRegion); - nRects = REGION_NUM_RECTS(&cleanRegion); + nRects = RegionNumRects(&cleanRegion); size = nRects * sizeof(*pRects); pRects = (XRectangle *) xalloc(size); - pBox = REGION_RECTS(&cleanRegion); + pBox = RegionRects(&cleanRegion); for (i = nRects; i-- > 0;) { @@ -4186,9 +4186,9 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, xfree((char *) pRects); - extents = *REGION_EXTENTS(pWin -> pScreen, &cleanRegion); + extents = *RegionExtents(&cleanRegion); - REGION_UNINIT(pWin -> pScreen, &cleanRegion); + RegionUninit(&cleanRegion); xDst = extents.x1; yDst = extents.y1; @@ -4248,15 +4248,15 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, * root window size. */ - REGION_INTERSECT(pWin -> pScreen, prgnRestore, prgnRestore, + RegionIntersect(prgnRestore, prgnRestore, &WindowTable[pWin -> drawable.pScreen -> myNum] -> winSize); pBackingStore = (miBSWindowPtr) pWin -> backStorage; pVirtualPixmap = nxagentVirtualPixmap(pPixmap); - fbCopyWindowProc(&pVirtualPixmap -> drawable, &pWin -> drawable, 0, REGION_RECTS(prgnRestore), - REGION_NUM_RECTS(prgnRestore), -xorg, -yorg, FALSE, FALSE, 0, 0); + fbCopyWindowProc(&pVirtualPixmap -> drawable, &pWin -> drawable, 0, RegionRects(prgnRestore), + RegionNumRects(prgnRestore), -xorg, -yorg, FALSE, FALSE, 0, 0); pDrawable = &pVirtualPixmap -> drawable; @@ -4268,7 +4268,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, * Translate the reference point to the origin of the window. */ - REGION_TRANSLATE(pWin -> drawable.pScreen, prgnRestore, + RegionTranslate(prgnRestore, -pWin -> drawable.x - pWin -> borderWidth, -pWin -> drawable.y - pWin -> borderWidth); @@ -4276,26 +4276,26 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, if (nxagentDrawableStatus((DrawablePtr) pPixmap) == NotSynchronized) { - clipRegion = REGION_CREATE(pPixmap -> drawable -> pScreen, NullBox, 1); + clipRegion = RegionCreate(NullBox, 1); - REGION_COPY(pPixmap -> drawable -> pScreen, clipRegion, + RegionCopy(clipRegion, nxagentCorruptedRegion((DrawablePtr) pPixmap)); /* * Translate the reference point to the origin of the window. */ - REGION_TRANSLATE(pPixmap -> drawable -> pScreen, clipRegion, + RegionTranslate(clipRegion, pBackingStore -> x, pBackingStore -> y); - REGION_INTERSECT(pPixmap -> drawable -> pScreen, clipRegion, prgnRestore, clipRegion); + RegionIntersect(clipRegion, prgnRestore, clipRegion); /* * Subtract the corrupted region from the saved areas. * miBSRestoreAreas will return the exposure region. */ - REGION_SUBTRACT(pPixmap -> drawable -> pScreen, &pBackingStore->SavedRegion, + RegionSubtract(&pBackingStore->SavedRegion, &pBackingStore->SavedRegion, clipRegion); /* @@ -4304,24 +4304,24 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, if (nxagentRemoteExposeRegion != NULL) { - REGION_TRANSLATE(pPixmap -> drawable -> pScreen, clipRegion, pWin -> drawable.x, pWin -> drawable.y); + RegionTranslate(clipRegion, pWin -> drawable.x, pWin -> drawable.y); - REGION_UNION(pScreen, nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, clipRegion); + RegionUnion(nxagentRemoteExposeRegion, nxagentRemoteExposeRegion, clipRegion); - REGION_TRANSLATE(pPixmap -> drawable -> pScreen, clipRegion, -pWin -> drawable.x, -pWin -> drawable.y); + RegionTranslate(clipRegion, -pWin -> drawable.x, -pWin -> drawable.y); } /* * Compute the region to be restored. */ - REGION_SUBTRACT(pPixmap -> drawable -> pScreen, clipRegion, prgnRestore, clipRegion); + RegionSubtract(clipRegion, prgnRestore, clipRegion); } - nRects = REGION_NUM_RECTS(clipRegion); + nRects = RegionNumRects(clipRegion); size = nRects * sizeof(*pRects); pRects = (XRectangle *) xalloc(size); - pBox = REGION_RECTS(clipRegion); + pBox = RegionRects(clipRegion); for (i = nRects; i-- > 0;) { @@ -4335,7 +4335,7 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, xfree(pRects); - extents = *REGION_EXTENTS(pWin -> pScreen, clipRegion); + extents = *RegionExtents(clipRegion); xDst = extents.x1; yDst = extents.y1; @@ -4355,14 +4355,14 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, if (clipRegion != NULL && clipRegion != prgnRestore) { - REGION_DESTROY(pPixmap -> drawable -> pScreen, clipRegion); + RegionDestroy(clipRegion); } /* * Restore the reference point to the origin of the screen. */ - REGION_TRANSLATE(pWin -> drawable.pScreen, prgnRestore, + RegionTranslate(prgnRestore, pWin -> drawable.x - pWin -> borderWidth, pWin -> drawable.y + pWin -> borderWidth); @@ -4437,11 +4437,11 @@ void nxagentShadowAdaptToRatio(void) box.x2 = nxagentShadowPixmapPtr -> drawable.width; box.y2 = nxagentShadowPixmapPtr -> drawable.height; - REGION_INIT(pScreen, ®ion, &box, 1); + RegionInit(®ion, &box, 1); nxagentMarkCorruptedRegion((DrawablePtr)nxagentShadowPixmapPtr, ®ion); - REGION_UNINIT(pScreen, ®ion); + RegionUninit(®ion); } void nxagentPrintGeometry() diff --git a/nx-X11/programs/Xserver/hw/nxagent/Split.c b/nx-X11/programs/Xserver/hw/nxagent/Split.c index 4cc2ea607..1840328e4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Split.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Split.c @@ -502,7 +502,7 @@ void nxagentReleaseSplit(DrawablePtr pDrawable) (void *) pDrawable); #endif - REGION_DESTROY(pDrawable -> pScreen, pResource -> region); + RegionDestroy(pResource -> region); pResource -> region = NullRegion; } @@ -623,11 +623,11 @@ void nxagentValidateSplit(DrawablePtr pDrawable, RegionPtr pRegion) * streamed. */ - REGION_INIT(pDrawable -> pScreen, &tmpRegion, NullBox, 1); + RegionInit(&tmpRegion, NullBox, 1); - REGION_INTERSECT(pDrawable -> pScreen, &tmpRegion, pResource -> region, pRegion); + RegionIntersect(&tmpRegion, pResource -> region, pRegion); - if (REGION_NIL(&tmpRegion) == 0) + if (RegionNil(&tmpRegion) == 0) { #ifdef TEST fprintf(stderr, "nxagentValidateSplit: Marking the overlapping commits as invalid " @@ -644,7 +644,7 @@ void nxagentValidateSplit(DrawablePtr pDrawable, RegionPtr pRegion) } #endif - REGION_UNINIT(pDrawable -> pScreen, &tmpRegion); + RegionUninit(&tmpRegion); } } @@ -1097,9 +1097,9 @@ void nxagentHandleEndSplitEvent(int resource) if (pResource -> drawable != NULL && pResource -> region != NullRegion) { - if (REGION_NIL(pResource -> region) == 0) + if (RegionNil(pResource -> region) == 0) { - REGION_SUBTRACT(pResource -> drawable -> pScreen, + RegionSubtract( nxagentCorruptedRegion(pResource -> drawable), nxagentCorruptedRegion(pResource -> drawable), pResource -> region); diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 782ab9c9c..9201df197 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -388,7 +388,7 @@ FIXME: We need to set save under on the real display? nxagentWindowPriv(pWin) -> visibilityState = VisibilityUnobscured; - nxagentWindowPriv(pWin) -> corruptedRegion = REGION_CREATE(pWin -> drawable.pScreen, NULL, 1); + nxagentWindowPriv(pWin) -> corruptedRegion = RegionCreate(NULL, 1); nxagentWindowPriv(pWin) -> hasTransparentChildren = 0; @@ -486,8 +486,8 @@ FIXME: Do all the windows for which nxagentWindowTopLevel(pWin) #endif /* SHAPE */ #else #ifdef SHAPE - nxagentWindowPriv(pWin)->boundingShape = REGION_CREATE(pWin->drawable.pScreen, NULL, 1); - nxagentWindowPriv(pWin)->clipShape = REGION_CREATE(pWin->drawable.pScreen, NULL, 1); + nxagentWindowPriv(pWin)->boundingShape = RegionCreate(NULL, 1); + nxagentWindowPriv(pWin)->clipShape = RegionCreate(NULL, 1); #endif /* SHAPE */ #endif @@ -546,14 +546,14 @@ Bool nxagentDestroyWindow(WindowPtr pWin) { if (nxagentExposeQueue.exposures[i].localRegion != NullRegion) { - REGION_DESTROY(pWin -> drawable.pScreen, nxagentExposeQueue.exposures[i].localRegion); + RegionDestroy(nxagentExposeQueue.exposures[i].localRegion); } nxagentExposeQueue.exposures[i].localRegion = NullRegion; if (nxagentExposeQueue.exposures[i].remoteRegion != NullRegion) { - REGION_DESTROY(pWin -> drawable.pScreen, nxagentExposeQueue.exposures[i].remoteRegion); + RegionDestroy(nxagentExposeQueue.exposures[i].remoteRegion); } nxagentExposeQueue.exposures[i].remoteRegion = NullRegion; @@ -576,13 +576,13 @@ Bool nxagentDestroyWindow(WindowPtr pWin) if (pWindowPriv->boundingShape) { - REGION_DESTROY(pWin->drawable.pScreen, + RegionDestroy( pWindowPriv->boundingShape); } if (pWindowPriv->clipShape) { - REGION_DESTROY(pWin->drawable.pScreen, + RegionDestroy( pWindowPriv->clipShape); } @@ -590,17 +590,17 @@ Bool nxagentDestroyWindow(WindowPtr pWin) #else - REGION_DESTROY(pWin->drawable.pScreen, + RegionDestroy( pWindowPriv->boundingShape); - REGION_DESTROY(pWin->drawable.pScreen, + RegionDestroy( pWindowPriv->clipShape); #endif if (pWindowPriv -> corruptedRegion) { - REGION_DESTROY(pWin -> drawable.pScreen, + RegionDestroy( pWindowPriv -> corruptedRegion); pWindowPriv -> corruptedRegion = NULL; @@ -1342,7 +1342,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) if (nxagentExposeQueue.exposures[i].pWindow == pWin && nxagentExposeQueue.exposures[i].remoteRegion != NullRegion) { - REGION_TRANSLATE(pWin -> drawable.pScreen, nxagentExposeQueue.exposures[i].remoteRegion, offX, offY); + RegionTranslate(nxagentExposeQueue.exposures[i].remoteRegion, offX, offY); } } } @@ -1989,9 +1989,9 @@ void nxagentPaintWindowBackground(pWin, pRegion, what) { BoxPtr pBox; - pBox = REGION_RECTS(pRegion); + pBox = RegionRects(pRegion); - for (i = 0; i < REGION_NUM_RECTS(pRegion); i++) + for (i = 0; i < RegionNumRects(pRegion); i++) { XClearArea(nxagentDisplay, nxagentWindow(pWin), pBox[i].x1 - pWin->drawable.x, @@ -2015,13 +2015,13 @@ void nxagentPaintWindowBackground(pWin, pRegion, what) * so we need to clip ourselves. */ - REGION_INIT(pWin -> drawable.pScreen, &temp, NullBox, 1); + RegionInit(&temp, NullBox, 1); - REGION_INTERSECT(pWin -> drawable.pScreen, &temp, pRegion, &pWin -> clipList); + RegionIntersect(&temp, pRegion, &pWin -> clipList); nxagentFrameBufferPaintWindow(pWin, &temp, what); - REGION_UNINIT(pWin -> drawable.pScreen, &temp); + RegionUninit(&temp); } void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) @@ -2034,13 +2034,13 @@ void nxagentPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) * so we need to clip ourselves. */ - REGION_INIT(pWin -> drawable.pScreen, &temp, NullBox, 1); + RegionInit(&temp, NullBox, 1); - REGION_INTERSECT(pWin -> drawable.pScreen, &temp, pRegion, &pWin -> borderClip); + RegionIntersect(&temp, pRegion, &pWin -> borderClip); nxagentFrameBufferPaintWindow(pWin, &temp, what); - REGION_UNINIT(pWin -> drawable.pScreen, &temp); + RegionUninit(&temp); } void nxagentCopyWindow(WindowPtr pWin, xPoint oldOrigin, RegionPtr oldRegion) @@ -2149,29 +2149,29 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo nxagentExposeArrayIsInitialized = 1; } - REGION_INIT(pWin -> drawable.pScreen, &temp, (BoxRec *) NULL, 1); + RegionInit(&temp, (BoxRec *) NULL, 1); if (pRgn != NULL) { - if (REGION_NUM_RECTS(pRgn) > RECTLIMIT) + if (RegionNumRects(pRgn) > RECTLIMIT) { - box = *REGION_EXTENTS(pWin -> drawable.pScreen, pRgn); + box = *RegionExtents(pRgn); - REGION_EMPTY(pWin -> drawable.pScreen, pRgn); - REGION_INIT(pWin -> drawable.pScreen, pRgn, &box, 1); + RegionEmpty(pRgn); + RegionInit(pRgn, &box, 1); } - REGION_UNION(pWin -> drawable.pScreen, &temp, &temp, pRgn); + RegionUnion(&temp, &temp, pRgn); } if (other_exposed != NULL) { - REGION_UNION(pWin -> drawable.pScreen, &temp, &temp, other_exposed); + RegionUnion(&temp, &temp, other_exposed); } - if (REGION_NIL(&temp) == 0) + if (RegionNil(&temp) == 0) { - REGION_TRANSLATE(pWin -> drawable.pScreen, &temp, + RegionTranslate(&temp, -(pWin -> drawable.x), -(pWin -> drawable.y)); if (nxagentExposeQueue.length < EXPOSED_SIZE) @@ -2183,15 +2183,15 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo nxagentExposeQueue.exposures[index].pWindow = pWin; - nxagentExposeQueue.exposures[index].localRegion = REGION_CREATE(pwin -> drawable.pScreen, NULL, 1); + nxagentExposeQueue.exposures[index].localRegion = RegionCreate(NULL, 1); if (nxagentOption(Rootless) && nxagentWindowPriv(pWin) && (nxagentWindowPriv(pWin) -> isMapped == 0 || nxagentWindowPriv(pWin) -> visibilityState != VisibilityUnobscured)) { - nxagentExposeQueue.exposures[index].remoteRegion = REGION_CREATE(pwin -> drawable.pScreen, NULL, 1); + nxagentExposeQueue.exposures[index].remoteRegion = RegionCreate(NULL, 1); - REGION_UNION(pWin -> drawable.pScreen, nxagentExposeQueue.exposures[index].remoteRegion, + RegionUnion(nxagentExposeQueue.exposures[index].remoteRegion, nxagentExposeQueue.exposures[index].remoteRegion, &temp); #ifdef TEST @@ -2201,7 +2201,7 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo } else { - REGION_UNION(pWin -> drawable.pScreen, nxagentExposeQueue.exposures[index].localRegion, + RegionUnion(nxagentExposeQueue.exposures[index].localRegion, nxagentExposeQueue.exposures[index].localRegion, &temp); #ifdef TEST @@ -2234,21 +2234,21 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo (nxagentWindowPriv(pWin) -> isMapped == 0 || nxagentWindowPriv(pWin) -> visibilityState != VisibilityUnobscured)) { - REGION_UNINIT(pWin -> drawable.pScreen, &temp); + RegionUninit(&temp); return; } } else { - REGION_UNINIT(pWin -> drawable.pScreen, &temp); + RegionUninit(&temp); #ifdef TEST fprintf(stderr, "nxagentWindowExposures: WARNING! Reached maximum size of collect exposures vector.\n"); #endif - if ((pRgn != NULL && REGION_NOTEMPTY(pWin -> drawable.pScreen, pRgn) != 0) || - (other_exposed != NULL && REGION_NOTEMPTY(pWin -> drawable.pScreen, other_exposed) != 0)) + if ((pRgn != NULL && RegionNotEmpty(pRgn) != 0) || + (other_exposed != NULL && RegionNotEmpty(other_exposed) != 0)) { nxagentUnmarkExposedRegion(pWin, pRgn, other_exposed); @@ -2259,11 +2259,11 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo } } - REGION_UNINIT(pWin -> drawable.pScreen, &temp); + RegionUninit(&temp); } - if ((pRgn != NULL && REGION_NOTEMPTY(pWin -> drawable.pScreen, pRgn) != 0) || - (other_exposed != NULL && REGION_NOTEMPTY(pWin -> drawable.pScreen, other_exposed) != 0)) + if ((pRgn != NULL && RegionNotEmpty(pRgn) != 0) || + (other_exposed != NULL && RegionNotEmpty(other_exposed) != 0)) { nxagentUnmarkExposedRegion(pWin, pRgn, other_exposed); @@ -2283,11 +2283,11 @@ static Bool nxagentRegionEqual(RegionPtr pReg1, RegionPtr pReg2) if (pReg1 == NullRegion || pReg2 == NullRegion) return False; - pBox1 = REGION_RECTS(pReg1); - n1 = REGION_NUM_RECTS(pReg1); + pBox1 = RegionRects(pReg1); + n1 = RegionNumRects(pReg1); - pBox2 = REGION_RECTS(pReg2); - n2 = REGION_NUM_RECTS(pReg2); + pBox2 = RegionRects(pReg2); + n2 = RegionNumRects(pReg2); if (n1 != n2) return False; @@ -2326,23 +2326,23 @@ void nxagentShapeWindow(WindowPtr pWin) { #ifdef DEBUG fprintf(stderr, "nxagentShapeWindow: wBounding shape has [%ld] rects.\n", - REGION_NUM_RECTS(wBoundingShape(pWin))); + RegionNumRects(wBoundingShape(pWin))); #endif #ifdef NXAGENT_SHAPE2 if (!nxagentWindowPriv(pWin)->boundingShape) { - nxagentWindowPriv(pWin)->boundingShape = REGION_CREATE(pWin->drawable.pScreen, NULL, 1); + nxagentWindowPriv(pWin)->boundingShape = RegionCreate(NULL, 1); } #endif - REGION_COPY(pWin->drawable.pScreen, + RegionCopy( nxagentWindowPriv(pWin)->boundingShape, wBoundingShape(pWin)); reg = XCreateRegion(); - pBox = REGION_RECTS(nxagentWindowPriv(pWin)->boundingShape); + pBox = RegionRects(nxagentWindowPriv(pWin)->boundingShape); for (i = 0; - i < REGION_NUM_RECTS(nxagentWindowPriv(pWin)->boundingShape); + i < RegionNumRects(nxagentWindowPriv(pWin)->boundingShape); i++) { rect.x = pBox[i].x1; @@ -2365,7 +2365,7 @@ void nxagentShapeWindow(WindowPtr pWin) fprintf(stderr, "nxagentShapeWindow: wBounding shape does not exist. Removing the shape.\n"); #endif - REGION_EMPTY(pWin->drawable.pScreen, + RegionEmpty( nxagentWindowPriv(pWin)->boundingShape); #ifndef NXAGENT_SHAPE @@ -2386,23 +2386,23 @@ void nxagentShapeWindow(WindowPtr pWin) { #ifdef DEBUG fprintf(stderr, "nxagentShapeWindow: wClip shape has [%ld] rects.\n", - REGION_NUM_RECTS(wClipShape(pWin))); + RegionNumRects(wClipShape(pWin))); #endif #ifdef NXAGENT_SHAPE2 if (!nxagentWindowPriv(pWin)->clipShape) { - nxagentWindowPriv(pWin)->clipShape = REGION_CREATE(pWin->drawable.pScreen, NULL, 1); + nxagentWindowPriv(pWin)->clipShape = RegionCreate(NULL, 1); } #endif - REGION_COPY(pWin->drawable.pScreen, + RegionCopy( nxagentWindowPriv(pWin)->clipShape, wClipShape(pWin)); reg = XCreateRegion(); - pBox = REGION_RECTS(nxagentWindowPriv(pWin)->clipShape); + pBox = RegionRects(nxagentWindowPriv(pWin)->clipShape); for (i = 0; - i < REGION_NUM_RECTS(nxagentWindowPriv(pWin)->clipShape); + i < RegionNumRects(nxagentWindowPriv(pWin)->clipShape); i++) { rect.x = pBox[i].x1; @@ -2425,7 +2425,7 @@ void nxagentShapeWindow(WindowPtr pWin) fprintf(stderr, "nxagentShapeWindow: wClip shape does not exist. Removing the shape.\n"); #endif - REGION_EMPTY(pWin->drawable.pScreen, + RegionEmpty( nxagentWindowPriv(pWin)->clipShape); #ifndef NXAGENT_SHAPE @@ -2450,15 +2450,15 @@ static int nxagentForceExposure(WindowPtr pWin, void * ptr) Box.x2 = Box.x1 + pWin->drawable.width; Box.y2 = Box.y1 + pWin->drawable.height; - exposedRgn = REGION_CREATE(pWin->drawable.pScreen, &Box, 1); - REGION_INTERSECT(pWin->drawable.pScreen, exposedRgn, exposedRgn, &pRoot->winSize); + exposedRgn = RegionCreate(&Box, 1); + RegionIntersect(exposedRgn, exposedRgn, &pRoot->winSize); - if (exposedRgn != NULL && REGION_NOTEMPTY(pWin -> drawable.pScreen, exposedRgn) != 0) + if (exposedRgn != NULL && RegionNotEmpty(exposedRgn) != 0) { miWindowExposures(pWin, exposedRgn, NullRegion); } - REGION_DESTROY(pWin->drawable.pScreen, exposedRgn); + RegionDestroy(exposedRgn); } return WT_WALKCHILDREN; @@ -3186,14 +3186,14 @@ static void nxagentReconfigureWindow(void * param0, XID param1, void * data_buff #ifdef SHAPE if (nxagentWindowPriv(pWin) -> boundingShape) { - REGION_DESTROY(pWin -> drawable.pScreen, + RegionDestroy( nxagentWindowPriv(pWin) -> boundingShape); nxagentWindowPriv(pWin) -> boundingShape = NULL; } if (nxagentWindowPriv(pWin) -> clipShape) { - REGION_DESTROY(pWin -> drawable.pScreen, + RegionDestroy( nxagentWindowPriv(pWin) -> clipShape); nxagentWindowPriv(pWin) -> clipShape = NULL; } @@ -3740,7 +3740,7 @@ void nxagentEmptyBackingStoreRegion(void * param0, XID param1, void * data_buffe if (pBackingStore != NULL) { - REGION_EMPTY(pWin -> pScreen, &pBackingStore->SavedRegion); + RegionEmpty(&pBackingStore->SavedRegion); #ifdef TEST fprintf(stderr, "nxagentEmptyBackingStoreRegion: Emptying saved region for window at [%p].\n", (void*) pWin); diff --git a/nx-X11/programs/Xserver/include/regionstr.h b/nx-X11/programs/Xserver/include/regionstr.h index cf41170a6..b1eb100a5 100644 --- a/nx-X11/programs/Xserver/include/regionstr.h +++ b/nx-X11/programs/Xserver/include/regionstr.h @@ -103,73 +103,73 @@ extern RegDataRec miBrokenData; #ifdef NEED_SCREEN_REGIONS -#define REGION_CREATE(_pScreen, _rect, _size) \ +#define RegionCreate(_rect, _size) \ (*(REG_pScreen)->RegionCreate)(_rect, _size) -#define REGION_INIT(_pScreen, _pReg, _rect, _size) \ +#define RegionInit(_pReg, _rect, _size) \ (*(REG_pScreen)->RegionInit)(_pReg, _rect, _size) -#define REGION_COPY(_pScreen, dst, src) \ +#define RegionCopy(dst, src) \ (*(REG_pScreen)->RegionCopy)(dst, src) -#define REGION_DESTROY(_pScreen, _pReg) \ +#define RegionDestroy(_pReg) \ (*(REG_pScreen)->RegionDestroy)(_pReg) -#define REGION_UNINIT(_pScreen, _pReg) \ +#define RegionUninit(_pReg) \ (*(REG_pScreen)->RegionUninit)(_pReg) -#define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \ +#define RegionIntersect(newReg, reg1, reg2) \ (*(REG_pScreen)->Intersect)(newReg, reg1, reg2) -#define REGION_UNION(_pScreen, newReg, reg1, reg2) \ +#define RegionUnion(newReg, reg1, reg2) \ (*(REG_pScreen)->Union)(newReg, reg1, reg2) -#define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \ +#define RegionSubtract(newReg, reg1, reg2) \ (*(REG_pScreen)->Subtract)(newReg, reg1, reg2) -#define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \ +#define RegionInverse(newReg, reg1, invRect) \ (*(REG_pScreen)->Inverse)(newReg, reg1, invRect) -#define REGION_RESET(_pScreen, _pReg, _pBox) \ +#define RegionReset(_pReg, _pBox) \ (*(REG_pScreen)->RegionReset)(_pReg, _pBox) -#define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \ +#define RegionTranslate(_pReg, _x, _y) \ (*(REG_pScreen)->TranslateRegion)(_pReg, _x, _y) -#define RECT_IN_REGION(_pScreen, _pReg, prect) \ +#define RegionContainsRect(_pReg, prect) \ (*(REG_pScreen)->RectIn)(_pReg, prect) -#define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \ +#define RegionContainsPoint(_pReg, _x, _y, prect) \ (*(REG_pScreen)->PointInRegion)(_pReg, _x, _y, prect) -#define REGION_NOTEMPTY(_pScreen, _pReg) \ +#define RegionNotEmpty(_pReg) \ (*(REG_pScreen)->RegionNotEmpty)(_pReg) -#define REGION_EQUAL(_pScreen, _pReg1, _pReg2) \ +#define RegionEqual(_pReg1, _pReg2) \ (*(REG_pScreen)->RegionEqual)(_pReg1, _pReg2) -#define REGION_BROKEN(_pScreen, _pReg) \ +#define RegionBroken(_pReg) \ (*(REG_pScreen)->RegionBroken)(_pReg) -#define REGION_BREAK(_pScreen, _pReg) \ +#define RegionBreak(_pReg) \ (*(REG_pScreen)->RegionBreak)(_pReg) -#define REGION_EMPTY(_pScreen, _pReg) \ +#define RegionEmpty(_pReg) \ (*(REG_pScreen)->RegionEmpty)(_pReg) -#define REGION_EXTENTS(_pScreen, _pReg) \ +#define RegionExtents(_pReg) \ (*(REG_pScreen)->RegionExtents)(_pReg) -#define REGION_APPEND(_pScreen, dstrgn, rgn) \ +#define RegionAppend(dstrgn, rgn) \ (*(REG_pScreen)->RegionAppend)(dstrgn, rgn) -#define REGION_VALIDATE(_pScreen, badreg, pOverlap) \ +#define RegionValidate(badreg, pOverlap) \ (*(REG_pScreen)->RegionValidate)(badreg, pOverlap) #define BITMAP_TO_REGION(_pScreen, pPix) \ (*(REG_pScreen)->BitmapToRegion)(pPix) -#define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \ +#define RegionFromRects(nrects, prect, ctype) \ (*(REG_pScreen)->RectsToRegion)(nrects, prect, ctype) #else /* !NEED_SCREEN_REGIONS */ @@ -177,80 +177,80 @@ extern RegDataRec miBrokenData; /* Reference _pScreen macro argument and check its type */ #define REGION_SCREEN(_pScreen) (void)((REG_pScreen)->myNum) -#define REGION_CREATE(_pScreen, _rect, _size) \ +#define RegionCreate(_rect, _size) \ (REGION_SCREEN(_pScreen), miRegionCreate(_rect, _size)) -#define REGION_COPY(_pScreen, dst, src) \ +#define RegionCopy(dst, src) \ (REGION_SCREEN(_pScreen), miRegionCopy(dst, src)) -#define REGION_DESTROY(_pScreen, _pReg) \ +#define RegionDestroy(_pReg) \ (REGION_SCREEN(_pScreen), miRegionDestroy(_pReg)) -#define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \ +#define RegionIntersect(newReg, reg1, reg2) \ (REGION_SCREEN(_pScreen), miIntersect(newReg, reg1, reg2)) -#define REGION_UNION(_pScreen, newReg, reg1, reg2) \ +#define RegionUnion(newReg, reg1, reg2) \ (REGION_SCREEN(_pScreen), miUnion(newReg, reg1, reg2)) -#define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \ +#define RegionSubtract(newReg, reg1, reg2) \ (REGION_SCREEN(_pScreen), miSubtract(newReg, reg1, reg2)) -#define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \ +#define RegionInverse(newReg, reg1, invRect) \ (REGION_SCREEN(_pScreen), miInverse(newReg, reg1, invRect)) -#define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \ +#define RegionTranslate(_pReg, _x, _y) \ (REGION_SCREEN(_pScreen), miTranslateRegion(_pReg, _x, _y)) -#define RECT_IN_REGION(_pScreen, _pReg, prect) \ +#define RegionContainsRect(_pReg, prect) \ (REGION_SCREEN(_pScreen), miRectIn(_pReg, prect)) -#define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \ +#define RegionContainsPoint(_pReg, _x, _y, prect) \ (REGION_SCREEN(_pScreen), miPointInRegion(_pReg, _x, _y, prect)) -#define REGION_APPEND(_pScreen, dstrgn, rgn) \ +#define RegionAppend(dstrgn, rgn) \ (REGION_SCREEN(_pScreen), miRegionAppend(dstrgn, rgn)) -#define REGION_VALIDATE(_pScreen, badreg, pOverlap) \ +#define RegionValidate(badreg, pOverlap) \ (REGION_SCREEN(_pScreen), miRegionValidate(badreg, pOverlap)) #define BITMAP_TO_REGION(_pScreen, pPix) \ (*(_pScreen)->BitmapToRegion)(pPix) /* no mi version?! */ -#define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \ +#define RegionFromRects(nrects, prect, ctype) \ (REGION_SCREEN(_pScreen), miRectsToRegion(nrects, prect, ctype)) -#define REGION_EQUAL(_pScreen, _pReg1, _pReg2) \ +#define RegionEqual(_pReg1, _pReg2) \ (REGION_SCREEN(_pScreen), miRegionEqual(_pReg1, _pReg2)) -#define REGION_BREAK(_pScreen, _pReg) \ +#define RegionBreak(_pReg) \ (REGION_SCREEN(_pScreen), miRegionBreak(_pReg)) #ifdef DONT_INLINE_REGION_OPS -#define REGION_INIT(_pScreen, _pReg, _rect, _size) \ +#define RegionInit(_pReg, _rect, _size) \ (REGION_SCREEN(_pScreen), miRegionInit(_pReg, _rect, _size)) -#define REGION_UNINIT(_pScreen, _pReg) \ +#define RegionUninit(_pReg) \ (REGION_SCREEN(_pScreen), miRegionUninit(_pReg)) -#define REGION_RESET(_pScreen, _pReg, _pBox) \ +#define RegionReset(_pReg, _pBox) \ (REGION_SCREEN(_pScreen), miRegionReset(_pReg, _pBox)) -#define REGION_NOTEMPTY(_pScreen, _pReg) \ +#define RegionNotEmpty(_pReg) \ (REGION_SCREEN(_pScreen), miRegionNotEmpty(_pReg)) -#define REGION_BROKEN(_pScreen, _pReg) \ +#define RegionBroken(_pReg) \ (REGION_SCREEN(_pScreen), miRegionBroken(_pReg)) -#define REGION_EMPTY(_pScreen, _pReg) \ +#define RegionEmpty(_pReg) \ (REGION_SCREEN(_pScreen), miRegionEmpty(_pReg)) -#define REGION_EXTENTS(_pScreen, _pReg) \ +#define RegionExtents(_pReg) \ (REGION_SCREEN(_pScreen), miRegionExtents(_pReg)) #else /* inline certain simple region ops for performance */ -#define REGION_INIT(_pScreen, _pReg, _rect, _size) \ +#define RegionInit(_pReg, _rect, _size) \ { \ REGION_SCREEN(_pScreen); \ if (_rect) \ @@ -274,7 +274,7 @@ extern RegDataRec miBrokenData; } -#define REGION_UNINIT(_pScreen, _pReg) \ +#define RegionUninit(_pReg) \ { \ REGION_SCREEN(_pScreen); \ if ((_pReg)->data && (_pReg)->data->size) { \ @@ -283,32 +283,32 @@ extern RegDataRec miBrokenData; } \ } -#define REGION_RESET(_pScreen, _pReg, _pBox) \ +#define RegionReset(_pReg, _pBox) \ { \ REGION_SCREEN(_pScreen); \ (_pReg)->extents = *(_pBox); \ - REGION_UNINIT(_pScreen, _pReg); \ + RegionUninit(_pReg); \ (_pReg)->data = (RegDataPtr)NULL; \ } -#define REGION_NOTEMPTY(_pScreen, _pReg) \ +#define RegionNotEmpty(_pReg) \ (REGION_SCREEN(_pScreen), !REGION_NIL(_pReg)) -#define REGION_BROKEN(_pScreen, _pReg) \ +#define RegionBroken(_pReg) \ (REGION_SCREEN(_pScreen), REGION_NAR(_pReg)) -#define REGION_EMPTY(_pScreen, _pReg) \ +#define RegionEmpty(_pReg) \ { \ - REGION_UNINIT(_pScreen, _pReg); \ + RegionUninit(_pReg); \ (_pReg)->extents.x2 = (_pReg)->extents.x1; \ (_pReg)->extents.y2 = (_pReg)->extents.y1; \ (_pReg)->data = &miEmptyData; \ } -#define REGION_EXTENTS(_pScreen, _pReg) \ +#define RegionExtents(_pReg) \ (REGION_SCREEN(_pScreen), &(_pReg)->extents) -#define REGION_NULL(_pScreen, _pReg) \ +#define RegionNull(_pReg) \ { \ REGION_SCREEN(_pScreen); \ (_pReg)->extents = miEmptyBox; \ @@ -319,9 +319,9 @@ extern RegDataRec miBrokenData; #endif /* NEED_SCREEN_REGIONS */ -#ifndef REGION_NULL -#define REGION_NULL(_pScreen, _pReg) \ - REGION_INIT(_pScreen, _pReg, NullBox, 1) +#ifndef RegionNull +#define RegionNull(_pReg) \ + RegionInit(_pReg, NullBox, 1) #endif /* moved from mi.h */ 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..167e63d0a 100644 --- a/nx-X11/programs/Xserver/mi/migc.c +++ b/nx-X11/programs/Xserver/mi/migc.c @@ -55,7 +55,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 +104,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 +121,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 +132,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 +157,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 +213,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 +228,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 +269,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, ®, &box, 1); + RegionInit(®, &box, 1); if (pWin->backStorage) { pBSReg = (* pScreen->ClearBackingStore)(pWin, x, y, w, h, generateExposures); } - REGION_INTERSECT(pScreen, ®, ®, clipList); + RegionIntersect(®, ®, clipList); if (generateExposures) (*pScreen->WindowExposures)(pWin, ®, pBSReg); else if (pWin->backgroundState != None) (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); - REGION_UNINIT(pScreen, ®); + RegionUninit(®); 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 index 1df0dcc46..b8216e1bb 100644 --- a/nx-X11/programs/Xserver/mi/miregion.c +++ b/nx-X11/programs/Xserver/mi/miregion.c @@ -197,7 +197,7 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ { \ if (!miRectAlloc(pReg, 1)) \ return FALSE; \ - pNextRect = REGION_TOP(pReg); \ + pNextRect = RegionTop(pReg); \ } \ ADDRECT(pNextRect,nx1,ny1,nx2,ny2); \ pReg->data->numRects++; \ @@ -208,7 +208,7 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ #define DOWNSIZE(reg,numRects) \ if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \ { \ - size_t NewSize = REGION_SZOF(numRects); \ + size_t NewSize = RegionSizeof(numRects); \ RegDataPtr NewData = \ (NewSize > 0) ? (RegDataPtr)xrealloc((reg)->data, NewSize) : NULL; \ if (NewData) \ @@ -234,9 +234,9 @@ miPrintRegion(rgn) register int i; BoxPtr rects; - num = REGION_NUM_RECTS(rgn); - size = REGION_SIZE(rgn); - rects = REGION_RECTS(rgn); + num = RegionNumRects(rgn); + size = RegionSize(rgn); + rects = RegionRects(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); @@ -261,11 +261,11 @@ miRegionEqual(reg1, reg2) 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; + num = RegionNumRects(reg1); + if (num != RegionNumRects(reg2)) return FALSE; - rects1 = REGION_RECTS(reg1); - rects2 = REGION_RECTS(reg2); + rects1 = RegionRects(reg1); + rects2 = RegionRects(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; @@ -285,7 +285,7 @@ miValidRegion(reg) if ((reg->extents.x1 > reg->extents.x2) || (reg->extents.y1 > reg->extents.y2)) return FALSE; - numRects = REGION_NUM_RECTS(reg); + numRects = RegionNumRects(reg); if (!numRects) return ((reg->extents.x1 == reg->extents.x2) && (reg->extents.y1 == reg->extents.y2) && @@ -297,7 +297,7 @@ miValidRegion(reg) register BoxPtr pboxP, pboxN; BoxRec box; - pboxP = REGION_RECTS(reg); + pboxP = RegionRects(reg); box = *pboxP; box.y2 = pboxP[numRects-1].y2; pboxN = pboxP + 1; @@ -349,7 +349,7 @@ miRegionCreate(rect, size) else { pReg->extents = miEmptyBox; - newSize = REGION_SZOF(size); + newSize = RegionSizeof(size); if ((size > 1) && (newSize > 0) && (pReg->data = xalloc(newSize))) { @@ -383,7 +383,7 @@ miRegionInit(pReg, rect, size) else { pReg->extents = miEmptyBox; - newSize = REGION_SZOF(size); + newSize = RegionSizeof(size); if ((size > 1) && (newSize > 0) && (pReg->data = xalloc(newSize))) { @@ -434,16 +434,16 @@ miRectAlloc( if (!pRgn->data) { n++; - rgnSize = REGION_SZOF(n); + rgnSize = RegionSizeof(n); pRgn->data = (rgnSize > 0) ? xalloc(rgnSize) : NULL; if (!pRgn->data) return miRegionBreak (pRgn); pRgn->data->numRects = 1; - *REGION_BOXPTR(pRgn) = pRgn->extents; + *RegionBoxptr(pRgn) = pRgn->extents; } else if (!pRgn->data->size) { - rgnSize = REGION_SZOF(n); + rgnSize = RegionSizeof(n); pRgn->data = (rgnSize > 0) ? xalloc(rgnSize) : NULL; if (!pRgn->data) return miRegionBreak (pRgn); @@ -458,7 +458,7 @@ miRectAlloc( n = 250; } n += pRgn->data->numRects; - rgnSize = REGION_SZOF(n); + rgnSize = RegionSizeof(n); data = (rgnSize > 0) ? xrealloc(pRgn->data, rgnSize) : NULL; if (!data) return miRegionBreak (pRgn); @@ -486,7 +486,7 @@ miRegionCopy(dst, src) } if (!dst->data || (dst->data->size < src->data->numRects)) { - size_t newSize = REGION_SZOF(src->data->numRects); + size_t newSize = RegionSizeof(src->data->numRects); xfreeData(dst); dst->data = newSize > 0 ? xalloc(newSize) : NULL; @@ -495,7 +495,7 @@ miRegionCopy(dst, src) dst->data->size = src->data->numRects; } dst->data->numRects = src->data->numRects; - memmove((char *)REGION_BOXPTR(dst),(char *)REGION_BOXPTR(src), + memmove((char *)RegionBoxptr(dst),(char *)RegionBoxptr(src), dst->data->numRects * sizeof(BoxRec)); return TRUE; } @@ -545,8 +545,8 @@ miCoalesce ( * 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); + pPrevBox = RegionBox(pReg, prevStart); + pCurBox = RegionBox(pReg, curStart); if (pPrevBox->y2 != pCurBox->y1) return curStart; /* @@ -625,7 +625,7 @@ miAppendNonO ( /* Make sure we have enough space for all rectangles to be added */ RECTALLOC(pReg, newRects); - pNextRect = REGION_TOP(pReg); + pNextRect = RegionTop(pReg); pReg->data->numRects += newRects; do { assert(r->x1 < r->x2); @@ -650,7 +650,7 @@ miAppendNonO ( int newRects; \ if ((newRects = rEnd - r)) { \ RECTALLOC(newReg, newRects); \ - memmove((char *)REGION_TOP(newReg),(char *)r, \ + memmove((char *)RegionTop(newReg),(char *)r, \ newRects * sizeof(BoxRec)); \ newReg->data->numRects += newRects; \ } \ @@ -731,7 +731,7 @@ miRegionOp( /* * Break any region computed from a broken region */ - if (REGION_NAR (reg1) || REGION_NAR(reg2)) + if (RegionNar (reg1) || RegionNar(reg2)) return miRegionBreak (newReg); /* @@ -742,11 +742,11 @@ miRegionOp( * another array of rectangles for it to use. */ - r1 = REGION_RECTS(reg1); - newSize = REGION_NUM_RECTS(reg1); + r1 = RegionRects(reg1); + newSize = RegionNumRects(reg1); r1End = r1 + newSize; - numRects = REGION_NUM_RECTS(reg2); - r2 = REGION_RECTS(reg2); + numRects = RegionNumRects(reg2); + r2 = RegionRects(reg2); r2End = r2 + numRects; assert(r1 != r1End); assert(r2 != r2End); @@ -903,7 +903,7 @@ miRegionOp( } else if (numRects == 1) { - newReg->extents = *REGION_BOXPTR(newReg); + newReg->extents = *RegionBoxptr(newReg); xfreeData(newReg); newReg->data = (RegDataPtr)NULL; } @@ -945,8 +945,8 @@ miSetExtents (pReg) return; } - pBox = REGION_BOXPTR(pReg); - pBoxEnd = REGION_END(pReg); + pBox = RegionBoxptr(pReg); + pBoxEnd = RegionEnd(pReg); /* * Since pBox is the first rectangle in the region, it must have the @@ -1004,7 +1004,7 @@ miIntersectO ( register int x2; register BoxPtr pNextRect; - pNextRect = REGION_TOP(pReg); + pNextRect = RegionTop(pReg); assert(y1 < y2); assert(r1 != r1End && r2 != r2End); @@ -1047,14 +1047,14 @@ miIntersect(newReg, reg1, reg2) good(reg2); good(newReg); /* check for trivial reject */ - if (REGION_NIL(reg1) || REGION_NIL(reg2) || + if (RegionNil(reg1) || RegionNil(reg2) || !EXTENTCHECK(®1->extents, ®2->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)) + if (RegionNar(reg1) || RegionNar(reg2)) { newReg->data = &miBrokenData; return FALSE; @@ -1150,7 +1150,7 @@ miUnionO ( assert (y1 < y2); assert(r1 != r1End && r2 != r2End); - pNextRect = REGION_TOP(pReg); + pNextRect = RegionTop(pReg); /* Start off current rectangle */ if (r1->x1 < r2->x1) @@ -1217,9 +1217,9 @@ miUnion(newReg, reg1, reg2) /* * Region 1 is empty */ - if (REGION_NIL(reg1)) + if (RegionNil(reg1)) { - if (REGION_NAR(reg1)) + if (RegionNar(reg1)) return miRegionBreak (newReg); if (newReg != reg2) return miRegionCopy(newReg, reg2); @@ -1229,9 +1229,9 @@ miUnion(newReg, reg1, reg2) /* * Region 2 is empty */ - if (REGION_NIL(reg2)) + if (RegionNil(reg2)) { - if (REGION_NAR(reg2)) + if (RegionNar(reg2)) return miRegionBreak (newReg); if (newReg != reg1) return miRegionCopy(newReg, reg1); @@ -1300,7 +1300,7 @@ miRegionAppend(dstrgn, rgn) BoxPtr new, old; Bool prepend; - if (REGION_NAR(rgn)) + if (RegionNar(rgn)) return miRegionBreak (dstrgn); if (!rgn->data && (dstrgn->data == &miEmptyData)) @@ -1310,16 +1310,16 @@ miRegionAppend(dstrgn, rgn) return TRUE; } - numRects = REGION_NUM_RECTS(rgn); + numRects = RegionNumRects(rgn); if (!numRects) return TRUE; prepend = FALSE; size = numRects; - dnumRects = REGION_NUM_RECTS(dstrgn); + dnumRects = RegionNumRects(dstrgn); if (!dnumRects && (size < 200)) size = 200; /* XXX pick numbers out of a hat */ RECTALLOC(dstrgn, size); - old = REGION_RECTS(rgn); + old = RegionRects(rgn); if (!dnumRects) dstrgn->extents = rgn->extents; else if (dstrgn->extents.x2 > dstrgn->extents.x1) @@ -1327,7 +1327,7 @@ miRegionAppend(dstrgn, rgn) register BoxPtr first, last; first = old; - last = REGION_BOXPTR(dstrgn) + (dnumRects - 1); + last = RegionBoxptr(dstrgn) + (dnumRects - 1); if ((first->y1 > last->y2) || ((first->y1 == last->y1) && (first->y2 == last->y2) && (first->x1 > last->x2))) @@ -1340,7 +1340,7 @@ miRegionAppend(dstrgn, rgn) } else { - first = REGION_BOXPTR(dstrgn); + first = RegionBoxptr(dstrgn); last = old + (numRects - 1); if ((first->y1 > last->y2) || ((first->y1 == last->y1) && (first->y2 == last->y2) && @@ -1359,16 +1359,16 @@ miRegionAppend(dstrgn, rgn) } if (prepend) { - new = REGION_BOX(dstrgn, numRects); + new = RegionBox(dstrgn, numRects); if (dnumRects == 1) - *new = *REGION_BOXPTR(dstrgn); + *new = *RegionBoxptr(dstrgn); else - memmove((char *)new,(char *)REGION_BOXPTR(dstrgn), + memmove((char *)new,(char *)RegionBoxptr(dstrgn), dnumRects * sizeof(BoxRec)); - new = REGION_BOXPTR(dstrgn); + new = RegionBoxptr(dstrgn); } else - new = REGION_BOXPTR(dstrgn) + dnumRects; + new = RegionBoxptr(dstrgn) + dnumRects; if (numRects == 1) *new = *old; else @@ -1511,7 +1511,7 @@ miRegionValidate(badreg, pOverlap) numRects = badreg->data->numRects; if (!numRects) { - if (REGION_NAR(badreg)) + if (RegionNar(badreg)) return FALSE; good(badreg); return TRUE; @@ -1532,7 +1532,7 @@ miRegionValidate(badreg, pOverlap) } /* Step 1: Sort the rects array into ascending (y1, x1) order */ - QuickSortRects(REGION_BOXPTR(badreg), numRects); + QuickSortRects(RegionBoxptr(badreg), numRects); /* Step 2: Scatter the sorted array into the minimum number of regions */ @@ -1546,7 +1546,7 @@ miRegionValidate(badreg, pOverlap) ri[0].prevBand = 0; ri[0].curBand = 0; ri[0].reg = *badreg; - box = REGION_BOXPTR(&ri[0].reg); + box = RegionBoxptr(&ri[0].reg); ri[0].reg.extents = *box; ri[0].reg.data->numRects = 1; @@ -1563,7 +1563,7 @@ miRegionValidate(badreg, pOverlap) for (j = numRI, rit = ri; --j >= 0; rit++) { reg = &rit->reg; - riBox = REGION_END(reg); + riBox = RegionEnd(reg); if (box->y1 == riBox->y1 && box->y2 == riBox->y2) { @@ -1577,7 +1577,7 @@ miRegionValidate(badreg, pOverlap) else { RECTALLOC_BAIL(reg, 1, bail); - *REGION_TOP(reg) = *box; + *RegionTop(reg) = *box; reg->data->numRects++; } goto NextRect; /* So sue me */ @@ -1590,7 +1590,7 @@ miRegionValidate(badreg, pOverlap) Coalesce(reg, rit->prevBand, rit->curBand); rit->curBand = reg->data->numRects; RECTALLOC_BAIL(reg, 1, bail); - *REGION_TOP(reg) = *box; + *RegionTop(reg) = *box; reg->data->numRects++; goto NextRect; } @@ -1624,7 +1624,7 @@ NextRect: ; for (j = numRI, rit = ri; --j >= 0; rit++) { reg = &rit->reg; - riBox = REGION_END(reg); + riBox = RegionEnd(reg); reg->extents.y2 = riBox->y2; if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2; Coalesce(reg, rit->prevBand, rit->curBand); @@ -1682,7 +1682,7 @@ miRectsToRegion(nrects, prect, ctype) size_t newSize; pRgn = miRegionCreate(NullBox, 0); - if (REGION_NAR (pRgn)) + if (RegionNar (pRgn)) return pRgn; if (!nrects) return pRgn; @@ -1704,7 +1704,7 @@ miRectsToRegion(nrects, prect, ctype) } return pRgn; } - newSize = REGION_SZOF(nrects); + newSize = RegionSizeof(nrects); pData = newSize > 0 ? xalloc(newSize) : NULL; if (!pData) { @@ -1790,7 +1790,7 @@ miSubtractO ( assert(y1extents, ®S->extents)) { - if (REGION_NAR (regS)) + if (RegionNar (regS)) return miRegionBreak (regD); return miRegionCopy(regD, regM); } @@ -1973,9 +1973,9 @@ miInverse(newReg, reg1, invRect) good(reg1); good(newReg); /* check for trivial rejects */ - if (REGION_NIL(reg1) || !EXTENTCHECK(invRect, ®1->extents)) + if (RegionNil(reg1) || !EXTENTCHECK(invRect, ®1->extents)) { - if (REGION_NAR(reg1)) + if (RegionNar(reg1)) return miRegionBreak (newReg); newReg->extents = *invRect; xfreeData(newReg); @@ -2033,7 +2033,7 @@ miRectIn(region, prect) int numRects; good(region); - numRects = REGION_NUM_RECTS(region); + numRects = RegionNumRects(region); /* useful optimization */ if (!numRects || !EXTENTCHECK(®ion->extents, prect)) return(rgnOUT); @@ -2055,7 +2055,7 @@ miRectIn(region, prect) 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; + for (pbox = RegionBoxptr(region), pboxEnd = pbox + numRects; pbox != pboxEnd; pbox++) { @@ -2135,7 +2135,7 @@ miTranslateRegion(pReg, x, y) { if (pReg->data && (nbox = pReg->data->numRects)) { - for (pbox = REGION_BOXPTR(pReg); nbox--; pbox++) + for (pbox = RegionBoxptr(pReg); nbox--; pbox++) { pbox->x1 += x; pbox->y1 += y; @@ -2165,7 +2165,7 @@ miTranslateRegion(pReg, x, y) { register BoxPtr pboxout; - for (pboxout = pbox = REGION_BOXPTR(pReg); nbox--; pbox++) + for (pboxout = pbox = RegionBoxptr(pReg); nbox--; pbox++) { pboxout->x1 = x1 = pbox->x1 + x; pboxout->y1 = y1 = pbox->y1 + y; @@ -2191,7 +2191,7 @@ miTranslateRegion(pReg, x, y) { if (pReg->data->numRects == 1) { - pReg->extents = *REGION_BOXPTR(pReg); + pReg->extents = *RegionBoxptr(pReg); xfreeData(pReg); pReg->data = (RegDataPtr)NULL; } @@ -2220,7 +2220,7 @@ miRegionDataCopy( } if (!dst->data || (dst->data->size < src->data->numRects)) { - size_t newSize = REGION_SZOF(src->data->numRects); + size_t newSize = RegionSizeof(src->data->numRects); xfreeData(dst); dst->data = newSize > 0 ? xalloc(newSize) : NULL; if (!dst->data) @@ -2254,7 +2254,7 @@ miPointInRegion(pReg, x, y, box) int numRects; good(pReg); - numRects = REGION_NUM_RECTS(pReg); + numRects = RegionNumRects(pReg); if (!numRects || !INBOX(&pReg->extents, x, y)) return(FALSE); if (numRects == 1) @@ -2262,7 +2262,7 @@ miPointInRegion(pReg, x, y, box) *box = pReg->extents; return(TRUE); } - for (pbox = REGION_BOXPTR(pReg), pboxEnd = pbox + numRects; + for (pbox = RegionBoxptr(pReg), pboxEnd = pbox + numRects; pbox != pboxEnd; pbox++) { @@ -2283,14 +2283,14 @@ miRegionNotEmpty(pReg) RegionPtr pReg; { good(pReg); - return(!REGION_NIL(pReg)); + return(!RegionNil(pReg)); } Bool miRegionBroken(RegionPtr pReg) { good(pReg); - return (REGION_NAR(pReg)); + return (RegionNar(pReg)); } void @@ -2497,7 +2497,7 @@ miClipSpans( if ((! fSorted) && (nspans > 1)) QuickSortSpans(ppt, pwidth, nspans); - pboxBandStart = REGION_BOXPTR(prgnDst); + pboxBandStart = RegionBoxptr(prgnDst); pboxLast = pboxBandStart + numRects; NextBand(); @@ -2558,8 +2558,8 @@ miFindMaxBand(prgn) short yThisBand; good(prgn); - nbox = REGION_NUM_RECTS(prgn); - pbox = REGION_RECTS(prgn); + nbox = RegionNumRects(prgn); + pbox = RegionRects(prgn); while(nbox > 0) { 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, ®, &box, 1); + RegionInit(®, &box, 1); if (pWin->backStorage) { /* @@ -128,14 +128,14 @@ miClearToBackground(pWin, x, y, w, h, generateExposures) generateExposures); } - REGION_INTERSECT(pScreen, ®, ®, &pWin->clipList); + RegionIntersect(®, ®, &pWin->clipList); if (generateExposures) (*pScreen->WindowExposures)(pWin, ®, pBSReg); else if (pWin->backgroundState != None) (*pScreen->PaintWindowBackground)(pWin, ®, PW_BACKGROUND); - REGION_UNINIT(pScreen, ®); + RegionUninit(®); 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); diff --git a/nx-X11/programs/Xserver/miext/cw/cw.c b/nx-X11/programs/Xserver/miext/cw/cw.c index 8079a0009..9f39b9650 100644 --- a/nx-X11/programs/Xserver/miext/cw/cw.c +++ b/nx-X11/programs/Xserver/miext/cw/cw.c @@ -190,8 +190,8 @@ cwValidateGC(GCPtr pGC, unsigned long stateChanges, DrawablePtr pDrawable) XID vals[2]; RegionPtr pCompositeClip; - pCompositeClip = REGION_CREATE (pScreen, NULL, 0); - REGION_COPY (pScreen, pCompositeClip, pGC->pCompositeClip); + pCompositeClip = RegionCreate(NULL, 0); + RegionCopy(pCompositeClip, pGC->pCompositeClip); /* Either the drawable has changed, or the clip list in the drawable has * changed. Copy the new clip list over and set the new translated @@ -397,8 +397,8 @@ cwFillRegionSolid(DrawablePtr pDrawable, RegionPtr pRegion, unsigned long pixel) NULL, v); ValidateGC(pDrawable, pGC); - pBox = REGION_RECTS(pRegion); - nbox = REGION_NUM_RECTS(pRegion); + pBox = RegionRects(pRegion); + nbox = RegionNumRects(pRegion); for (i = 0; i < nbox; i++, pBox++) { xRectangle rect; @@ -433,8 +433,8 @@ cwFillRegionTiled(DrawablePtr pDrawable, RegionPtr pRegion, PixmapPtr pTile, ValidateGC(pDrawable, pGC); - pBox = REGION_RECTS(pRegion); - nbox = REGION_NUM_RECTS(pRegion); + pBox = RegionRects(pRegion); + nbox = RegionNumRects(pRegion); for (i = 0; i < nbox; i++, pBox++) { xRectangle rect; @@ -473,7 +473,7 @@ cwPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) if (pWin && (pWin->backgroundState == BackgroundPixel || pWin->backgroundState == BackgroundPixmap)) { - REGION_TRANSLATE(pScreen, pRegion, x_screen, y_screen); + RegionTranslate(pRegion, x_screen, y_screen); if (pWin->backgroundState == BackgroundPixel) { cwFillRegionSolid(pBackingDrawable, pRegion, @@ -483,7 +483,7 @@ cwPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what) pWin->background.pixmap, x_off, y_off); } - REGION_TRANSLATE(pScreen, pRegion, -x_screen, -y_screen); + RegionTranslate(pRegion, -x_screen, -y_screen); } } @@ -509,7 +509,7 @@ cwPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) x_screen = x_off - pWin->drawable.x; y_screen = y_off - pWin->drawable.y; - REGION_TRANSLATE(pScreen, pRegion, x_screen, y_screen); + RegionTranslate(pRegion, x_screen, y_screen); if (pWin->borderIsPixel) { cwFillRegionSolid(pBackingDrawable, pRegion, pWin->border.pixel); @@ -518,7 +518,7 @@ cwPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what) x_off, y_off); } - REGION_TRANSLATE(pScreen, pRegion, -x_screen, -y_screen); + RegionTranslate(pRegion, -x_screen, -y_screen); } SCREEN_EPILOGUE(pScreen, PaintWindowBorder, cwPaintWindowBorder); @@ -545,7 +545,7 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) dx = ptOldOrg.x - pWin->drawable.x; dy = ptOldOrg.y - pWin->drawable.y; - pExtents = REGION_EXTENTS(pScreen, prgnSrc); + pExtents = RegionExtents(prgnSrc); pBackingPixmap = (PixmapPtr) cwGetBackingDrawable((DrawablePtr)pWin, &x_off, &y_off); @@ -558,15 +558,15 @@ cwCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) dst_y = src_y - dy; /* Translate region (as required by API) */ - REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy); + RegionTranslate(prgnSrc, -dx, -dy); pGC = GetScratchGC(pBackingPixmap->drawable.depth, pScreen); /* * Copy region to GC as clip, aligning as dest clip */ - pClip = REGION_CREATE (pScreen, NULL, 0); - REGION_INTERSECT(pScreen, pClip, &pWin->borderClip, prgnSrc); - REGION_TRANSLATE(pScreen, pClip, + pClip = RegionCreate(NULL, 0); + RegionIntersect(pClip, &pWin->borderClip, prgnSrc); + RegionTranslate(pClip, -pBackingPixmap->screen_x, -pBackingPixmap->screen_y); diff --git a/nx-X11/programs/Xserver/miext/cw/cw_ops.c b/nx-X11/programs/Xserver/miext/cw/cw_ops.c index 9e09d0532..e4c53b79f 100644 --- a/nx-X11/programs/Xserver/miext/cw/cw_ops.c +++ b/nx-X11/programs/Xserver/miext/cw/cw_ops.c @@ -195,7 +195,7 @@ cwCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, dstx, dsty); if (exposed != NULL) - REGION_TRANSLATE(pDst->pScreen, exposed, odstx - dstx, odsty - dsty); + RegionTranslate(exposed, odstx - dstx, odsty - dsty); EPILOGUE(pGC); @@ -223,7 +223,7 @@ cwCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, int srcx, int srcy, dstx, dsty, plane); if (exposed != NULL) - REGION_TRANSLATE(pDst->pScreen, exposed, odstx - dstx, odsty - dsty); + RegionTranslate(exposed, odstx - dstx, odsty - dsty); EPILOGUE(pGC); diff --git a/nx-X11/programs/Xserver/miext/damage/damage.c b/nx-X11/programs/Xserver/miext/damage/damage.c index 0dd788ec3..60e2ae4b5 100755 --- a/nx-X11/programs/Xserver/miext/damage/damage.c +++ b/nx-X11/programs/Xserver/miext/damage/damage.c @@ -137,7 +137,7 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, #endif /* short circuit for empty regions */ - if (!REGION_NOTEMPTY(pScreen, pRegion)) + if (!RegionNotEmpty(pRegion)) return; #ifdef COMPOSITE @@ -152,7 +152,7 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, screen_y = ((PixmapPtr) pDrawable)->screen_y - pDrawable->y; } if (screen_x || screen_y) - REGION_TRANSLATE (pScreen, pRegion, screen_x, screen_y); + RegionTranslate(pRegion, screen_x, screen_y); #endif if (pDrawable->type == DRAWABLE_WINDOW && @@ -160,22 +160,22 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, { if (subWindowMode == ClipByChildren) { - REGION_INTERSECT(pScreen, pRegion, pRegion, + RegionIntersect(pRegion, pRegion, &((WindowPtr)(pDrawable))->clipList); } else if (subWindowMode == IncludeInferiors) { RegionPtr pTempRegion = NotClippedByChildren((WindowPtr)(pDrawable)); - REGION_INTERSECT(pScreen, pRegion, pRegion, pTempRegion); - REGION_DESTROY(pScreen, pTempRegion); + RegionIntersect(pRegion, pRegion, pTempRegion); + RegionDestroy(pTempRegion); } /* If subWindowMode is set to an invalid value, don't perform * any drawable-based clipping. */ } - REGION_NULL (pScreen, &clippedRec); + RegionNull(&clippedRec); for (; pDamage; pDamage = pNext) { pNext = pDamage->pNext; @@ -223,7 +223,7 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, { pDamageRegion = &clippedRec; if (pDamage->pDrawable->type == DRAWABLE_WINDOW) { - REGION_INTERSECT (pScreen, pDamageRegion, pRegion, + RegionIntersect(pDamageRegion, pRegion, &((WindowPtr)(pDamage->pDrawable))->borderClip); } else { BoxRec box; @@ -231,14 +231,14 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, box.y1 = draw_y; box.x2 = draw_x + pDamage->pDrawable->width; box.y2 = draw_y + pDamage->pDrawable->height; - REGION_INIT(pScreen, &pixClip, &box, 1); - REGION_INTERSECT (pScreen, pDamageRegion, pRegion, &pixClip); - REGION_UNINIT(pScreen, &pixClip); + RegionInit(&pixClip, &box, 1); + RegionIntersect(pDamageRegion, pRegion, &pixClip); + RegionUninit(&pixClip); } /* * Short circuit empty results */ - if (!REGION_NOTEMPTY(pScreen, pDamageRegion)) + if (!RegionNotEmpty(pDamageRegion)) continue; } @@ -253,39 +253,39 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, * Move region to target coordinate space */ if (draw_x || draw_y) - REGION_TRANSLATE (pScreen, pDamageRegion, -draw_x, -draw_y); + RegionTranslate(pDamageRegion, -draw_x, -draw_y); switch (pDamage->damageLevel) { case DamageReportRawRegion: (*pDamage->damageReport) (pDamage, pDamageRegion, pDamage->closure); break; case DamageReportDeltaRegion: - REGION_NULL (pScreen, &tmpRegion); - REGION_SUBTRACT (pScreen, &tmpRegion, pDamageRegion, &pDamage->damage); - if (REGION_NOTEMPTY (pScreen, &tmpRegion)) + RegionNull(&tmpRegion); + RegionSubtract(&tmpRegion, pDamageRegion, &pDamage->damage); + if (RegionNotEmpty(&tmpRegion)) { - REGION_UNION(pScreen, &pDamage->damage, + RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); (*pDamage->damageReport) (pDamage, &tmpRegion, pDamage->closure); } - REGION_UNINIT(pScreen, &tmpRegion); + RegionUninit(&tmpRegion); break; case DamageReportBoundingBox: - tmpBox = *REGION_EXTENTS (pScreen, &pDamage->damage); - REGION_UNION(pScreen, &pDamage->damage, + tmpBox = *RegionExtents(&pDamage->damage); + RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); - if (!BOX_SAME (&tmpBox, REGION_EXTENTS (pScreen, &pDamage->damage))) + if (!BOX_SAME (&tmpBox, RegionExtents(&pDamage->damage))) (*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure); break; case DamageReportNonEmpty: - was_empty = !REGION_NOTEMPTY(pScreen, &pDamage->damage); - REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage, + was_empty = !RegionNotEmpty(&pDamage->damage); + RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); - if (was_empty && REGION_NOTEMPTY(pScreen, &pDamage->damage)) + if (was_empty && RegionNotEmpty(&pDamage->damage)) (*pDamage->damageReport) (pDamage, &pDamage->damage, pDamage->closure); break; case DamageReportNone: - REGION_UNION(pScreen, &pDamage->damage, &pDamage->damage, + RegionUnion(&pDamage->damage, &pDamage->damage, pDamageRegion); break; } @@ -293,14 +293,14 @@ damageDamageRegion (DrawablePtr pDrawable, RegionPtr pRegion, Bool clip, * translate original region back */ if (pDamageRegion == pRegion && (draw_x || draw_y)) - REGION_TRANSLATE (pScreen, pDamageRegion, draw_x, draw_y); + RegionTranslate(pDamageRegion, draw_x, draw_y); } #ifdef COMPOSITE if (screen_x || screen_y) - REGION_TRANSLATE (pScreen, pRegion, -screen_x, -screen_y); + RegionTranslate(pRegion, -screen_x, -screen_y); #endif - REGION_UNINIT (pScreen, &clippedRec); + RegionUninit(&clippedRec); } #if DAMAGE_DEBUG_ENABLE @@ -314,13 +314,13 @@ damageDamageBox (DrawablePtr pDrawable, BoxPtr pBox, int subWindowMode) { RegionRec region; - REGION_INIT (pDrawable->pScreen, ®ion, pBox, 1); + RegionInit(®ion, pBox, 1); #if DAMAGE_DEBUG_ENABLE _damageDamageRegion (pDrawable, ®ion, TRUE, subWindowMode, where); #else damageDamageRegion (pDrawable, ®ion, TRUE, subWindowMode); #endif - REGION_UNINIT (pDrawable->pScreen, ®ion); + RegionUninit(®ion); } static void damageValidateGC(GCPtr, unsigned long, DrawablePtr); @@ -489,7 +489,7 @@ damageDestroyClip(GCPtr pGC) #define checkGCDamage(d,g) (getDrawableDamage(d) && \ (!g->pCompositeClip ||\ - REGION_NOTEMPTY(d->pScreen, \ + RegionNotEmpty(\ g->pCompositeClip))) #ifdef RENDER @@ -503,7 +503,7 @@ damageDestroyClip(GCPtr pGC) } #define checkPictureDamage(p) (getDrawableDamage(p->pDrawable) && \ - REGION_NOTEMPTY(pScreen, p->pCompositeClip)) + RegionNotEmpty(p->pCompositeClip)) static void damageComposite (CARD8 op, @@ -1615,9 +1615,9 @@ damageCopyWindow(WindowPtr pWindow, * The region comes in source relative, but the damage occurs * at the destination location. Translate back and forth. */ - REGION_TRANSLATE (pScreen, prgnSrc, dx, dy); + RegionTranslate(prgnSrc, dx, dy); damageDamageRegion (&pWindow->drawable, prgnSrc, FALSE, -1); - REGION_TRANSLATE (pScreen, prgnSrc, -dx, -dy); + RegionTranslate(prgnSrc, -dx, -dy); } unwrap (pScrPriv, pScreen, CopyWindow); (*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc); @@ -1820,7 +1820,7 @@ DamageCreate (DamageReportFunc damageReport, return 0; pDamage->pNext = 0; pDamage->pNextWin = 0; - REGION_NULL(pScreen, &pDamage->damage); + RegionNull(&pDamage->damage); pDamage->damageLevel = damageLevel; pDamage->isInternal = isInternal; @@ -1909,7 +1909,7 @@ DamageDestroy (DamagePtr pDamage) { if (pDamage->damageDestroy) (*pDamage->damageDestroy) (pDamage, pDamage->closure); - REGION_UNINIT (pDamage->pDrawable->pScreen, &pDamage->damage); + RegionUninit(&pDamage->damage); xfree (pDamage); } @@ -1921,7 +1921,7 @@ DamageSubtract (DamagePtr pDamage, RegionRec pixmapClip; DrawablePtr pDrawable = pDamage->pDrawable; - REGION_SUBTRACT (pDrawable->pScreen, &pDamage->damage, &pDamage->damage, pRegion); + RegionSubtract(&pDamage->damage, &pDamage->damage, pRegion); if (pDrawable) { if (pDrawable->type == DRAWABLE_WINDOW) @@ -1934,22 +1934,22 @@ DamageSubtract (DamagePtr pDamage, box.y1 = pDrawable->y; box.x2 = pDrawable->x + pDrawable->width; box.y2 = pDrawable->y + pDrawable->height; - REGION_INIT (pDrawable->pScreen, &pixmapClip, &box, 1); + RegionInit(&pixmapClip, &box, 1); pClip = &pixmapClip; } - REGION_TRANSLATE (pDrawable->pScreen, &pDamage->damage, pDrawable->x, pDrawable->y); - REGION_INTERSECT (pDrawable->pScreen, &pDamage->damage, &pDamage->damage, pClip); - REGION_TRANSLATE (pDrawable->pScreen, &pDamage->damage, -pDrawable->x, -pDrawable->y); + RegionTranslate(&pDamage->damage, pDrawable->x, pDrawable->y); + RegionIntersect(&pDamage->damage, &pDamage->damage, pClip); + RegionTranslate(&pDamage->damage, -pDrawable->x, -pDrawable->y); if (pDrawable->type != DRAWABLE_WINDOW) - REGION_UNINIT(pDrawable->pScreen, &pixmapClip); + RegionUninit(&pixmapClip); } - return REGION_NOTEMPTY (pDrawable->pScreen, &pDamage->damage); + return RegionNotEmpty(&pDamage->damage); } void DamageEmpty (DamagePtr pDamage) { - REGION_EMPTY (pDamage->pDrawable->pScreen, &pDamage->damage); + RegionEmpty(&pDamage->damage); } RegionPtr diff --git a/nx-X11/programs/Xserver/render/mipict.c b/nx-X11/programs/Xserver/render/mipict.c index cf9c27f01..ae7cf5a6d 100644 --- a/nx-X11/programs/Xserver/render/mipict.c +++ b/nx-X11/programs/Xserver/render/mipict.c @@ -48,7 +48,7 @@ void miDestroyPicture (PicturePtr pPicture) { if (pPicture->freeCompClip) - REGION_DESTROY(pPicture->pDrawable->pScreen, pPicture->pCompositeClip); + RegionDestroy(pPicture->pCompositeClip); } void @@ -65,7 +65,7 @@ miDestroyPictureClip (PicturePtr pPicture) * we know we'll never have a list of rectangles, since ChangeClip * immediately turns them into a region */ - REGION_DESTROY(pPicture->pDrawable->pScreen, pPicture->clientClip); + RegionDestroy(pPicture->clientClip); break; } pPicture->clientClip = NULL; @@ -86,7 +86,7 @@ miChangePictureClip (PicturePtr pPicture, switch (type) { case CT_PIXMAP: /* convert the pixmap to a region */ - clientClip = (void *) BITMAP_TO_REGION(pScreen, (PixmapPtr) value); + clientClip = (void *) BitmapToRegion(pScreen, (PixmapPtr) value); if (!clientClip) return BadAlloc; clientClipType = CT_REGION; @@ -101,7 +101,7 @@ miChangePictureClip (PicturePtr pPicture, clientClipType = CT_NONE; break; default: - clientClip = (void *) RECTS_TO_REGION(pScreen, n, + clientClip = (void *) RegionFromRects(n, (xRectangle *) value, type); if (!clientClip) @@ -162,7 +162,7 @@ miValidatePicture (PicturePtr pPicture, if (pPicture->clientClipType == CT_NONE) { if (freeCompClip) - REGION_DESTROY(pScreen, pPicture->pCompositeClip); + RegionDestroy(pPicture->pCompositeClip); pPicture->pCompositeClip = pregWin; pPicture->freeCompClip = freeTmpClip; } @@ -177,30 +177,30 @@ miValidatePicture (PicturePtr pPicture, * clip. if neither is real, create a new region. */ - REGION_TRANSLATE(pScreen, pPicture->clientClip, + RegionTranslate(pPicture->clientClip, pDrawable->x + pPicture->clipOrigin.x, pDrawable->y + pPicture->clipOrigin.y); if (freeCompClip) { - REGION_INTERSECT(pScreen, pPicture->pCompositeClip, + RegionIntersect(pPicture->pCompositeClip, pregWin, pPicture->clientClip); if (freeTmpClip) - REGION_DESTROY(pScreen, pregWin); + RegionDestroy(pregWin); } else if (freeTmpClip) { - REGION_INTERSECT(pScreen, pregWin, pregWin, pPicture->clientClip); + RegionIntersect(pregWin, pregWin, pPicture->clientClip); pPicture->pCompositeClip = pregWin; } else { - pPicture->pCompositeClip = REGION_CREATE(pScreen, NullBox, 0); - REGION_INTERSECT(pScreen, pPicture->pCompositeClip, + pPicture->pCompositeClip = RegionCreate(NullBox, 0); + RegionIntersect(pPicture->pCompositeClip, pregWin, pPicture->clientClip); } pPicture->freeCompClip = TRUE; - REGION_TRANSLATE(pScreen, pPicture->clientClip, + RegionTranslate(pPicture->clientClip, -(pDrawable->x + pPicture->clipOrigin.x), -(pDrawable->y + pPicture->clipOrigin.y)); } @@ -218,31 +218,31 @@ miValidatePicture (PicturePtr pPicture, if (pPicture->freeCompClip) { - REGION_RESET(pScreen, pPicture->pCompositeClip, &pixbounds); + RegionReset(pPicture->pCompositeClip, &pixbounds); } else { pPicture->freeCompClip = TRUE; - pPicture->pCompositeClip = REGION_CREATE(pScreen, &pixbounds, 1); + pPicture->pCompositeClip = RegionCreate(&pixbounds, 1); } if (pPicture->clientClipType == CT_REGION) { if(pDrawable->x || pDrawable->y) { - REGION_TRANSLATE(pScreen, pPicture->clientClip, + RegionTranslate(pPicture->clientClip, pDrawable->x + pPicture->clipOrigin.x, pDrawable->y + pPicture->clipOrigin.y); - REGION_INTERSECT(pScreen, pPicture->pCompositeClip, + RegionIntersect(pPicture->pCompositeClip, pPicture->pCompositeClip, pPicture->clientClip); - REGION_TRANSLATE(pScreen, pPicture->clientClip, + RegionTranslate(pPicture->clientClip, -(pDrawable->x + pPicture->clipOrigin.x), -(pDrawable->y + pPicture->clipOrigin.y)); } else { - REGION_TRANSLATE(pScreen, pPicture->pCompositeClip, + RegionTranslate(pPicture->pCompositeClip, -pPicture->clipOrigin.x, -pPicture->clipOrigin.y); - REGION_INTERSECT(pScreen, pPicture->pCompositeClip, + RegionIntersect(pPicture->pCompositeClip, pPicture->pCompositeClip, pPicture->clientClip); - REGION_TRANSLATE(pScreen, pPicture->pCompositeClip, + RegionTranslate(pPicture->pCompositeClip, pPicture->clipOrigin.x, pPicture->clipOrigin.y); } } @@ -274,11 +274,11 @@ miClipPictureReg (RegionPtr pRegion, int dx, int dy) { - if (REGION_NUM_RECTS(pRegion) == 1 && - REGION_NUM_RECTS(pClip) == 1) + if (RegionNumRects(pRegion) == 1 && + RegionNumRects(pClip) == 1) { - BoxPtr pRbox = REGION_RECTS(pRegion); - BoxPtr pCbox = REGION_RECTS(pClip); + BoxPtr pRbox = RegionRects(pRegion); + BoxPtr pCbox = RegionRects(pClip); int v; if (pRbox->x1 < (v = pCbox->x1 + dx)) @@ -292,21 +292,21 @@ miClipPictureReg (RegionPtr pRegion, if (pRbox->x1 >= pRbox->x2 || pRbox->y1 >= pRbox->y2) { - REGION_EMPTY(pScreen, pRegion); + RegionEmpty(pRegion); } } - else if (!REGION_NOTEMPTY (pScreen, pClip)) + else if (!RegionNotEmpty(pClip)) return FALSE; else { if (dx || dy) - REGION_TRANSLATE(pScreen, pRegion, -dx, -dy); - if (!REGION_INTERSECT (pScreen, pRegion, pRegion, pClip)) + RegionTranslate(pRegion, -dx, -dy); + if (!RegionIntersect(pRegion, pRegion, pClip)) return FALSE; if (dx || dy) - REGION_TRANSLATE(pScreen, pRegion, dx, dy); + RegionTranslate(pRegion, dx, dy); } - return REGION_NOTEMPTY(pScreen, pRegion); + return RegionNotEmpty(pRegion); } static __inline Bool @@ -322,13 +322,13 @@ miClipPictureSrc (RegionPtr pRegion, { if (pPicture->clientClipType != CT_NONE) { - REGION_TRANSLATE(pScreen, pRegion, + RegionTranslate(pRegion, dx - pPicture->clipOrigin.x, dy - pPicture->clipOrigin.y); - if (!REGION_INTERSECT (pScreen, pRegion, pRegion, + if (!RegionIntersect(pRegion, pRegion, (RegionPtr) pPicture->clientClip)) return FALSE; - REGION_TRANSLATE(pScreen, pRegion, + RegionTranslate(pRegion, - (dx - pPicture->clipOrigin.x), - (dy - pPicture->clipOrigin.y)); } @@ -432,13 +432,13 @@ miComputeCompositeRegion (RegionPtr pRegion, if (pRegion->extents.x1 >= pRegion->extents.x2 || pRegion->extents.y1 >= pRegion->extents.y2) { - REGION_EMPTY (pDst->pDrawable->pScreen, pRegion); + RegionEmpty(pRegion); return FALSE; } /* clip against dst */ if (!miClipPictureReg (pRegion, pDst->pCompositeClip, 0, 0)) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } if (pDst->alphaMap) @@ -447,14 +447,14 @@ miComputeCompositeRegion (RegionPtr pRegion, -pDst->alphaOrigin.x, -pDst->alphaOrigin.y)) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } } /* clip against src */ if (!miClipPictureSrc (pRegion, pSrc, xDst - xSrc, yDst - ySrc)) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } if (pSrc->alphaMap) @@ -463,7 +463,7 @@ miComputeCompositeRegion (RegionPtr pRegion, xDst - (xSrc + pSrc->alphaOrigin.x), yDst - (ySrc + pSrc->alphaOrigin.y))) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } } @@ -472,7 +472,7 @@ miComputeCompositeRegion (RegionPtr pRegion, { if (!miClipPictureSrc (pRegion, pMask, xDst - xMask, yDst - yMask)) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } if (pMask->alphaMap) @@ -481,7 +481,7 @@ miComputeCompositeRegion (RegionPtr pRegion, xDst - (xMask + pMask->alphaOrigin.x), yDst - (yMask + pMask->alphaOrigin.y))) { - REGION_UNINIT (pScreen, pRegion); + RegionUninit(pRegion); return FALSE; } } diff --git a/nx-X11/programs/Xserver/render/mirect.c b/nx-X11/programs/Xserver/render/mirect.c index c4aeb9aba..3ce7a7f4c 100644 --- a/nx-X11/programs/Xserver/render/mirect.c +++ b/nx-X11/programs/Xserver/render/mirect.c @@ -65,8 +65,8 @@ miColorRects (PicturePtr pDst, tmpval[4] = pDst->clipOrigin.y - yoff; mask |= GCClipXOrigin|GCClipYOrigin; - pClip = REGION_CREATE (pScreen, NULL, 1); - REGION_COPY (pScreen, pClip, + pClip = RegionCreate(NULL, 1); + RegionCopy(pClip, (RegionPtr) pClipPict->clientClip); (*pGC->funcs->ChangeClip) (pGC, CT_REGION, pClip, 0); } diff --git a/nx-X11/programs/Xserver/render/picture.c b/nx-X11/programs/Xserver/render/picture.c index 754d468bb..5d8496610 100644 --- a/nx-X11/programs/Xserver/render/picture.c +++ b/nx-X11/programs/Xserver/render/picture.c @@ -1390,7 +1390,7 @@ SetPictureClipRects (PicturePtr pPicture, RegionPtr clientClip; int result; - clientClip = RECTS_TO_REGION(pScreen, + clientClip = RegionFromRects( nRect, rects, CT_UNSORTED); if (!clientClip) return BadAlloc; @@ -1421,14 +1421,14 @@ SetPictureClipRegion (PicturePtr pPicture, if (pRegion) { type = CT_REGION; - clientClip = REGION_CREATE (pScreen, - REGION_EXTENTS(pScreen, pRegion), - REGION_NUM_RECTS(pRegion)); + clientClip = RegionCreate( + RegionExtents(pRegion), + RegionNumRects(pRegion)); if (!clientClip) return BadAlloc; - if (!REGION_COPY (pSCreen, clientClip, pRegion)) + if (!RegionCopy(clientClip, pRegion)) { - REGION_DESTROY (pScreen, clientClip); + RegionDestroy(clientClip); return BadAlloc; } } @@ -1538,9 +1538,9 @@ CopyPicture (PicturePtr pSrc, RegionPtr clientClip; RegionPtr srcClientClip = (RegionPtr)pSrc->clientClip; - clientClip = REGION_CREATE(pSrc->pDrawable->pScreen, - REGION_EXTENTS(pSrc->pDrawable->pScreen, srcClientClip), - REGION_NUM_RECTS(srcClientClip)); + clientClip = RegionCreate( + RegionExtents(srcClientClip), + RegionNumRects(srcClientClip)); (*ps->ChangePictureClip)(pDst, CT_REGION, clientClip, 0); } break; diff --git a/nx-X11/programs/Xserver/xfixes/region.c b/nx-X11/programs/Xserver/xfixes/region.c index cb9e0de9a..0b1865cf0 100755 --- a/nx-X11/programs/Xserver/xfixes/region.c +++ b/nx-X11/programs/Xserver/xfixes/region.c @@ -43,20 +43,20 @@ RegionResFree (void * data, XID id) { RegionPtr pRegion = (RegionPtr) data; - REGION_DESTROY (0, pRegion); + RegionDestroy(pRegion); return Success; } RegionPtr XFixesRegionCopy (RegionPtr pRegion) { - RegionPtr pNew = REGION_CREATE (0, REGION_EXTENTS(0, pRegion), - REGION_NUM_RECTS(pRegion)); + RegionPtr pNew = RegionCreate(RegionExtents(pRegion), + RegionNumRects(pRegion)); if (!pNew) return 0; - if (!REGION_COPY (0, pNew, pRegion)) + if (!RegionCopy(pNew, pRegion)) { - REGION_DESTROY (0, pNew); + RegionDestroy(pNew); return 0; } return pNew; @@ -84,7 +84,7 @@ ProcXFixesCreateRegion (ClientPtr client) return BadLength; things >>= 3; - pRegion = RECTS_TO_REGION(0, things, (xRectangle *) (stuff + 1), CT_UNSORTED); + pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED); if (!pRegion) return BadAlloc; if (!AddResource (stuff->region, RegionResType, (void *) pRegion)) @@ -127,7 +127,7 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client) if (pPixmap->drawable.depth != 1) return BadMatch; - pRegion = BITMAP_TO_REGION(pPixmap->drawable.pScreen, pPixmap); + pRegion = BitmapToRegion(pPixmap->drawable.pScreen, pPixmap); if (!pRegion) return BadAlloc; @@ -229,7 +229,7 @@ ProcXFixesCreateRegionFromGC (ClientPtr client) switch (pGC->clientClipType) { case CT_PIXMAP: - pRegion = BITMAP_TO_REGION(pGC->pScreen, (PixmapPtr) pGC->clientClip); + pRegion = BitmapToRegion(pGC->pScreen, (PixmapPtr) pGC->clientClip); if (!pRegion) return BadAlloc; break; @@ -278,7 +278,7 @@ ProcXFixesCreateRegionFromPicture (ClientPtr client) switch (pPicture->clientClipType) { case CT_PIXMAP: - pRegion = BITMAP_TO_REGION(pPicture->pDrawable->pScreen, + pRegion = BitmapToRegion(pPicture->pDrawable->pScreen, (PixmapPtr) pPicture->clientClip); if (!pRegion) return BadAlloc; @@ -353,15 +353,15 @@ ProcXFixesSetRegion (ClientPtr client) return BadLength; things >>= 3; - pNew = RECTS_TO_REGION(0, things, (xRectangle *) (stuff + 1), CT_UNSORTED); + pNew = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED); if (!pNew) return BadAlloc; - if (!REGION_COPY (0, pRegion, pNew)) + if (!RegionCopy(pRegion, pNew)) { - REGION_DESTROY (0, pNew); + RegionDestroy(pNew); return BadAlloc; } - REGION_DESTROY (0, pNew); + RegionDestroy(pNew); return(client->noClientException); } @@ -387,7 +387,7 @@ ProcXFixesCopyRegion (ClientPtr client) VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); - if (!REGION_COPY(pScreen, pDestination, pSource)) + if (!RegionCopy(pDestination, pSource)) return BadAlloc; return(client->noClientException); @@ -420,15 +420,15 @@ ProcXFixesCombineRegion (ClientPtr client) switch (stuff->xfixesReqType) { case X_XFixesUnionRegion: - if (!REGION_UNION (0, pDestination, pSource1, pSource2)) + if (!RegionUnion(pDestination, pSource1, pSource2)) ret = BadAlloc; break; case X_XFixesIntersectRegion: - if (!REGION_INTERSECT (0, pDestination, pSource1, pSource2)) + if (!RegionIntersect(pDestination, pSource1, pSource2)) ret = BadAlloc; break; case X_XFixesSubtractRegion: - if (!REGION_SUBTRACT (0, pDestination, pSource1, pSource2)) + if (!RegionSubtract(pDestination, pSource1, pSource2)) ret = BadAlloc; break; } @@ -477,7 +477,7 @@ ProcXFixesInvertRegion (ClientPtr client) else bounds.y2 = stuff->y + stuff->height; - if (!REGION_INVERSE(0, pDestination, pSource, &bounds)) + if (!RegionInverse(pDestination, pSource, &bounds)) ret = BadAlloc; if (ret == Success) @@ -511,7 +511,7 @@ ProcXFixesTranslateRegion (ClientPtr client) REQUEST_SIZE_MATCH(xXFixesTranslateRegionReq); VERIFY_REGION(pRegion, stuff->region, client, SecurityWriteAccess); - REGION_TRANSLATE(pScreen, pRegion, stuff->dx, stuff->dy); + RegionTranslate(pRegion, stuff->dx, stuff->dy); return (client->noClientException); } @@ -539,7 +539,7 @@ ProcXFixesRegionExtents (ClientPtr client) VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); - REGION_RESET (0, pDestination, REGION_EXTENTS (0, pSource)); + RegionReset(pDestination, RegionExtents(pSource)); return (client->noClientException); } @@ -571,9 +571,9 @@ ProcXFixesFetchRegion (ClientPtr client) REQUEST_SIZE_MATCH(xXFixesFetchRegionReq); VERIFY_REGION(pRegion, stuff->region, client, SecurityReadAccess); - pExtent = REGION_EXTENTS (0, pRegion); - pBox = REGION_RECTS (pRegion); - nBox = REGION_NUM_RECTS (pRegion); + pExtent = RegionExtents(pRegion); + pBox = RegionRects (pRegion); + nBox = RegionNumRects (pRegion); reply = xalloc (sizeof (xXFixesFetchRegionReply) + nBox * sizeof (xRectangle)); @@ -716,7 +716,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client) break; } if (stuff->xOff || stuff->yOff) - REGION_TRANSLATE (0, pRegion, stuff->xOff, stuff->yOff); + RegionTranslate(pRegion, stuff->xOff, stuff->yOff); } else { @@ -739,7 +739,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client) pDestRegion = &pRegion; /* a NULL region pointer */ } if (*pDestRegion) - REGION_DESTROY(pScreen, *pDestRegion); + RegionDestroy(*pDestRegion); *pDestRegion = pRegion; (*pScreen->SetShape) (pWin); SendShapeNotify (pWin, stuff->destKind); @@ -818,8 +818,8 @@ ProcXFixesExpandRegion (ClientPtr client) VERIFY_REGION(pSource, stuff->source, client, SecurityReadAccess); VERIFY_REGION(pDestination, stuff->destination, client, SecurityWriteAccess); - nBoxes = REGION_NUM_RECTS(pSource); - pSrc = REGION_RECTS(pSource); + nBoxes = RegionNumRects(pSource); + pSrc = RegionRects(pSource); if (nBoxes) { pTmp = xalloc (nBoxes * sizeof (BoxRec)); @@ -832,12 +832,12 @@ ProcXFixesExpandRegion (ClientPtr client) pTmp[i].y1 = pSrc[i].y1 - stuff->top; pTmp[i].y2 = pSrc[i].y2 + stuff->bottom; } - REGION_EMPTY (pScreen, pDestination); + RegionEmpty(pDestination); for (i = 0; i < nBoxes; i++) { RegionRec r; - REGION_INIT (pScreen, &r, &pTmp[i], 0); - REGION_UNION (pScreen, pDestination, pDestination, &r); + RegionInit(&r, &pTmp[i], 0); + RegionUnion(pDestination, pDestination, &r); } } if (ret == Success) diff --git a/nx-X11/programs/Xserver/xkb/ddxFakeMtn.c b/nx-X11/programs/Xserver/xkb/ddxFakeMtn.c index 33fa49ae7..7f096683b 100644 --- a/nx-X11/programs/Xserver/xkb/ddxFakeMtn.c +++ b/nx-X11/programs/Xserver/xkb/ddxFakeMtn.c @@ -64,12 +64,12 @@ ScreenPtr pScreen, oldScreen; BoxRec box; int i; - if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum], + if(!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum], oldX, oldY, &box)) { FOR_NSCREENS(i) { if(i == pScreen->myNum) continue; - if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], + if(RegionContainsPoint(&XineramaScreenRegions[i], oldX, oldY, &box)) { pScreen = screenInfo.screens[i]; break; @@ -85,12 +85,12 @@ ScreenPtr pScreen, oldScreen; oldY= y; else oldY+= y; - if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum], + if(!RegionContainsPoint(&XineramaScreenRegions[pScreen->myNum], oldX, oldY, &box)) { FOR_NSCREENS(i) { if(i == pScreen->myNum) continue; - if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], + if(RegionContainsPoint(&XineramaScreenRegions[i], oldX, oldY, &box)) { pScreen = screenInfo.screens[i]; break; -- cgit v1.2.3 From 4a8d6eca395e1ec0490e20e7971177f688da18ec Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 05:11:40 +0100 Subject: Change region implementation from macros to inline functions. This makes all of the previous macros into inline functions and also turns all of the direct calls to pixman region code into inline functions as well. v1: Keith Packard v2: Mike Gabriel --- nx-X11/programs/Xserver/include/misc.h | 2 +- nx-X11/programs/Xserver/include/miscstruct.h | 6 +- nx-X11/programs/Xserver/include/regionstr.h | 399 ++++++++++++--------------- 3 files changed, 183 insertions(+), 224 deletions(-) diff --git a/nx-X11/programs/Xserver/include/misc.h b/nx-X11/programs/Xserver/include/misc.h index e6bc1019d..5f30823fa 100644 --- a/nx-X11/programs/Xserver/include/misc.h +++ b/nx-X11/programs/Xserver/include/misc.h @@ -295,7 +295,7 @@ extern int Ones( unsigned long /*mask*/); typedef struct _xPoint *DDXPointPtr; -typedef struct _Box *BoxPtr; +typedef struct pixman_box16 *BoxPtr; typedef struct _xEvent *xEventPtr; typedef struct _xRectangle *xRectanglePtr; typedef struct _GrabRec *GrabPtr; diff --git a/nx-X11/programs/Xserver/include/miscstruct.h b/nx-X11/programs/Xserver/include/miscstruct.h index 7df9240c9..7b1f8047b 100644 --- a/nx-X11/programs/Xserver/include/miscstruct.h +++ b/nx-X11/programs/Xserver/include/miscstruct.h @@ -50,15 +50,15 @@ SOFTWARE. #ifndef MISCSTRUCT_H #define MISCSTRUCT_H 1 +#include + #include "misc.h" #include #include "gc.h" typedef xPoint DDXPointRec; -typedef struct _Box { - short x1, y1, x2, y2; -} BoxRec; +typedef struct pixman_box16 BoxRec; typedef union _DevUnion { void * ptr; diff --git a/nx-X11/programs/Xserver/include/regionstr.h b/nx-X11/programs/Xserver/include/regionstr.h index b1eb100a5..c61acc003 100644 --- a/nx-X11/programs/Xserver/include/regionstr.h +++ b/nx-X11/programs/Xserver/include/regionstr.h @@ -51,7 +51,9 @@ SOFTWARE. #ifndef REGIONSTRUCT_H #define REGIONSTRUCT_H -typedef struct _Region RegionRec, *RegionPtr; +#include + +typedef struct pixman_region16 RegionRec, *RegionPtr; #include #include @@ -70,261 +72,218 @@ typedef struct _Region RegionRec, *RegionPtr; * clip region */ -typedef struct _RegData { - long size; - long numRects; -/* BoxRec rects[size]; in memory but not explicitly declared */ -} RegDataRec, *RegDataPtr; - -struct _Region { - BoxRec extents; - RegDataPtr data; -}; +typedef struct pixman_region16_data RegDataRec, *RegDataPtr; extern BoxRec miEmptyBox; extern RegDataRec miEmptyData; extern RegDataRec miBrokenData; -#define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects) -/* not a region */ -#define REGION_NAR(reg) ((reg)->data == &miBrokenData) -#define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1) -#define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0) -#define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \ - : &(reg)->extents) -#define REGION_BOXPTR(reg) ((BoxPtr)((reg)->data + 1)) -#define REGION_BOX(reg,i) (®ION_BOXPTR(reg)[i]) -#define REGION_TOP(reg) REGION_BOX(reg, (reg)->data->numRects) -#define REGION_END(reg) REGION_BOX(reg, (reg)->data->numRects - 1) -#define REGION_SZOF(n) (n < ((INT_MAX - sizeof(RegDataRec)) / sizeof(BoxRec)) ? sizeof(RegDataRec) + ((n) * sizeof(BoxRec)) : 0) - -/* Keith recommends weaning the region code of pScreen argument */ -#define REG_pScreen screenInfo.screens[0] - -#ifdef NEED_SCREEN_REGIONS - -#define RegionCreate(_rect, _size) \ - (*(REG_pScreen)->RegionCreate)(_rect, _size) - -#define RegionInit(_pReg, _rect, _size) \ - (*(REG_pScreen)->RegionInit)(_pReg, _rect, _size) - -#define RegionCopy(dst, src) \ - (*(REG_pScreen)->RegionCopy)(dst, src) - -#define RegionDestroy(_pReg) \ - (*(REG_pScreen)->RegionDestroy)(_pReg) - -#define RegionUninit(_pReg) \ - (*(REG_pScreen)->RegionUninit)(_pReg) - -#define RegionIntersect(newReg, reg1, reg2) \ - (*(REG_pScreen)->Intersect)(newReg, reg1, reg2) - -#define RegionUnion(newReg, reg1, reg2) \ - (*(REG_pScreen)->Union)(newReg, reg1, reg2) - -#define RegionSubtract(newReg, reg1, reg2) \ - (*(REG_pScreen)->Subtract)(newReg, reg1, reg2) - -#define RegionInverse(newReg, reg1, invRect) \ - (*(REG_pScreen)->Inverse)(newReg, reg1, invRect) - -#define RegionReset(_pReg, _pBox) \ - (*(REG_pScreen)->RegionReset)(_pReg, _pBox) - -#define RegionTranslate(_pReg, _x, _y) \ - (*(REG_pScreen)->TranslateRegion)(_pReg, _x, _y) - -#define RegionContainsRect(_pReg, prect) \ - (*(REG_pScreen)->RectIn)(_pReg, prect) - -#define RegionContainsPoint(_pReg, _x, _y, prect) \ - (*(REG_pScreen)->PointInRegion)(_pReg, _x, _y, prect) - -#define RegionNotEmpty(_pReg) \ - (*(REG_pScreen)->RegionNotEmpty)(_pReg) - -#define RegionEqual(_pReg1, _pReg2) \ - (*(REG_pScreen)->RegionEqual)(_pReg1, _pReg2) - -#define RegionBroken(_pReg) \ - (*(REG_pScreen)->RegionBroken)(_pReg) - -#define RegionBreak(_pReg) \ - (*(REG_pScreen)->RegionBreak)(_pReg) - -#define RegionEmpty(_pReg) \ - (*(REG_pScreen)->RegionEmpty)(_pReg) - -#define RegionExtents(_pReg) \ - (*(REG_pScreen)->RegionExtents)(_pReg) - -#define RegionAppend(dstrgn, rgn) \ - (*(REG_pScreen)->RegionAppend)(dstrgn, rgn) - -#define RegionValidate(badreg, pOverlap) \ - (*(REG_pScreen)->RegionValidate)(badreg, pOverlap) - -#define BITMAP_TO_REGION(_pScreen, pPix) \ - (*(REG_pScreen)->BitmapToRegion)(pPix) - -#define RegionFromRects(nrects, prect, ctype) \ - (*(REG_pScreen)->RectsToRegion)(nrects, prect, ctype) - -#else /* !NEED_SCREEN_REGIONS */ - -/* Reference _pScreen macro argument and check its type */ -#define REGION_SCREEN(_pScreen) (void)((REG_pScreen)->myNum) - -#define RegionCreate(_rect, _size) \ - (REGION_SCREEN(_pScreen), miRegionCreate(_rect, _size)) - -#define RegionCopy(dst, src) \ - (REGION_SCREEN(_pScreen), miRegionCopy(dst, src)) - -#define RegionDestroy(_pReg) \ - (REGION_SCREEN(_pScreen), miRegionDestroy(_pReg)) - -#define RegionIntersect(newReg, reg1, reg2) \ - (REGION_SCREEN(_pScreen), miIntersect(newReg, reg1, reg2)) - -#define RegionUnion(newReg, reg1, reg2) \ - (REGION_SCREEN(_pScreen), miUnion(newReg, reg1, reg2)) - -#define RegionSubtract(newReg, reg1, reg2) \ - (REGION_SCREEN(_pScreen), miSubtract(newReg, reg1, reg2)) - -#define RegionInverse(newReg, reg1, invRect) \ - (REGION_SCREEN(_pScreen), miInverse(newReg, reg1, invRect)) - -#define RegionTranslate(_pReg, _x, _y) \ - (REGION_SCREEN(_pScreen), miTranslateRegion(_pReg, _x, _y)) - -#define RegionContainsRect(_pReg, prect) \ - (REGION_SCREEN(_pScreen), miRectIn(_pReg, prect)) - -#define RegionContainsPoint(_pReg, _x, _y, prect) \ - (REGION_SCREEN(_pScreen), miPointInRegion(_pReg, _x, _y, prect)) - -#define RegionAppend(dstrgn, rgn) \ - (REGION_SCREEN(_pScreen), miRegionAppend(dstrgn, rgn)) +static inline Bool RegionNil(RegionPtr reg) { + return ((reg)->data && !(reg)->data->numRects); +} -#define RegionValidate(badreg, pOverlap) \ - (REGION_SCREEN(_pScreen), miRegionValidate(badreg, pOverlap)) +static inline Bool RegionNar(RegionPtr reg) { + return ((reg)->data == &miBrokenData); +} -#define BITMAP_TO_REGION(_pScreen, pPix) \ - (*(_pScreen)->BitmapToRegion)(pPix) /* no mi version?! */ +static inline int RegionNumRects(RegionPtr reg) { + return ((reg)->data ? (reg)->data->numRects : 1); +} -#define RegionFromRects(nrects, prect, ctype) \ - (REGION_SCREEN(_pScreen), miRectsToRegion(nrects, prect, ctype)) +static inline int RegionSize(RegionPtr reg) { + return ((reg)->data ? (reg)->data->size : 0); +} -#define RegionEqual(_pReg1, _pReg2) \ - (REGION_SCREEN(_pScreen), miRegionEqual(_pReg1, _pReg2)) +static inline BoxPtr RegionRects(RegionPtr reg) { + return ((reg)->data ? (BoxPtr)((reg)->data + 1) : &(reg)->extents); +} -#define RegionBreak(_pReg) \ - (REGION_SCREEN(_pScreen), miRegionBreak(_pReg)) +static inline BoxPtr RegionBoxptr(RegionPtr reg) { + return ((BoxPtr)((reg)->data + 1)); +} -#ifdef DONT_INLINE_REGION_OPS +static inline BoxPtr RegionBox(RegionPtr reg, int i) { + return (&RegionBoxptr(reg)[i]); +} -#define RegionInit(_pReg, _rect, _size) \ - (REGION_SCREEN(_pScreen), miRegionInit(_pReg, _rect, _size)) +static inline BoxPtr RegionTop(RegionPtr reg) { + return RegionBox(reg, (reg)->data->numRects); +} -#define RegionUninit(_pReg) \ - (REGION_SCREEN(_pScreen), miRegionUninit(_pReg)) +static inline BoxPtr RegionEnd(RegionPtr reg) { + return RegionBox(reg, (reg)->data->numRects - 1); +} -#define RegionReset(_pReg, _pBox) \ - (REGION_SCREEN(_pScreen), miRegionReset(_pReg, _pBox)) +static inline size_t RegionSizeof(int n) { + return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec))); +} -#define RegionNotEmpty(_pReg) \ - (REGION_SCREEN(_pScreen), miRegionNotEmpty(_pReg)) +static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size) +{ + if ((_rect) != NULL) + { + (_pReg)->extents = *(_rect); + (_pReg)->data = (RegDataPtr)NULL; + } + else + { + (_pReg)->extents = miEmptyBox; + if (((_size) > 1) && ((_pReg)->data = + (RegDataPtr)malloc(RegionSizeof(_size)))) + { + (_pReg)->data->size = (_size); + (_pReg)->data->numRects = 0; + } + else + (_pReg)->data = &miEmptyData; + } +} -#define RegionBroken(_pReg) \ - (REGION_SCREEN(_pScreen), miRegionBroken(_pReg)) +static inline void RegionUninit(RegionPtr _pReg) +{ + if ((_pReg)->data && (_pReg)->data->size) { + free((_pReg)->data); + (_pReg)->data = NULL; + } +} -#define RegionEmpty(_pReg) \ - (REGION_SCREEN(_pScreen), miRegionEmpty(_pReg)) +static inline void RegionReset(RegionPtr _pReg, BoxPtr _pBox) +{ + (_pReg)->extents = *(_pBox); + RegionUninit(_pReg); + (_pReg)->data = (RegDataPtr)NULL; +} -#define RegionExtents(_pReg) \ - (REGION_SCREEN(_pScreen), miRegionExtents(_pReg)) +static inline Bool RegionNotEmpty(RegionPtr _pReg) { + return !RegionNil(_pReg); +} -#else /* inline certain simple region ops for performance */ +static inline Bool RegionBroken(RegionPtr _pReg) { + return RegionNar(_pReg); +} -#define RegionInit(_pReg, _rect, _size) \ -{ \ - REGION_SCREEN(_pScreen); \ - if (_rect) \ - { \ - (_pReg)->extents = *(_rect); \ - (_pReg)->data = (RegDataPtr)NULL; \ - } \ - else \ - { \ - size_t rgnSize; \ - (_pReg)->extents = miEmptyBox; \ - if (((_size) > 1) && ((rgnSize = REGION_SZOF(_size)) > 0) && \ - ((_pReg)->data = (RegDataPtr)xalloc(rgnSize))) \ - { \ - (_pReg)->data->size = (_size); \ - (_pReg)->data->numRects = 0; \ - } \ - else \ - (_pReg)->data = &miEmptyData; \ - } \ - } +static inline void RegionEmpty(RegionPtr _pReg) +{ + RegionUninit(_pReg); + (_pReg)->extents.x2 = (_pReg)->extents.x1; + (_pReg)->extents.y2 = (_pReg)->extents.y1; + (_pReg)->data = &miEmptyData; +} +static inline BoxPtr RegionExtents(RegionPtr _pReg) +{ + return (&(_pReg)->extents); +} -#define RegionUninit(_pReg) \ -{ \ - REGION_SCREEN(_pScreen); \ - if ((_pReg)->data && (_pReg)->data->size) { \ - xfree((_pReg)->data); \ - (_pReg)->data = NULL; \ - } \ +static inline void RegionNull(RegionPtr _pReg) +{ + (_pReg)->extents = miEmptyBox; + (_pReg)->data = &miEmptyData; } -#define RegionReset(_pReg, _pBox) \ -{ \ - REGION_SCREEN(_pScreen); \ - (_pReg)->extents = *(_pBox); \ - RegionUninit(_pReg); \ - (_pReg)->data = (RegDataPtr)NULL; \ +static inline Bool +RegionCopy(RegionPtr dst, RegionPtr src) +{ + return pixman_region_copy (dst, src); } -#define RegionNotEmpty(_pReg) \ - (REGION_SCREEN(_pScreen), !REGION_NIL(_pReg)) +static inline Bool +RegionIntersect( + RegionPtr newReg, /* destination Region */ + RegionPtr reg1, + RegionPtr reg2 /* source regions */ + ) +{ + return pixman_region_intersect (newReg, reg1, reg2); +} -#define RegionBroken(_pReg) \ - (REGION_SCREEN(_pScreen), REGION_NAR(_pReg)) +static inline Bool +RegionUnion( + RegionPtr newReg, /* destination Region */ + RegionPtr reg1, + RegionPtr reg2 /* source regions */ + ) +{ + return pixman_region_union (newReg, reg1, reg2); +} -#define RegionEmpty(_pReg) \ -{ \ - RegionUninit(_pReg); \ - (_pReg)->extents.x2 = (_pReg)->extents.x1; \ - (_pReg)->extents.y2 = (_pReg)->extents.y1; \ - (_pReg)->data = &miEmptyData; \ +/* + *----------------------------------------------------------------------- + * Subtract -- + * 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. + * + *----------------------------------------------------------------------- + */ +static inline Bool +RegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS) +{ + return pixman_region_subtract (regD, regM, regS); } -#define RegionExtents(_pReg) \ - (REGION_SCREEN(_pScreen), &(_pReg)->extents) +/* + *----------------------------------------------------------------------- + * Inverse -- + * 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. + * + *----------------------------------------------------------------------- + */ +static inline Bool +RegionInverse( + RegionPtr newReg, /* Destination region */ + RegionPtr reg1, /* Region to invert */ + BoxPtr invRect /* Bounding box for inversion */ + ) +{ + return pixman_region_inverse (newReg, reg1, invRect); +} -#define RegionNull(_pReg) \ -{ \ - REGION_SCREEN(_pScreen); \ - (_pReg)->extents = miEmptyBox; \ - (_pReg)->data = &miEmptyData; \ +static inline int +RegionContainsRect(RegionPtr region, BoxPtr prect) +{ + return pixman_region_contains_rectangle (region, prect); } -#endif /* DONT_INLINE_REGION_OPS */ +/* TranslateRegion(pReg, x, y) + * translates in place + */ -#endif /* NEED_SCREEN_REGIONS */ +static inline void +RegionTranslate(RegionPtr pReg, int x, int y) +{ + pixman_region_translate (pReg, x, y); +} -#ifndef RegionNull -#define RegionNull(_pReg) \ - RegionInit(_pReg, NullBox, 1) -#endif +static inline Bool +RegionContainsPoint( + RegionPtr pReg, + int x, + int y, + BoxPtr box /* "return" value */ + ) +{ + return pixman_region_contains_point (pReg, x, y, box); +} -/* moved from mi.h */ +static inline Bool +RegionEqual(RegionPtr reg1, RegionPtr reg2) +{ + return pixman_region_equal (reg1, reg2); +} extern RegionPtr miRegionCreate( BoxPtr /*rect*/, -- cgit v1.2.3 From d9e7f6ae42b30e32619e1d0979598c2ba2288a3e Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 05:13:43 +0100 Subject: pixman-devel: Build against shared library pkg-config(pixman-1). --- debian/control | 1 + nx-X11/programs/Xserver/GL/glx/Imakefile | 3 ++- nx-X11/programs/Xserver/GL/mesa/X/Imakefile | 3 ++- nx-X11/programs/Xserver/Imakefile | 15 +++++++-------- nx-X11/programs/Xserver/XTrap/Imakefile | 2 +- nx-X11/programs/Xserver/Xext/Imakefile | 3 ++- nx-X11/programs/Xserver/Xi/Imakefile | 2 +- nx-X11/programs/Xserver/composite/Imakefile | 3 ++- nx-X11/programs/Xserver/damageext/Imakefile | 3 ++- nx-X11/programs/Xserver/dbe/Imakefile | 2 +- nx-X11/programs/Xserver/dix/Imakefile | 3 ++- nx-X11/programs/Xserver/fb/Imakefile | 3 ++- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 5 ++++- nx-X11/programs/Xserver/include/scrnintstr.h | 4 ++++ nx-X11/programs/Xserver/mi/Imakefile | 3 ++- nx-X11/programs/Xserver/miext/cw/Imakefile | 3 ++- nx-X11/programs/Xserver/miext/damage/Imakefile | 3 ++- nx-X11/programs/Xserver/os/Imakefile | 3 ++- nx-X11/programs/Xserver/randr/Imakefile | 4 +++- nx-X11/programs/Xserver/record/Imakefile | 2 +- nx-X11/programs/Xserver/render/Imakefile | 3 ++- nx-X11/programs/Xserver/xfixes/Imakefile | 3 ++- nx-X11/programs/Xserver/xkb/Imakefile | 3 ++- nx-libs.spec | 3 +++ nxcompext/configure.in | 2 ++ 25 files changed, 56 insertions(+), 28 deletions(-) diff --git a/debian/control b/debian/control index 83aee8e58..3e1f45e5d 100644 --- a/debian/control +++ b/debian/control @@ -28,6 +28,7 @@ Build-Depends: pkg-config, x11proto-core-dev, expat, + libpixman-1-dev, Standards-Version: 3.9.6 Homepage: http://code.x2go.org/gitweb?p=nx-libs.git;a=summary Vcs-Git: git://code.x2go.org/nx-libs.git diff --git a/nx-X11/programs/Xserver/GL/glx/Imakefile b/nx-X11/programs/Xserver/GL/glx/Imakefile index 506ef5539..bf2d760a0 100644 --- a/nx-X11/programs/Xserver/GL/glx/Imakefile +++ b/nx-X11/programs/Xserver/GL/glx/Imakefile @@ -43,7 +43,8 @@ LinkSourceFile(indirect_size.h, $(MESASRCDIR)/src/glx/x11) INCLUDES = -I$(SERVERSRC)/GL/glx -I$(SERVERSRC)/GL/include -I$(SERVERSRC)/include -I$(INCLUDESRC) -I$(MESASRCDIR)/include \ -I$(XINCLUDESRC) -I$(SERVERSRC)/mi \ -I$(EXTINCSRC) -I$(LIBSRC)/GL/include \ - -I$(XF86SRC) + -I$(XF86SRC) \ + `pkg-config --cflags-only-I pixman-1` #if defined(DarwinArchitecture) && ((OSMajorVersion == 6 && OSMinorVersion < 3) || OSMajorVersion < 6) NO_EXT_DEFS = -DMISSING_GL_EXTS diff --git a/nx-X11/programs/Xserver/GL/mesa/X/Imakefile b/nx-X11/programs/Xserver/GL/mesa/X/Imakefile index ee728b556..9fb00ef73 100644 --- a/nx-X11/programs/Xserver/GL/mesa/X/Imakefile +++ b/nx-X11/programs/Xserver/GL/mesa/X/Imakefile @@ -39,7 +39,8 @@ LinkSourceFile(compsize.c,$(MESASRCDIR)/src/glx/x11) -I$(SERVERSRC)/include -I$(SERVERSRC)/GL/include \ -I$(SERVERSRC)/GL/glx \ -I$(XF86OSSRC) \ - -I$(DRMSRCDIR)/shared-core + -I$(DRMSRCDIR)/shared-core \ + `pkg-config --cflags-only-I pixman-1` DEFINES = $(GLX_DEFINES) $(GLXSRV_DEFINES) -DNXAGENT_SERVER /*-DUSE_X86_ASM*/ /*-DUSE_SPARC_ASM*/ diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index c7e1af550..a2a3f7ced 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -384,10 +384,12 @@ NXAGENTOBJS = hw/nxagent/miinitext.o \ dix/main.o #endif -XPMLIB = -lXpm +XPMLIB = -lXpm +XMLLIB = `pkg-config --libs libxml-2.0` +PIXMANLIB = `pkg-config --libs pixman-1` NXAGENT = hw/nxagent/LibraryTargetName(nxagent) NXAGENTLIBS = PreFbLibs $(NXAGENT) FbPostFbLibs $(NXAGENT) $(MI) -NXAGENTSYSLIBS = $(LDPRELIBS) $(XLIB) $(SYSLIBS) $(XPMLIB) +NXAGENTSYSLIBS = $(LDPRELIBS) $(XLIB) $(SYSLIBS) $(XPMLIB) $(XMLLIB) $(PIXMANLIB) #if HasParallelMake MakeMutex($(NXAGENTDIRS) $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS)) #endif @@ -403,18 +405,15 @@ $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS):: $(NXAGENTDIRS) #if defined(SunArchitecture) NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext -L ../../../nxcompshad \ -lXcomp -lXcompext -lXcompshad -lrt -L/usr/sfw/lib -lXrender -lXfixes -lXfont \ - -L../../../nx-X11/exports/lib -lXtst -lXrandr -lXcomposite -lXdmcp \ -`pkg-config --libs libxml-2.0` + -L../../../nx-X11/exports/lib -lXtst -lXrandr -lXcomposite -lXdmcp #elif defined(cygwinArchitecture) NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext \ -lXcomp -lXcompext -lXrender -lX11 -lNX_Xext -lXcomposite -lXfixes -lXfont \ - -L ../../../nxcompshad -lXcompshad -L../../../nx-X11/exports/lib -lXtst -lXdmcp \ -`pkg-config --libs libxml-2.0` + -L ../../../nxcompshad -lXcompshad -L../../../nx-X11/exports/lib -lXtst -lXdmcp #else NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext -L ../../../nxcompshad \ -lXcomp -lXcompext -lXcompshad -lXrender -lNX_X11 -lNX_Xext -lXfixes -lXfont \ - -L../../../nx-X11/exports/lib -lXtst -lXrandr -lXcomposite -lXinerama -lXdmcp \ -`pkg-config --libs libxml-2.0` + -L../../../nx-X11/exports/lib -lXtst -lXrandr -lXcomposite -lXinerama -lXdmcp #endif #endif diff --git a/nx-X11/programs/Xserver/XTrap/Imakefile b/nx-X11/programs/Xserver/XTrap/Imakefile index 2362634c7..c61712f1d 100644 --- a/nx-X11/programs/Xserver/XTrap/Imakefile +++ b/nx-X11/programs/Xserver/XTrap/Imakefile @@ -11,7 +11,7 @@ XCOMM $XFree86: xc/programs/Xserver/XTrap/Imakefile,v 1.1 2001/11/02 23:29:29 da #endif SRCS = xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c OBJS = xtrapddmi.o xtrapdi.o xtrapdiswp.o xtrapditbl.o - INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext + INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/Xext `pkg-config --cflags-only-I pixman-1` NormalLibraryTarget(xtrap,$(OBJS)) LintLibraryTarget(xtrap,$(SRCS)) diff --git a/nx-X11/programs/Xserver/Xext/Imakefile b/nx-X11/programs/Xserver/Xext/Imakefile index eb4588e37..199e59f1d 100644 --- a/nx-X11/programs/Xserver/Xext/Imakefile +++ b/nx-X11/programs/Xserver/Xext/Imakefile @@ -161,7 +161,8 @@ XF86INCLUDES = -I$(XF86COMSRC) #endif INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \ $(PNRXINCLUDES) $(XF86INCLUDES) \ - $(FONTCACHEINCLUDES) $(DMXINCLUDES) + $(FONTCACHEINCLUDES) $(DMXINCLUDES) \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln #if defined(NXAgentServer) && NXAgentServer diff --git a/nx-X11/programs/Xserver/Xi/Imakefile b/nx-X11/programs/Xserver/Xi/Imakefile index 27e1f5df0..29190b711 100644 --- a/nx-X11/programs/Xserver/Xi/Imakefile +++ b/nx-X11/programs/Xserver/Xi/Imakefile @@ -83,7 +83,7 @@ XCOMM $XFree86: xc/programs/Xserver/Xi/Imakefile,v 3.2 1999/04/17 09:08:22 dawes ungrdev.o \ ungrdevb.o \ ungrdevk.o - INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC) + INCLUDES = -I../include -I$(EXTINCSRC) -I$(XINCLUDESRC) `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln NormalLibraryTarget(xinput,$(OBJS)) diff --git a/nx-X11/programs/Xserver/composite/Imakefile b/nx-X11/programs/Xserver/composite/Imakefile index c45aa7f6a..f121e0bbe 100644 --- a/nx-X11/programs/Xserver/composite/Imakefile +++ b/nx-X11/programs/Xserver/composite/Imakefile @@ -6,7 +6,8 @@ INCLUDES = -I../include -I../mi -I../Xext -I../render -I../xfixes \ -I../damageext -I../miext/damage -I$(EXTINCSRC) \ - -I$(XINCLUDESRC) + -I$(XINCLUDESRC) \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln diff --git a/nx-X11/programs/Xserver/damageext/Imakefile b/nx-X11/programs/Xserver/damageext/Imakefile index f7ce4573b..24dcee85c 100644 --- a/nx-X11/programs/Xserver/damageext/Imakefile +++ b/nx-X11/programs/Xserver/damageext/Imakefile @@ -5,7 +5,8 @@ OBJS = damageext.o INCLUDES = -I../include -I../Xext -I../render -I../xfixes -I../miext/damage \ - -I$(EXTINCSRC) -I$(XINCLUDESRC) + -I$(EXTINCSRC) -I$(XINCLUDESRC) \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln diff --git a/nx-X11/programs/Xserver/dbe/Imakefile b/nx-X11/programs/Xserver/dbe/Imakefile index 9d9c3fd67..5e5eac4a1 100644 --- a/nx-X11/programs/Xserver/dbe/Imakefile +++ b/nx-X11/programs/Xserver/dbe/Imakefile @@ -17,7 +17,7 @@ XCOMM $XFree86: xc/programs/Xserver/dbe/Imakefile,v 3.10 2001/01/17 22:36:41 daw SRCS = dbe.c midbe.c OBJS = dbe.o midbe.o - INCLUDES = -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) $(EXTRAINCLUDES) + INCLUDES = -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(EXTINCSRC) $(EXTRAINCLUDES) `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln NormalLibraryObjectRule() diff --git a/nx-X11/programs/Xserver/dix/Imakefile b/nx-X11/programs/Xserver/dix/Imakefile index 47e617718..22b21eb95 100644 --- a/nx-X11/programs/Xserver/dix/Imakefile +++ b/nx-X11/programs/Xserver/dix/Imakefile @@ -25,7 +25,8 @@ OBJS = atom.o colormap.o cursor.o devices.o dispatch.o dixutils.o events.o \ tables.o window.o initatoms.o dixfonts.o privates.o pixmap.o $(FFS_OBJ) INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \ - -I$(SERVERSRC)/Xext -I$(SERVERSRC)/lbx + -I$(SERVERSRC)/Xext -I$(SERVERSRC)/lbx \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../os/llib-los.ln /* diff --git a/nx-X11/programs/Xserver/fb/Imakefile b/nx-X11/programs/Xserver/fb/Imakefile index 489d6a201..662a70717 100644 --- a/nx-X11/programs/Xserver/fb/Imakefile +++ b/nx-X11/programs/Xserver/fb/Imakefile @@ -123,7 +123,8 @@ OBJS = $(XFMODOBJ) \ INCLUDES = -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) \ -I$(XF86SRC)/common $(EXTRAINCLUDES) \ - -I$(SERVERSRC)/render -I$(EXTINCSRC) -I$(SERVERSRC)/Xext + -I$(SERVERSRC)/render -I$(EXTINCSRC) -I$(SERVERSRC)/Xext \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln $(SERVERSRC)/os/llib-los.ln \ $(SERVERSRC)/mi/llib-lmi.ln diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index 160d01e60..b0aff4b07 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -141,7 +141,8 @@ INCLUDES = -I. -I../../../../../nxcomp -I../../../../../nxcompext -I../../../../ -I../../GL/glx -I../../GL/include -I../../../../lib/GL/include -I../../Xext \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ $(VFBINCLUDES) \ - `pkg-config --cflags-only-I libxml-2.0` + `pkg-config --cflags-only-I libxml-2.0` \ + `pkg-config --cflags-only-I pixman-1` #ifdef SunArchitecture INCLUDES = -I. -I../../../../../nxcomp -I../../../../../nxcompext -I../../../../../nxcompshad \ -I../../../../extras/Mesa/include \ @@ -153,6 +154,7 @@ INCLUDES = -I. -I../../../../../nxcomp -I../../../../../nxcompext -I../../../../ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ $(VFBINCLUDES) \ `pkg-config --cflags-only-I libxml-2.0` + `pkg-config --cflags-only-I pixman-1` #else #ifdef cygwinArchitecture INCLUDES = -I. -I$(XBUILDINCDIR) \ @@ -164,6 +166,7 @@ INCLUDES = -I. -I$(XBUILDINCDIR) \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ $(VFBINCLUDES) \ `pkg-config --cflags-only-I libxml-2.0` + `pkg-config --cflags-only-I pixman-1` #endif #endif diff --git a/nx-X11/programs/Xserver/include/scrnintstr.h b/nx-X11/programs/Xserver/include/scrnintstr.h index 0539ca516..2597d6b67 100644 --- a/nx-X11/programs/Xserver/include/scrnintstr.h +++ b/nx-X11/programs/Xserver/include/scrnintstr.h @@ -709,6 +709,10 @@ typedef struct _Screen { } ScreenRec; +static inline RegionPtr BitmapToRegion(ScreenPtr _pScreen, PixmapPtr pPix) { + return (*(_pScreen)->BitmapToRegion)(pPix); /* no mi version?! */ +} + typedef struct _ScreenInfo { int imageByteOrder; int bitmapScanlineUnit; diff --git a/nx-X11/programs/Xserver/mi/Imakefile b/nx-X11/programs/Xserver/mi/Imakefile index e62fb0005..290f85790 100644 --- a/nx-X11/programs/Xserver/mi/Imakefile +++ b/nx-X11/programs/Xserver/mi/Imakefile @@ -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/miext/cw/Imakefile b/nx-X11/programs/Xserver/miext/cw/Imakefile index 39106ac13..795ed1987 100755 --- a/nx-X11/programs/Xserver/miext/cw/Imakefile +++ b/nx-X11/programs/Xserver/miext/cw/Imakefile @@ -7,7 +7,8 @@ OBJS = cw.o cw_ops.o cw_render.o INCLUDES = -I../../mi -I../../fb -I../../render -I../../composite \ -I../../include -I$(XINCLUDESRC) $(EXTRAINCLUDES) \ - -I$(EXTINCSRC) + -I$(EXTINCSRC) \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \ ../../mi/llib-lmi.ln diff --git a/nx-X11/programs/Xserver/miext/damage/Imakefile b/nx-X11/programs/Xserver/miext/damage/Imakefile index 7fa745b65..a28786203 100755 --- a/nx-X11/programs/Xserver/miext/damage/Imakefile +++ b/nx-X11/programs/Xserver/miext/damage/Imakefile @@ -11,7 +11,8 @@ OBJS = damage.o INCLUDES = -I. -I../shadow -I../../mi -I../../fb -I../../include -I$(XINCLUDESRC) \ -I$(XF86SRC)/common $(EXTRAINCLUDES) \ - -I../../render -I../cw -I$(EXTINCSRC) + -I../../render -I../cw -I$(EXTINCSRC) \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \ ../../mi/llib-lmi.ln diff --git a/nx-X11/programs/Xserver/os/Imakefile b/nx-X11/programs/Xserver/os/Imakefile index 18bb9804d..5245b7841 100644 --- a/nx-X11/programs/Xserver/os/Imakefile +++ b/nx-X11/programs/Xserver/os/Imakefile @@ -158,7 +158,8 @@ BOOTSTRAPCFLAGS = $(RANDOM_DEFINES) $(BUGMSG) $(XTRANS_FAILDEFINES) $(NX_DEFINES) INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \ -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ - -I$(TOP)/lib/Xau Krb5Includes $(NX_INCLUDES) + -I$(TOP)/lib/Xau Krb5Includes $(NX_INCLUDES) \ + `pkg-config --cflags-only-I pixman-1` DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) \ $(TRANS_INCLUDES) $(CONNECTION_FLAGS) $(GETPEER_DEFINES) \ DependDefines diff --git a/nx-X11/programs/Xserver/randr/Imakefile b/nx-X11/programs/Xserver/randr/Imakefile index 19f8143e4..7f920aece 100644 --- a/nx-X11/programs/Xserver/randr/Imakefile +++ b/nx-X11/programs/Xserver/randr/Imakefile @@ -23,7 +23,9 @@ XCOMM $XFree86: xc/programs/Xserver/randr/Imakefile,v 1.1 2001/05/23 03:29:44 ke INCLUDES = -I../include -I../mi \ -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ - -I../render + -I../render \ + `pkg-config --cflags-only-I pixman-1` + LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln DEFINES = -DNXAGENT_SERVER diff --git a/nx-X11/programs/Xserver/record/Imakefile b/nx-X11/programs/Xserver/record/Imakefile index 4d4bf6a73..c24cbb0d9 100644 --- a/nx-X11/programs/Xserver/record/Imakefile +++ b/nx-X11/programs/Xserver/record/Imakefile @@ -16,7 +16,7 @@ XCOMM $XFree86: xc/programs/Xserver/record/Imakefile,v 1.12 2001/11/02 23:29:34 #endif SRCS = record.c set.c OBJS = record.o set.o - INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext + INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln DEFINES = -DNDEBUG diff --git a/nx-X11/programs/Xserver/render/Imakefile b/nx-X11/programs/Xserver/render/Imakefile index 1331b1fb4..23f9476ea 100644 --- a/nx-X11/programs/Xserver/render/Imakefile +++ b/nx-X11/programs/Xserver/render/Imakefile @@ -29,7 +29,8 @@ XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.10 2002/11/23 02:38:15 INCLUDES = -I. -I../include -I../mi \ -I../fb -I../hw/kdrive -I$(EXTINCSRC) -I$(XINCLUDESRC) \ - -I../Xext + -I../Xext \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln NormalLibraryTarget(render,$(OBJS)) diff --git a/nx-X11/programs/Xserver/xfixes/Imakefile b/nx-X11/programs/Xserver/xfixes/Imakefile index e467ed149..84f7c6f16 100755 --- a/nx-X11/programs/Xserver/xfixes/Imakefile +++ b/nx-X11/programs/Xserver/xfixes/Imakefile @@ -5,7 +5,8 @@ OBJS = cursor.o region.o saveset.o select.o xfixes.o INCLUDES = -I. -I../include -I../Xext -I../fixes -I../render \ - -I$(EXTINCSRC) -I$(XINCLUDESRC) + -I$(EXTINCSRC) -I$(XINCLUDESRC) \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln diff --git a/nx-X11/programs/Xserver/xkb/Imakefile b/nx-X11/programs/Xserver/xkb/Imakefile index 2ac6fe32d..e63ca4462 100644 --- a/nx-X11/programs/Xserver/xkb/Imakefile +++ b/nx-X11/programs/Xserver/xkb/Imakefile @@ -51,7 +51,8 @@ XF86INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) XKBMisc.o XKBMAlloc.o XKBAlloc.o XKBGAlloc.o \ $(XKBXI_OBJS) $(DDX_OBJS) INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) -I$(SERVERSRC)/Xext \ - -I$(SERVERSRC)/mi $(XF86INCLUDES) + -I$(SERVERSRC)/mi $(XF86INCLUDES) \ + `pkg-config --cflags-only-I pixman-1` LINTLIBS = ../dix/llib-ldix.ln ../os/llib-los.ln DEFINES = -DXKB_IN_SERVER $(EXTRA_ALLOC_DEFINES) $(XKB_DDXDEFS) $(NX_DEFINES) diff --git a/nx-libs.spec b/nx-libs.spec index 24287f178..98cee6926 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -29,6 +29,7 @@ BuildRequires: fdupes BuildRequires: pkgconfig(expat) BuildRequires: pkgconfig(libpng) BuildRequires: pkgconfig(libxml-2.0) +BuildRequires: pkgconfig(pixman-1) BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(xext) BuildRequires: pkgconfig(xpm) @@ -44,6 +45,7 @@ BuildRequires: pkgconfig(xinerama) BuildRequires: libexpat-devel BuildRequires: libpng-devel BuildRequires: libxml2-devel +BuildRequires: pixman-devel BuildRequires: xorg-x11-libX11-devel BuildRequires: xorg-x11-libXext-devel BuildRequires: xorg-x11-libXpm-devel @@ -63,6 +65,7 @@ BuildRequires: xorg-x11-util-devel BuildRequires: expat-devel BuildRequires: libpng-devel BuildRequires: libxml2-devel +BuildRequires: pixman-devel BuildRequires: libX11-devel BuildRequires: libXext-devel BuildRequires: libXpm-devel diff --git a/nxcompext/configure.in b/nxcompext/configure.in index eb6604dba..5b9ccc4da 100644 --- a/nxcompext/configure.in +++ b/nxcompext/configure.in @@ -28,6 +28,8 @@ if test -d "../nx-X11/include" ; then LDFLAGS="$LDFLAGS -L../nx-X11/exports/lib" fi +X_CFLAGS=`pkg-config --cflags-only-I pixman-1` + dnl Check for programs. AC_PROG_CXX -- cgit v1.2.3 From 288136514239708fdd8c4d377dad134035d9b734 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Fri, 18 Mar 2016 04:49:09 +0100 Subject: Move mi/miregion.c to dix/region.c v1: Keith Packard v2: Mike Gabriel (backported to nx-libs) --- nx-X11/programs/Xserver/dix/Imakefile | 4 +- nx-X11/programs/Xserver/dix/region.c | 2580 +++++++++++++++++++++++++++++++++ nx-X11/programs/Xserver/mi/Imakefile | 4 +- nx-X11/programs/Xserver/mi/miregion.c | 2578 -------------------------------- 4 files changed, 2584 insertions(+), 2582 deletions(-) create mode 100644 nx-X11/programs/Xserver/dix/region.c delete mode 100644 nx-X11/programs/Xserver/mi/miregion.c diff --git a/nx-X11/programs/Xserver/dix/Imakefile b/nx-X11/programs/Xserver/dix/Imakefile index 22b21eb95..20be46390 100644 --- a/nx-X11/programs/Xserver/dix/Imakefile +++ b/nx-X11/programs/Xserver/dix/Imakefile @@ -17,11 +17,11 @@ FFS_OBJ = ffs.o SRCS = atom.c colormap.c cursor.c devices.c dispatch.c dixutils.c events.c \ extension.c gc.c globals.c glyphcurs.c grabs.c \ - main.c property.c resource.c swaprep.c swapreq.c \ + main.c property.c region.c resource.c swaprep.c swapreq.c \ tables.c window.c initatoms.c dixfonts.c privates.c pixmap.c $(FFS_SRC) OBJS = atom.o colormap.o cursor.o devices.o dispatch.o dixutils.o events.o \ extension.o gc.o globals.o glyphcurs.o grabs.o \ - main.o property.o resource.o swaprep.o swapreq.o \ + main.o property.o region.o resource.o swaprep.o swapreq.o \ tables.o window.o initatoms.o dixfonts.o privates.o pixmap.o $(FFS_OBJ) INCLUDES = -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \ diff --git a/nx-X11/programs/Xserver/dix/region.c b/nx-X11/programs/Xserver/dix/region.c new file mode 100644 index 000000000..410772ff8 --- /dev/null +++ b/nx-X11/programs/Xserver/dix/region.c @@ -0,0 +1,2580 @@ +/* $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 +#endif + +#include + +#include "regionstr.h" +#include +#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 = RegionTop(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 = RegionSizeof(numRects); \ + RegDataPtr NewData = \ + (NewSize > 0) ? (RegDataPtr)xrealloc((reg)->data, NewSize) : NULL; \ + if (NewData) \ + { \ + NewData->size = (numRects); \ + (reg)->data = NewData; \ + } \ +} + + +pixman_box16_t 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 = RegionNumRects(rgn); + size = RegionSize(rgn); + rects = RegionRects(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 = RegionNumRects(reg1); + if (num != RegionNumRects(reg2)) return FALSE; + + rects1 = RegionRects(reg1); + rects2 = RegionRects(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 = RegionNumRects(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 = RegionRects(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 = RegionSizeof(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 = RegionSizeof(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 = RegionSizeof(n); + pRgn->data = (rgnSize > 0) ? xalloc(rgnSize) : NULL; + if (!pRgn->data) + return miRegionBreak (pRgn); + pRgn->data->numRects = 1; + *RegionBoxptr(pRgn) = pRgn->extents; + } + else if (!pRgn->data->size) + { + rgnSize = RegionSizeof(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 = RegionSizeof(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 = RegionSizeof(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 *)RegionBoxptr(dst),(char *)RegionBoxptr(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 = RegionBox(pReg, prevStart); + pCurBox = RegionBox(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 = RegionTop(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 *)RegionTop(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 (RegionNar (reg1) || RegionNar(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 = RegionRects(reg1); + newSize = RegionNumRects(reg1); + r1End = r1 + newSize; + numRects = RegionNumRects(reg2); + r2 = RegionRects(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 = *RegionBoxptr(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 = RegionBoxptr(pReg); + pBoxEnd = RegionEnd(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 = RegionTop(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 (RegionNil(reg1) || RegionNil(reg2) || + !EXTENTCHECK(®1->extents, ®2->extents)) + { + /* Covers about 20% of all cases */ + xfreeData(newReg); + newReg->extents.x2 = newReg->extents.x1; + newReg->extents.y2 = newReg->extents.y1; + if (RegionNar(reg1) || RegionNar(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(®2->extents, ®1->extents)) + { + return miRegionCopy(newReg, reg1); + } + else if (!reg1->data && SUBSUMES(®1->extents, ®2->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 = RegionTop(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 (RegionNil(reg1)) + { + if (RegionNar(reg1)) + return miRegionBreak (newReg); + if (newReg != reg2) + return miRegionCopy(newReg, reg2); + return TRUE; + } + + /* + * Region 2 is empty + */ + if (RegionNil(reg2)) + { + if (RegionNar(reg2)) + return miRegionBreak (newReg); + if (newReg != reg1) + return miRegionCopy(newReg, reg1); + return TRUE; + } + + /* + * Region 1 completely subsumes region 2 + */ + if (!reg1->data && SUBSUMES(®1->extents, ®2->extents)) + { + if (newReg != reg1) + return miRegionCopy(newReg, reg1); + return TRUE; + } + + /* + * Region 2 completely subsumes region 1 + */ + if (!reg2->data && SUBSUMES(®2->extents, ®1->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 (RegionNar(rgn)) + return miRegionBreak (dstrgn); + + if (!rgn->data && (dstrgn->data == &miEmptyData)) + { + dstrgn->extents = rgn->extents; + dstrgn->data = (RegDataPtr)NULL; + return TRUE; + } + + numRects = RegionNumRects(rgn); + if (!numRects) + return TRUE; + prepend = FALSE; + size = numRects; + dnumRects = RegionNumRects(dstrgn); + if (!dnumRects && (size < 200)) + size = 200; /* XXX pick numbers out of a hat */ + RECTALLOC(dstrgn, size); + old = RegionRects(rgn); + if (!dnumRects) + dstrgn->extents = rgn->extents; + else if (dstrgn->extents.x2 > dstrgn->extents.x1) + { + register BoxPtr first, last; + + first = old; + last = RegionBoxptr(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 = RegionBoxptr(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 = RegionBox(dstrgn, numRects); + if (dnumRects == 1) + *new = *RegionBoxptr(dstrgn); + else + memmove((char *)new,(char *)RegionBoxptr(dstrgn), + dnumRects * sizeof(BoxRec)); + new = RegionBoxptr(dstrgn); + } + else + new = RegionBoxptr(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 (RegionNar(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(RegionBoxptr(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 = RegionBoxptr(&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 = RegionEnd(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); + *RegionTop(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); + *RegionTop(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 = RegionEnd(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 (RegionNar (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 = RegionSizeof(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(y1x2 <= 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(x1x1); + 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(x1x2); + 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 (RegionNil(regM) || RegionNil(regS) || + !EXTENTCHECK(®M->extents, ®S->extents)) + { + if (RegionNar (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 (RegionNil(reg1) || !EXTENTCHECK(invRect, ®1->extents)) + { + if (RegionNar(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 = RegionNumRects(region); + /* useful optimization */ + if (!numRects || !EXTENTCHECK(®ion->extents, prect)) + return(rgnOUT); + + if (numRects == 1) + { + /* We know that it must be rgnIN or rgnPART */ + if (SUBSUMES(®ion->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 = RegionBoxptr(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 = RegionBoxptr(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 = RegionBoxptr(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 = *RegionBoxptr(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 = RegionSizeof(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 = RegionNumRects(pReg); + if (!numRects || !INBOX(&pReg->extents, x, y)) + return(FALSE); + if (numRects == 1) + { + *box = pReg->extents; + return(TRUE); + } + for (pbox = RegionBoxptr(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(!RegionNil(pReg)); +} + +Bool +miRegionBroken(RegionPtr pReg) +{ + good(pReg); + return (RegionNar(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 = RegionBoxptr(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 = RegionNumRects(prgn); + pbox = RegionRects(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/Imakefile b/nx-X11/programs/Xserver/mi/Imakefile index 290f85790..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 \ diff --git a/nx-X11/programs/Xserver/mi/miregion.c b/nx-X11/programs/Xserver/mi/miregion.c deleted file mode 100644 index b8216e1bb..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 -#endif - -#include "regionstr.h" -#include -#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 = RegionTop(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 = RegionSizeof(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 = RegionNumRects(rgn); - size = RegionSize(rgn); - rects = RegionRects(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 = RegionNumRects(reg1); - if (num != RegionNumRects(reg2)) return FALSE; - - rects1 = RegionRects(reg1); - rects2 = RegionRects(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 = RegionNumRects(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 = RegionRects(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 = RegionSizeof(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 = RegionSizeof(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 = RegionSizeof(n); - pRgn->data = (rgnSize > 0) ? xalloc(rgnSize) : NULL; - if (!pRgn->data) - return miRegionBreak (pRgn); - pRgn->data->numRects = 1; - *RegionBoxptr(pRgn) = pRgn->extents; - } - else if (!pRgn->data->size) - { - rgnSize = RegionSizeof(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 = RegionSizeof(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 = RegionSizeof(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 *)RegionBoxptr(dst),(char *)RegionBoxptr(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 = RegionBox(pReg, prevStart); - pCurBox = RegionBox(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 = RegionTop(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 *)RegionTop(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 (RegionNar (reg1) || RegionNar(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 = RegionRects(reg1); - newSize = RegionNumRects(reg1); - r1End = r1 + newSize; - numRects = RegionNumRects(reg2); - r2 = RegionRects(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 = *RegionBoxptr(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 = RegionBoxptr(pReg); - pBoxEnd = RegionEnd(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 = RegionTop(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 (RegionNil(reg1) || RegionNil(reg2) || - !EXTENTCHECK(®1->extents, ®2->extents)) - { - /* Covers about 20% of all cases */ - xfreeData(newReg); - newReg->extents.x2 = newReg->extents.x1; - newReg->extents.y2 = newReg->extents.y1; - if (RegionNar(reg1) || RegionNar(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(®2->extents, ®1->extents)) - { - return miRegionCopy(newReg, reg1); - } - else if (!reg1->data && SUBSUMES(®1->extents, ®2->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 = RegionTop(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 (RegionNil(reg1)) - { - if (RegionNar(reg1)) - return miRegionBreak (newReg); - if (newReg != reg2) - return miRegionCopy(newReg, reg2); - return TRUE; - } - - /* - * Region 2 is empty - */ - if (RegionNil(reg2)) - { - if (RegionNar(reg2)) - return miRegionBreak (newReg); - if (newReg != reg1) - return miRegionCopy(newReg, reg1); - return TRUE; - } - - /* - * Region 1 completely subsumes region 2 - */ - if (!reg1->data && SUBSUMES(®1->extents, ®2->extents)) - { - if (newReg != reg1) - return miRegionCopy(newReg, reg1); - return TRUE; - } - - /* - * Region 2 completely subsumes region 1 - */ - if (!reg2->data && SUBSUMES(®2->extents, ®1->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 (RegionNar(rgn)) - return miRegionBreak (dstrgn); - - if (!rgn->data && (dstrgn->data == &miEmptyData)) - { - dstrgn->extents = rgn->extents; - dstrgn->data = (RegDataPtr)NULL; - return TRUE; - } - - numRects = RegionNumRects(rgn); - if (!numRects) - return TRUE; - prepend = FALSE; - size = numRects; - dnumRects = RegionNumRects(dstrgn); - if (!dnumRects && (size < 200)) - size = 200; /* XXX pick numbers out of a hat */ - RECTALLOC(dstrgn, size); - old = RegionRects(rgn); - if (!dnumRects) - dstrgn->extents = rgn->extents; - else if (dstrgn->extents.x2 > dstrgn->extents.x1) - { - register BoxPtr first, last; - - first = old; - last = RegionBoxptr(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 = RegionBoxptr(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 = RegionBox(dstrgn, numRects); - if (dnumRects == 1) - *new = *RegionBoxptr(dstrgn); - else - memmove((char *)new,(char *)RegionBoxptr(dstrgn), - dnumRects * sizeof(BoxRec)); - new = RegionBoxptr(dstrgn); - } - else - new = RegionBoxptr(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 (RegionNar(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(RegionBoxptr(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 = RegionBoxptr(&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 = RegionEnd(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); - *RegionTop(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); - *RegionTop(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 = RegionEnd(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 (RegionNar (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 = RegionSizeof(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(y1x2 <= 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(x1x1); - 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(x1x2); - 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 (RegionNil(regM) || RegionNil(regS) || - !EXTENTCHECK(®M->extents, ®S->extents)) - { - if (RegionNar (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 (RegionNil(reg1) || !EXTENTCHECK(invRect, ®1->extents)) - { - if (RegionNar(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 = RegionNumRects(region); - /* useful optimization */ - if (!numRects || !EXTENTCHECK(®ion->extents, prect)) - return(rgnOUT); - - if (numRects == 1) - { - /* We know that it must be rgnIN or rgnPART */ - if (SUBSUMES(®ion->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 = RegionBoxptr(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 = RegionBoxptr(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 = RegionBoxptr(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 = *RegionBoxptr(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 = RegionSizeof(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 = RegionNumRects(pReg); - if (!numRects || !INBOX(&pReg->extents, x, y)) - return(FALSE); - if (numRects == 1) - { - *box = pReg->extents; - return(TRUE); - } - for (pbox = RegionBoxptr(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(!RegionNil(pReg)); -} - -Bool -miRegionBroken(RegionPtr pReg) -{ - good(pReg); - return (RegionNar(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 = RegionBoxptr(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 = RegionNumRects(prgn); - pbox = RegionRects(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); -} -- cgit v1.2.3 From b0e69fe350d9ede82b1c2238df2d43028c868204 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 13:05:05 +0100 Subject: Change region implementation names to eliminate the 'mi' prefix This prepares the file to be moved from mi to dix. This patch was done mechanically with the included scripts 'fix-miregion' run over the entire X server and 'fix-miregion-private' run over include/regionstr.h and mi/miregion.c. v1: Keith Packard v2: Mike Gabriel (backported to nx-libs) --- nx-X11/programs/Xserver/dix/region.c | 978 ++------------------------ nx-X11/programs/Xserver/dix/window.c | 4 +- nx-X11/programs/Xserver/fb/fbpixmap.c | 4 +- nx-X11/programs/Xserver/fix-miregion | 29 + nx-X11/programs/Xserver/fix-miregion-private | 14 + nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 4 +- nx-X11/programs/Xserver/include/regionstr.h | 60 +- nx-X11/programs/Xserver/mi/mi.h | 11 +- nx-X11/programs/Xserver/mi/migc.c | 1 + nx-X11/programs/Xserver/mi/miscrinit.c | 44 +- nx-X11/programs/Xserver/mi/mispans.h | 2 +- 11 files changed, 178 insertions(+), 973 deletions(-) create mode 100755 nx-X11/programs/Xserver/fix-miregion create mode 100755 nx-X11/programs/Xserver/fix-miregion-private diff --git a/nx-X11/programs/Xserver/dix/region.c b/nx-X11/programs/Xserver/dix/region.c index 410772ff8..e927b9fde 100644 --- a/nx-X11/programs/Xserver/dix/region.c +++ b/nx-X11/programs/Xserver/dix/region.c @@ -86,8 +86,6 @@ Equipment Corporation. #include "regionstr.h" #include #include "gc.h" -#include "mi.h" -#include "mispans.h" #if defined (__GNUC__) && !defined (NO_INLINES) #define INLINE __inline @@ -104,7 +102,7 @@ Equipment Corporation. #define assert(expr) #endif -#define good(reg) assert(miValidRegion(reg)) +#define good(reg) assert(RegionIsValid(reg)) /* * The functions in this file implement the Region abstraction used extensively @@ -147,7 +145,7 @@ Equipment Corporation. * * 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 + * and added RegionValidate 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. @@ -178,11 +176,11 @@ Equipment Corporation. #define RECTALLOC_BAIL(pReg,n,bail) \ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ - if (!miRectAlloc(pReg, n)) { goto bail; } + if (!RegionRectAlloc(pReg, n)) { goto bail; } #define RECTALLOC(pReg,n) \ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ - if (!miRectAlloc(pReg, n)) { return FALSE; } + if (!RegionRectAlloc(pReg, n)) { return FALSE; } #define ADDRECT(pNextRect,nx1,ny1,nx2,ny2) \ { \ @@ -197,7 +195,7 @@ if (!(pReg)->data || (((pReg)->data->numRects + (n)) > (pReg)->data->size)) \ { \ if (!(pReg)->data || ((pReg)->data->numRects == (pReg)->data->size))\ { \ - if (!miRectAlloc(pReg, 1)) \ + if (!RegionRectAlloc(pReg, 1)) \ return FALSE; \ pNextRect = RegionTop(pReg); \ } \ @@ -221,15 +219,15 @@ if (((numRects) < ((reg)->data->size >> 1)) && ((reg)->data->size > 50)) \ } -pixman_box16_t miEmptyBox = {0, 0, 0, 0}; -RegDataRec miEmptyData = {0, 0}; +pixman_box16_t RegionEmptyBox = {0, 0, 0, 0}; +RegDataRec RegionEmptyData = {0, 0}; -RegDataRec miBrokenData = {0, 0}; -RegionRec miBrokenRegion = { { 0, 0, 0, 0 }, &miBrokenData }; +RegDataRec RegionBrokenData = {0, 0}; +RegionRec RegionBrokenRegion = { { 0, 0, 0, 0 }, &RegionBrokenData }; #ifdef DEBUG int -miPrintRegion(rgn) +RegionPrint(rgn) RegionPtr rgn; { int num, size; @@ -250,36 +248,9 @@ miPrintRegion(rgn) } #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 = RegionNumRects(reg1); - if (num != RegionNumRects(reg2)) return FALSE; - - rects1 = RegionRects(reg1); - rects2 = RegionRects(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) +RegionIsValid(reg) RegionPtr reg; { register int i, numRects; @@ -291,7 +262,7 @@ miValidRegion(reg) if (!numRects) return ((reg->extents.x1 == reg->extents.x2) && (reg->extents.y1 == reg->extents.y2) && - (reg->data->size || (reg->data == &miEmptyData))); + (reg->data->size || (reg->data == &RegionEmptyData))); else if (numRects == 1) return (!reg->data); else @@ -334,7 +305,7 @@ miValidRegion(reg) *****************************************************************/ RegionPtr -miRegionCreate(rect, size) +RegionCreate(rect, size) BoxPtr rect; int size; { @@ -342,7 +313,7 @@ miRegionCreate(rect, size) size_t newSize; pReg = (RegionPtr)xalloc(sizeof(RegionRec)); if (!pReg) - return &miBrokenRegion; + return &RegionBrokenRegion; if (rect) { pReg->extents = *rect; @@ -350,7 +321,7 @@ miRegionCreate(rect, size) } else { - pReg->extents = miEmptyBox; + pReg->extents = RegionEmptyBox; newSize = RegionSizeof(size); if ((size > 1) && (newSize > 0) && (pReg->data = xalloc(newSize))) @@ -359,74 +330,33 @@ miRegionCreate(rect, size) pReg->data->numRects = 0; } else - pReg->data = &miEmptyData; + pReg->data = &RegionEmptyData; } 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 = RegionSizeof(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) +RegionDestroy(pReg) RegionPtr pReg; { good(pReg); xfreeData(pReg); - if (pReg != &miBrokenRegion) + if (pReg != &RegionBrokenRegion) xfree(pReg); } -void -miRegionUninit(pReg) - RegionPtr pReg; -{ - good(pReg); - xfreeData(pReg); -} - Bool -miRegionBreak (pReg) +RegionBreak (pReg) RegionPtr pReg; { xfreeData (pReg); - pReg->extents = miEmptyBox; - pReg->data = &miBrokenData; + pReg->extents = RegionEmptyBox; + pReg->data = &RegionBrokenData; return FALSE; } Bool -miRectAlloc( +RegionRectAlloc( register RegionPtr pRgn, int n) { @@ -439,7 +369,7 @@ miRectAlloc( rgnSize = RegionSizeof(n); pRgn->data = (rgnSize > 0) ? xalloc(rgnSize) : NULL; if (!pRgn->data) - return miRegionBreak (pRgn); + return RegionBreak (pRgn); pRgn->data->numRects = 1; *RegionBoxptr(pRgn) = pRgn->extents; } @@ -448,7 +378,7 @@ miRectAlloc( rgnSize = RegionSizeof(n); pRgn->data = (rgnSize > 0) ? xalloc(rgnSize) : NULL; if (!pRgn->data) - return miRegionBreak (pRgn); + return RegionBreak (pRgn); pRgn->data->numRects = 0; } else @@ -463,44 +393,13 @@ miRectAlloc( rgnSize = RegionSizeof(n); data = (rgnSize > 0) ? xrealloc(pRgn->data, rgnSize) : NULL; if (!data) - return miRegionBreak (pRgn); + return RegionBreak (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 = RegionSizeof(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 *)RegionBoxptr(dst),(char *)RegionBoxptr(src), - dst->data->numRects * sizeof(BoxRec)); - return TRUE; -} /*====================================================================== @@ -509,10 +408,10 @@ miRegionCopy(dst, src) /*- *----------------------------------------------------------------------- - * miCoalesce -- + * RegionCoalesce -- * 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. + * the end of the rects array. Used only by RegionOp. * * Results: * The new index for the previous band. @@ -526,7 +425,7 @@ miRegionCopy(dst, src) *----------------------------------------------------------------------- */ INLINE static int -miCoalesce ( +RegionCoalesce ( register RegionPtr pReg, /* Region to coalesce */ int prevStart, /* Index of start of previous band */ int curStart) /* Index of start of current band */ @@ -583,18 +482,18 @@ miCoalesce ( } -/* Quicky macro to avoid trivial reject procedure calls to miCoalesce */ +/* Quicky macro to avoid trivial reject procedure calls to RegionCoalesce */ #define Coalesce(newReg, prevBand, curBand) \ if (curBand - prevBand == newReg->data->numRects - curBand) { \ - prevBand = miCoalesce(newReg, prevBand, curBand); \ + prevBand = RegionCoalesce(newReg, prevBand, curBand); \ } else { \ prevBand = curBand; \ } /*- *----------------------------------------------------------------------- - * miAppendNonO -- + * RegionAppendNonO -- * 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. @@ -610,7 +509,7 @@ miCoalesce ( */ INLINE static Bool -miAppendNonO ( +RegionAppendNonO ( register RegionPtr pReg, register BoxPtr r, BoxPtr rEnd, @@ -660,9 +559,9 @@ miAppendNonO ( /*- *----------------------------------------------------------------------- - * miRegionOp -- - * Apply an operation to two regions. Called by miUnion, miInverse, - * miSubtract, miIntersect.... Both regions MUST have at least one + * RegionOp -- + * Apply an operation to two regions. Called by RegionUnion, RegionInverse, + * RegionSubtract, RegionIntersect.... Both regions MUST have at least one * rectangle, and cannot be the same object. * * Results: @@ -698,7 +597,7 @@ typedef Bool (*OverlapProcPtr)( Bool *pOverlap); static Bool -miRegionOp( +RegionOp( RegionPtr newReg, /* Place to store result */ RegionPtr reg1, /* First region in operation */ RegionPtr reg2, /* 2d region in operation */ @@ -734,7 +633,7 @@ miRegionOp( * Break any region computed from a broken region */ if (RegionNar (reg1) || RegionNar(reg2)) - return miRegionBreak (newReg); + return RegionBreak (newReg); /* * Initialization: @@ -758,18 +657,18 @@ miRegionOp( ((newReg == reg2) && (numRects > 1))) { oldData = newReg->data; - newReg->data = &miEmptyData; + newReg->data = &RegionEmptyData; } /* guess at new size */ if (numRects > newSize) newSize = numRects; newSize <<= 1; if (!newReg->data) - newReg->data = &miEmptyData; + newReg->data = &RegionEmptyData; else if (newReg->data->size) newReg->data->numRects = 0; if (newSize > newReg->data->size) - if (!miRectAlloc(newReg, newSize)) + if (!RegionRectAlloc(newReg, newSize)) return FALSE; /* @@ -790,7 +689,7 @@ miRegionOp( /* * prevBand serves to mark the start of the previous band so rectangles - * can be coalesced into larger rectangles. qv. miCoalesce, above. + * can be coalesced into larger rectangles. qv. RegionCoalesce, 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 @@ -827,7 +726,7 @@ miRegionOp( bot = min(r1->y2, r2y1); if (top != bot) { curBand = newReg->data->numRects; - miAppendNonO(newReg, r1, r1BandEnd, top, bot); + RegionAppendNonO(newReg, r1, r1BandEnd, top, bot); Coalesce(newReg, prevBand, curBand); } } @@ -838,7 +737,7 @@ miRegionOp( bot = min(r2->y2, r1y1); if (top != bot) { curBand = newReg->data->numRects; - miAppendNonO(newReg, r2, r2BandEnd, top, bot); + RegionAppendNonO(newReg, r2, r2BandEnd, top, bot); Coalesce(newReg, prevBand, curBand); } } @@ -880,7 +779,7 @@ miRegionOp( /* 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); + RegionAppendNonO(newReg, r1, r1BandEnd, max(r1y1, ybot), r1->y2); Coalesce(newReg, prevBand, curBand); /* Just append the rest of the boxes */ AppendRegions(newReg, r1BandEnd, r1End); @@ -889,7 +788,7 @@ miRegionOp( /* 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); + RegionAppendNonO(newReg, r2, r2BandEnd, max(r2y1, ybot), r2->y2); Coalesce(newReg, prevBand, curBand); /* Append rest of boxes */ AppendRegions(newReg, r2BandEnd, r2End); @@ -901,7 +800,7 @@ miRegionOp( if (!(numRects = newReg->data->numRects)) { xfreeData(newReg); - newReg->data = &miEmptyData; + newReg->data = &RegionEmptyData; } else if (numRects == 1) { @@ -919,10 +818,10 @@ miRegionOp( /*- *----------------------------------------------------------------------- - * miSetExtents -- + * RegionSetExtents -- * 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. + * RegionSubtract and RegionIntersect as they can't figure it out along the + * way or do so easily, as RegionUnion can. * * Results: * None. @@ -933,7 +832,7 @@ miRegionOp( *----------------------------------------------------------------------- */ void -miSetExtents (pReg) +RegionSetExtents (pReg) register RegionPtr pReg; { register BoxPtr pBox, pBoxEnd; @@ -974,132 +873,6 @@ miSetExtents (pReg) 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 = RegionTop(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 (RegionNil(reg1) || RegionNil(reg2) || - !EXTENTCHECK(®1->extents, ®2->extents)) - { - /* Covers about 20% of all cases */ - xfreeData(newReg); - newReg->extents.x2 = newReg->extents.x1; - newReg->extents.y2 = newReg->extents.y1; - if (RegionNar(reg1) || RegionNar(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(®2->extents, ®1->extents)) - { - return miRegionCopy(newReg, reg1); - } - else if (!reg1->data && SUBSUMES(®1->extents, ®2->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) { \ @@ -1121,7 +894,7 @@ miIntersect(newReg, reg1, reg2) /*- *----------------------------------------------------------------------- - * miUnionO -- + * RegionUnionO -- * Handle an overlapping band for the union operation. Picks the * left-most rectangle each time and merges it into the region. * @@ -1135,7 +908,7 @@ miIntersect(newReg, reg1, reg2) *----------------------------------------------------------------------- */ static Bool -miUnionO ( +RegionUnionO ( register RegionPtr pReg, register BoxPtr r1, BoxPtr r1End, @@ -1194,97 +967,19 @@ miUnionO ( 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 (RegionNil(reg1)) - { - if (RegionNar(reg1)) - return miRegionBreak (newReg); - if (newReg != reg2) - return miRegionCopy(newReg, reg2); - return TRUE; - } - - /* - * Region 2 is empty - */ - if (RegionNil(reg2)) - { - if (RegionNar(reg2)) - return miRegionBreak (newReg); - if (newReg != reg1) - return miRegionCopy(newReg, reg1); - return TRUE; - } - - /* - * Region 1 completely subsumes region 2 - */ - if (!reg1->data && SUBSUMES(®1->extents, ®2->extents)) - { - if (newReg != reg1) - return miRegionCopy(newReg, reg1); - return TRUE; - } - - /* - * Region 2 completely subsumes region 1 - */ - if (!reg2->data && SUBSUMES(®2->extents, ®1->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 -- + * RegionAppend -- * * "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. + * call RegionValidate to ensure that a valid region is constructed. * * Results: * TRUE if successful. @@ -1294,7 +989,7 @@ miUnion(newReg, reg1, reg2) * */ Bool -miRegionAppend(dstrgn, rgn) +RegionAppend(dstrgn, rgn) register RegionPtr dstrgn; register RegionPtr rgn; { @@ -1303,9 +998,9 @@ miRegionAppend(dstrgn, rgn) Bool prepend; if (RegionNar(rgn)) - return miRegionBreak (dstrgn); + return RegionBreak (dstrgn); - if (!rgn->data && (dstrgn->data == &miEmptyData)) + if (!rgn->data && (dstrgn->data == &RegionEmptyData)) { dstrgn->extents = rgn->extents; dstrgn->data = (RegDataPtr)NULL; @@ -1449,7 +1144,7 @@ QuickSortRects( /*- *----------------------------------------------------------------------- - * miRegionValidate -- + * RegionValidate -- * * 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 @@ -1473,14 +1168,14 @@ QuickSortRects( * 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 + * RegionUnion. Maximize the work each RegionUnion call does by using * a binary merge. * *----------------------------------------------------------------------- */ Bool -miRegionValidate(badreg, pOverlap) +RegionValidate(badreg, pOverlap) RegionPtr badreg; Bool *pOverlap; { @@ -1542,7 +1237,7 @@ miRegionValidate(badreg, pOverlap) /* 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); + return RegionBreak (badreg); sizeRI = 4; numRI = 1; ri[0].prevBand = 0; @@ -1615,7 +1310,7 @@ miRegionValidate(badreg, pOverlap) rit->curBand = 0; rit->reg.extents = *box; rit->reg.data = (RegDataPtr)NULL; - if (!miRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */ + if (!RegionRectAlloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */ goto bail; NextRect: ; } /* for i */ @@ -1645,7 +1340,7 @@ NextRect: ; { reg = &ri[j].reg; hreg = &ri[j+half].reg; - if (!miRegionOp(reg, reg, hreg, miUnionO, TRUE, TRUE, pOverlap)) + if (!RegionOp(reg, reg, hreg, RegionUnionO, TRUE, TRUE, pOverlap)) ret = FALSE; if (hreg->extents.x1 < reg->extents.x1) reg->extents.x1 = hreg->extents.x1; @@ -1667,11 +1362,11 @@ bail: for (i = 0; i < numRI; i++) xfreeData(&ri[i].reg); xfree (ri); - return miRegionBreak (badreg); + return RegionBreak (badreg); } RegionPtr -miRectsToRegion(nrects, prect, ctype) +RegionFromRects(nrects, prect, ctype) int nrects; register xRectangle *prect; int ctype; @@ -1683,7 +1378,7 @@ miRectsToRegion(nrects, prect, ctype) int x1, y1, x2, y2; size_t newSize; - pRgn = miRegionCreate(NullBox, 0); + pRgn = RegionCreate(NullBox, 0); if (RegionNar (pRgn)) return pRgn; if (!nrects) @@ -1710,7 +1405,7 @@ miRectsToRegion(nrects, prect, ctype) pData = newSize > 0 ? xalloc(newSize) : NULL; if (!pData) { - miRegionBreak (pRgn); + RegionBreak (pRgn); return pRgn; } pBox = (BoxPtr) (pData + 1); @@ -1740,10 +1435,10 @@ miRectsToRegion(nrects, prect, ctype) { Bool overlap; /* result ignored */ pRgn->extents.x1 = pRgn->extents.x2 = 0; - miRegionValidate(pRgn, &overlap); + RegionValidate(pRgn, &overlap); } else - miSetExtents(pRgn); + RegionSetExtents(pRgn); good(pRgn); } else @@ -1753,456 +1448,6 @@ miRectsToRegion(nrects, prect, ctype) 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(y1x2 <= 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(x1x1); - 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(x1x2); - 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 (RegionNil(regM) || RegionNil(regS) || - !EXTENTCHECK(®M->extents, ®S->extents)) - { - if (RegionNar (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 (RegionNil(reg1) || !EXTENTCHECK(invRect, ®1->extents)) - { - if (RegionNar(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 = RegionNumRects(region); - /* useful optimization */ - if (!numRects || !EXTENTCHECK(®ion->extents, prect)) - return(rgnOUT); - - if (numRects == 1) - { - /* We know that it must be rgnIN or rgnPART */ - if (SUBSUMES(®ion->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 = RegionBoxptr(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 = RegionBoxptr(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 = RegionBoxptr(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 = *RegionBoxptr(pReg); - xfreeData(pReg); - pReg->data = (RegDataPtr)NULL; - } - else - miSetExtents(pReg); - } - } -} - Bool miRegionDataCopy( register RegionPtr dst, @@ -2226,94 +1471,13 @@ miRegionDataCopy( xfreeData(dst); dst->data = newSize > 0 ? xalloc(newSize) : NULL; if (!dst->data) - return miRegionBreak (dst); + return RegionBreak (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 = RegionNumRects(pReg); - if (!numRects || !INBOX(&pReg->extents, x, y)) - return(FALSE); - if (numRects == 1) - { - *box = pReg->extents; - return(TRUE); - } - for (pbox = RegionBoxptr(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(!RegionNil(pReg)); -} - -Bool -miRegionBroken(RegionPtr pReg) -{ - good(pReg); - return (RegionNar(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; \ @@ -2433,7 +1597,7 @@ static void QuickSortSpans( */ int -miClipSpans( +RegionClipSpans( RegionPtr prgnDst, register DDXPointPtr ppt, register int *pwidth, diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index ce94dc8a5..916d7e276 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -180,7 +180,7 @@ PrintChildren(WindowPtr p1, int indent) p2 = p1->firstChild; for (i=0; idrawable.id); - miPrintRegion(&p1->clipList); + RegionPrint(&p1->clipList); PrintChildren(p2, indent+4); p1 = p1->nextSib; } @@ -195,7 +195,7 @@ PrintWindowTree() { ErrorF( "WINDOW %d\n", i); pWin = WindowTable[i]; - miPrintRegion(&pWin->clipList); + RegionPrint(&pWin->clipList); p1 = pWin->firstChild; PrintChildren(p1, 4); } diff --git a/nx-X11/programs/Xserver/fb/fbpixmap.c b/nx-X11/programs/Xserver/fb/fbpixmap.c index 6c2cafd94..99c03862b 100644 --- a/nx-X11/programs/Xserver/fb/fbpixmap.c +++ b/nx-X11/programs/Xserver/fb/fbpixmap.c @@ -118,7 +118,7 @@ if (((rx1) < (rx2)) && ((ry1) < (ry2)) && \ { \ if ((reg)->data->numRects == (reg)->data->size) \ { \ - miRectAlloc(reg, 1); \ + RegionRectAlloc(reg, 1); \ fr = RegionBoxptr(reg); \ r = fr + (reg)->data->numRects; \ } \ @@ -314,7 +314,7 @@ fbPixmapToRegion(PixmapPtr pPix) } } #ifdef DEBUG - if (!miValidRegion(pReg)) + if (!RegionIsValid(pReg)) FatalError("Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); #endif return(pReg); diff --git a/nx-X11/programs/Xserver/fix-miregion b/nx-X11/programs/Xserver/fix-miregion new file mode 100755 index 000000000..fc502bbfd --- /dev/null +++ b/nx-X11/programs/Xserver/fix-miregion @@ -0,0 +1,29 @@ +#!/bin/sh +sed -i \ +-e 's/miRegionCreate\b/RegionCreate/g' \ +-e 's/miRegionInit\b/RegionInit/g' \ +-e 's/miRegionDestroy\b/RegionDestroy/g' \ +-e 's/miRegionUninit\b/RegionUninit/g' \ +-e 's/miRegionCopy\b/RegionCopy/g' \ +-e 's/miIntersect\b/RegionIntersect/g' \ +-e 's/miUnion\b/RegionUnion/g' \ +-e 's/miRegionAppend\b/RegionAppend/g' \ +-e 's/miRegionValidate\b/RegionValidate/g' \ +-e 's/miRectsToRegion\b/RegionFromRects/g' \ +-e 's/miSubtract\b/RegionSubtract/g' \ +-e 's/miInverse\b/RegionInverse/g' \ +-e 's/miRectIn\b/RegionContainsRect/g' \ +-e 's/miTranslateRegion\b/RegionTranslate/g' \ +-e 's/miRegionReset\b/RegionReset/g' \ +-e 's/miRegionBreak\b/RegionBreak/g' \ +-e 's/miPointInRegion\b/RegionContainsPoint/g' \ +-e 's/miRegionEqual\b/RegionEqual/g' \ +-e 's/miRegionNotEmpty\b/RegionNotEmpty/g' \ +-e 's/miRegionEmpty\b/RegionEmpty/g' \ +-e 's/miRegionExtents\b/RegionExtents/g' \ +-e 's/miPrintRegion\b/RegionPrint/g' \ +-e 's/miRectAlloc\b/RegionRectAlloc/g' \ +-e 's/miValidRegion\b/RegionIsValid/g' \ +-e 's/miRegionBroken\b/RegionBroken/g' \ +-e 's/miClipSpans\b/RegionClipSpans/g' \ +"$@" diff --git a/nx-X11/programs/Xserver/fix-miregion-private b/nx-X11/programs/Xserver/fix-miregion-private new file mode 100755 index 000000000..ebc24fac0 --- /dev/null +++ b/nx-X11/programs/Xserver/fix-miregion-private @@ -0,0 +1,14 @@ +#!/bin/sh +sed -i \ +-e 's/miEmptyBox\b/RegionEmptyBox/g' \ +-e 's/miEmptyData\b/RegionEmptyData/g' \ +-e 's/miBrokenData\b/RegionBrokenData/g' \ +-e 's/miBrokenRegion\b/RegionBrokenRegion/g' \ +-e 's/miCoalesce\b/RegionCoalesce/g' \ +-e 's/miAppendNonO\b/RegionAppendNonO/g' \ +-e 's/miRegionOp\b/RegionOp/g' \ +-e 's/miSetExtents\b/RegionSetExtents/g' \ +-e 's/miIntersectO\b/RegionIntersectO/g' \ +-e 's/miUnionO\b/RegionUnionO/g' \ +-e 's/miSubtractO\b/RegionSubtractO/g' \ +"$@" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index a3d791ff8..89b7c617c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -226,7 +226,7 @@ PrintChildren(WindowPtr p1, int indent) p2 = p1->firstChild; for (i=0; idrawable.id); - miPrintRegion(&p1->clipList); + RegionPrint(&p1->clipList); PrintChildren(p2, indent+4); p1 = p1->nextSib; } @@ -241,7 +241,7 @@ PrintWindowTree() { ErrorF( "WINDOW %d\n", i); pWin = WindowTable[i]; - miPrintRegion(&pWin->clipList); + RegionPrint(&pWin->clipList); p1 = pWin->firstChild; PrintChildren(p1, 4); } diff --git a/nx-X11/programs/Xserver/include/regionstr.h b/nx-X11/programs/Xserver/include/regionstr.h index c61acc003..8ddc62af2 100644 --- a/nx-X11/programs/Xserver/include/regionstr.h +++ b/nx-X11/programs/Xserver/include/regionstr.h @@ -74,16 +74,16 @@ typedef struct pixman_region16 RegionRec, *RegionPtr; typedef struct pixman_region16_data RegDataRec, *RegDataPtr; -extern BoxRec miEmptyBox; -extern RegDataRec miEmptyData; -extern RegDataRec miBrokenData; +extern BoxRec RegionEmptyBox; +extern RegDataRec RegionEmptyData; +extern RegDataRec RegionBrokenData; static inline Bool RegionNil(RegionPtr reg) { return ((reg)->data && !(reg)->data->numRects); } static inline Bool RegionNar(RegionPtr reg) { - return ((reg)->data == &miBrokenData); + return ((reg)->data == &RegionBrokenData); } static inline int RegionNumRects(RegionPtr reg) { @@ -127,7 +127,7 @@ static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size) } else { - (_pReg)->extents = miEmptyBox; + (_pReg)->extents = RegionEmptyBox; if (((_size) > 1) && ((_pReg)->data = (RegDataPtr)malloc(RegionSizeof(_size)))) { @@ -135,7 +135,7 @@ static inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size) (_pReg)->data->numRects = 0; } else - (_pReg)->data = &miEmptyData; + (_pReg)->data = &RegionEmptyData; } } @@ -167,7 +167,7 @@ static inline void RegionEmpty(RegionPtr _pReg) RegionUninit(_pReg); (_pReg)->extents.x2 = (_pReg)->extents.x1; (_pReg)->extents.y2 = (_pReg)->extents.y1; - (_pReg)->data = &miEmptyData; + (_pReg)->data = &RegionEmptyData; } static inline BoxPtr RegionExtents(RegionPtr _pReg) @@ -177,8 +177,8 @@ static inline BoxPtr RegionExtents(RegionPtr _pReg) static inline void RegionNull(RegionPtr _pReg) { - (_pReg)->extents = miEmptyBox; - (_pReg)->data = &miEmptyData; + (_pReg)->extents = RegionEmptyBox; + (_pReg)->data = &RegionEmptyData; } static inline Bool @@ -285,91 +285,91 @@ RegionEqual(RegionPtr reg1, RegionPtr reg2) return pixman_region_equal (reg1, reg2); } -extern RegionPtr miRegionCreate( +extern RegionPtr RegionCreate( BoxPtr /*rect*/, int /*size*/); -extern void miRegionInit( +extern void RegionInit( RegionPtr /*pReg*/, BoxPtr /*rect*/, int /*size*/); -extern void miRegionDestroy( +extern void RegionDestroy( RegionPtr /*pReg*/); -extern void miRegionUninit( +extern void RegionUninit( RegionPtr /*pReg*/); -extern Bool miRegionCopy( +extern Bool RegionCopy( RegionPtr /*dst*/, RegionPtr /*src*/); -extern Bool miIntersect( +extern Bool RegionIntersect( RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/); -extern Bool miUnion( +extern Bool RegionUnion( RegionPtr /*newReg*/, RegionPtr /*reg1*/, RegionPtr /*reg2*/); -extern Bool miRegionAppend( +extern Bool RegionAppend( RegionPtr /*dstrgn*/, RegionPtr /*rgn*/); -extern Bool miRegionValidate( +extern Bool RegionValidate( RegionPtr /*badreg*/, Bool * /*pOverlap*/); -extern RegionPtr miRectsToRegion( +extern RegionPtr RegionFromRects( int /*nrects*/, xRectanglePtr /*prect*/, int /*ctype*/); -extern Bool miSubtract( +extern Bool RegionSubtract( RegionPtr /*regD*/, RegionPtr /*regM*/, RegionPtr /*regS*/); -extern Bool miInverse( +extern Bool RegionInverse( RegionPtr /*newReg*/, RegionPtr /*reg1*/, BoxPtr /*invRect*/); -extern int miRectIn( +extern int RegionContainsRect( RegionPtr /*region*/, BoxPtr /*prect*/); -extern void miTranslateRegion( +extern void RegionTranslate( RegionPtr /*pReg*/, int /*x*/, int /*y*/); -extern void miRegionReset( +extern void RegionReset( RegionPtr /*pReg*/, BoxPtr /*pBox*/); -extern Bool miRegionBreak( +extern Bool RegionBreak( RegionPtr /*pReg*/); -extern Bool miPointInRegion( +extern Bool RegionContainsPoint( RegionPtr /*pReg*/, int /*x*/, int /*y*/, BoxPtr /*box*/); -extern Bool miRegionEqual( +extern Bool RegionEqual( RegionPtr /*pReg1*/, RegionPtr /*pReg2*/); -extern Bool miRegionNotEmpty( +extern Bool RegionNotEmpty( RegionPtr /*pReg*/); -extern void miRegionEmpty( +extern void RegionEmpty( RegionPtr /*pReg*/); -extern BoxPtr miRegionExtents( +extern BoxPtr RegionExtents( RegionPtr /*pReg*/); #endif /* REGIONSTRUCT_H */ 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/migc.c b/nx-X11/programs/Xserver/mi/migc.c index 167e63d0a..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 #endif +#include "regionstr.h" #include "scrnintstr.h" #include "gcstruct.h" #include "pixmapstr.h" 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*/, -- cgit v1.2.3 From 12020463167af75a0f2958827da07bbf66467bc8 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 13:06:30 +0100 Subject: Add REGION_ macros for source compatibility with existing drivers. This makes the region code changes source compatible with existing code, although none of them are used within the server source itself. In NX, this patch is not really necessary, but it has been backported with the previous patches for the sake of backporting the complete mi/miregion.c -> dix/region.c change in X.Org. v1: Keith Packard v2: Mike Gabriel (backported to nx-libs) --- nx-X11/programs/Xserver/include/regionstr.h | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/nx-X11/programs/Xserver/include/regionstr.h b/nx-X11/programs/Xserver/include/regionstr.h index 8ddc62af2..ace8031e0 100644 --- a/nx-X11/programs/Xserver/include/regionstr.h +++ b/nx-X11/programs/Xserver/include/regionstr.h @@ -372,4 +372,43 @@ extern void RegionEmpty( extern BoxPtr RegionExtents( RegionPtr /*pReg*/); +#define INCLUDE_LEGACY_REGION_DEFINES +#ifdef INCLUDE_LEGACY_REGION_DEFINES + +#define REGION_NIL RegionNil +#define REGION_NAR RegionNar +#define REGION_NUM_RECTS RegionNumRects +#define REGION_SIZE RegionSize +#define REGION_RECTS RegionRects +#define REGION_BOXPTR RegionBoxptr +#define REGION_BOX RegionBox +#define REGION_TOP RegionTop +#define REGION_END RegionEnd +#define REGION_SZOF RegionSizeof +#define BitmapToRegion BitmapToRegion +#define REGION_CREATE(pScreen, r, s) RegionCreate(r,s) +#define REGION_COPY(pScreen, d, r) RegionCopy(d, r) +#define REGION_DESTROY(pScreen, r) RegionDestroy(r) +#define REGION_INTERSECT(pScreen, res, r1, r2) RegionIntersect(res, r1, r2) +#define REGION_UNION(pScreen, res, r1, r2) RegionUnion(res, r1, r2) +#define REGION_SUBTRACT(pScreen, res, r1, r2) RegionSubtract(res, r1, r2) +#define REGION_INVERSE(pScreen, n, r, b) RegionInverse(n, r, b) +#define REGION_TRANSLATE(pScreen, r, x, y) RegionTranslate(r, x, y) +#define RECT_IN_REGION(pScreen, r, b) RegionContainsRect(r, b) +#define POINT_IN_REGION(pScreen, r, x, y, b) RegionContainsPoint(r, x, y, b) +#define REGION_EQUAL(pScreen, r1, r2) RegionEqual(r1, r2) +#define REGION_APPEND(pScreen, d, r) RegionAppend(d, r) +#define REGION_VALIDATE(pScreen, r, o) RegionValidate(r, o) +#define RECTS_TO_REGION(pScreen, n, r, c) RegionFromRects(n, r, c) +#define REGION_BREAK(pScreen, r) RegionBreak(r) +#define REGION_INIT(pScreen, r, b, s) RegionInit(r, b, s) +#define REGION_UNINIT(pScreen, r) RegionUninit(r) +#define REGION_RESET(pScreen, r, b) RegionReset(r, b) +#define REGION_NOTEMPTY(pScreen, r) RegionNotEmpty(r) +#define REGION_BROKEN(pScreen, r) RegionBroken(r) +#define REGION_EMPTY(pScreen, r) RegionEmpty(r) +#define REGION_EXTENTS(pScreen, r) RegionExtents(r) +#define REGION_NULL(pScreen, r) RegionNull(r) + +#endif /* INCLUDE_LEGACY_REGION_DEFINES */ #endif /* REGIONSTRUCT_H */ -- cgit v1.2.3 From f3f0a6b4b1e4c3e08501a9967a302f6f2914d828 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 15:59:58 +0100 Subject: hw/nxagent/Drawable.c: RegionNumRects returns int, not long int anymore. --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 7fa984eee..51d41db23 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -647,7 +647,7 @@ int nxagentSynchronizeRegion(DrawablePtr pDrawable, RegionPtr pRegion, unsigned if (length == 0) { - fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] with region geometry [%ld][%d,%d,%d,%d].\n", + fprintf(stderr, "nxagentSynchronizeRegion: Drawable [%s] at [%p] with region geometry [%d][%d,%d,%d,%d].\n", nxagentDrawableType(pDrawable), (void *) pDrawable, RegionNumRects(clipRegion), clipRegion -> extents.x1, clipRegion -> extents.y1, clipRegion -> extents.x2, clipRegion -> extents.y2); -- cgit v1.2.3 From 5bbdbfce2ef7d153dba7c888edf49021bcbe3914 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 16:05:01 +0100 Subject: hw/nxagent/Clipboard.c: The result variable is only needed when combiled with -DDEBUG. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` Clipboard.c: In function ‘nxagentRequestSelection’: Clipboard.c:272:7: warning: variable ‘result’ set but not used [-Wunused-but-set-variable] int result; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 10606a24f..82a1ed77e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -269,7 +269,9 @@ void nxagentClearSelection(XEvent *X) void nxagentRequestSelection(XEvent *X) { + #ifdef DEBUG int result; + #endif int i = 0; XSelectionEvent eventSelection; @@ -311,7 +313,7 @@ FIXME: Do we need this? if (X->xselectionrequest.target == serverTARGETS) { Atom xa_STRING = XA_STRING; - result = XChangeProperty (nxagentDisplay, + XChangeProperty (nxagentDisplay, X->xselectionrequest.requestor, X->xselectionrequest.property, XInternAtom(nxagentDisplay, "ATOM", 0), @@ -329,7 +331,7 @@ FIXME: Do we need this? if (i < NumCurrentSelections) { - result = XChangeProperty(nxagentDisplay, + XChangeProperty(nxagentDisplay, X->xselectionrequest.requestor, X->xselectionrequest.property, X->xselectionrequest.target, @@ -349,7 +351,10 @@ FIXME: Do we need this? eventSelection.target = X->xselectionrequest.target; eventSelection.time = X->xselectionrequest.time; - result = XSendEvent(nxagentDisplay, + #ifdef DEBUG + result = + #endif + XSendEvent(nxagentDisplay, eventSelection.requestor, False, 0L, @@ -463,7 +468,10 @@ FIXME: Do we need this? eventSelection.property = None; eventSelection.time = X->xselectionrequest.time; - result = XSendEvent(nxagentDisplay, + #ifdef DEBUG + result = + #endif + XSendEvent(nxagentDisplay, eventSelection.requestor, False, 0L, -- cgit v1.2.3 From c206a0c69d8b2fd1888f8102a32007839b135eae Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 16:06:59 +0100 Subject: hw/nxagent/Splash.c: Drop unused variable declaration "XPoint m[12];". MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` Splash.c: In function ‘nxagentPaintLogo’: Splash.c:168:13: warning: unused variable ‘m’ [-Wunused-variable] XPoint m[12]; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 1 - 1 file changed, 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index abb0872d1..a069b3e23 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -165,7 +165,6 @@ int nxagentShowSplashWindow(Window parentWindow) void nxagentPaintLogo(Window win, GC gc, int scale, int width, int height) { XPoint rect[4]; - XPoint m[12]; int w, h, c, w2, h2; /* -- cgit v1.2.3 From 802f5816363ac032d5a3a612007c302074b302da Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 16:08:45 +0100 Subject: hw/nxagent/Rootless.c: Type cast type Atom to type long unsigned int before handing it over to %lu in fprintf(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warnings: ``` Rootless.c: In function ‘nxagentExportProperty’: Rootless.c:775:21: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘Atom’ [-Wformat=] "Property [%lu] too long.\n", propertyX); ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index 53a3b3fb7..4cf4afcad 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -772,7 +772,7 @@ int nxagentExportProperty(pWin, property, type, format, mode, nUnits, value) { #ifdef WARNING fprintf(stderr, "nxagentExportProperty: WARNING! " - "Property [%lu] too long.\n", propertyX); + "Property [%lu] too long.\n", (long unsigned int)propertyX); #endif goto nxagentExportPropertyError; -- cgit v1.2.3 From 08d38484111299e09b9553f14346f61b949cbbec Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 16:15:29 +0100 Subject: hw/nxagent/Extension.c: Don't declare pRandRScrPriv without using it later on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following the compiler warnings: ``` Extensions.c: In function ‘nxagentRandRInitSizes’: Extensions.c:159:16: warning: unused variable ‘pRandRScrPriv’ [-Wunused-variable] rrScrPrivPtr pRandRScrPriv = rrGetScrPriv(pScreen); ^ Extensions.c: In function ‘nxagentRandRSetConfig’: Extensions.c:263:16: warning: unused variable ‘pRandRScrPriv’ [-Wunused-variable] rrScrPrivPtr pRandRScrPriv; ^ Extensions.c: In function ‘nxagentRandRScreenSetSize’: Extensions.c:322:16: warning: unused variable ‘pRandRScrPriv’ [-Wunused-variable] rrScrPrivPtr pRandRScrPriv; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Extensions.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c index d77d27674..dfa511448 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Extensions.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Extensions.c @@ -156,7 +156,6 @@ int nxagentRandRGetInfo(ScreenPtr pScreen, Rotation *pRotations) static int nxagentRandRInitSizes(ScreenPtr pScreen) { RRScreenSizePtr pSize; - rrScrPrivPtr pRandRScrPriv = rrGetScrPriv(pScreen); int width; int height; @@ -260,7 +259,6 @@ int nxagentRandRSetConfig(ScreenPtr pScreen, Rotation rotation, int rate, RRScreenSizePtr pSize) { int r; - rrScrPrivPtr pRandRScrPriv; UpdateCurrentTime(); @@ -319,7 +317,6 @@ int nxagentRandRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height, CARD32 mmWidth, CARD32 mmHeight) { int result; - rrScrPrivPtr pRandRScrPriv; UpdateCurrentTime(); -- cgit v1.2.3 From 5ea2457effe433f4fc66a1a17e0a1ab7527462d6 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 16:17:30 +0100 Subject: hw/nxagent/Pixmap.c: pBool pointer is only required when compiled in -DTEST mode. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` Pixmap.c: In function ‘nxagentDisconnectPixmap’: Pixmap.c:755:9: warning: variable ‘pBool’ set but not used [-Wunused-but-set-variable] Bool *pBool; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index cd2234492..67c514714 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -752,11 +752,11 @@ void nxagentDisconnectPixmap(void *p0, XID x1, void *p2) { PixmapPtr pPixmap = (PixmapPtr) p0; + #ifdef TEST Bool *pBool; pBool = (Bool*) p2; - #ifdef TEST fprintf(stderr, "nxagentDisconnectPixmap: Called with bool [%d] and pixmap at [%p].\n", *pBool, (void *) pPixmap); -- cgit v1.2.3 From 7d3d47f1f298e4f2e0c45a2beab089978bd7d407 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 16:27:09 +0100 Subject: hw/nxagent/Window.c: Don't declare "XWindowChanges changes;" and later not use it. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` Window.c:2179:24: warning: variable ‘changes’ set but not used [-Wunused-but-set-variable] XWindowChanges changes; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 9201df197..37148f222 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -2176,7 +2176,6 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo if (nxagentExposeQueue.length < EXPOSED_SIZE) { - XWindowChanges changes; int index; index = (nxagentExposeQueue.start + nxagentExposeQueue.length) % EXPOSED_SIZE; @@ -2212,9 +2211,6 @@ void nxagentWindowExposures(WindowPtr pWin, RegionPtr pRgn, RegionPtr other_expo nxagentExposeSerial = (nxagentExposeSerial - 1) % EXPOSED_SIZE; - changes.x = nxagentExposeSerial; - changes.y = -2; - nxagentExposeQueue.exposures[index].serial = nxagentExposeSerial; #ifdef TEST -- cgit v1.2.3 From 72386e1718da8ccd1eb42bf1e8565b8f411cfc38 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 16:34:43 +0100 Subject: hw/nxagent/Screen.c: Correctly use already defined MIN/MAX macros. Use MIN(A,B) macro as defined in Utils.h. Add MAX(A,B) macro in Utils.h, as well. Don't have another set of MIN/MAX macro definitions in Screen.c. Amends the following compiler warnings: ``` Screen.c:3600:0: warning: "MIN" redefined #define MIN(a,b) ((a) < (b)) ? (a) : (b); ^ In file included from Screen.c:78:0: Utils.h:36:0: note: this is the location of the previous definition #define MIN(A, B) ( (A) < (B) ? (A) : (B) ) ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 4 ---- nx-X11/programs/Xserver/hw/nxagent/Utils.h | 4 ++++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 6131775d9..bfa28a0ce 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -3595,10 +3595,6 @@ Bool nxagentReconnectScreen(void *p0) return True; } -/* FIXME: there must be such macros somewhere already...*/ -#define MAX(a,b) ((a) > (b)) ? (a) : (b); -#define MIN(a,b) ((a) < (b)) ? (a) : (b); - /* intersect two rectangles */ Bool intersect(int ax1, int ay1, unsigned int aw, unsigned int ah, int bx1, int by1, unsigned int bw, unsigned int bh, diff --git a/nx-X11/programs/Xserver/hw/nxagent/Utils.h b/nx-X11/programs/Xserver/hw/nxagent/Utils.h index f5bd55d8b..ef8c4c714 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Utils.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Utils.h @@ -36,4 +36,8 @@ #define MIN(A, B) ( (A) < (B) ? (A) : (B) ) #endif +#ifndef MAX +#define MAX(A, B) ( (A) > (B) ? (A) : (B) ); +#endif + #endif /* __Utils_H__ */ -- cgit v1.2.3 From ef287b54f0a1b23402ba9e8cb6cb8be7b7455a3b Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 16:35:43 +0100 Subject: hw/nxagent/Screen.h: Provide prototype for nxagentAdjustRandRXinerama(). Avoid implicit-declaration compiler warning. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` Screen.c:3716:5: warning: implicit declaration of function ‘nxagentAdjustRandRXinerama’ [-Wimplicit-function-declaration] nxagentAdjustRandRXinerama(pScreen); ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 1 + nx-X11/programs/Xserver/hw/nxagent/Screen.h | 2 ++ 2 files changed, 3 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index bfa28a0ce..767810b5e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -171,6 +171,7 @@ WindowPtr nxagentViewportFrameBelow; Bool nxagentCreateScreenResources(ScreenPtr pScreen); void nxagentPrintAgentGeometry(char *hdrMessage, char *prefix); + /* * These variables are for shadowing feature. */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.h b/nx-X11/programs/Xserver/hw/nxagent/Screen.h index aab3ba19c..305d5648f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.h @@ -102,6 +102,8 @@ Bool nxagentResizeScreen(ScreenPtr pScreen, int width, int height, int nxagentChangeScreenConfig(int screen, int width, int height, int mmWidth, int mmHeight); +int nxagentAdjustRandRXinerama(ScreenPtr pScreen); + extern Bool nxagentReconnectScreen(void *p0); void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin); -- cgit v1.2.3 From ab50f84b50c8f11e0be813a5e54ca307e72a656f Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 16:45:59 +0100 Subject: hw/nxagent/Screen.c: Drop various unused variables. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warnings: ``` Screen.c: In function ‘nxagentReconnectScreen’: Screen.c:3547:7: warning: variable ‘flexibility’ set but not used [-Wunused-but-set-variable] int flexibility; ^ Screen.c: In function ‘nxagentAdjustRandRXinerama’: Screen.c:3746:12: warning: unused variable ‘j’ [-Wunused-variable] int i, j; ^ Screen.c: In function ‘nxagentSaveAreas’: Screen.c:4116:15: warning: variable ‘pDrawable’ set but not used [-Wunused-but-set-variable] DrawablePtr pDrawable; ^ Screen.c: In function ‘nxagentRestoreAreas’: Screen.c:4236:15: warning: variable ‘pDrawable’ set but not used [-Wunused-but-set-variable] DrawablePtr pDrawable; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 767810b5e..c5e09df49 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -3545,11 +3545,8 @@ Bool nxagentReconnectScreen(void *p0) { CARD16 w, h; PixmapPtr pPixmap = (PixmapPtr)nxagentDefaultScreen->devPrivate; - int flexibility; Mask mask; - flexibility = *(int*)p0; - #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_SCREEN_DEBUG) fprintf(stderr, "nxagentReconnectScreen\n"); #endif @@ -3740,7 +3737,7 @@ int nxagentAdjustRandRXinerama(ScreenPtr pScreen) if (pScrPriv) { - int i, j; + int i; int number = 0; XineramaScreenInfo *screeninfo = NULL; @@ -4110,7 +4107,6 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, nxagentPrivPixmapPtr pPrivPixmap; XlibGC gc; XGCValues values; - DrawablePtr pDrawable; int i; int xSrc, ySrc, xDst, yDst, w, h; int nRects; @@ -4131,8 +4127,6 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, fbCopyWindowProc(&pWin -> drawable, &pVirtualPixmap -> drawable, 0, RegionRects(prgnSave), RegionNumRects(prgnSave), xorg, yorg, FALSE, FALSE, 0, 0); - pDrawable = &pWin -> drawable; - values.subwindow_mode = IncludeInferiors; gc = XCreateGC(nxagentDisplay, nxagentWindow(WindowTable[0]), GCSubwindowMode, &values); @@ -4230,7 +4224,6 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, RegionPtr clipRegion; XlibGC gc; XGCValues values; - DrawablePtr pDrawable; int i; int xSrc, ySrc, xDst, yDst, w, h; int nRects; @@ -4255,8 +4248,6 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, fbCopyWindowProc(&pVirtualPixmap -> drawable, &pWin -> drawable, 0, RegionRects(prgnRestore), RegionNumRects(prgnRestore), -xorg, -yorg, FALSE, FALSE, 0, 0); - pDrawable = &pVirtualPixmap -> drawable; - values.subwindow_mode = ClipByChildren; gc = XCreateGC(nxagentDisplay, nxagentWindow(WindowTable[0]), GCSubwindowMode, &values); -- cgit v1.2.3 From b5b7a2d26b4c2b02fa2889e1ed9e0c64ccfb8273 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 18 Mar 2016 16:46:34 +0100 Subject: hw/nxagent/Screen.c: Cast proper types before handing values over to fprintf(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warnings: ``` Screen.c: In function ‘nxagentCreateIconWindow’: Screen.c:394:15: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘Window’ [-Wformat=] nxagentIconWindow); ^ Screen.c: In function ‘nxagentSetScreenSaverTime’: Screen.c:456:19: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘CARD32’ [-Wformat=] ScreenSaverTime, ScreenSaverInterval); ^ Screen.c:456:19: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘CARD32’ [-Wformat=] Screen.c:476:19: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘CARD32’ [-Wformat=] ScreenSaverTime, ScreenSaverInterval); ^ Screen.c:476:19: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘CARD32’ [-Wformat=] Screen.c: In function ‘nxagentOpenScreen’: Screen.c:1234:19: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘VisualID’ [-Wformat=] visuals[numVisuals].vid); ^ Screen.c:1274:23: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘VisualID’ [-Wformat=] depths[depthIndex].depth); ^ Screen.c:1282:17: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘VisualID’ [-Wformat=] defaultVisualIndex, visuals[defaultVisualIndex].vid); ^ Screen.c:1319:19: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 6 has type ‘VisualID’ [-Wformat=] rootDepth, defaultVisual); ^ Screen.c:1336:19: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 6 has type ‘VisualID’ [-Wformat=] rootDepth, defaultVisual); ^ Screen.c:1348:19: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 6 has type ‘VisualID’ [-Wformat=] rootDepth, defaultVisual); ^ Screen.c:1357:19: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 6 has type ‘VisualID’ [-Wformat=] rootDepth, defaultVisual); ^ Screen.c:1723:21: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘Window’ [-Wformat=] nxagentDefaultWindows[pScreen->myNum]); ^ Screen.c:1763:19: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘Window’ [-Wformat=] nxagentDefaultWindows[pScreen->myNum]); ^ Screen.c:1775:17: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘Window’ [-Wformat=] nxagentDefaultWindows[pScreen->myNum]); ^ Screen.c:1790:17: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘Window’ [-Wformat=] nxagentDefaultWindows[pScreen->myNum]); ^ Screen.c: In function ‘nxagentShadowAdaptDepth’: Screen.c:3189:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat=] pVisual -> red_mask, pVisual -> green_mask, pVisual -> blue_mask); ^ Screen.c:3189:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat=] Screen.c:3189:14: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘long unsigned int’ [-Wformat=] Screen.c:3198:15: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘long unsigned int’ [-Wformat=] redMask, greenMask, blueMask); ^ Screen.c:3198:15: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long unsigned int’ [-Wformat=] Screen.c:3198:15: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 5 has type ‘long unsigned int’ [-Wformat=] ``` --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 42 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index c5e09df49..83bcc01fd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -391,8 +391,8 @@ Window nxagentCreateIconWindow() valuemask, &attributes); #ifdef TEST - fprintf(stderr, "nxagentCreateIconWindow: Created new icon window with id [%ld].\n", - nxagentIconWindow); + fprintf(stderr, "nxagentCreateIconWindow: Created new icon window with id [%lu].\n", + (long unsigned int)nxagentIconWindow); #endif /* @@ -454,7 +454,7 @@ void nxagentSetScreenSaverTime(void) { #ifdef TEST fprintf(stderr, "nxagentSetScreenSaverTime: ScreenSaverTime was [%lu], ScreenSaverInterval was [%lu].\n", - ScreenSaverTime, ScreenSaverInterval); + (long unsigned int)ScreenSaverTime, (long unsigned int)ScreenSaverInterval); #endif /* @@ -474,7 +474,7 @@ void nxagentSetScreenSaverTime(void) #ifdef TEST fprintf(stderr, "nxagentSetScreenSaverTime: ScreenSaverTime now is [%lu], ScreenSaverInterval now is [%lu].\n", - ScreenSaverTime, ScreenSaverInterval); + (long unsigned int)ScreenSaverTime, (long unsigned int)ScreenSaverInterval); #endif } @@ -1232,7 +1232,7 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen, #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Added visual [%lu].\n" , - visuals[numVisuals].vid); + (long unsigned int)visuals[numVisuals].vid); #endif for (j = 0; j < numDepths; j++) @@ -1271,7 +1271,7 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen, #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Registered visual [%lu] for depth [%d (%d)].\n" , - visuals[numVisuals].vid, depthIndex, + (long unsigned int)visuals[numVisuals].vid, depthIndex, depths[depthIndex].depth); #endif @@ -1280,7 +1280,7 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen, #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "Debug: Setting default visual [%d (%lu)].\n", - defaultVisualIndex, visuals[defaultVisualIndex].vid); + defaultVisualIndex, (long unsigned int)visuals[defaultVisualIndex].vid); fprintf(stderr, "Debug: Setting root depth [%d].\n", visuals[defaultVisualIndex].nplanes); @@ -1316,8 +1316,8 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen, #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "nxagentOpenScreen: Before fbScreenInit numVisuals [%d] numDepths [%d] " - "rootDepth [%d] defaultVisual [%ld].\n", numVisuals, numDepths, - rootDepth, defaultVisual); + "rootDepth [%d] defaultVisual [%lu].\n", numVisuals, numDepths, + rootDepth, (long unsigned int)defaultVisual); #endif if (monitorResolution < 1) @@ -1333,8 +1333,8 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen, #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "nxagentOpenScreen: After fbScreenInit numVisuals [%d] numDepths [%d] " - "rootDepth [%d] defaultVisual [%ld].\n", numVisuals, numDepths, - rootDepth, defaultVisual); + "rootDepth [%d] defaultVisual [%lu].\n", numVisuals, numDepths, + rootDepth, (long unsigned int)defaultVisual); #endif /* @@ -1345,8 +1345,8 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen, #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "nxagentOpenScreen: Before GLX numVisuals [%d] numDepths [%d] " - "rootDepth [%d] defaultVisual [%ld].\n", numVisuals, numDepths, - rootDepth, defaultVisual); + "rootDepth [%d] defaultVisual [%lu].\n", numVisuals, numDepths, + rootDepth, (long unsigned int)defaultVisual); #endif nxagentInitGlxExtension(&visuals, &depths, &numVisuals, &numDepths, @@ -1354,8 +1354,8 @@ Bool nxagentOpenScreen(int index, ScreenPtr pScreen, #if defined(DEBUG) || defined(DEBUG_COLORMAP) fprintf(stderr, "nxagentOpenScreen: After GLX numVisuals [%d] numDepths [%d] " - "rootDepth [%d] defaultVisual [%ld].\n", numVisuals, numDepths, - rootDepth, defaultVisual); + "rootDepth [%d] defaultVisual [%lu].\n", numVisuals, numDepths, + rootDepth, (long unsigned int)defaultVisual); #endif /* @@ -1721,7 +1721,7 @@ N/A #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Using root window id [%ld].\n", - nxagentDefaultWindows[pScreen->myNum]); + (long int)nxagentDefaultWindows[pScreen->myNum]); #endif } @@ -1761,7 +1761,7 @@ N/A #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Created new default window with id [%ld].\n", - nxagentDefaultWindows[pScreen->myNum]); + (long int)nxagentDefaultWindows[pScreen->myNum]); #endif /* @@ -1773,7 +1773,7 @@ N/A { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Setting WM_CLASS and WM_NAME for window withid [%ld].\n", - nxagentDefaultWindows[pScreen->myNum]); + (long int)nxagentDefaultWindows[pScreen->myNum]); #endif XClassHint hint; hint.res_name=malloc(strlen("X2GoAgent")+1); @@ -1788,7 +1788,7 @@ N/A { #ifdef TEST fprintf(stderr, "nxagentOpenScreen: Setting WM_CLASS and WM_NAME for window withid [%ld].\n", - nxagentDefaultWindows[pScreen->myNum]); + (long int)nxagentDefaultWindows[pScreen->myNum]); #endif XClassHint hint; @@ -3186,7 +3186,7 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, } #ifdef TEST - fprintf(stderr, "nxagentCorrectDepthShadow: Shadow redMask [%x] greenMask[%x] blueMask[%x].\n", + fprintf(stderr, "nxagentCorrectDepthShadow: Shadow redMask [%lu] greenMask[%lu] blueMask[%lu].\n", pVisual -> red_mask, pVisual -> green_mask, pVisual -> blue_mask); #endif @@ -3195,7 +3195,7 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, blueMask = nxagentShadowDisplay -> screens[0].root_visual[0].blue_mask; #ifdef TEST - fprintf(stderr, "nxagentCorrectDepthShadow: Master redMask [%x] greenMask[%x] blueMask[%x].\n", + fprintf(stderr, "nxagentCorrectDepthShadow: Master redMask [%lu] greenMask[%lu] blueMask[%lu].\n", redMask, greenMask, blueMask); #endif -- cgit v1.2.3 From eb682184c6d83910b083715dcba21e9792d9dad5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 09:41:16 +0100 Subject: hw/nxagent/*.c: Drop various declarations of unused ScreenPtr pScreen. These can be dropped after we have turned REGION_* macros into static inline function calls in some of the previous commits. --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 6 ------ nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 3 --- nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c | 13 ------------- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 6 ------ 4 files changed, 28 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index d1d1a5f59..12b941530 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2538,7 +2538,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) RegionPtr exposeRegion; BoxRec rect; WindowPtr pWin; - ScreenPtr pScreen; StoringPixmapPtr pStoringPixmapRec = NULL; miBSWindowPtr pBSwindow = NULL; int drawableType; @@ -2581,8 +2580,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) pWin = pStoringPixmapRec -> pSavedWindow; } - pScreen = pWin -> drawable.pScreen; - /* * Rectangle affected by GraphicsExpose * event. @@ -2639,7 +2636,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X) int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) { - ScreenPtr pScreen; WindowPtr pWin; xEvent x; @@ -2757,8 +2753,6 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) if (X -> xclient.window == nxagentIconWindow) { - pScreen = nxagentScreen(X -> xmap.window); - XMapRaised(nxagentDisplay, nxagentFullscreenWindow); XIconifyWindow(nxagentDisplay, nxagentIconWindow, diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 117203103..f871cad13 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -2313,7 +2313,6 @@ WindowsRestructured() * compute correctly. */ void ReinitializeRootWindow(WindowPtr win, int xoff, int yoff) { - ScreenPtr pScreen = win->drawable.pScreen; GrabPtr grab; if (noPanoramiXExtension) return; @@ -2461,7 +2460,6 @@ XineramaPointInWindowIsVisible( int y ) { - ScreenPtr pScreen = pWin->drawable.pScreen; BoxRec box; int i, xoff, yoff; @@ -2477,7 +2475,6 @@ XineramaPointInWindowIsVisible( for(i = 1; i < PanoramiXNumScreens; i++) { pWin = sprite.windows[i]; - pScreen = pWin->drawable.pScreen; x = xoff - panoramiXdataPtr[i].x; y = yoff - panoramiXdataPtr[i].y; diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c index 08c052294..56237605e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c @@ -292,14 +292,12 @@ miChangeSaveUnder(pWin, first) * Used when pWin was restacked */ { RegionRec rgn; /* Area obscured by saveUnder windows */ - register ScreenPtr pScreen; Bool res; if (!deltaSaveUndersViewable && !numSaveUndersViewable) return FALSE; numSaveUndersViewable += deltaSaveUndersViewable; deltaSaveUndersViewable = 0; - pScreen = pWin->drawable.pScreen; RegionNull(&rgn); res = miCheckSubSaveUnder (pWin->parent, pWin->saveUnder ? first : pWin->nextSib, @@ -385,9 +383,6 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin) register WindowPtr pChild, pLast; Bool anyMarked = FALSE; MarkWindowProcPtr MarkWindow = pWin->drawable.pScreen->MarkWindow; - ScreenPtr pScreen; - - pScreen = pWin->drawable.pScreen; /* single layered systems are easy */ if (ppLayerWin) *ppLayerWin = pWin; @@ -470,11 +465,8 @@ miHandleValidateExposures(pWin) { register WindowPtr pChild; register ValidatePtr val; - ScreenPtr pScreen; WindowExposuresProcPtr WindowExposures; - pScreen = pWin->drawable.pScreen; - pChild = pWin; WindowExposures = pChild->drawable.pScreen->WindowExposures; while (1) @@ -598,12 +590,10 @@ miRecomputeExposures ( register WindowPtr pWin, void * value) /* must conform to VisitWindowProcPtr */ { - register ScreenPtr pScreen; RegionPtr pValid = (RegionPtr)value; if (pWin->valdata) { - pScreen = pWin->drawable.pScreen; /* * compute exposed regions of this window */ @@ -1206,11 +1196,8 @@ miMarkUnrealizedWindow(pChild, pWin, fromConfigure) void miSegregateChildren(WindowPtr pWin, RegionPtr pReg, int depth) { - ScreenPtr pScreen; WindowPtr pChild; - pScreen = pWin->drawable.pScreen; - for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) { if (pChild->drawable.depth == depth) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 89b7c617c..b2da4e97c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -2154,12 +2154,10 @@ ShapeOverlap ( BoxPtr pSibBox) { RegionPtr pWinRgn, pSibRgn; - register ScreenPtr pScreen; Bool ret; if (!IS_SHAPED(pWin) && !IS_SHAPED(pSib)) return TRUE; - pScreen = pWin->drawable.pScreen; pWinRgn = MakeBoundingRegion (pWin, pWinBox); pSibRgn = MakeBoundingRegion (pSib, pSibBox); RegionIntersect(pWinRgn, pWinRgn, pSibRgn); @@ -2260,7 +2258,6 @@ WhereDoIGoInTheStack( int smode) { BoxRec box; - register ScreenPtr pScreen; WindowPtr pHead, pFirst; if ((pWin == pWin->parent->firstChild) && @@ -2268,7 +2265,6 @@ WhereDoIGoInTheStack( return((WindowPtr ) NULL); pHead = RealChildHead(pWin->parent); pFirst = pHead ? pHead->nextSib : pWin->parent->firstChild; - pScreen = pWin->drawable.pScreen; box.x1 = x; box.y1 = y; box.x2 = x + (int)w; @@ -3509,10 +3505,8 @@ PointInWindowIsVisible(register WindowPtr pWin, int x, int y) RegionPtr NotClippedByChildren(register WindowPtr pWin) { - register ScreenPtr pScreen; RegionPtr pReg; - pScreen = pWin->drawable.pScreen; pReg = RegionCreate(NullBox, 1); if (pWin->parent || screenIsSaved != SCREEN_SAVER_ON || -- cgit v1.2.3 From fc393174cb56e2fae07a94fb777a34b9f73b6776 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 09:43:02 +0100 Subject: hw/nxagent/Keyboard.c: Don't declare and set XkbDescPtr xkb if not used later on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` Keyboard.c: In function ‘nxagentNotifyKeyboardChanges’: Keyboard.c:1211:16: warning: variable ‘xkb’ set but not used [-Wunused-but-set-variable] XkbDescPtr xkb; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 9ead48de1..560ca64e4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -1208,11 +1208,9 @@ void nxagentNotifyKeyboardChanges(int oldMinKeycode, int oldMaxKeycode) if (!noXkbExtension) { DeviceIntPtr dev; - XkbDescPtr xkb; xkbNewKeyboardNotify nkn; dev = inputInfo.keyboard; - xkb = dev -> key -> xkbInfo -> desc; memset(&nkn, 0, sizeof(xkbNewKeyboardNotify)); nkn.deviceID = nkn.oldDeviceID = dev -> id; -- cgit v1.2.3 From 66f889542f07ba3715d22dc55ffea6005bdc5a9f Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 09:47:29 +0100 Subject: hw/nxagent/Handlers.c: Don't declare and assign result variable if not used later on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` Handlers.c: In function ‘nxagentShadowBlockHandler’: Handlers.c:732:7: warning: variable ‘result’ set but not used [-Wunused-but-set-variable] int result; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Handlers.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index 0396a458e..aee983253 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c @@ -729,7 +729,6 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas int changed; int suspended = 0; - int result; int width_, height_; #ifdef BLOCKS @@ -796,7 +795,7 @@ void nxagentShadowBlockHandler(void * data, struct timeval **timeout, void * mas nxagentShadowPoll(nxagentShadowPixmapPtr, nxagentShadowGCPtr, nxagentShadowDepth, nxagentShadowWidth, nxagentShadowHeight, nxagentShadowBuffer, &changed, &suspended); - result = nxagentShadowSendUpdates(&suspended); + nxagentShadowSendUpdates(&suspended); if (nxagentBlocking == 0) { -- cgit v1.2.3 From 182569bf6f4fdd8f5761d15fa0f184665ee787b5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 09:48:11 +0100 Subject: hw/nxagent/Keyboard.c: The ret variable is only used later on when compiled with -DTEST. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` Keyboard.c: In function ‘nxagentKeyboardProc’: Keyboard.c:688:7: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable] int ret; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 560ca64e4..8d1fbd4c1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -685,7 +685,9 @@ int nxagentKeyboardProc(DeviceIntPtr pDev, int onoff) int free_model = 0, free_layout = 0; XkbDescPtr xkb = NULL; + #ifdef TEST int ret; + #endif switch (onoff) { @@ -842,7 +844,10 @@ XkbError: memmove((char *) defaultKeyboardControl.autoRepeats, (char *) values.auto_repeats, sizeof(values.auto_repeats)); - ret = InitKeyboardDeviceStruct((DevicePtr) pDev, &keySyms, modmap, + #ifdef TEST + ret = + #endif + InitKeyboardDeviceStruct((DevicePtr) pDev, &keySyms, modmap, nxagentBell, nxagentChangeKeyboardControl); #ifdef TEST -- cgit v1.2.3 From 292d88d07b98045d678e07f8b6dc092cde18e7db Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 11:54:55 +0100 Subject: hw/nxagent/NXglyphcurs.c: Don't declare and set gcval, if not being used later on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` NXglyphcurs.c: In function ‘ServerBitsFromGlyph’: NXglyphcurs.c:109:17: warning: variable ‘gcval’ set but not used [-Wunused-but-set-variable] ChangeGCVal gcval[3]; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c index 7a1d813b3..1696ae51f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyphcurs.c @@ -106,7 +106,6 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, uns PixmapPtr ppix; long nby; char *pbits; - ChangeGCVal gcval[3]; unsigned char char2b[2]; /* turn glyph index into a protocol-format char2b */ @@ -165,7 +164,6 @@ ServerBitsFromGlyph(FontPtr pfont, unsigned ch, register CursorMetricPtr cm, uns fbPolyFillRect((DrawablePtr)ppix, pGC, 1, &rect); /* draw the glyph */ - gcval[0].val = 1; pGC->fgPixel = 1; pGC->stateChanges |= GCForeground; -- cgit v1.2.3 From 23d3821f0a9ab8c8581feae26a0b8e6d61f8b78d Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 11:55:31 +0100 Subject: hw/nxagent/NXpicture.c: Don't declare anything in empty function nxagentReconnectPictFormat. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warnings: ``` NXpicture.c: In function ‘nxagentReconnectPictFormat’: NXpicture.c:2148:9: warning: variable ‘pBool’ set but not used [-Wunused-but-set-variable] Bool *pBool; ^ NXpicture.c:2147:17: warning: variable ‘pFormat’ set but not used [-Wunused-but-set-variable] PictFormatPtr pFormat; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/NXpicture.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c index 725f5137e..67cd5d6ed 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c @@ -2144,12 +2144,6 @@ Bool nxagentReconnectAllPictFormat(void *p) void nxagentReconnectPictFormat(void *p0, XID x1, void *p2) { - PictFormatPtr pFormat; - Bool *pBool; - - pFormat = (PictFormatPtr)p0; - pBool = (Bool*)p2; - #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_PICTFORMAT_DEBUG) fprintf(stderr, "nxagentReconnectPictFormat.\n"); #endif -- cgit v1.2.3 From 5e6b72dc745eafa8b8b74e2d42ca8f2cac6aff4e Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 14:18:42 +0100 Subject: hw/nxagent/NXdixfonts.c: Don't include . No symbol needed from that header file. --- nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 1 - 1 file changed, 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index 2f3a75147..c695ead8f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c @@ -73,7 +73,6 @@ Equipment Corporation. #include #endif -#include #include #include #include -- cgit v1.2.3 From fb832b01e9a497d6e59d026cdd58068101f4c4cb Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 15:54:24 +0100 Subject: Adapt API for MakeAtom() and CopyISOLatin1Lowered to latest changes in X.org. This requires adaptations of arguments' types for the external references to MakeAtom() and CopyISOLatin1Lowered(). These adaptations have been required in Xserver/include/dix.h, Xserver/include/dixfonts.c Xserver/dix/atom.c, Xserver/dix/dixutils.c, Xserver/os/oscolor.c. --- nx-X11/programs/Xserver/dix/atom.c | 2 +- nx-X11/programs/Xserver/dix/dixutils.c | 2 +- nx-X11/programs/Xserver/include/dix.h | 6 +++--- nx-X11/programs/Xserver/os/oscolor.c | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nx-X11/programs/Xserver/dix/atom.c b/nx-X11/programs/Xserver/dix/atom.c index 583f2dafc..29e60be03 100644 --- a/nx-X11/programs/Xserver/dix/atom.c +++ b/nx-X11/programs/Xserver/dix/atom.c @@ -75,7 +75,7 @@ static NodePtr *nodeTable; void FreeAtom(NodePtr patom); Atom -MakeAtom(char *string, unsigned len, Bool makeit) +MakeAtom(const char *string, unsigned len, Bool makeit) { register NodePtr * np; unsigned i; diff --git a/nx-X11/programs/Xserver/dix/dixutils.c b/nx-X11/programs/Xserver/dix/dixutils.c index 8bcfce619..e91303851 100644 --- a/nx-X11/programs/Xserver/dix/dixutils.c +++ b/nx-X11/programs/Xserver/dix/dixutils.c @@ -171,7 +171,7 @@ ISOLatin1ToLower (unsigned char source) void -CopyISOLatin1Lowered(unsigned char *dest, unsigned char *source, int length) +CopyISOLatin1Lowered(char *dest, const char *source, int length) { register int i; diff --git a/nx-X11/programs/Xserver/include/dix.h b/nx-X11/programs/Xserver/include/dix.h index 25260e46c..5f9d3b5d5 100644 --- a/nx-X11/programs/Xserver/include/dix.h +++ b/nx-X11/programs/Xserver/include/dix.h @@ -386,8 +386,8 @@ extern void ddxBeforeReset (void); /* dixutils.c */ extern void CopyISOLatin1Lowered( - unsigned char * /*dest*/, - unsigned char * /*source*/, + char * /*dest*/, + const char * /*source*/, int /*length*/); extern int CompareISOLatin1Lowered( @@ -511,7 +511,7 @@ extern Bool ClientIsAsleep( /* atom.c */ extern Atom MakeAtom( - char * /*string*/, + const char * /*string*/, unsigned /*len*/, Bool /*makeit*/); diff --git a/nx-X11/programs/Xserver/os/oscolor.c b/nx-X11/programs/Xserver/os/oscolor.c index e8692a92c..a8b01b4b9 100644 --- a/nx-X11/programs/Xserver/os/oscolor.c +++ b/nx-X11/programs/Xserver/os/oscolor.c @@ -98,8 +98,8 @@ int rgb_dbm = 0; #endif extern void CopyISOLatin1Lowered( - unsigned char * /*dest*/, - unsigned char * /*source*/, + char * /*dest*/, + const char * /*source*/, int /*length*/); int @@ -191,8 +191,8 @@ typedef struct _dbEntry { extern void CopyISOLatin1Lowered( - unsigned char * /*dest*/, - unsigned char * /*source*/, + char * /*dest*/, + const char * /*source*/, int /*length*/); static dbEntryPtr hashTab[HASHSIZE]; @@ -354,7 +354,7 @@ lookup(char *name, int len, Bool create) char *str = name; if (!(name = (char*)ALLOCATE_LOCAL(len +1))) return NULL; - CopyISOLatin1Lowered((unsigned char *)name, (unsigned char *)str, len); + CopyISOLatin1Lowered(name, str, len); name[len] = '\0'; for(str = name; *str; str++) { -- cgit v1.2.3 From e3e451629b00ab589f8720d498089dba0447cf8f Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 2 May 2016 15:38:30 +0200 Subject: hw/nxagent/NXdixfonts.c: Fix implicit declaration for register_fpe_functions(). --- nx-X11/programs/Xserver/dix/dixfonts.c | 2 ++ nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/nx-X11/programs/Xserver/dix/dixfonts.c b/nx-X11/programs/Xserver/dix/dixfonts.c index 6e515300d..1f92ff824 100644 --- a/nx-X11/programs/Xserver/dix/dixfonts.c +++ b/nx-X11/programs/Xserver/dix/dixfonts.c @@ -144,6 +144,8 @@ _NXGetFontPathError: #define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics +extern void register_fpe_functions(void); + extern void * fosNaturalParams; extern FontPtr defaultFont; diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index c695ead8f..33b0ea93d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c @@ -176,6 +176,8 @@ _NXGetFontPathError: #define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics +extern void register_fpe_functions(void); + extern void * fosNaturalParams; extern FontPtr defaultFont; -- cgit v1.2.3 From ce8fb1f93f71246462d5692c42c88989eb32b1d2 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 16:11:46 +0100 Subject: HAVE_STDINT_H: Always include . We don't define HAVE_STDINT_H anywhere and it should be more safe using the system's definition of UINT32_MAX. --- nx-X11/programs/Xserver/Xext/sampleEVI.c | 4 ---- nx-X11/programs/Xserver/Xext/xcmisc.c | 4 ---- nx-X11/programs/Xserver/hw/nxagent/NXglyph.c | 4 ---- nx-X11/programs/Xserver/render/glyph.c | 4 ---- 4 files changed, 16 deletions(-) diff --git a/nx-X11/programs/Xserver/Xext/sampleEVI.c b/nx-X11/programs/Xserver/Xext/sampleEVI.c index 598992742..961c108f9 100644 --- a/nx-X11/programs/Xserver/Xext/sampleEVI.c +++ b/nx-X11/programs/Xserver/Xext/sampleEVI.c @@ -37,11 +37,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include "EVIstruct.h" #include "scrnintstr.h" -#if HAVE_STDINT_H #include -#elif !defined(UINT32_MAX) -#define UINT32_MAX 0xffffffffU -#endif static int sampleGetVisualInfo( VisualID32 *visual, diff --git a/nx-X11/programs/Xserver/Xext/xcmisc.c b/nx-X11/programs/Xserver/Xext/xcmisc.c index 1d7ad0e09..e353d65ac 100644 --- a/nx-X11/programs/Xserver/Xext/xcmisc.c +++ b/nx-X11/programs/Xserver/Xext/xcmisc.c @@ -44,11 +44,7 @@ from The Open Group. #include #include "modinit.h" -#if HAVE_STDINT_H #include -#elif !defined(UINT32_MAX) -#define UINT32_MAX 0xffffffffU -#endif #if 0 static unsigned char XCMiscCode; diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c index 47db919ef..757ffff21 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c @@ -76,11 +76,7 @@ #endif -#if HAVE_STDINT_H #include -#elif !defined(UINT32_MAX) -#define UINT32_MAX 0xffffffffU -#endif /* * From Knuth -- a good choice for hash/rehash values is p, p-2 where diff --git a/nx-X11/programs/Xserver/render/glyph.c b/nx-X11/programs/Xserver/render/glyph.c index 900cf9844..f15b199b5 100644 --- a/nx-X11/programs/Xserver/render/glyph.c +++ b/nx-X11/programs/Xserver/render/glyph.c @@ -43,11 +43,7 @@ #include "picturestr.h" #include "glyphstr.h" -#if HAVE_STDINT_H #include -#elif !defined(UINT32_MAX) -#define UINT32_MAX 0xffffffffU -#endif /* * From Knuth -- a good choice for hash/rehash values is p, p-2 where -- cgit v1.2.3 From ab196f3a14da044f37621186f84b40957d6c2efb Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 16:14:00 +0100 Subject: hw/nxagent/NXrender.c: Don't declare and assign the colors variable, if not used later on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` NXrender.c: In function ‘swapStops’: NXrender.c:3036:13: warning: variable ‘colors’ set but not used [-Wunused-but-set-variable] CARD16 *colors; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index dc1d2387e..1999c33b0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -3033,13 +3033,11 @@ static void swapStops(void *stuff, int num) { int i, n; CARD32 *stops; - CARD16 *colors; stops = (CARD32 *)(stuff); for (i = 0; i < num; ++i) { swapl(stops, n); ++stops; } - colors = (CARD16 *)(stops); for (i = 0; i < 4*num; ++i) { swaps(stops, n); ++stops; -- cgit v1.2.3 From 30cd3a6c24b2097c30fa2f81c9908aff174e0980 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 16:31:49 +0100 Subject: hw/nxagent/Display.c: Don't declare and assign packMethod / packQuality if not used later on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warnings: ``` Display.c: In function ‘nxagentReconnectDisplay’: Display.c:2449:19: warning: variable ‘packQuality’ set but not used [-Wunused-but-set-variable] int packMethod, packQuality; ^ Display.c:2449:7: warning: variable ‘packMethod’ set but not used [-Wunused-but-set-variable] int packMethod, packQuality; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index abc6a9380..5586e82cd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -2446,7 +2446,6 @@ Bool nxagentReconnectDisplay(void *p0) { int i; int flexibility = *(int*)p0; - int packMethod, packQuality; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_DISPLAY_DEBUG) fprintf(stderr, "nxagentReconnectDisplay\n"); @@ -2464,9 +2463,6 @@ Bool nxagentReconnectDisplay(void *p0) * Reset the values to their defaults. */ - packMethod = nxagentPackMethod; - packQuality = nxagentPackQuality; - nxagentPackMethod = -1; nxagentPackQuality = -1; nxagentSplitThreshold = -1; -- cgit v1.2.3 From 7876d1f28161f244fe837f2ed5bc348cfdac10de Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 16:32:41 +0100 Subject: hw/nxagent/Events.c: Only declare and assign message_data and box variables if compiled with -DTEST / -DDEBUG (plus drop commented out code). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warnings: ``` Events.c: In function ‘nxagentHandleClientMessageEvent’: Events.c:2694:13: warning: variable ‘message_data’ set but not used [-Wunused-but-set-variable] char *message_data; ^ Events.c: In function ‘nxagentClipAndSendExpose’: Events.c:4313:10: warning: variable ‘box’ set but not used [-Wunused-but-set-variable] BoxRec box; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 33 +++++++---------------------- 1 file changed, 8 insertions(+), 25 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 12b941530..0631d8d79 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -2687,7 +2687,9 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) if (message_type == MakeAtom("WM_PROTOCOLS", strlen("WM_PROTOCOLS"), False)) { + #ifdef TEST char *message_data; + #endif x.u.u.type = ClientMessage; x.u.u.detail = X -> xclient.format; @@ -2706,12 +2708,12 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result) return 0; } + #ifdef TEST else { message_data = validateString(NameForAtom(x.u.clientMessage.u.l.longs0)); } - #ifdef TEST fprintf(stderr, "nxagentHandleClientMessageEvent: Sent client message of type WM_PROTOCOLS " "and value [%s].\n", message_data); #endif @@ -3119,28 +3121,6 @@ int nxagentCheckWindowConfiguration(XConfigureEvent* X) unsigned int nchildren_return = 0; Status result; - WindowPtr pWin; - - pWin = nxagentWindowPtr(X -> window); - - /* - * This optimization has some problems to - * work in rootless mode inside NXWin. To - * verify this you can launch xterm and - * another application, f.e. firefox. By - * raising xterm above firefox, the stack - * order seems to become incoherent showing - * the underneath window content in the - * overlapping area when the mouse botton is - * pressed with the pointer inside of such area. - * - * if ((pWin != NULL) && X -> override_redirect == 0) - * { - * return 1; - * } - * - */ - if (win == X -> window) { if (x != X -> x || @@ -4304,7 +4284,10 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) { RegionPtr exposeRgn; RegionPtr remoteExposeRgn; + + #ifdef DEBUG BoxRec box; + #endif #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Called.\n"); @@ -4316,16 +4299,16 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) { exposeRgn = RegionCreate(NULL, 1); + #ifdef DEBUG box = *RegionExtents(remoteExposeRgn); - #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Root expose extents: [%d] [%d] [%d] [%d].\n", box.x1, box.y1, box.x2, box.y2); #endif + #ifdef DEBUG box = *RegionExtents(&pWin -> clipList); - #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Clip list extents for window at [%p]: [%d] [%d] [%d] [%d].\n", pWin, box.x1, box.y1, box.x2, box.y2); #endif -- cgit v1.2.3 From e8042c9ff8b13665e7cbd7797c0c94dc8ae0f742 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 16:36:15 +0100 Subject: hw/nxagent/GC.c: Don't declare and assign flexibility variable if not used later on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` GC.c: In function ‘nxagentReconnectAllGCs’: GC.c:1154:7: warning: variable ‘flexibility’ set but not used [-Wunused-but-set-variable] int flexibility; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/GC.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/GC.c b/nx-X11/programs/Xserver/hw/nxagent/GC.c index c06e56a00..7450c1e6c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GC.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GC.c @@ -1151,12 +1151,9 @@ static void nxagentReconnectGC(void *param0, XID param1, void * param2) Bool nxagentReconnectAllGCs(void *p0) { - int flexibility; int cid; Bool GCSuccess = True; - flexibility = *(int*)p0; - #ifdef DEBUG fprintf(stderr, "nxagentReconnectAllGCs\n"); #endif -- cgit v1.2.3 From 634484bb347ac01740a08e97e17ed28127e8e82e Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 16:36:38 +0100 Subject: hw/nxagent/GCOps.c: Don't declare and assign oldDstxyValue if not used later on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` GCOps.c: In function ‘nxagentCopyArea’: GCOps.c:597:7: warning: variable ‘oldDstxyValue’ set but not used [-Wunused-but-set-variable] int oldDstxyValue; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 604b1d85a..5f753ffe4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -594,8 +594,6 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, unsigned int format; unsigned long planeMask = 0xffffffff; - int oldDstxyValue; - RegionPtr pDstRegion; int skip = 0; @@ -651,8 +649,6 @@ RegionPtr nxagentCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, } } - oldDstxyValue = dsty; - if (dsty + pDstDrawable->y + height > 32767) { #ifdef WARNING -- cgit v1.2.3 From 7251ef492f72c57713f7e56cf979541bed03d02b Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 22:22:07 +0100 Subject: hw/nxagent/Colormap.c: Don't declare and assign flexibility variable if not used later on. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` Colormap.c: In function ‘nxagentReconnectAllColormap’: Colormap.c:575:7: warning: variable ‘flexibility’ set but not used [-Wunused-but-set-variable] int flexibility; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Colormap.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c index 3a47e270e..fe3b6ce1d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c @@ -572,10 +572,8 @@ static void nxagentReconnectColormap(void * p0, XID x1, void * p2) Bool nxagentReconnectAllColormap(void *p0) { - int flexibility; int cid; Bool success = True; - flexibility = *(int*)p0; #if defined(NXAGENT_RECONNECT_DEBUG) || defined(NXAGENT_RECONNECT_COLORMAP_DEBUG) fprintf(stderr, "nxagentReconnectAllColormap\n"); -- cgit v1.2.3 From 00059798d5ee29296d2e4f5e0ff05ba0fd44ac7b Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 22:37:38 +0100 Subject: hw/nxagent/Window.c: Initialize tmp_mask and attributes.event_mask with NoEventMask. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning: ``` Window.c: In function ‘nxagentSetTopLevelEventMask’: Window.c:3392:31: warning: ‘attributes.event_mask’ may be used uninitialized in this function [-Wmaybe-uninitialized] Mask tmp_mask = attributes.event_mask; ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 37148f222..fb26b8242 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -3385,7 +3385,7 @@ void nxagentSetTopLevelEventMask(pWin) if (nxagentOption(Rootless) && nxagentWindowTopLevel(pWin)) { /* Assume that the mask fits in int... broken on Big Endian 64bit systems. */ - Mask tmp_mask = attributes.event_mask; + Mask tmp_mask = attributes.event_mask = NoEventMask; nxagentGetEventMask(pWin, &tmp_mask); attributes.event_mask = (int)tmp_mask; -- cgit v1.2.3 From 021023202a2c96f37197cc64268003f4fb9e5ad5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 21 Mar 2016 22:49:25 +0100 Subject: hw/nxagent/Keystroke.c: Fix warning: pointer type mismatch in conditional expression. --- nx-X11/programs/Xserver/hw/nxagent/Keystroke.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c index 404ed035d..212fcd93c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keystroke.c @@ -168,7 +168,7 @@ static int read_binding_from_xmlnode(xmlNode *node, struct nxagentSpecialKeystro /* ignore attributes without data (which should never happen anyways) */ if (attr->children->content == NULL) { - char *aname = (attr->name)?(attr->name):"unknown"; + char *aname = (attr->name)?((char *)attr->name):"unknown"; fprintf(stderr, "attribute %s with NULL value", aname); continue; } -- cgit v1.2.3 From c2de5f1989d2c7276af5548a4b6cc35ed50f5e16 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 22 Mar 2016 01:11:55 +0100 Subject: hw/nxagent/NXmiexpose.c: Initialize all items of the newValues[] array. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warnings: ``` NXmiexpose.c:904:18: warning: ‘newValues[2].ptr’ may be used uninitialized in this function [-Wmaybe-uninitialized] gcval[i++].ptr = newValues[TILE].ptr; ^ NXmiexpose.c:914:24: warning: ‘newValues[1].val’ may be used uninitialized in this function [-Wmaybe-uninitialized] if ( pGC->fgPixel != newValues[FOREGROUND].val) { ^ ``` --- nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c index 201d6d83b..ad75b43f8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c @@ -708,7 +708,7 @@ int what; #define COUNT_BITS 8 ChangeGCVal gcval[7]; - ChangeGCVal newValues [COUNT_BITS]; + ChangeGCVal newValues [COUNT_BITS] = {{ 0 }}; BITS32 gcmask, index, mask; RegionRec prgnWin; -- cgit v1.2.3 From b91135b0c80b95e491474f17fb112446b1689d8b Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Tue, 19 Apr 2016 10:43:40 +0200 Subject: hw/nxagent/Events.c: Avoid '#endif #ifdef DEBUG' blocks. --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 0631d8d79..5ad81f781 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -1834,9 +1834,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was { #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: Going to handle new Expose event.\n"); - #endif - #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: WARNING! Received Expose event " "for drawable [%lx] geometry [%d, %d, %d, %d] count [%d].\n", X.xexpose.window, X.xexpose.x, X.xexpose.y, X.xexpose.width, @@ -1851,9 +1849,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was { #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: Going to handle new GraphicsExpose event.\n"); - #endif - #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: WARNING! Received GraphicsExpose event " "for drawable [%lx] geometry [%d, %d, %d, %d] count [%d].\n", X.xgraphicsexpose.drawable, X.xgraphicsexpose.x, X.xgraphicsexpose.y, @@ -1869,9 +1865,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was { #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: Going to handle new NoExpose event.\n"); - #endif - #ifdef DEBUG fprintf(stderr, "nxagentDispatchEvents: WARNING! Received NoExpose event for " "drawable [%lx].\n", X.xnoexpose.drawable); #endif @@ -2401,9 +2395,7 @@ int nxagentHandleExposeEvent(XEvent *X) #ifdef DEBUG fprintf(stderr, "nxagentHandleExposeEvent: Checking remote expose events.\n"); - #endif - #ifdef DEBUG fprintf(stderr, "nxagentHandleExposeEvent: Looking for window id [%ld].\n", X -> xexpose.window); #endif @@ -4287,9 +4279,7 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) #ifdef DEBUG BoxRec box; - #endif - #ifdef DEBUG fprintf(stderr, "nxagentClipAndSendExpose: Called.\n"); #endif @@ -4304,9 +4294,7 @@ int nxagentClipAndSendExpose(WindowPtr pWin, void * ptr) fprintf(stderr, "nxagentClipAndSendExpose: Root expose extents: [%d] [%d] [%d] [%d].\n", box.x1, box.y1, box.x2, box.y2); - #endif - #ifdef DEBUG box = *RegionExtents(&pWin -> clipList); fprintf(stderr, "nxagentClipAndSendExpose: Clip list extents for window at [%p]: [%d] [%d] [%d] [%d].\n", -- cgit v1.2.3 From e79fe3b9a1d04ba4d3c16680ce39b1bd5cdb0607 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 3 May 2016 17:49:54 +0200 Subject: hw/nxagent/Holder.c: Define Pixmap from XlibPixmap before including hw/nxagent/X11/include/xpm_nxagent.h. --- nx-X11/programs/Xserver/hw/nxagent/Holder.c | 1 + 1 file changed, 1 insertion(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Holder.c b/nx-X11/programs/Xserver/hw/nxagent/Holder.c index 64ffb24a4..db43acafc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Holder.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Holder.c @@ -23,6 +23,7 @@ #include "scrnintstr.h" #include "Agent.h" #define GC XlibGC +#define Pixmap XlibPixmap #define PIXEL_ALREADY_TYPEDEFED #endif /* _XSERVER64 */ -- cgit v1.2.3 From a0e5589edf49f6f43631ce4ee7458e2dce4994e5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 3 May 2016 19:28:48 +0200 Subject: hw/nxagent/Display.c: Define Pixmap from XlibPixmap before including Icons.h (which includes hw/nxagent/X11/include/xpm_nxagent.h). --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 5586e82cd..960b8a1ad 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -62,7 +62,11 @@ is" without express or implied warranty. #include "Init.h" #include "Args.h" #include "Image.h" + +#define Pixmap XlibPixmap #include "Icons.h" +#undef Pixmap + #include "Render.h" #include "Font.h" #include "Reconnect.h" -- cgit v1.2.3 From 52dc49607e244c0e39b5d7cbdb8b41755f078aac Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 3 May 2016 19:42:46 +0200 Subject: hw/nxagent/Display.c: Avoid incompatible pointer type. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Amends the following compiler warning Display.c: In function ‘nxagentMakeIcon’: Display.c:1949:18: warning: assignment from incompatible pointer type agentIconData=x2goagentIconData; ^ Display.c:1954:18: warning: assignment from incompatible pointer type agentIconData=nxagentIconData; ^ Display.c:2001:41: warning: passing argument 3 of ‘XpmCreatePixmapFromData’ from incompatible pointer type agentIconData, ^ In file included from Icons.h:22:0, from Display.c:67: X11/include/xpm_nxagent.h:242:6: note: expected ‘char **’ but argument is of type ‘char *’ FUNC(XpmCreatePixmapFromData, int, (Display *display, ^ X11/include/xpm_nxagent.h:230:32: note: in definition of macro ‘FUNC’ #define FUNC(f, t, p) extern t f p --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 960b8a1ad..628c4c495 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -1938,7 +1938,7 @@ Bool nxagentMakeIcon(Display *display, Pixmap *nxIcon, Pixmap *nxMask) XlibPixmap IconPixmap; XlibPixmap IconShape; char* agent_icon_name; - char* agentIconData; + char** agentIconData; /* * selecting x2go icon when running as X2Go agent -- cgit v1.2.3