65fea56f17cd614bc8908264df980a62e1931468vboxsync/***********************************************************
65fea56f17cd614bc8908264df980a62e1931468vboxsyncCopyright 1987, 1998 The Open Group
65fea56f17cd614bc8908264df980a62e1931468vboxsyncPermission to use, copy, modify, distribute, and sell this software and its
65fea56f17cd614bc8908264df980a62e1931468vboxsyncdocumentation for any purpose is hereby granted without fee, provided that
65fea56f17cd614bc8908264df980a62e1931468vboxsyncthe above copyright notice appear in all copies and that both that
65fea56f17cd614bc8908264df980a62e1931468vboxsynccopyright notice and this permission notice appear in supporting
65fea56f17cd614bc8908264df980a62e1931468vboxsyncdocumentation.
65fea56f17cd614bc8908264df980a62e1931468vboxsyncThe above copyright notice and this permission notice shall be included in
65fea56f17cd614bc8908264df980a62e1931468vboxsyncall copies or substantial portions of the Software.
65fea56f17cd614bc8908264df980a62e1931468vboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
65fea56f17cd614bc8908264df980a62e1931468vboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
65fea56f17cd614bc8908264df980a62e1931468vboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
65fea56f17cd614bc8908264df980a62e1931468vboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
65fea56f17cd614bc8908264df980a62e1931468vboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
65fea56f17cd614bc8908264df980a62e1931468vboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
65fea56f17cd614bc8908264df980a62e1931468vboxsyncExcept as contained in this notice, the name of The Open Group shall not be
65fea56f17cd614bc8908264df980a62e1931468vboxsyncused in advertising or otherwise to promote the sale, use or other dealings
65fea56f17cd614bc8908264df980a62e1931468vboxsyncin this Software without prior written authorization from The Open Group.
65fea56f17cd614bc8908264df980a62e1931468vboxsyncCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
65fea56f17cd614bc8908264df980a62e1931468vboxsync All Rights Reserved
65fea56f17cd614bc8908264df980a62e1931468vboxsyncPermission to use, copy, modify, and distribute this software and its
65fea56f17cd614bc8908264df980a62e1931468vboxsyncdocumentation for any purpose and without fee is hereby granted,
65fea56f17cd614bc8908264df980a62e1931468vboxsyncprovided that the above copyright notice appear in all copies and that
65fea56f17cd614bc8908264df980a62e1931468vboxsyncboth that copyright notice and this permission notice appear in
65fea56f17cd614bc8908264df980a62e1931468vboxsyncsupporting documentation, and that the name of Digital not be
65fea56f17cd614bc8908264df980a62e1931468vboxsyncused in advertising or publicity pertaining to distribution of the
65fea56f17cd614bc8908264df980a62e1931468vboxsyncsoftware without specific, written prior permission.
65fea56f17cd614bc8908264df980a62e1931468vboxsyncDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
65fea56f17cd614bc8908264df980a62e1931468vboxsyncALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
65fea56f17cd614bc8908264df980a62e1931468vboxsyncDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
65fea56f17cd614bc8908264df980a62e1931468vboxsyncANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
65fea56f17cd614bc8908264df980a62e1931468vboxsyncWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
65fea56f17cd614bc8908264df980a62e1931468vboxsyncARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
65fea56f17cd614bc8908264df980a62e1931468vboxsync******************************************************************/
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct pixman_region16 RegionRec, *RegionPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* Return values from RectIn() */
65fea56f17cd614bc8908264df980a62e1931468vboxsync * clip region
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct pixman_region16_data RegDataRec, *RegDataPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* not a region */
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline int
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline int
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsync return ((reg)->data ? (BoxPtr) ((reg)->data + 1) : &(reg)->extents);
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline size_t
65fea56f17cd614bc8908264df980a62e1931468vboxsync return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)));
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes)
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_init_rects(pReg, boxes, nBoxes);
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT RegionPtr RegionCreate(BoxPtr /*rect */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /*size */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT void RegionDestroy(RegionPtr /*pReg */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT RegionPtr RegionDuplicate(RegionPtr /* pOld */);
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionIntersect(RegionPtr newReg, /* destination Region */
65fea56f17cd614bc8908264df980a62e1931468vboxsync RegionPtr reg1, RegionPtr reg2 /* source regions */
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_intersect(newReg, reg1, reg2);
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionUnion(RegionPtr newReg, /* destination Region */
65fea56f17cd614bc8908264df980a62e1931468vboxsync RegionPtr reg1, RegionPtr reg2 /* source regions */
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT Bool RegionAppend(RegionPtr /*dstrgn */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT Bool RegionValidate(RegionPtr /*badreg */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT RegionPtr RegionFromRects(int /*nrects */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /*ctype */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsync *-----------------------------------------------------------------------
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Subtract --
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Subtract regS from regM and leave the result in regD.
65fea56f17cd614bc8908264df980a62e1931468vboxsync * S stands for subtrahend, M for minuend and D for difference.
65fea56f17cd614bc8908264df980a62e1931468vboxsync * TRUE if successful.
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Side Effects:
65fea56f17cd614bc8908264df980a62e1931468vboxsync * regD is overwritten.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *-----------------------------------------------------------------------
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
65fea56f17cd614bc8908264df980a62e1931468vboxsync *-----------------------------------------------------------------------
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Inverse --
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Take a region and a box and return a region that is everything
65fea56f17cd614bc8908264df980a62e1931468vboxsync * in the box but not in the region. The careful reader will note
65fea56f17cd614bc8908264df980a62e1931468vboxsync * that this is the same as subtracting the region from the box...
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Side Effects:
65fea56f17cd614bc8908264df980a62e1931468vboxsync * newReg is overwritten.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *-----------------------------------------------------------------------
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionInverse(RegionPtr newReg, /* Destination region */
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_inverse(newReg, reg1, invRect);
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline int
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_contains_rectangle(region, prect);
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* TranslateRegion(pReg, x, y)
65fea56f17cd614bc8908264df980a62e1931468vboxsync translates in place
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT Bool RegionBreak(RegionPtr /*pReg */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionContainsPoint(RegionPtr pReg, int x, int y, BoxPtr box /* "return" value */
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_contains_point(pReg, x, y, box);
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT Bool RegionRectAlloc(RegionPtr /*pRgn */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT Bool RegionIsValid(RegionPtr /*prgn */
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT void RegionPrint(RegionPtr /*pReg */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_CREATE(pScreen, r, s) RegionCreate(r,s)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_INTERSECT(pScreen, res, r1, r2) RegionIntersect(res, r1, r2)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_UNION(pScreen, res, r1, r2) RegionUnion(res, r1, r2)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_SUBTRACT(pScreen, res, r1, r2) RegionSubtract(res, r1, r2)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_INVERSE(pScreen, n, r, b) RegionInverse(n, r, b)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_TRANSLATE(pScreen, r, x, y) RegionTranslate(r, x, y)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define RECT_IN_REGION(pScreen, r, b) RegionContainsRect(r, b)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define POINT_IN_REGION(pScreen, r, x, y, b) RegionContainsPoint(r, x, y, b)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_EQUAL(pScreen, r1, r2) RegionEqual(r1, r2)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_APPEND(pScreen, d, r) RegionAppend(d, r)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_VALIDATE(pScreen, r, o) RegionValidate(r, o)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define RECTS_TO_REGION(pScreen, n, r, c) RegionFromRects(n, r, c)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_INIT(pScreen, r, b, s) RegionInit(r, b, s)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_RESET(pScreen, r, b) RegionReset(r, b)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_NOTEMPTY(pScreen, r) RegionNotEmpty(r)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif /* INCLUDE_LEGACY_REGION_DEFINES */
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif /* REGIONSTRUCT_H */