65fea56f17cd614bc8908264df980a62e1931468vboxsync/***********************************************************
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncCopyright 1987, 1998 The Open Group
65fea56f17cd614bc8908264df980a62e1931468vboxsync
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.
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncThe above copyright notice and this permission notice shall be included in
65fea56f17cd614bc8908264df980a62e1931468vboxsyncall copies or substantial portions of the Software.
65fea56f17cd614bc8908264df980a62e1931468vboxsync
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.
65fea56f17cd614bc8908264df980a62e1931468vboxsync
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.
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync All Rights Reserved
65fea56f17cd614bc8908264df980a62e1931468vboxsync
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.
65fea56f17cd614bc8908264df980a62e1931468vboxsync
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
65fea56f17cd614bc8908264df980a62e1931468vboxsyncSOFTWARE.
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync******************************************************************/
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#ifndef REGIONSTRUCT_H
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGIONSTRUCT_H
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct pixman_region16 RegionRec, *RegionPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#include "miscstruct.h"
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* Return values from RectIn() */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define rgnOUT 0
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define rgnIN 1
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define rgnPART 2
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define NullRegion ((RegionPtr)0)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/*
65fea56f17cd614bc8908264df980a62e1931468vboxsync * clip region
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsynctypedef struct pixman_region16_data RegDataRec, *RegDataPtr;
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT BoxRec RegionEmptyBox;
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT RegDataRec RegionEmptyData;
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT RegDataRec RegionBrokenData;
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionNil(RegionPtr reg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return ((reg)->data && !(reg)->data->numRects);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* not a region */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionNar(RegionPtr reg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return ((reg)->data == &RegionBrokenData);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline int
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionNumRects(RegionPtr reg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return ((reg)->data ? (reg)->data->numRects : 1);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline int
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionSize(RegionPtr reg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return ((reg)->data ? (reg)->data->size : 0);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionRects(RegionPtr reg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return ((reg)->data ? (BoxPtr) ((reg)->data + 1) : &(reg)->extents);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionBoxptr(RegionPtr reg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return ((BoxPtr) ((reg)->data + 1));
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionBox(RegionPtr reg, int i)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return (&RegionBoxptr(reg)[i]);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionTop(RegionPtr reg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return RegionBox(reg, (reg)->data->numRects);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionEnd(RegionPtr reg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return RegionBox(reg, (reg)->data->numRects - 1);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline size_t
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionSizeof(int n)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)));
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionInit(RegionPtr _pReg, BoxPtr _rect, int _size)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync if ((_rect) != NULL) {
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->extents = *(_rect);
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->data = (RegDataPtr) NULL;
65fea56f17cd614bc8908264df980a62e1931468vboxsync }
65fea56f17cd614bc8908264df980a62e1931468vboxsync else {
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->extents = RegionEmptyBox;
65fea56f17cd614bc8908264df980a62e1931468vboxsync if (((_size) > 1) && ((_pReg)->data =
65fea56f17cd614bc8908264df980a62e1931468vboxsync (RegDataPtr) malloc(RegionSizeof(_size)))) {
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->data->size = (_size);
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->data->numRects = 0;
65fea56f17cd614bc8908264df980a62e1931468vboxsync }
65fea56f17cd614bc8908264df980a62e1931468vboxsync else
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->data = &RegionEmptyData;
65fea56f17cd614bc8908264df980a62e1931468vboxsync }
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionInitBoxes(RegionPtr pReg, BoxPtr boxes, int nBoxes)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_init_rects(pReg, boxes, nBoxes);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionUninit(RegionPtr _pReg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync if ((_pReg)->data && (_pReg)->data->size) {
65fea56f17cd614bc8908264df980a62e1931468vboxsync free((_pReg)->data);
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->data = NULL;
65fea56f17cd614bc8908264df980a62e1931468vboxsync }
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionReset(RegionPtr _pReg, BoxPtr _pBox)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->extents = *(_pBox);
65fea56f17cd614bc8908264df980a62e1931468vboxsync RegionUninit(_pReg);
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->data = (RegDataPtr) NULL;
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionNotEmpty(RegionPtr _pReg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return !RegionNil(_pReg);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionBroken(RegionPtr _pReg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return RegionNar(_pReg);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionEmpty(RegionPtr _pReg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync RegionUninit(_pReg);
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->extents.x2 = (_pReg)->extents.x1;
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->extents.y2 = (_pReg)->extents.y1;
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->data = &RegionEmptyData;
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline BoxPtr
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionExtents(RegionPtr _pReg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return (&(_pReg)->extents);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionNull(RegionPtr _pReg)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->extents = RegionEmptyBox;
65fea56f17cd614bc8908264df980a62e1931468vboxsync (_pReg)->data = &RegionEmptyData;
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT void InitRegions(void);
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT RegionPtr RegionCreate(BoxPtr /*rect */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /*size */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT void RegionDestroy(RegionPtr /*pReg */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT RegionPtr RegionDuplicate(RegionPtr /* pOld */);
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionCopy(RegionPtr dst, RegionPtr src)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_copy(dst, src);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionIntersect(RegionPtr newReg, /* destination Region */
65fea56f17cd614bc8908264df980a62e1931468vboxsync RegionPtr reg1, RegionPtr reg2 /* source regions */
65fea56f17cd614bc8908264df980a62e1931468vboxsync )
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_intersect(newReg, reg1, reg2);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionUnion(RegionPtr newReg, /* destination Region */
65fea56f17cd614bc8908264df980a62e1931468vboxsync RegionPtr reg1, RegionPtr reg2 /* source regions */
65fea56f17cd614bc8908264df980a62e1931468vboxsync )
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_union(newReg, reg1, reg2);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT Bool RegionAppend(RegionPtr /*dstrgn */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync RegionPtr /*rgn */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT Bool RegionValidate(RegionPtr /*badreg */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync Bool * /*pOverlap */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT RegionPtr RegionFromRects(int /*nrects */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync xRectanglePtr /*prect */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /*ctype */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/*-
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 *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Results:
65fea56f17cd614bc8908264df980a62e1931468vboxsync * TRUE if successful.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Side Effects:
65fea56f17cd614bc8908264df980a62e1931468vboxsync * regD is overwritten.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync *-----------------------------------------------------------------------
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_subtract(regD, regM, regS);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/*-
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 *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Results:
65fea56f17cd614bc8908264df980a62e1931468vboxsync * TRUE.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync * Side Effects:
65fea56f17cd614bc8908264df980a62e1931468vboxsync * newReg is overwritten.
65fea56f17cd614bc8908264df980a62e1931468vboxsync *
65fea56f17cd614bc8908264df980a62e1931468vboxsync *-----------------------------------------------------------------------
65fea56f17cd614bc8908264df980a62e1931468vboxsync */
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionInverse(RegionPtr newReg, /* Destination region */
65fea56f17cd614bc8908264df980a62e1931468vboxsync RegionPtr reg1, /* Region to invert */
65fea56f17cd614bc8908264df980a62e1931468vboxsync BoxPtr invRect /* Bounding box for inversion */
65fea56f17cd614bc8908264df980a62e1931468vboxsync )
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_inverse(newReg, reg1, invRect);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline int
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionContainsRect(RegionPtr region, BoxPtr prect)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_contains_rectangle(region, prect);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync/* TranslateRegion(pReg, x, y)
65fea56f17cd614bc8908264df980a62e1931468vboxsync translates in place
65fea56f17cd614bc8908264df980a62e1931468vboxsync*/
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline void
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionTranslate(RegionPtr pReg, int x, int y)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync pixman_region_translate(pReg, x, y);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT Bool RegionBreak(RegionPtr /*pReg */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionContainsPoint(RegionPtr pReg, int x, int y, BoxPtr box /* "return" value */
65fea56f17cd614bc8908264df980a62e1931468vboxsync )
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_contains_point(pReg, x, y, box);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncstatic inline Bool
65fea56f17cd614bc8908264df980a62e1931468vboxsyncRegionEqual(RegionPtr reg1, RegionPtr reg2)
65fea56f17cd614bc8908264df980a62e1931468vboxsync{
65fea56f17cd614bc8908264df980a62e1931468vboxsync return pixman_region_equal(reg1, reg2);
65fea56f17cd614bc8908264df980a62e1931468vboxsync}
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT Bool RegionRectAlloc(RegionPtr /*pRgn */ ,
65fea56f17cd614bc8908264df980a62e1931468vboxsync int /*n */
65fea56f17cd614bc8908264df980a62e1931468vboxsync );
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#ifdef DEBUG
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT Bool RegionIsValid(RegionPtr /*prgn */
65fea56f17cd614bc8908264df980a62e1931468vboxsync );
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsyncextern _X_EXPORT void RegionPrint(RegionPtr /*pReg */ );
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define INCLUDE_LEGACY_REGION_DEFINES
65fea56f17cd614bc8908264df980a62e1931468vboxsync#ifdef INCLUDE_LEGACY_REGION_DEFINES
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_NIL RegionNil
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_NAR RegionNar
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_NUM_RECTS RegionNumRects
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_SIZE RegionSize
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_RECTS RegionRects
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_BOXPTR RegionBoxptr
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_BOX RegionBox
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_TOP RegionTop
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_END RegionEnd
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_SZOF RegionSizeof
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define BITMAP_TO_REGION BitmapToRegion
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_CREATE(pScreen, r, s) RegionCreate(r,s)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_COPY(pScreen, d, r) RegionCopy(d, r)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_DESTROY(pScreen, r) RegionDestroy(r)
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_BREAK(pScreen, r) RegionBreak(r)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_INIT(pScreen, r, b, s) RegionInit(r, b, s)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_UNINIT(pScreen, r) RegionUninit(r)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_RESET(pScreen, r, b) RegionReset(r, b)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_NOTEMPTY(pScreen, r) RegionNotEmpty(r)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_BROKEN(pScreen, r) RegionBroken(r)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_EMPTY(pScreen, r) RegionEmpty(r)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_EXTENTS(pScreen, r) RegionExtents(r)
65fea56f17cd614bc8908264df980a62e1931468vboxsync#define REGION_NULL(pScreen, r) RegionNull(r)
65fea56f17cd614bc8908264df980a62e1931468vboxsync
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif /* INCLUDE_LEGACY_REGION_DEFINES */
65fea56f17cd614bc8908264df980a62e1931468vboxsync#endif /* REGIONSTRUCT_H */