VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.8.0/regionstr.h@ 61179

最後變更 在這個檔案從61179是 28062,由 vboxsync 提交於 15 年 前

Additions/x11/x11include: header files for building X.Org server 1.8 drivers

  • 屬性 svn:eol-style 設為 native
檔案大小: 8.1 KB
 
1/***********************************************************
2
3Copyright 1987, 1998 The Open Group
4
5Permission to use, copy, modify, distribute, and sell this software and its
6documentation for any purpose is hereby granted without fee, provided that
7the above copyright notice appear in all copies and that both that
8copyright notice and this permission notice appear in supporting
9documentation.
10
11The above copyright notice and this permission notice shall be included in
12all copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
20
21Except as contained in this notice, the name of The Open Group shall not be
22used in advertising or otherwise to promote the sale, use or other dealings
23in this Software without prior written authorization from The Open Group.
24
25
26Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
27
28 All Rights Reserved
29
30Permission to use, copy, modify, and distribute this software and its
31documentation for any purpose and without fee is hereby granted,
32provided that the above copyright notice appear in all copies and that
33both that copyright notice and this permission notice appear in
34supporting documentation, and that the name of Digital not be
35used in advertising or publicity pertaining to distribution of the
36software without specific, written prior permission.
37
38DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
39ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
40DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
41ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
42WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
43ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
44SOFTWARE.
45
46******************************************************************/
47
48#ifndef REGIONSTRUCT_H
49#define REGIONSTRUCT_H
50
51typedef struct pixman_region16 RegionRec, *RegionPtr;
52
53#include "miscstruct.h"
54
55/* Return values from RectIn() */
56
57#define rgnOUT 0
58#define rgnIN 1
59#define rgnPART 2
60
61#define NullRegion ((RegionPtr)0)
62
63/*
64 * clip region
65 */
66
67typedef struct pixman_region16_data RegDataRec, *RegDataPtr;
68
69extern _X_EXPORT BoxRec miEmptyBox;
70extern _X_EXPORT RegDataRec miEmptyData;
71extern _X_EXPORT RegDataRec miBrokenData;
72
73#define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
74/* not a region */
75#define REGION_NAR(reg) ((reg)->data == &miBrokenData)
76#define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
77#define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
78#define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \
79 : &(reg)->extents)
80#define REGION_BOXPTR(reg) ((BoxPtr)((reg)->data + 1))
81#define REGION_BOX(reg,i) (&REGION_BOXPTR(reg)[i])
82#define REGION_TOP(reg) REGION_BOX(reg, (reg)->data->numRects)
83#define REGION_END(reg) REGION_BOX(reg, (reg)->data->numRects - 1)
84#define REGION_SZOF(n) (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)))
85
86#define REGION_CREATE(_pScreen, _rect, _size) \
87 miRegionCreate(_rect, _size)
88
89#define REGION_COPY(_pScreen, dst, src) \
90 miRegionCopy(dst, src)
91
92#define REGION_DESTROY(_pScreen, _pReg) \
93 miRegionDestroy(_pReg)
94
95#define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \
96 miIntersect(newReg, reg1, reg2)
97
98#define REGION_UNION(_pScreen, newReg, reg1, reg2) \
99 miUnion(newReg, reg1, reg2)
100
101#define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \
102 miSubtract(newReg, reg1, reg2)
103
104#define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \
105 miInverse(newReg, reg1, invRect)
106
107#define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \
108 miTranslateRegion(_pReg, _x, _y)
109
110#define RECT_IN_REGION(_pScreen, _pReg, prect) \
111 miRectIn(_pReg, prect)
112
113#define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \
114 miPointInRegion(_pReg, _x, _y, prect)
115
116#define REGION_APPEND(_pScreen, dstrgn, rgn) \
117 miRegionAppend(dstrgn, rgn)
118
119#define REGION_VALIDATE(_pScreen, badreg, pOverlap) \
120 miRegionValidate(badreg, pOverlap)
121
122#define BITMAP_TO_REGION(_pScreen, pPix) \
123 (*(_pScreen)->BitmapToRegion)(pPix) /* no mi version?! */
124
125#define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \
126 miRectsToRegion(nrects, prect, ctype)
127
128#define REGION_EQUAL(_pScreen, _pReg1, _pReg2) \
129 miRegionEqual(_pReg1, _pReg2)
130
131#define REGION_BREAK(_pScreen, _pReg) \
132 miRegionBreak(_pReg)
133
134#define REGION_INIT(_pScreen, _pReg, _rect, _size) \
135{ \
136 if ((_rect) != NULL) \
137 { \
138 (_pReg)->extents = *(_rect); \
139 (_pReg)->data = (RegDataPtr)NULL; \
140 } \
141 else \
142 { \
143 (_pReg)->extents = miEmptyBox; \
144 if (((_size) > 1) && ((_pReg)->data = \
145 (RegDataPtr)xalloc(REGION_SZOF(_size)))) \
146 { \
147 (_pReg)->data->size = (_size); \
148 (_pReg)->data->numRects = 0; \
149 } \
150 else \
151 (_pReg)->data = &miEmptyData; \
152 } \
153 }
154
155
156#define REGION_UNINIT(_pScreen, _pReg) \
157{ \
158 if ((_pReg)->data && (_pReg)->data->size) { \
159 xfree((_pReg)->data); \
160 (_pReg)->data = NULL; \
161 } \
162}
163
164#define REGION_RESET(_pScreen, _pReg, _pBox) \
165{ \
166 (_pReg)->extents = *(_pBox); \
167 REGION_UNINIT(_pScreen, _pReg); \
168 (_pReg)->data = (RegDataPtr)NULL; \
169}
170
171#define REGION_NOTEMPTY(_pScreen, _pReg) \
172 !REGION_NIL(_pReg)
173
174#define REGION_BROKEN(_pScreen, _pReg) \
175 REGION_NAR(_pReg)
176
177#define REGION_EMPTY(_pScreen, _pReg) \
178{ \
179 REGION_UNINIT(_pScreen, _pReg); \
180 (_pReg)->extents.x2 = (_pReg)->extents.x1; \
181 (_pReg)->extents.y2 = (_pReg)->extents.y1; \
182 (_pReg)->data = &miEmptyData; \
183}
184
185#define REGION_EXTENTS(_pScreen, _pReg) \
186 (&(_pReg)->extents)
187
188#define REGION_NULL(_pScreen, _pReg) \
189{ \
190 (_pReg)->extents = miEmptyBox; \
191 (_pReg)->data = &miEmptyData; \
192}
193
194#ifndef REGION_NULL
195#define REGION_NULL(_pScreen, _pReg) \
196 REGION_INIT(_pScreen, _pReg, NullBox, 1)
197#endif
198
199/* moved from mi.h */
200
201extern _X_EXPORT void InitRegions (void);
202
203extern _X_EXPORT RegionPtr miRegionCreate(
204 BoxPtr /*rect*/,
205 int /*size*/);
206
207extern _X_EXPORT void miRegionInit(
208 RegionPtr /*pReg*/,
209 BoxPtr /*rect*/,
210 int /*size*/);
211
212extern _X_EXPORT void miRegionDestroy(
213 RegionPtr /*pReg*/);
214
215extern _X_EXPORT void miRegionUninit(
216 RegionPtr /*pReg*/);
217
218extern _X_EXPORT Bool miRegionCopy(
219 RegionPtr /*dst*/,
220 RegionPtr /*src*/);
221
222extern _X_EXPORT Bool miIntersect(
223 RegionPtr /*newReg*/,
224 RegionPtr /*reg1*/,
225 RegionPtr /*reg2*/);
226
227extern _X_EXPORT Bool miUnion(
228 RegionPtr /*newReg*/,
229 RegionPtr /*reg1*/,
230 RegionPtr /*reg2*/);
231
232extern _X_EXPORT Bool miRegionAppend(
233 RegionPtr /*dstrgn*/,
234 RegionPtr /*rgn*/);
235
236extern _X_EXPORT Bool miRegionValidate(
237 RegionPtr /*badreg*/,
238 Bool * /*pOverlap*/);
239
240extern _X_EXPORT RegionPtr miRectsToRegion(
241 int /*nrects*/,
242 xRectanglePtr /*prect*/,
243 int /*ctype*/);
244
245extern _X_EXPORT Bool miSubtract(
246 RegionPtr /*regD*/,
247 RegionPtr /*regM*/,
248 RegionPtr /*regS*/);
249
250extern _X_EXPORT Bool miInverse(
251 RegionPtr /*newReg*/,
252 RegionPtr /*reg1*/,
253 BoxPtr /*invRect*/);
254
255extern _X_EXPORT int miRectIn(
256 RegionPtr /*region*/,
257 BoxPtr /*prect*/);
258
259extern _X_EXPORT void miTranslateRegion(
260 RegionPtr /*pReg*/,
261 int /*x*/,
262 int /*y*/);
263
264extern _X_EXPORT void miRegionReset(
265 RegionPtr /*pReg*/,
266 BoxPtr /*pBox*/);
267
268extern _X_EXPORT Bool miRegionBreak(
269 RegionPtr /*pReg*/);
270
271extern _X_EXPORT Bool miPointInRegion(
272 RegionPtr /*pReg*/,
273 int /*x*/,
274 int /*y*/,
275 BoxPtr /*box*/);
276
277extern _X_EXPORT Bool miRegionEqual(
278 RegionPtr /*pReg1*/,
279 RegionPtr /*pReg2*/);
280
281extern _X_EXPORT Bool miRegionNotEmpty(
282 RegionPtr /*pReg*/);
283
284extern _X_EXPORT void miRegionEmpty(
285 RegionPtr /*pReg*/);
286
287extern _X_EXPORT BoxPtr miRegionExtents(
288 RegionPtr /*pReg*/);
289
290extern _X_EXPORT void miPrintRegion(
291 RegionPtr /*pReg*/);
292
293#endif /* REGIONSTRUCT_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette