regionstr.h revision 8c3d541c7ee7442f570b22eca3d82808b35b0385
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync/***********************************************************
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncCopyright 1987, 1998 The Open Group
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncPermission to use, copy, modify, distribute, and sell this software and its
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncdocumentation for any purpose is hereby granted without fee, provided that
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncthe above copyright notice appear in all copies and that both that
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsynccopyright notice and this permission notice appear in supporting
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncdocumentation.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncThe above copyright notice and this permission notice shall be included in
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncall copies or substantial portions of the Software.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncExcept as contained in this notice, the name of The Open Group shall not be
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncused in advertising or otherwise to promote the sale, use or other dealings
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncin this Software without prior written authorization from The Open Group.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync All Rights Reserved
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncPermission to use, copy, modify, and distribute this software and its
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncdocumentation for any purpose and without fee is hereby granted,
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncprovided that the above copyright notice appear in all copies and that
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncboth that copyright notice and this permission notice appear in
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncsupporting documentation, and that the name of Digital not be
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncused in advertising or publicity pertaining to distribution of the
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncsoftware without specific, written prior permission.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync******************************************************************/
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsynctypedef struct pixman_region16 RegionRec, *RegionPtr;
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync/* Return values from RectIn() */
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * clip region
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsynctypedef struct pixman_region16_data RegDataRec, *RegDataPtr;
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync/* not a region */
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync return ((reg)->data ? (BoxPtr)((reg)->data + 1) : &(reg)->extents);
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline BoxPtr RegionBox(RegionPtr reg, int i) {
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)));
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline void RegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline void RegionReset(RegionPtr _pReg, BoxPtr _pBox)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline Bool RegionNotEmpty(RegionPtr _pReg) {
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync int /*size*/);
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline Bool
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline Bool
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync return pixman_region_intersect (newReg, reg1, reg2);
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline Bool
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync int /*nrects*/,
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync int /*ctype*/);
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync *-----------------------------------------------------------------------
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * Subtract --
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * Subtract regS from regM and leave the result in regD.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * S stands for subtrahend, M for minuend and D for difference.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * TRUE if successful.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * Side Effects:
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * regD is overwritten.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync *-----------------------------------------------------------------------
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline Bool
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncRegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync *-----------------------------------------------------------------------
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * Inverse --
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * Take a region and a box and return a region that is everything
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * in the box but not in the region. The careful reader will note
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * that this is the same as subtracting the region from the box...
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * Side Effects:
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync * newReg is overwritten.
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync *-----------------------------------------------------------------------
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline Bool
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync return pixman_region_inverse (newReg, reg1, invRect);
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline int
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync return pixman_region_contains_rectangle (region, prect);
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync/* TranslateRegion(pReg, x, y)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync translates in place
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline void
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline Bool
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync return pixman_region_contains_point (pReg, x, y, box);
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsyncstatic inline Bool
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync int * /*pwidth*/,
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync int /*nspans*/,
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync int * /*pwidthNew*/,
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync int /*fSorted*/
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_CREATE(pScreen, r, s) RegionCreate(r,s)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_INTERSECT(pScreen, res, r1, r2) RegionIntersect(res, r1, r2)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_UNION(pScreen, res, r1, r2) RegionUnion(res, r1, r2)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_SUBTRACT(pScreen, res, r1, r2) RegionSubtract(res, r1, r2)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_INVERSE(pScreen, n, r, b) RegionInverse(n, r, b)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_TRANSLATE(pScreen, r, x, y) RegionTranslate(r, x, y)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define RECT_IN_REGION(pScreen, r, b) RegionContainsRect(r, b)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define POINT_IN_REGION(pScreen, r, x, y, b) RegionContainsPoint(r, x, y, b)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_EQUAL(pScreen, r1, r2) RegionEqual(r1, r2)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_APPEND(pScreen, d, r) RegionAppend(d, r)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_VALIDATE(pScreen, r, o) RegionValidate(r, o)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define RECTS_TO_REGION(pScreen, n, r, c) RegionFromRects(n, r, c)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_INIT(pScreen, r, b, s) RegionInit(r, b, s)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_RESET(pScreen, r, b) RegionReset(r, b)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#define REGION_NOTEMPTY(pScreen, r) RegionNotEmpty(r)
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#endif /* INCLUDE_LEGACY_REGION_DEFINES */
8c3d541c7ee7442f570b22eca3d82808b35b0385vboxsync#endif /* REGIONSTRUCT_H */