First import
[xorg_rtime.git] / xorg-server-1.4 / mi / mizerarc.h
blob28ebbe030938010de6bf3227b1a792cd95cdeaf7
1 /************************************************************
3 Copyright 1989, 1998 The Open Group
5 Permission to use, copy, modify, distribute, and sell this software and its
6 documentation for any purpose is hereby granted without fee, provided that
7 the above copyright notice appear in all copies and that both that
8 copyright notice and this permission notice appear in supporting
9 documentation.
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
18 AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
19 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 Except as contained in this notice, the name of The Open Group shall not be
22 used in advertising or otherwise to promote the sale, use or other dealings
23 in this Software without prior written authorization from The Open Group.
25 ********************************************************/
28 typedef struct {
29 int x;
30 int y;
31 int mask;
32 } miZeroArcPtRec;
34 typedef struct {
35 int x, y, k1, k3, a, b, d, dx, dy;
36 int alpha, beta;
37 int xorg, yorg;
38 int xorgo, yorgo;
39 int w, h;
40 int initialMask;
41 miZeroArcPtRec start, altstart, end, altend;
42 int firstx, firsty;
43 int startAngle, endAngle;
44 } miZeroArcRec;
46 #define miCanZeroArc(arc) (((arc)->width == (arc)->height) || \
47 (((arc)->width <= 800) && ((arc)->height <= 800)))
49 #define MIARCSETUP() \
50 x = info.x; \
51 y = info.y; \
52 k1 = info.k1; \
53 k3 = info.k3; \
54 a = info.a; \
55 b = info.b; \
56 d = info.d; \
57 dx = info.dx; \
58 dy = info.dy
60 #define MIARCOCTANTSHIFT(clause) \
61 if (a < 0) \
62 { \
63 if (y == info.h) \
64 { \
65 d = -1; \
66 a = b = k1 = 0; \
67 } \
68 else \
69 { \
70 dx = (k1 << 1) - k3; \
71 k1 = dx - k1; \
72 k3 = -k3; \
73 b = b + a - (k1 >> 1); \
74 d = b + ((-a) >> 1) - d + (k3 >> 3); \
75 if (dx < 0) \
76 a = -((-dx) >> 1) - a; \
77 else \
78 a = (dx >> 1) - a; \
79 dx = 0; \
80 dy = 1; \
81 clause \
82 } \
85 #define MIARCSTEP(move1,move2) \
86 b -= k1; \
87 if (d < 0) \
88 { \
89 x += dx; \
90 y += dy; \
91 a += k1; \
92 d += b; \
93 move1 \
94 } \
95 else \
96 { \
97 x++; \
98 y++; \
99 a += k3; \
100 d -= a; \
101 move2 \
104 #define MIARCCIRCLESTEP(clause) \
105 b -= k1; \
106 x++; \
107 if (d < 0) \
109 a += k1; \
110 d += b; \
112 else \
114 y++; \
115 a += k3; \
116 d -= a; \
117 clause \
120 /* mizerarc.c */
122 extern Bool miZeroArcSetup(
123 xArc * /*arc*/,
124 miZeroArcRec * /*info*/,
125 Bool /*ok360*/