mifillarc.h revision b8e299dddd091ae24e0c08c45d91b8f937bd14d2
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $XFree86: xc/programs/Xserver/mi/mifillarc.h,v 3.6 2001/10/25 12:03:47 alanh Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/************************************************************
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncCopyright 1989, 1998 The Open Group
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncPermission to use, copy, modify, distribute, and sell this software and its
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncdocumentation for any purpose is hereby granted without fee, provided that
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncthe above copyright notice appear in all copies and that both that
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynccopyright notice and this permission notice appear in supporting
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncdocumentation.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncThe above copyright notice and this permission notice shall be included in
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncall copies or substantial portions of the Software.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncExcept as contained in this notice, the name of The Open Group shall not be
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncused in advertising or otherwise to promote the sale, use or other dealings
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncin this Software without prior written authorization from The Open Group.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync********************************************************/
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* $Xorg: mifillarc.h,v 1.4 2001/02/09 02:05:20 xorgcvs Exp $ */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#ifndef __MIFILLARC_H__
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define __MIFILLARC_H__
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define FULLCIRCLE (360 * 64)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct _miFillArc {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int xorg, yorg;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int y;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int dx, dy;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int e;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int ym, yk, xm, xk;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} miFillArcRec;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync/* could use 64-bit integers */
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynctypedef struct _miFillArcD {
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int xorg, yorg;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int y;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync int dx, dy;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync double e;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync double ym, yk, xm, xk;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync} miFillArcDRec;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define miFillArcEmpty(arc) (!(arc)->angle2 || \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync !(arc)->width || !(arc)->height || \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (((arc)->width == 1) && ((arc)->height & 1)))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define miCanFillArc(arc) (((arc)->width == (arc)->height) || \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync (((arc)->width <= 800) && ((arc)->height <= 800)))
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#define MIFILLARCSETUP() \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync x = 0; \
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync y = info.y; \
e = info.e; \
xk = info.xk; \
xm = info.xm; \
yk = info.yk; \
ym = info.ym; \
dx = info.dx; \
dy = info.dy; \
xorg = info.xorg; \
yorg = info.yorg
#define MIFILLARCSTEP(slw) \
e += yk; \
while (e >= 0) \
{ \
x++; \
xk -= xm; \
e += xk; \
} \
y--; \
yk -= ym; \
slw = (x << 1) + dx; \
if ((e == xk) && (slw > 1)) \
slw--
#define MIFILLCIRCSTEP(slw) MIFILLARCSTEP(slw)
#define MIFILLELLSTEP(slw) MIFILLARCSTEP(slw)
#define miFillArcLower(slw) (((y + dy) != 0) && ((slw > 1) || (e != xk)))
typedef struct _miSliceEdge {
int x;
int stepx;
int deltax;
int e;
int dy;
int dx;
} miSliceEdgeRec, *miSliceEdgePtr;
typedef struct _miArcSlice {
miSliceEdgeRec edge1, edge2;
int min_top_y, max_top_y;
int min_bot_y, max_bot_y;
Bool edge1_top, edge2_top;
Bool flip_top, flip_bot;
} miArcSliceRec;
#define MIARCSLICESTEP(edge) \
edge.x -= edge.stepx; \
edge.e -= edge.dx; \
if (edge.e <= 0) \
{ \
edge.x -= edge.deltax; \
edge.e += edge.dy; \
}
#define miFillSliceUpper(slice) \
((y >= slice.min_top_y) && (y <= slice.max_top_y))
#define miFillSliceLower(slice) \
((y >= slice.min_bot_y) && (y <= slice.max_bot_y))
#define MIARCSLICEUPPER(xl,xr,slice,slw) \
xl = xorg - x; \
xr = xl + slw - 1; \
if (slice.edge1_top && (slice.edge1.x < xr)) \
xr = slice.edge1.x; \
if (slice.edge2_top && (slice.edge2.x > xl)) \
xl = slice.edge2.x;
#define MIARCSLICELOWER(xl,xr,slice,slw) \
xl = xorg - x; \
xr = xl + slw - 1; \
if (!slice.edge1_top && (slice.edge1.x > xl)) \
xl = slice.edge1.x; \
if (!slice.edge2_top && (slice.edge2.x < xr)) \
xr = slice.edge2.x;
#define MIWIDEARCSETUP(x,y,dy,slw,e,xk,xm,yk,ym) \
x = 0; \
y = slw >> 1; \
yk = y << 3; \
xm = 8; \
ym = 8; \
if (dy) \
{ \
xk = 0; \
if (slw & 1) \
e = -1; \
else \
e = -(y << 2) - 2; \
} \
else \
{ \
y++; \
yk += 4; \
xk = -4; \
if (slw & 1) \
e = -(y << 2) - 3; \
else \
e = - (y << 3); \
}
#define MIFILLINARCSTEP(slw) \
ine += inyk; \
while (ine >= 0) \
{ \
inx++; \
inxk -= inxm; \
ine += inxk; \
} \
iny--; \
inyk -= inym; \
slw = (inx << 1) + dx; \
if ((ine == inxk) && (slw > 1)) \
slw--
#define miFillInArcLower(slw) (((iny + dy) != 0) && \
((slw > 1) || (ine != inxk)))
extern int miFreeArcCache(
pointer /*data*/,
XID /*id*/
);
extern struct finalSpan *realAllocSpan(
void
);
extern void miFillArcSetup(
xArc * /*arc*/,
miFillArcRec * /*info*/
);
extern void miFillArcDSetup(
xArc * /*arc*/,
miFillArcDRec * /*info*/
);
extern void miEllipseAngleToSlope(
int /*angle*/,
int /*width*/,
int /*height*/,
int * /*dxp*/,
int * /*dyp*/,
double * /*d_dxp*/,
double * /*d_dyp*/
);
extern void miFillArcSliceSetup(
xArc * /*arc*/,
miArcSliceRec * /*slice*/,
GCPtr /*pGC*/
);
#endif /* __MIFILLARC_H__ */