| 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 | typedef struct { |
| 28 | int x; |
| 29 | int y; |
| 30 | int mask; |
| 31 | } miZeroArcPtRec; |
| 32 | |
| 33 | typedef struct { |
| 34 | int x, y, k1, k3, a, b, d, dx, dy; |
| 35 | int alpha, beta; |
| 36 | int xorg, yorg; |
| 37 | int xorgo, yorgo; |
| 38 | int w, h; |
| 39 | int initialMask; |
| 40 | miZeroArcPtRec start, altstart, end, altend; |
| 41 | int firstx, firsty; |
| 42 | int startAngle, endAngle; |
| 43 | } miZeroArcRec; |
| 44 | |
| 45 | #define miCanZeroArc(arc) (((arc)->width == (arc)->height) || \ |
| 46 | (((arc)->width <= 800) && ((arc)->height <= 800))) |
| 47 | |
| 48 | #define MIARCSETUP() \ |
| 49 | x = info.x; \ |
| 50 | y = info.y; \ |
| 51 | k1 = info.k1; \ |
| 52 | k3 = info.k3; \ |
| 53 | a = info.a; \ |
| 54 | b = info.b; \ |
| 55 | d = info.d; \ |
| 56 | dx = info.dx; \ |
| 57 | dy = info.dy |
| 58 | |
| 59 | #define MIARCOCTANTSHIFT(clause) \ |
| 60 | if (a < 0) \ |
| 61 | { \ |
| 62 | if (y == info.h) \ |
| 63 | { \ |
| 64 | d = -1; \ |
| 65 | a = b = k1 = 0; \ |
| 66 | } \ |
| 67 | else \ |
| 68 | { \ |
| 69 | dx = (k1 << 1) - k3; \ |
| 70 | k1 = dx - k1; \ |
| 71 | k3 = -k3; \ |
| 72 | b = b + a - (k1 >> 1); \ |
| 73 | d = b + ((-a) >> 1) - d + (k3 >> 3); \ |
| 74 | if (dx < 0) \ |
| 75 | a = -((-dx) >> 1) - a; \ |
| 76 | else \ |
| 77 | a = (dx >> 1) - a; \ |
| 78 | dx = 0; \ |
| 79 | dy = 1; \ |
| 80 | clause \ |
| 81 | } \ |
| 82 | } |
| 83 | |
| 84 | #define MIARCSTEP(move1,move2) \ |
| 85 | b -= k1; \ |
| 86 | if (d < 0) \ |
| 87 | { \ |
| 88 | x += dx; \ |
| 89 | y += dy; \ |
| 90 | a += k1; \ |
| 91 | d += b; \ |
| 92 | move1 \ |
| 93 | } \ |
| 94 | else \ |
| 95 | { \ |
| 96 | x++; \ |
| 97 | y++; \ |
| 98 | a += k3; \ |
| 99 | d -= a; \ |
| 100 | move2 \ |
| 101 | } |
| 102 | |
| 103 | #define MIARCCIRCLESTEP(clause) \ |
| 104 | b -= k1; \ |
| 105 | x++; \ |
| 106 | if (d < 0) \ |
| 107 | { \ |
| 108 | a += k1; \ |
| 109 | d += b; \ |
| 110 | } \ |
| 111 | else \ |
| 112 | { \ |
| 113 | y++; \ |
| 114 | a += k3; \ |
| 115 | d -= a; \ |
| 116 | clause \ |
| 117 | } |
| 118 | |
| 119 | /* mizerarc.c */ |
| 120 | |
| 121 | extern _X_EXPORT Bool miZeroArcSetup(xArc * /*arc */ , |
| 122 | miZeroArcRec * /*info */ , |
| 123 | Bool /*ok360 */ |
| 124 | ); |