2003-11-14 16:54:54 +01:00
|
|
|
/***********************************************************
|
|
|
|
|
|
|
|
Copyright 1987, 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 by Digital Equipment Corporation, Maynard, Massachusetts.
|
|
|
|
|
|
|
|
All Rights Reserved
|
|
|
|
|
2005-06-25 14:39:58 +02:00
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted,
|
2003-11-14 16:54:54 +01:00
|
|
|
provided that the above copyright notice appear in all copies and that
|
2005-06-25 14:39:58 +02:00
|
|
|
both that copyright notice and this permission notice appear in
|
2003-11-14 16:54:54 +01:00
|
|
|
supporting documentation, and that the name of Digital not be
|
|
|
|
used in advertising or publicity pertaining to distribution of the
|
2005-06-25 14:39:58 +02:00
|
|
|
software without specific, written prior permission.
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
******************************************************************/
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
#ifndef REGIONSTRUCT_H
|
|
|
|
#define REGIONSTRUCT_H
|
|
|
|
|
2007-05-12 22:58:54 +02:00
|
|
|
typedef struct pixman_region16 RegionRec, *RegionPtr;
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
#include "miscstruct.h"
|
|
|
|
|
|
|
|
/* Return values from RectIn() */
|
|
|
|
|
|
|
|
#define rgnOUT 0
|
|
|
|
#define rgnIN 1
|
|
|
|
#define rgnPART 2
|
|
|
|
|
|
|
|
#define NullRegion ((RegionPtr)0)
|
|
|
|
|
2005-06-25 14:39:58 +02:00
|
|
|
/*
|
2003-11-14 16:54:54 +01:00
|
|
|
* clip region
|
|
|
|
*/
|
|
|
|
|
2007-05-12 22:58:54 +02:00
|
|
|
typedef struct pixman_region16_data RegDataRec, *RegDataPtr;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT BoxRec RegionEmptyBox;
|
|
|
|
extern _X_EXPORT RegDataRec RegionEmptyData;
|
|
|
|
extern _X_EXPORT RegDataRec RegionBrokenData;
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionNil(reg) ((reg)->data && !(reg)->data->numRects)
|
2003-11-14 17:49:22 +01:00
|
|
|
/* not a region */
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionNar(reg) ((reg)->data == &RegionBrokenData)
|
|
|
|
#define RegionNumRects(reg) ((reg)->data ? (reg)->data->numRects : 1)
|
|
|
|
#define RegionSize(reg) ((reg)->data ? (reg)->data->size : 0)
|
|
|
|
#define RegionRects(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \
|
2003-11-14 16:54:54 +01:00
|
|
|
: &(reg)->extents)
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionBoxptr(reg) ((BoxPtr)((reg)->data + 1))
|
|
|
|
#define RegionBox(reg,i) (&RegionBoxptr(reg)[i])
|
|
|
|
#define RegionTop(reg) RegionBox(reg, (reg)->data->numRects)
|
|
|
|
#define RegionEnd(reg) RegionBox(reg, (reg)->data->numRects - 1)
|
|
|
|
#define RegionSizeof(n) (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)))
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionCreate(_rect, _size) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionCreate(_rect, _size)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionCopy(dst, src) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionCopy(dst, src)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionDestroy(_pReg) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionDestroy(_pReg)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionIntersect(newReg, reg1, reg2) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionIntersect(newReg, reg1, reg2)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionUnion(newReg, reg1, reg2) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionUnion(newReg, reg1, reg2)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionSubtract(newReg, reg1, reg2) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionSubtract(newReg, reg1, reg2)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionInverse(newReg, reg1, invRect) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionInverse(newReg, reg1, invRect)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionTranslate(_pReg, _x, _y) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionTranslate(_pReg, _x, _y)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionContainsRect(_pReg, prect) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionContainsRect(_pReg, prect)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionContainsPoint(_pReg, _x, _y, prect) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionContainsPoint(_pReg, _x, _y, prect)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionAppend(dstrgn, rgn) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionAppend(dstrgn, rgn)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionValidate(badreg, pOverlap) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionValidate(badreg, pOverlap)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define BitmapToRegion(_pScreen, pPix) \
|
2003-11-14 16:54:54 +01:00
|
|
|
(*(_pScreen)->BitmapToRegion)(pPix) /* no mi version?! */
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionFromRects(nrects, prect, ctype) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionFromRects(nrects, prect, ctype)
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionEqual(_pReg1, _pReg2) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionEqual(_pReg1, _pReg2)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionBreak(_pReg) \
|
2010-05-21 20:14:59 +02:00
|
|
|
RegionBreak(_pReg)
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionInit(_pReg, _rect, _size) \
|
2003-11-14 16:54:54 +01:00
|
|
|
{ \
|
2008-03-11 18:11:04 +01:00
|
|
|
if ((_rect) != NULL) \
|
2005-06-25 14:39:58 +02:00
|
|
|
{ \
|
|
|
|
(_pReg)->extents = *(_rect); \
|
|
|
|
(_pReg)->data = (RegDataPtr)NULL; \
|
|
|
|
} \
|
|
|
|
else \
|
|
|
|
{ \
|
2010-05-21 20:14:59 +02:00
|
|
|
(_pReg)->extents = RegionEmptyBox; \
|
2005-06-25 14:39:58 +02:00
|
|
|
if (((_size) > 1) && ((_pReg)->data = \
|
2010-05-22 00:05:48 +02:00
|
|
|
(RegDataPtr)malloc(RegionSizeof(_size)))) \
|
2005-06-25 14:39:58 +02:00
|
|
|
{ \
|
|
|
|
(_pReg)->data->size = (_size); \
|
|
|
|
(_pReg)->data->numRects = 0; \
|
|
|
|
} \
|
|
|
|
else \
|
2010-05-21 20:14:59 +02:00
|
|
|
(_pReg)->data = &RegionEmptyData; \
|
2005-06-25 14:39:58 +02:00
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionUninit(_pReg) \
|
2003-11-14 16:54:54 +01:00
|
|
|
{ \
|
2003-11-14 17:49:22 +01:00
|
|
|
if ((_pReg)->data && (_pReg)->data->size) { \
|
2010-05-05 20:44:06 +02:00
|
|
|
free((_pReg)->data); \
|
2003-11-14 17:49:22 +01:00
|
|
|
(_pReg)->data = NULL; \
|
|
|
|
} \
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionReset(_pReg, _pBox) \
|
2003-11-14 16:54:54 +01:00
|
|
|
{ \
|
|
|
|
(_pReg)->extents = *(_pBox); \
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUninit(_pReg); \
|
2003-11-14 16:54:54 +01:00
|
|
|
(_pReg)->data = (RegDataPtr)NULL; \
|
|
|
|
}
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionNotEmpty(_pReg) \
|
|
|
|
!RegionNil(_pReg)
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionBroken(_pReg) \
|
|
|
|
RegionNar(_pReg)
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionEmpty(_pReg) \
|
2003-11-14 16:54:54 +01:00
|
|
|
{ \
|
2010-05-22 00:05:48 +02:00
|
|
|
RegionUninit(_pReg); \
|
2003-11-14 16:54:54 +01:00
|
|
|
(_pReg)->extents.x2 = (_pReg)->extents.x1; \
|
|
|
|
(_pReg)->extents.y2 = (_pReg)->extents.y1; \
|
2010-05-21 20:14:59 +02:00
|
|
|
(_pReg)->data = &RegionEmptyData; \
|
2003-11-14 16:54:54 +01:00
|
|
|
}
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionExtents(_pReg) \
|
2006-03-28 02:18:31 +02:00
|
|
|
(&(_pReg)->extents)
|
2003-11-25 20:29:01 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#define RegionNull(_pReg) \
|
2003-11-25 20:29:01 +01:00
|
|
|
{ \
|
2010-05-21 20:14:59 +02:00
|
|
|
(_pReg)->extents = RegionEmptyBox; \
|
|
|
|
(_pReg)->data = &RegionEmptyData; \
|
2003-11-25 20:29:01 +01:00
|
|
|
}
|
2003-11-14 16:54:54 +01:00
|
|
|
|
|
|
|
/* moved from mi.h */
|
|
|
|
|
Rework symbol visibility for easier maintenance
Save in a few special cases, _X_EXPORT should not be used in C source
files. Instead, it should be used in headers, and the proper C source
include that header. Some special cases are symbols that need to be
shared between modules, but not expected to be used by external drivers,
and symbols that are accessible via LoaderSymbol/dlopen.
This patch also adds conditionally some new sdk header files, depending
on extensions enabled. These files were added to match pattern for
other extensions/modules, that is, have the headers "deciding" symbol
visibility in the sdk. These headers are:
o Xext/panoramiXsrv.h, Xext/panoramiX.h
o fbpict.h (unconditionally)
o vidmodeproc.h
o mioverlay.h (unconditionally, used only by xaa)
o xfixes.h (unconditionally, symbols required by dri2)
LoaderSymbol and similar functions now don't have different prototypes,
in loaderProcs.h and xf86Module.h, so that both headers can be included,
without the need of defining IN_LOADER.
xf86NewInputDevice() device prototype readded to xf86Xinput.h, but
not exported (and with a comment about it).
2008-12-03 08:43:34 +01:00
|
|
|
extern _X_EXPORT void InitRegions (void);
|
2007-05-12 23:41:47 +02:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT RegionPtr RegionCreate(
|
2003-11-14 16:54:54 +01:00
|
|
|
BoxPtr /*rect*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
int /*size*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT void RegionDestroy(
|
2003-11-25 20:29:01 +01:00
|
|
|
RegionPtr /*pReg*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT Bool RegionCopy(
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr /*dst*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
RegionPtr /*src*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT Bool RegionIntersect(
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr /*newReg*/,
|
|
|
|
RegionPtr /*reg1*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
RegionPtr /*reg2*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT Bool RegionUnion(
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr /*newReg*/,
|
|
|
|
RegionPtr /*reg1*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
RegionPtr /*reg2*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT Bool RegionAppend(
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr /*dstrgn*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
RegionPtr /*rgn*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT Bool RegionValidate(
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr /*badreg*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
Bool * /*pOverlap*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT RegionPtr RegionFromRects(
|
2003-11-14 16:54:54 +01:00
|
|
|
int /*nrects*/,
|
|
|
|
xRectanglePtr /*prect*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
int /*ctype*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT Bool RegionSubtract(
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr /*regD*/,
|
|
|
|
RegionPtr /*regM*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
RegionPtr /*regS*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT Bool RegionInverse(
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr /*newReg*/,
|
|
|
|
RegionPtr /*reg1*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
BoxPtr /*invRect*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT int RegionContainsRect(
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr /*region*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
BoxPtr /*prect*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT void RegionTranslate(
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr /*pReg*/,
|
|
|
|
int /*x*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
int /*y*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT Bool RegionBreak(
|
2003-11-25 20:29:01 +01:00
|
|
|
RegionPtr /*pReg*/);
|
2003-11-14 17:49:22 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT Bool RegionContainsPoint(
|
2003-11-14 16:54:54 +01:00
|
|
|
RegionPtr /*pReg*/,
|
|
|
|
int /*x*/,
|
|
|
|
int /*y*/,
|
2003-11-25 20:29:01 +01:00
|
|
|
BoxPtr /*box*/);
|
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT Bool RegionEqual(
|
2003-11-25 20:29:01 +01:00
|
|
|
RegionPtr /*pReg1*/,
|
|
|
|
RegionPtr /*pReg2*/);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
extern _X_EXPORT Bool RegionRectAlloc(
|
|
|
|
RegionPtr /*pRgn*/,
|
|
|
|
int /*n*/
|
|
|
|
);
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
#ifdef DEBUG
|
|
|
|
extern _X_EXPORT Bool RegionIsValid(
|
|
|
|
RegionPtr /*prgn*/
|
|
|
|
);
|
|
|
|
#endif
|
2003-11-14 16:54:54 +01:00
|
|
|
|
2010-05-21 20:14:59 +02:00
|
|
|
extern _X_EXPORT void RegionPrint(
|
2006-11-04 20:38:31 +01:00
|
|
|
RegionPtr /*pReg*/);
|
|
|
|
|
2010-05-22 00:05:48 +02:00
|
|
|
extern _X_EXPORT int RegionClipSpans(
|
|
|
|
RegionPtr /*prgnDst*/,
|
|
|
|
DDXPointPtr /*ppt*/,
|
|
|
|
int * /*pwidth*/,
|
|
|
|
int /*nspans*/,
|
|
|
|
DDXPointPtr /*pptNew*/,
|
|
|
|
int * /*pwidthNew*/,
|
|
|
|
int /*fSorted*/
|
|
|
|
);
|
|
|
|
|
2003-11-14 16:54:54 +01:00
|
|
|
#endif /* REGIONSTRUCT_H */
|