1 /************************************************************
3 Copyright (c) 1989 X Consortium
5 Permission is hereby granted, free of charge, to any person obtaining a copy
6 of this software and associated documentation files (the "Software"), to deal
7 in the Software without restriction, including without limitation the rights
8 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 copies of the Software, and to permit persons to whom the Software is
10 furnished to do so, subject to the following conditions:
12 The above copyright notice and this permission notice shall be included in
13 all copies or substantial portions of the Software.
15 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 Except as contained in this notice, the name of the X Consortium shall not be
23 used in advertising or otherwise to promote the sale, use or other dealings
24 in this Software without prior written authorization from the X Consortium.
26 ********************************************************/
28 /* $XConsortium: mifillarc.h,v 5.9 95/01/11 16:19:24 dpw Exp $ */
29 /* $XFree86: xc/programs/Xserver/mi/mifillarc.h,v 3.2 1995/01/28 16:15:53 dawes Exp $ */
31 #define FULLCIRCLE (360 * 64)
33 typedef struct _miFillArc {
41 /* could use 64-bit integers */
42 typedef struct _miFillArcD {
47 double ym, yk, xm, xk;
50 #define miFillArcEmpty(arc) (!(arc)->angle2 || \
51 !(arc)->width || !(arc)->height || \
52 (((arc)->width == 1) && ((arc)->height & 1)))
54 #define miCanFillArc(arc) (((arc)->width == (arc)->height) || \
55 (((arc)->width <= 800) && ((arc)->height <= 800)))
57 #define MIFILLARCSETUP() \
70 #define MIFILLARCSTEP(slw) \
80 slw = (x << 1) + dx; \
81 if ((e == xk) && (slw > 1)) \
84 #define MIFILLCIRCSTEP(slw) MIFILLARCSTEP(slw)
85 #define MIFILLELLSTEP(slw) MIFILLARCSTEP(slw)
87 #define miFillArcLower(slw) (((y + dy) != 0) && ((slw > 1) || (e != xk)))
89 typedef struct _miSliceEdge {
96 } miSliceEdgeRec, *miSliceEdgePtr;
98 typedef struct _miArcSlice {
99 miSliceEdgeRec edge1, edge2;
100 int min_top_y, max_top_y;
101 int min_bot_y, max_bot_y;
102 Bool edge1_top, edge2_top;
103 Bool flip_top, flip_bot;
106 #define MIARCSLICESTEP(edge) \
107 edge.x -= edge.stepx; \
111 edge.x -= edge.deltax; \
115 #define miFillSliceUpper(slice) \
116 ((y >= slice.min_top_y) && (y <= slice.max_top_y))
118 #define miFillSliceLower(slice) \
119 ((y >= slice.min_bot_y) && (y <= slice.max_bot_y))
121 #define MIARCSLICEUPPER(xl,xr,slice,slw) \
124 if (slice.edge1_top && (slice.edge1.x < xr)) \
125 xr = slice.edge1.x; \
126 if (slice.edge2_top && (slice.edge2.x > xl)) \
129 #define MIARCSLICELOWER(xl,xr,slice,slw) \
132 if (!slice.edge1_top && (slice.edge1.x > xl)) \
133 xl = slice.edge1.x; \
134 if (!slice.edge2_top && (slice.edge2.x < xr)) \
137 #define MIWIDEARCSETUP(x,y,dy,slw,e,xk,xm,yk,ym) \
162 #define MIFILLINARCSTEP(slw) \
172 slw = (inx << 1) + dx; \
173 if ((ine == inxk) && (slw > 1)) \
176 #define miFillInArcLower(slw) (((iny + dy) != 0) && \
177 ((slw > 1) || (ine != inxk)))
179 extern int miFreeArcCache(
180 #if NeedFunctionPrototypes
186 extern struct finalSpan *realAllocSpan(
187 #if NeedFunctionPrototypes
192 extern void miFillArcSetup(
193 #if NeedFunctionPrototypes
195 miFillArcRec * /*info*/
199 extern void miFillArcDSetup(
200 #if NeedFunctionPrototypes
202 miFillArcDRec * /*info*/
206 extern void miEllipseAngleToSlope(
207 #if NeedFunctionPrototypes
218 extern void miFillArcSliceSetup(
219 #if NeedFunctionPrototypes
221 miArcSliceRec * /*slice*/,