1 | /************************************************************
|
---|
2 |
|
---|
3 | Copyright 1989, 1998 The Open Group
|
---|
4 |
|
---|
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.
|
---|
10 |
|
---|
11 | The above copyright notice and this permission notice shall be included in
|
---|
12 | all copies or substantial portions of the Software.
|
---|
13 |
|
---|
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.
|
---|
20 |
|
---|
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.
|
---|
24 |
|
---|
25 | ********************************************************/
|
---|
26 |
|
---|
27 |
|
---|
28 | typedef struct {
|
---|
29 | int x;
|
---|
30 | int y;
|
---|
31 | int mask;
|
---|
32 | } miZeroArcPtRec;
|
---|
33 |
|
---|
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;
|
---|
45 |
|
---|
46 | #define miCanZeroArc(arc) (((arc)->width == (arc)->height) || \
|
---|
47 | (((arc)->width <= 800) && ((arc)->height <= 800)))
|
---|
48 |
|
---|
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
|
---|
59 |
|
---|
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 | } \
|
---|
83 | }
|
---|
84 |
|
---|
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 \
|
---|
102 | }
|
---|
103 |
|
---|
104 | #define MIARCCIRCLESTEP(clause) \
|
---|
105 | b -= k1; \
|
---|
106 | x++; \
|
---|
107 | if (d < 0) \
|
---|
108 | { \
|
---|
109 | a += k1; \
|
---|
110 | d += b; \
|
---|
111 | } \
|
---|
112 | else \
|
---|
113 | { \
|
---|
114 | y++; \
|
---|
115 | a += k3; \
|
---|
116 | d -= a; \
|
---|
117 | clause \
|
---|
118 | }
|
---|
119 |
|
---|
120 | /* mizerarc.c */
|
---|
121 |
|
---|
122 | extern Bool miZeroArcSetup(
|
---|
123 | xArc * /*arc*/,
|
---|
124 | miZeroArcRec * /*info*/,
|
---|
125 | Bool /*ok360*/
|
---|
126 | );
|
---|
127 |
|
---|
128 | extern DDXPointPtr miZeroArcPts(
|
---|
129 | xArc * /*arc*/,
|
---|
130 | DDXPointPtr /*pts*/
|
---|
131 | );
|
---|
132 |
|
---|