VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/xorg-server-1.16.0/mifillarc.h@ 107044

Last change on this file since 107044 was 52145, checked in by vboxsync, 10 years ago

Additions/x11/x11include: add header files for X.Org Server 1.16.

  • Property svn:eol-style set to native
File size: 4.7 KB
Line 
1/************************************************************
2
3Copyright 1989, 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********************************************************/
26
27#ifndef __MIFILLARC_H__
28#define __MIFILLARC_H__
29
30#define FULLCIRCLE (360 * 64)
31
32typedef struct _miFillArc {
33 int xorg, yorg;
34 int y;
35 int dx, dy;
36 int e;
37 int ym, yk, xm, xk;
38} miFillArcRec;
39
40/* could use 64-bit integers */
41typedef struct _miFillArcD {
42 int xorg, yorg;
43 int y;
44 int dx, dy;
45 double e;
46 double ym, yk, xm, xk;
47} miFillArcDRec;
48
49#define miFillArcEmpty(arc) (!(arc)->angle2 || \
50 !(arc)->width || !(arc)->height || \
51 (((arc)->width == 1) && ((arc)->height & 1)))
52
53#define miCanFillArc(arc) (((arc)->width == (arc)->height) || \
54 (((arc)->width <= 800) && ((arc)->height <= 800)))
55
56#define MIFILLARCSETUP() \
57 x = 0; \
58 y = info.y; \
59 e = info.e; \
60 xk = info.xk; \
61 xm = info.xm; \
62 yk = info.yk; \
63 ym = info.ym; \
64 dx = info.dx; \
65 dy = info.dy; \
66 xorg = info.xorg; \
67 yorg = info.yorg
68
69#define MIFILLARCSTEP(slw) \
70 e += yk; \
71 while (e >= 0) \
72 { \
73 x++; \
74 xk -= xm; \
75 e += xk; \
76 } \
77 y--; \
78 yk -= ym; \
79 slw = (x << 1) + dx; \
80 if ((e == xk) && (slw > 1)) \
81 slw--
82
83#define MIFILLCIRCSTEP(slw) MIFILLARCSTEP(slw)
84#define MIFILLELLSTEP(slw) MIFILLARCSTEP(slw)
85
86#define miFillArcLower(slw) (((y + dy) != 0) && ((slw > 1) || (e != xk)))
87
88typedef struct _miSliceEdge {
89 int x;
90 int stepx;
91 int deltax;
92 int e;
93 int dy;
94 int dx;
95} miSliceEdgeRec, *miSliceEdgePtr;
96
97typedef struct _miArcSlice {
98 miSliceEdgeRec edge1, edge2;
99 int min_top_y, max_top_y;
100 int min_bot_y, max_bot_y;
101 Bool edge1_top, edge2_top;
102 Bool flip_top, flip_bot;
103} miArcSliceRec;
104
105#define MIARCSLICESTEP(edge) \
106 edge.x -= edge.stepx; \
107 edge.e -= edge.dx; \
108 if (edge.e <= 0) \
109 { \
110 edge.x -= edge.deltax; \
111 edge.e += edge.dy; \
112 }
113
114#define miFillSliceUpper(slice) \
115 ((y >= slice.min_top_y) && (y <= slice.max_top_y))
116
117#define miFillSliceLower(slice) \
118 ((y >= slice.min_bot_y) && (y <= slice.max_bot_y))
119
120#define MIARCSLICEUPPER(xl,xr,slice,slw) \
121 xl = xorg - x; \
122 xr = xl + slw - 1; \
123 if (slice.edge1_top && (slice.edge1.x < xr)) \
124 xr = slice.edge1.x; \
125 if (slice.edge2_top && (slice.edge2.x > xl)) \
126 xl = slice.edge2.x;
127
128#define MIARCSLICELOWER(xl,xr,slice,slw) \
129 xl = xorg - x; \
130 xr = xl + slw - 1; \
131 if (!slice.edge1_top && (slice.edge1.x > xl)) \
132 xl = slice.edge1.x; \
133 if (!slice.edge2_top && (slice.edge2.x < xr)) \
134 xr = slice.edge2.x;
135
136#define MIWIDEARCSETUP(x,y,dy,slw,e,xk,xm,yk,ym) \
137 x = 0; \
138 y = slw >> 1; \
139 yk = y << 3; \
140 xm = 8; \
141 ym = 8; \
142 if (dy) \
143 { \
144 xk = 0; \
145 if (slw & 1) \
146 e = -1; \
147 else \
148 e = -(y << 2) - 2; \
149 } \
150 else \
151 { \
152 y++; \
153 yk += 4; \
154 xk = -4; \
155 if (slw & 1) \
156 e = -(y << 2) - 3; \
157 else \
158 e = - (y << 3); \
159 }
160
161#define MIFILLINARCSTEP(slw) \
162 ine += inyk; \
163 while (ine >= 0) \
164 { \
165 inx++; \
166 inxk -= inxm; \
167 ine += inxk; \
168 } \
169 iny--; \
170 inyk -= inym; \
171 slw = (inx << 1) + dx; \
172 if ((ine == inxk) && (slw > 1)) \
173 slw--
174
175#define miFillInArcLower(slw) (((iny + dy) != 0) && \
176 ((slw > 1) || (ine != inxk)))
177
178extern _X_EXPORT void miFillArcSetup(xArc * /*arc */ ,
179 miFillArcRec * /*info */
180 );
181
182extern _X_EXPORT void miFillArcSliceSetup(xArc * /*arc */ ,
183 miArcSliceRec * /*slice */ ,
184 GCPtr /*pGC */
185 );
186
187#endif /* __MIFILLARC_H__ */
Note: See TracBrowser for help on using the repository browser.

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