mizerarc.h revision 05b261ec
1/************************************************************ 2 3Copyright 1989, 1998 The Open Group 4 5Permission to use, copy, modify, distribute, and sell this software and its 6documentation for any purpose is hereby granted without fee, provided that 7the above copyright notice appear in all copies and that both that 8copyright notice and this permission notice appear in supporting 9documentation. 10 11The above copyright notice and this permission notice shall be included in 12all copies or substantial portions of the Software. 13 14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20 21Except as contained in this notice, the name of The Open Group shall not be 22used in advertising or otherwise to promote the sale, use or other dealings 23in this Software without prior written authorization from The Open Group. 24 25********************************************************/ 26 27 28typedef struct { 29 int x; 30 int y; 31 int mask; 32} miZeroArcPtRec; 33 34typedef 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 122extern Bool miZeroArcSetup( 123 xArc * /*arc*/, 124 miZeroArcRec * /*info*/, 125 Bool /*ok360*/ 126); 127