VirtualBox

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

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

Additions/x11/x11include: exported and set eol-style on new headers

  • 屬性 svn:eol-style 設為 native
檔案大小: 8.6 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 _Region 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 _RegData {
68 long size;
69 long numRects;
70/* BoxRec rects[size]; in memory but not explicitly declared */
71} RegDataRec, *RegDataPtr;
72
73struct _Region {
74 BoxRec extents;
75 RegDataPtr data;
76};
77
78extern BoxRec miEmptyBox;
79extern RegDataRec miEmptyData;
80extern RegDataRec miBrokenData;
81
82#define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
83/* not a region */
84#define REGION_NAR(reg) ((reg)->data == &miBrokenData)
85#define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
86#define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
87#define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \
88 : &(reg)->extents)
89#define REGION_BOXPTR(reg) ((BoxPtr)((reg)->data + 1))
90#define REGION_BOX(reg,i) (&REGION_BOXPTR(reg)[i])
91#define REGION_TOP(reg) REGION_BOX(reg, (reg)->data->numRects)
92#define REGION_END(reg) REGION_BOX(reg, (reg)->data->numRects - 1)
93#define REGION_SZOF(n) (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)))
94
95#define REGION_CREATE(_pScreen, _rect, _size) \
96 miRegionCreate(_rect, _size)
97
98#define REGION_COPY(_pScreen, dst, src) \
99 miRegionCopy(dst, src)
100
101#define REGION_DESTROY(_pScreen, _pReg) \
102 miRegionDestroy(_pReg)
103
104#define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \
105 miIntersect(newReg, reg1, reg2)
106
107#define REGION_UNION(_pScreen, newReg, reg1, reg2) \
108 miUnion(newReg, reg1, reg2)
109
110#define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \
111 miSubtract(newReg, reg1, reg2)
112
113#define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \
114 miInverse(newReg, reg1, invRect)
115
116#define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \
117 miTranslateRegion(_pReg, _x, _y)
118
119#define RECT_IN_REGION(_pScreen, _pReg, prect) \
120 miRectIn(_pReg, prect)
121
122#define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \
123 miPointInRegion(_pReg, _x, _y, prect)
124
125#define REGION_APPEND(_pScreen, dstrgn, rgn) \
126 miRegionAppend(dstrgn, rgn)
127
128#define REGION_VALIDATE(_pScreen, badreg, pOverlap) \
129 miRegionValidate(badreg, pOverlap)
130
131#define BITMAP_TO_REGION(_pScreen, pPix) \
132 (*(_pScreen)->BitmapToRegion)(pPix) /* no mi version?! */
133
134#define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \
135 miRectsToRegion(nrects, prect, ctype)
136
137#define REGION_EQUAL(_pScreen, _pReg1, _pReg2) \
138 miRegionEqual(_pReg1, _pReg2)
139
140#define REGION_BREAK(_pScreen, _pReg) \
141 miRegionBreak(_pReg)
142
143#ifdef DONT_INLINE_REGION_OPS
144
145#define REGION_INIT(_pScreen, _pReg, _rect, _size) \
146 miRegionInit(_pReg, _rect, _size)
147
148#define REGION_UNINIT(_pScreen, _pReg) \
149 miRegionUninit(_pReg)
150
151#define REGION_RESET(_pScreen, _pReg, _pBox) \
152 miRegionReset(_pReg, _pBox)
153
154#define REGION_NOTEMPTY(_pScreen, _pReg) \
155 miRegionNotEmpty(_pReg)
156
157#define REGION_BROKEN(_pScreen, _pReg) \
158 miRegionBroken(_pReg)
159
160#define REGION_EMPTY(_pScreen, _pReg) \
161 miRegionEmpty(_pReg)
162
163#define REGION_EXTENTS(_pScreen, _pReg) \
164 miRegionExtents(_pReg)
165
166#else /* inline certain simple region ops for performance */
167
168#define REGION_INIT(_pScreen, _pReg, _rect, _size) \
169{ \
170 if (_rect) \
171 { \
172 (_pReg)->extents = *(_rect); \
173 (_pReg)->data = (RegDataPtr)NULL; \
174 } \
175 else \
176 { \
177 (_pReg)->extents = miEmptyBox; \
178 if (((_size) > 1) && ((_pReg)->data = \
179 (RegDataPtr)xalloc(REGION_SZOF(_size)))) \
180 { \
181 (_pReg)->data->size = (_size); \
182 (_pReg)->data->numRects = 0; \
183 } \
184 else \
185 (_pReg)->data = &miEmptyData; \
186 } \
187 }
188
189
190#define REGION_UNINIT(_pScreen, _pReg) \
191{ \
192 if ((_pReg)->data && (_pReg)->data->size) { \
193 xfree((_pReg)->data); \
194 (_pReg)->data = NULL; \
195 } \
196}
197
198#define REGION_RESET(_pScreen, _pReg, _pBox) \
199{ \
200 (_pReg)->extents = *(_pBox); \
201 REGION_UNINIT(_pScreen, _pReg); \
202 (_pReg)->data = (RegDataPtr)NULL; \
203}
204
205#define REGION_NOTEMPTY(_pScreen, _pReg) \
206 !REGION_NIL(_pReg)
207
208#define REGION_BROKEN(_pScreen, _pReg) \
209 REGION_NAR(_pReg)
210
211#define REGION_EMPTY(_pScreen, _pReg) \
212{ \
213 REGION_UNINIT(_pScreen, _pReg); \
214 (_pReg)->extents.x2 = (_pReg)->extents.x1; \
215 (_pReg)->extents.y2 = (_pReg)->extents.y1; \
216 (_pReg)->data = &miEmptyData; \
217}
218
219#define REGION_EXTENTS(_pScreen, _pReg) \
220 (&(_pReg)->extents)
221
222#define REGION_NULL(_pScreen, _pReg) \
223{ \
224 (_pReg)->extents = miEmptyBox; \
225 (_pReg)->data = &miEmptyData; \
226}
227
228#endif /* DONT_INLINE_REGION_OPS */
229
230#ifndef REGION_NULL
231#define REGION_NULL(_pScreen, _pReg) \
232 REGION_INIT(_pScreen, _pReg, NullBox, 1)
233#endif
234
235/* moved from mi.h */
236
237extern RegionPtr miRegionCreate(
238 BoxPtr /*rect*/,
239 int /*size*/);
240
241extern void miRegionInit(
242 RegionPtr /*pReg*/,
243 BoxPtr /*rect*/,
244 int /*size*/);
245
246extern void miRegionDestroy(
247 RegionPtr /*pReg*/);
248
249extern void miRegionUninit(
250 RegionPtr /*pReg*/);
251
252extern Bool miRegionCopy(
253 RegionPtr /*dst*/,
254 RegionPtr /*src*/);
255
256extern Bool miIntersect(
257 RegionPtr /*newReg*/,
258 RegionPtr /*reg1*/,
259 RegionPtr /*reg2*/);
260
261extern Bool miUnion(
262 RegionPtr /*newReg*/,
263 RegionPtr /*reg1*/,
264 RegionPtr /*reg2*/);
265
266extern Bool miRegionAppend(
267 RegionPtr /*dstrgn*/,
268 RegionPtr /*rgn*/);
269
270extern Bool miRegionValidate(
271 RegionPtr /*badreg*/,
272 Bool * /*pOverlap*/);
273
274extern RegionPtr miRectsToRegion(
275 int /*nrects*/,
276 xRectanglePtr /*prect*/,
277 int /*ctype*/);
278
279extern Bool miSubtract(
280 RegionPtr /*regD*/,
281 RegionPtr /*regM*/,
282 RegionPtr /*regS*/);
283
284extern Bool miInverse(
285 RegionPtr /*newReg*/,
286 RegionPtr /*reg1*/,
287 BoxPtr /*invRect*/);
288
289extern int miRectIn(
290 RegionPtr /*region*/,
291 BoxPtr /*prect*/);
292
293extern void miTranslateRegion(
294 RegionPtr /*pReg*/,
295 int /*x*/,
296 int /*y*/);
297
298extern void miRegionReset(
299 RegionPtr /*pReg*/,
300 BoxPtr /*pBox*/);
301
302extern Bool miRegionBreak(
303 RegionPtr /*pReg*/);
304
305extern Bool miPointInRegion(
306 RegionPtr /*pReg*/,
307 int /*x*/,
308 int /*y*/,
309 BoxPtr /*box*/);
310
311extern Bool miRegionEqual(
312 RegionPtr /*pReg1*/,
313 RegionPtr /*pReg2*/);
314
315extern Bool miRegionNotEmpty(
316 RegionPtr /*pReg*/);
317
318extern void miRegionEmpty(
319 RegionPtr /*pReg*/);
320
321extern BoxPtr miRegionExtents(
322 RegionPtr /*pReg*/);
323
324#endif /* REGIONSTRUCT_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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