1 | /* $XFree86: xc/programs/Xserver/mi/mizerarc.h,v 1.2 2001/08/06 20:51:20 dawes Exp $ */
|
---|
2 | /************************************************************
|
---|
3 |
|
---|
4 | Copyright 1989, 1998 The Open Group
|
---|
5 |
|
---|
6 | Permission to use, copy, modify, distribute, and sell this software and its
|
---|
7 | documentation for any purpose is hereby granted without fee, provided that
|
---|
8 | the above copyright notice appear in all copies and that both that
|
---|
9 | copyright notice and this permission notice appear in supporting
|
---|
10 | documentation.
|
---|
11 |
|
---|
12 | The above copyright notice and this permission notice shall be included in
|
---|
13 | all copies or substantial portions of the Software.
|
---|
14 |
|
---|
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 | OPEN GROUP 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.
|
---|
21 |
|
---|
22 | Except as contained in this notice, the name of The Open Group 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 Open Group.
|
---|
25 |
|
---|
26 | ********************************************************/
|
---|
27 |
|
---|
28 | /* $Xorg: mizerarc.h,v 1.4 2001/02/09 02:05:22 xorgcvs Exp $ */
|
---|
29 |
|
---|
30 | typedef struct {
|
---|
31 | int x;
|
---|
32 | int y;
|
---|
33 | int mask;
|
---|
34 | } miZeroArcPtRec;
|
---|
35 |
|
---|
36 | typedef struct {
|
---|
37 | int x, y, k1, k3, a, b, d, dx, dy;
|
---|
38 | int alpha, beta;
|
---|
39 | int xorg, yorg;
|
---|
40 | int xorgo, yorgo;
|
---|
41 | int w, h;
|
---|
42 | int initialMask;
|
---|
43 | miZeroArcPtRec start, altstart, end, altend;
|
---|
44 | int firstx, firsty;
|
---|
45 | int startAngle, endAngle;
|
---|
46 | } miZeroArcRec;
|
---|
47 |
|
---|
48 | #define miCanZeroArc(arc) (((arc)->width == (arc)->height) || \
|
---|
49 | (((arc)->width <= 800) && ((arc)->height <= 800)))
|
---|
50 |
|
---|
51 | #define MIARCSETUP() \
|
---|
52 | x = info.x; \
|
---|
53 | y = info.y; \
|
---|
54 | k1 = info.k1; \
|
---|
55 | k3 = info.k3; \
|
---|
56 | a = info.a; \
|
---|
57 | b = info.b; \
|
---|
58 | d = info.d; \
|
---|
59 | dx = info.dx; \
|
---|
60 | dy = info.dy
|
---|
61 |
|
---|
62 | #define MIARCOCTANTSHIFT(clause) \
|
---|
63 | if (a < 0) \
|
---|
64 | { \
|
---|
65 | if (y == info.h) \
|
---|
66 | { \
|
---|
67 | d = -1; \
|
---|
68 | a = b = k1 = 0; \
|
---|
69 | } \
|
---|
70 | else \
|
---|
71 | { \
|
---|
72 | dx = (k1 << 1) - k3; \
|
---|
73 | k1 = dx - k1; \
|
---|
74 | k3 = -k3; \
|
---|
75 | b = b + a - (k1 >> 1); \
|
---|
76 | d = b + ((-a) >> 1) - d + (k3 >> 3); \
|
---|
77 | if (dx < 0) \
|
---|
78 | a = -((-dx) >> 1) - a; \
|
---|
79 | else \
|
---|
80 | a = (dx >> 1) - a; \
|
---|
81 | dx = 0; \
|
---|
82 | dy = 1; \
|
---|
83 | clause \
|
---|
84 | } \
|
---|
85 | }
|
---|
86 |
|
---|
87 | #define MIARCSTEP(move1,move2) \
|
---|
88 | b -= k1; \
|
---|
89 | if (d < 0) \
|
---|
90 | { \
|
---|
91 | x += dx; \
|
---|
92 | y += dy; \
|
---|
93 | a += k1; \
|
---|
94 | d += b; \
|
---|
95 | move1 \
|
---|
96 | } \
|
---|
97 | else \
|
---|
98 | { \
|
---|
99 | x++; \
|
---|
100 | y++; \
|
---|
101 | a += k3; \
|
---|
102 | d -= a; \
|
---|
103 | move2 \
|
---|
104 | }
|
---|
105 |
|
---|
106 | #define MIARCCIRCLESTEP(clause) \
|
---|
107 | b -= k1; \
|
---|
108 | x++; \
|
---|
109 | if (d < 0) \
|
---|
110 | { \
|
---|
111 | a += k1; \
|
---|
112 | d += b; \
|
---|
113 | } \
|
---|
114 | else \
|
---|
115 | { \
|
---|
116 | y++; \
|
---|
117 | a += k3; \
|
---|
118 | d -= a; \
|
---|
119 | clause \
|
---|
120 | }
|
---|
121 |
|
---|
122 | /* mizerarc.c */
|
---|
123 |
|
---|
124 | extern Bool miZeroArcSetup(
|
---|
125 | xArc * /*arc*/,
|
---|
126 | miZeroArcRec * /*info*/,
|
---|
127 | Bool /*ok360*/
|
---|
128 | );
|
---|
129 |
|
---|
130 | extern DDXPointPtr miZeroArcPts(
|
---|
131 | xArc * /*arc*/,
|
---|
132 | DDXPointPtr /*pts*/
|
---|
133 | );
|
---|
134 |
|
---|