VirtualBox

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

最後變更 在這個檔案是 51223,由 vboxsync 提交於 11 年 前

Additions/x11/x11include: added header files for X.Org Server 1.0 and 1.1.

  • 屬性 svn:eol-style 設為 native
檔案大小: 12.1 KB
 
1/* $XdotOrg: xc/programs/Xserver/include/regionstr.h,v 1.4 2005/06/25 12:39:58 zack Exp $ */
2/* $Xorg: regionstr.h,v 1.4 2001/02/09 02:05:15 xorgcvs Exp $ */
3/***********************************************************
4
5Copyright 1987, 1998 The Open Group
6
7Permission to use, copy, modify, distribute, and sell this software and its
8documentation for any purpose is hereby granted without fee, provided that
9the above copyright notice appear in all copies and that both that
10copyright notice and this permission notice appear in supporting
11documentation.
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
23Except as contained in this notice, the name of The Open Group shall not be
24used in advertising or otherwise to promote the sale, use or other dealings
25in this Software without prior written authorization from The Open Group.
26
27
28Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
29
30 All Rights Reserved
31
32Permission to use, copy, modify, and distribute this software and its
33documentation for any purpose and without fee is hereby granted,
34provided that the above copyright notice appear in all copies and that
35both that copyright notice and this permission notice appear in
36supporting documentation, and that the name of Digital not be
37used in advertising or publicity pertaining to distribution of the
38software without specific, written prior permission.
39
40DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
41ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
42DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
43ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
44WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
45ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46SOFTWARE.
47
48******************************************************************/
49/* $XFree86: xc/programs/Xserver/include/regionstr.h,v 1.12tsi Exp $ */
50
51#ifndef REGIONSTRUCT_H
52#define REGIONSTRUCT_H
53
54typedef struct _Region RegionRec, *RegionPtr;
55
56#include "miscstruct.h"
57
58/* Return values from RectIn() */
59
60#define rgnOUT 0
61#define rgnIN 1
62#define rgnPART 2
63
64#define NullRegion ((RegionPtr)0)
65
66/*
67 * clip region
68 */
69
70typedef struct _RegData {
71 long size;
72 long numRects;
73/* BoxRec rects[size]; in memory but not explicitly declared */
74} RegDataRec, *RegDataPtr;
75
76struct _Region {
77 BoxRec extents;
78 RegDataPtr data;
79};
80
81extern BoxRec miEmptyBox;
82extern RegDataRec miEmptyData;
83extern RegDataRec miBrokenData;
84
85#define REGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
86/* not a region */
87#define REGION_NAR(reg) ((reg)->data == &miBrokenData)
88#define REGION_NUM_RECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
89#define REGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
90#define REGION_RECTS(reg) ((reg)->data ? (BoxPtr)((reg)->data + 1) \
91 : &(reg)->extents)
92#define REGION_BOXPTR(reg) ((BoxPtr)((reg)->data + 1))
93#define REGION_BOX(reg,i) (&REGION_BOXPTR(reg)[i])
94#define REGION_TOP(reg) REGION_BOX(reg, (reg)->data->numRects)
95#define REGION_END(reg) REGION_BOX(reg, (reg)->data->numRects - 1)
96#define REGION_SZOF(n) (sizeof(RegDataRec) + ((n) * sizeof(BoxRec)))
97
98/* Keith recommends weaning the region code of pScreen argument */
99#define REG_pScreen screenInfo.screens[0]
100
101#ifdef NEED_SCREEN_REGIONS
102
103#define REGION_CREATE(_pScreen, _rect, _size) \
104 (*(REG_pScreen)->RegionCreate)(_rect, _size)
105
106#define REGION_INIT(_pScreen, _pReg, _rect, _size) \
107 (*(REG_pScreen)->RegionInit)(_pReg, _rect, _size)
108
109#define REGION_COPY(_pScreen, dst, src) \
110 (*(REG_pScreen)->RegionCopy)(dst, src)
111
112#define REGION_DESTROY(_pScreen, _pReg) \
113 (*(REG_pScreen)->RegionDestroy)(_pReg)
114
115#define REGION_UNINIT(_pScreen, _pReg) \
116 (*(REG_pScreen)->RegionUninit)(_pReg)
117
118#define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \
119 (*(REG_pScreen)->Intersect)(newReg, reg1, reg2)
120
121#define REGION_UNION(_pScreen, newReg, reg1, reg2) \
122 (*(REG_pScreen)->Union)(newReg, reg1, reg2)
123
124#define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \
125 (*(REG_pScreen)->Subtract)(newReg, reg1, reg2)
126
127#define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \
128 (*(REG_pScreen)->Inverse)(newReg, reg1, invRect)
129
130#define REGION_RESET(_pScreen, _pReg, _pBox) \
131 (*(REG_pScreen)->RegionReset)(_pReg, _pBox)
132
133#define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \
134 (*(REG_pScreen)->TranslateRegion)(_pReg, _x, _y)
135
136#define RECT_IN_REGION(_pScreen, _pReg, prect) \
137 (*(REG_pScreen)->RectIn)(_pReg, prect)
138
139#define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \
140 (*(REG_pScreen)->PointInRegion)(_pReg, _x, _y, prect)
141
142#define REGION_NOTEMPTY(_pScreen, _pReg) \
143 (*(REG_pScreen)->RegionNotEmpty)(_pReg)
144
145#define REGION_EQUAL(_pScreen, _pReg1, _pReg2) \
146 (*(REG_pScreen)->RegionEqual)(_pReg1, _pReg2)
147
148#define REGION_BROKEN(_pScreen, _pReg) \
149 (*(REG_pScreen)->RegionBroken)(_pReg)
150
151#define REGION_BREAK(_pScreen, _pReg) \
152 (*(REG_pScreen)->RegionBreak)(_pReg)
153
154#define REGION_EMPTY(_pScreen, _pReg) \
155 (*(REG_pScreen)->RegionEmpty)(_pReg)
156
157#define REGION_EXTENTS(_pScreen, _pReg) \
158 (*(REG_pScreen)->RegionExtents)(_pReg)
159
160#define REGION_APPEND(_pScreen, dstrgn, rgn) \
161 (*(REG_pScreen)->RegionAppend)(dstrgn, rgn)
162
163#define REGION_VALIDATE(_pScreen, badreg, pOverlap) \
164 (*(REG_pScreen)->RegionValidate)(badreg, pOverlap)
165
166#define BITMAP_TO_REGION(_pScreen, pPix) \
167 (*(REG_pScreen)->BitmapToRegion)(pPix)
168
169#define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \
170 (*(REG_pScreen)->RectsToRegion)(nrects, prect, ctype)
171
172#else /* !NEED_SCREEN_REGIONS */
173
174/* Reference _pScreen macro argument and check its type */
175#define REGION_SCREEN(_pScreen) (void)((REG_pScreen)->myNum)
176
177#define REGION_CREATE(_pScreen, _rect, _size) \
178 (REGION_SCREEN(_pScreen), miRegionCreate(_rect, _size))
179
180#define REGION_COPY(_pScreen, dst, src) \
181 (REGION_SCREEN(_pScreen), miRegionCopy(dst, src))
182
183#define REGION_DESTROY(_pScreen, _pReg) \
184 (REGION_SCREEN(_pScreen), miRegionDestroy(_pReg))
185
186#define REGION_INTERSECT(_pScreen, newReg, reg1, reg2) \
187 (REGION_SCREEN(_pScreen), miIntersect(newReg, reg1, reg2))
188
189#define REGION_UNION(_pScreen, newReg, reg1, reg2) \
190 (REGION_SCREEN(_pScreen), miUnion(newReg, reg1, reg2))
191
192#define REGION_SUBTRACT(_pScreen, newReg, reg1, reg2) \
193 (REGION_SCREEN(_pScreen), miSubtract(newReg, reg1, reg2))
194
195#define REGION_INVERSE(_pScreen, newReg, reg1, invRect) \
196 (REGION_SCREEN(_pScreen), miInverse(newReg, reg1, invRect))
197
198#define REGION_TRANSLATE(_pScreen, _pReg, _x, _y) \
199 (REGION_SCREEN(_pScreen), miTranslateRegion(_pReg, _x, _y))
200
201#define RECT_IN_REGION(_pScreen, _pReg, prect) \
202 (REGION_SCREEN(_pScreen), miRectIn(_pReg, prect))
203
204#define POINT_IN_REGION(_pScreen, _pReg, _x, _y, prect) \
205 (REGION_SCREEN(_pScreen), miPointInRegion(_pReg, _x, _y, prect))
206
207#define REGION_APPEND(_pScreen, dstrgn, rgn) \
208 (REGION_SCREEN(_pScreen), miRegionAppend(dstrgn, rgn))
209
210#define REGION_VALIDATE(_pScreen, badreg, pOverlap) \
211 (REGION_SCREEN(_pScreen), miRegionValidate(badreg, pOverlap))
212
213#define BITMAP_TO_REGION(_pScreen, pPix) \
214 (*(_pScreen)->BitmapToRegion)(pPix) /* no mi version?! */
215
216#define RECTS_TO_REGION(_pScreen, nrects, prect, ctype) \
217 (REGION_SCREEN(_pScreen), miRectsToRegion(nrects, prect, ctype))
218
219#define REGION_EQUAL(_pScreen, _pReg1, _pReg2) \
220 (REGION_SCREEN(_pScreen), miRegionEqual(_pReg1, _pReg2))
221
222#define REGION_BREAK(_pScreen, _pReg) \
223 (REGION_SCREEN(_pScreen), miRegionBreak(_pReg))
224
225#ifdef DONT_INLINE_REGION_OPS
226
227#define REGION_INIT(_pScreen, _pReg, _rect, _size) \
228 (REGION_SCREEN(_pScreen), miRegionInit(_pReg, _rect, _size))
229
230#define REGION_UNINIT(_pScreen, _pReg) \
231 (REGION_SCREEN(_pScreen), miRegionUninit(_pReg))
232
233#define REGION_RESET(_pScreen, _pReg, _pBox) \
234 (REGION_SCREEN(_pScreen), miRegionReset(_pReg, _pBox))
235
236#define REGION_NOTEMPTY(_pScreen, _pReg) \
237 (REGION_SCREEN(_pScreen), miRegionNotEmpty(_pReg))
238
239#define REGION_BROKEN(_pScreen, _pReg) \
240 (REGION_SCREEN(_pScreen), miRegionBroken(_pReg))
241
242#define REGION_EMPTY(_pScreen, _pReg) \
243 (REGION_SCREEN(_pScreen), miRegionEmpty(_pReg))
244
245#define REGION_EXTENTS(_pScreen, _pReg) \
246 (REGION_SCREEN(_pScreen), miRegionExtents(_pReg))
247
248#else /* inline certain simple region ops for performance */
249
250#define REGION_INIT(_pScreen, _pReg, _rect, _size) \
251{ \
252 REGION_SCREEN(_pScreen); \
253 if (_rect) \
254 { \
255 (_pReg)->extents = *(_rect); \
256 (_pReg)->data = (RegDataPtr)NULL; \
257 } \
258 else \
259 { \
260 (_pReg)->extents = miEmptyBox; \
261 if (((_size) > 1) && ((_pReg)->data = \
262 (RegDataPtr)xalloc(REGION_SZOF(_size)))) \
263 { \
264 (_pReg)->data->size = (_size); \
265 (_pReg)->data->numRects = 0; \
266 } \
267 else \
268 (_pReg)->data = &miEmptyData; \
269 } \
270 }
271
272
273#define REGION_UNINIT(_pScreen, _pReg) \
274{ \
275 REGION_SCREEN(_pScreen); \
276 if ((_pReg)->data && (_pReg)->data->size) { \
277 xfree((_pReg)->data); \
278 (_pReg)->data = NULL; \
279 } \
280}
281
282#define REGION_RESET(_pScreen, _pReg, _pBox) \
283{ \
284 REGION_SCREEN(_pScreen); \
285 (_pReg)->extents = *(_pBox); \
286 REGION_UNINIT(_pScreen, _pReg); \
287 (_pReg)->data = (RegDataPtr)NULL; \
288}
289
290#define REGION_NOTEMPTY(_pScreen, _pReg) \
291 (REGION_SCREEN(_pScreen), !REGION_NIL(_pReg))
292
293#define REGION_BROKEN(_pScreen, _pReg) \
294 (REGION_SCREEN(_pScreen), REGION_NAR(_pReg))
295
296#define REGION_EMPTY(_pScreen, _pReg) \
297{ \
298 REGION_UNINIT(_pScreen, _pReg); \
299 (_pReg)->extents.x2 = (_pReg)->extents.x1; \
300 (_pReg)->extents.y2 = (_pReg)->extents.y1; \
301 (_pReg)->data = &miEmptyData; \
302}
303
304#define REGION_EXTENTS(_pScreen, _pReg) \
305 (REGION_SCREEN(_pScreen), &(_pReg)->extents)
306
307#define REGION_NULL(_pScreen, _pReg) \
308{ \
309 REGION_SCREEN(_pScreen); \
310 (_pReg)->extents = miEmptyBox; \
311 (_pReg)->data = &miEmptyData; \
312}
313
314#endif /* DONT_INLINE_REGION_OPS */
315
316#endif /* NEED_SCREEN_REGIONS */
317
318#ifndef REGION_NULL
319#define REGION_NULL(_pScreen, _pReg) \
320 REGION_INIT(_pScreen, _pReg, NullBox, 1)
321#endif
322
323/* moved from mi.h */
324
325extern RegionPtr miRegionCreate(
326 BoxPtr /*rect*/,
327 int /*size*/);
328
329extern void miRegionInit(
330 RegionPtr /*pReg*/,
331 BoxPtr /*rect*/,
332 int /*size*/);
333
334extern void miRegionDestroy(
335 RegionPtr /*pReg*/);
336
337extern void miRegionUninit(
338 RegionPtr /*pReg*/);
339
340extern Bool miRegionCopy(
341 RegionPtr /*dst*/,
342 RegionPtr /*src*/);
343
344extern Bool miIntersect(
345 RegionPtr /*newReg*/,
346 RegionPtr /*reg1*/,
347 RegionPtr /*reg2*/);
348
349extern Bool miUnion(
350 RegionPtr /*newReg*/,
351 RegionPtr /*reg1*/,
352 RegionPtr /*reg2*/);
353
354extern Bool miRegionAppend(
355 RegionPtr /*dstrgn*/,
356 RegionPtr /*rgn*/);
357
358extern Bool miRegionValidate(
359 RegionPtr /*badreg*/,
360 Bool * /*pOverlap*/);
361
362extern RegionPtr miRectsToRegion(
363 int /*nrects*/,
364 xRectanglePtr /*prect*/,
365 int /*ctype*/);
366
367extern Bool miSubtract(
368 RegionPtr /*regD*/,
369 RegionPtr /*regM*/,
370 RegionPtr /*regS*/);
371
372extern Bool miInverse(
373 RegionPtr /*newReg*/,
374 RegionPtr /*reg1*/,
375 BoxPtr /*invRect*/);
376
377extern int miRectIn(
378 RegionPtr /*region*/,
379 BoxPtr /*prect*/);
380
381extern void miTranslateRegion(
382 RegionPtr /*pReg*/,
383 int /*x*/,
384 int /*y*/);
385
386extern void miRegionReset(
387 RegionPtr /*pReg*/,
388 BoxPtr /*pBox*/);
389
390extern Bool miRegionBreak(
391 RegionPtr /*pReg*/);
392
393extern Bool miPointInRegion(
394 RegionPtr /*pReg*/,
395 int /*x*/,
396 int /*y*/,
397 BoxPtr /*box*/);
398
399extern Bool miRegionEqual(
400 RegionPtr /*pReg1*/,
401 RegionPtr /*pReg2*/);
402
403extern Bool miRegionNotEmpty(
404 RegionPtr /*pReg*/);
405
406extern void miRegionEmpty(
407 RegionPtr /*pReg*/);
408
409extern BoxPtr miRegionExtents(
410 RegionPtr /*pReg*/);
411
412#endif /* REGIONSTRUCT_H */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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