#define _XOPEN_SOURCE_EXTENDED /* to get prototype for cbrt on some systems */
#define _XOPEN_SOURCE /* to get prototype for hypot on some systems */
+#include <config.h>
#include <string.h> /* memmove */
#include <limits.h>
register int x, y, e;
int xk, yk, xm, ym, dx, dy;
register int slw, inslw;
- int inx, iny, ine;
- int inxk, inyk, inxm, inym;
+ int inx = 0, iny, ine = 0;
+ int inxk = 0, inyk = 0, inxm = 0, inym = 0;
doinner = -lw;
slw = parc->width - doinner;
register miArcSpan *span;
double w, h, r, xorg;
double Hs, Hf, WH, K, Vk, Nk, Fk, Vr, N, Nc, Z, rs;
- double A, T, b, d, x, y, t, inx, outx, hepp, hepm;
+ double A, T, b, d, x, y, t, inx, outx = 0.0, hepp, hepm;
int flip, solution;
w = (double)parc->width / 2.0;
spdata = lruent->spdata;
if (!spdata || spdata->k != k)
{
- if (spdata)
- g_free(spdata);
+ g_free(spdata);
spdata = (miArcSpanData *)g_malloc(sizeof(miArcSpanData) +
sizeof(miArcSpan) * (k + 2));
lruent->spdata = spdata;
register int i;
miArc *parc;
int xMin, xMax, yMin, yMax;
- int pixmapWidth, pixmapHeight;
- int xOrg, yOrg;
+ int pixmapWidth = 0, pixmapHeight = 0;
+ int xOrg = 0, yOrg = 0;
int width;
gboolean fTricky;
GdkDrawable* pDrawTo;
}
static double
-angleBetween (center, point1, point2)
- SppPointRec center, point1, point2;
+angleBetween (SppPointRec center, SppPointRec point1, SppPointRec point2)
{
double a1, a2, a;
}
static void
-translateBounds (b, x, y, fx, fy)
-miArcFacePtr b;
-int x, y;
-double fx, fy;
+translateBounds (miArcFacePtr b, int x, int y, double fx, double fy)
{
fx += x;
fy += y;
int cpt;
SppArcRec arc;
miArcFaceRec Right, Left;
- int polyLen;
+ int polyLen = 0;
int xOrg, yOrg;
double xFtrans, yFtrans;
double a;
/*ARGSUSED*/
static void
-miArcCap (pDraw, pGC, pFace, end, xOrg, yOrg, xFtrans, yFtrans)
- GdkDrawable* pDraw;
- GdkGC* pGC;
- miArcFacePtr pFace;
- int end;
- int xOrg, yOrg;
- double xFtrans, yFtrans;
+miArcCap (GdkDrawable *pDraw, GdkGC *pGC, miArcFacePtr pFace, int end,
+ int xOrg, int yOrg, double xFtrans, double yFtrans)
{
SppPointRec corner, otherCorner, center, endPoint, poly[5];
{
int cpt;
double width;
- double miDatan2 ();
SppArcRec arc;
SppPointPtr pArcPts;
arc.y = pCenter.y - width/2;
arc.width = width;
arc.height = width;
- arc.angle1 = -miDatan2 (pCorner.y - pCenter.y, pCorner.x - pCenter.x);
+ arc.angle1 = -(miDatan2 (pCorner.y - pCenter.y, pCorner.x - pCenter.x));
if(PTISEQUAL(pCenter, pEnd))
arc.angle2 = - 180.0;
else {
# define mod(a,b) ((a) >= 0 ? (a) % (b) : (b) - (-a) % (b))
static double
-miDcos (a)
-double a;
+miDcos (double a)
{
int i;
}
static double
-miDsin (a)
-double a;
+miDsin (double a)
{
int i;
}
static double
-miDasin (v)
-double v;
+miDasin (double v)
{
if (v == 0)
return 0.0;
}
static double
-miDatan2 (dy, dx)
-double dy, dx;
+miDatan2 (double dy, double dx)
{
if (dy == 0) {
if (dx >= 0)
x1 = x2; y1 = y2;
}
/* adjust the last point */
- if (abs(parc->angle2) >= 360.0)
+ if (fabs(parc->angle2) >= 360.0)
poly[cpt +i -1] = poly[0];
else {
poly[cpt +i -1].x = (miDcos(st + et) * parc->width/2.0 + xc);
# define ADD_REALLOC_STEP 20
static void
-addCap (capsp, ncapsp, sizep, end, arcIndex)
- miArcCapPtr *capsp;
- int *ncapsp, *sizep;
- int end, arcIndex;
+addCap (miArcCapPtr *capsp, int *ncapsp, int *sizep, int end, int arcIndex)
{
int newsize;
miArcCapPtr cap;
}
static void
-addJoin (joinsp, njoinsp, sizep, end0, index0, phase0, end1, index1, phase1)
- miArcJoinPtr *joinsp;
- int *njoinsp, *sizep;
- int end0, index0, phase0, end1, index1, phase1;
+addJoin (miArcJoinPtr *joinsp, int *njoinsp, int *sizep, int end0, int index0,
+ int phase0, int end1, int index1, int phase1)
{
int newsize;
miArcJoinPtr join;
}
static miArcDataPtr
-addArc (arcsp, narcsp, sizep, xarc)
- miArcDataPtr *arcsp;
- int *narcsp, *sizep;
- miArc *xarc;
+addArc (miArcDataPtr *arcsp, int *narcsp, int *sizep, miArc *xarc)
{
int newsize;
miArcDataPtr arc;
# define dashXAngleStep (((double) (90 * 64)) / ((double) (DASH_MAP_SIZE - 1)))
static void
-computeDashMap (arcp, map)
- miArc *arcp;
- dashMap *map;
+computeDashMap (miArc *arcp, dashMap *map)
{
int di;
- double a, x, y, prevx, prevy, dist;
+ double a, x, y, prevx = 0.0, prevy = 0.0, dist;
for (di = 0; di < DASH_MAP_SIZE; di++) {
a = dashIndexToAngle (di);
int isDashed, isDoubleDash;
int dashOffset;
miPolyArcPtr arcs;
- int start, i, j, k, nexti, nextk;
+ int start, i, j, k = 0, nexti, nextk = 0;
int joinSize[2];
int capSize[2];
int arcSize[2];
struct arcData *data;
miArcDataPtr arc;
miArc xarc;
- int iphase, prevphase, joinphase;
+ int iphase, prevphase = 0, joinphase;
int arcsJoin;
int selfJoin;
- int iDash, dashRemaining;
- int iDashStart, dashRemainingStart, iphaseStart;
- int startAngle, spanAngle, endAngle, backwards;
+ int iDash = 0, dashRemaining;
+ int iDashStart = 0, dashRemainingStart = 0, iphaseStart;
+ int startAngle, spanAngle, endAngle, backwards = 0;
int prevDashAngle, dashAngle;
dashMap map;
for (iphase = 0; iphase < (isDoubleDash ? 2 : 1); iphase++) {
arcs[iphase].njoins = 0;
- arcs[iphase].joins = 0;
+ arcs[iphase].joins = NULL;
joinSize[iphase] = 0;
arcs[iphase].ncaps = 0;
- arcs[iphase].caps = 0;
+ arcs[iphase].caps = NULL;
capSize[iphase] = 0;
arcs[iphase].narcs = 0;
- arcs[iphase].arcs = 0;
+ arcs[iphase].arcs = NULL;
arcSize[iphase] = 0;
}
/*
* add dashed arcs to each bucket
*/
- arc = 0;
+ arc = NULL;
while (dashAngle != endAngle) {
prevDashAngle = dashAngle;
if (arcType == OTHER) {
}
static double
-angleToLength (angle, map)
- int angle;
- dashMap *map;
+angleToLength (int angle, dashMap *map)
{
double len, excesslen, sidelen = map->map[DASH_MAP_SIZE - 1], totallen;
int di;
*/
static int
-lengthToAngle (len, map)
- double len;
- dashMap *map;
+lengthToAngle (double len, dashMap *map)
{
double sidelen = map->map[DASH_MAP_SIZE - 1];
int angle, angleexcess;
*/
static void
-drawZeroArc (pDraw, pGC, tarc, lw, left, right)
- GdkDrawable* pDraw;
- GdkGC* pGC;
- miArc *tarc;
- int lw;
- miArcFacePtr right, left;
+drawZeroArc (GdkDrawable *pDraw, GdkGC *pGC, miArc *tarc, int lw,
+ miArcFacePtr left, miArcFacePtr right)
{
- double x0, y0, x1, y1, w, h, x, y;
+ double x0 = 0.0, y0 = 0.0, x1 = 0.0, y1 = 0.0, w, h, x, y;
double xmax, ymax, xmin, ymin;
int a0, a1;
double a, startAngle, endAngle;
*/
static void
-tailEllipseY (def, acc)
- struct arc_def *def;
- struct accelerators *acc;
+tailEllipseY (struct arc_def *def, struct accelerators *acc)
{
double t;
*/
static double
-outerXfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+outerXfromXY (double x, double y,
+ struct arc_def *def, struct accelerators *acc)
{
return x + (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-outerYfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+outerYfromXY (double x, double y,
+ struct arc_def *def, struct accelerators *acc)
{
return y + (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-innerXfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+innerXfromXY (double x, double y,
+ struct arc_def *def, struct accelerators *acc)
{
return x - (x * acc->h2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-innerYfromXY (x, y, def, acc)
- double x, y;
- struct arc_def *def;
- struct accelerators *acc;
+innerYfromXY (double x, double y,
+ struct arc_def *def, struct accelerators *acc)
{
return y - (y * acc->w2l) / sqrt (x*x * acc->h4 + y*y * acc->w4);
}
static double
-innerYfromY (y, def, acc)
- double y;
- struct arc_def *def;
- struct accelerators *acc;
+innerYfromY (double y, struct arc_def *def, struct accelerators *acc)
{
double x;
}
static void
-computeLine (x1, y1, x2, y2, line)
- double x1, y1, x2, y2;
- struct line *line;
+computeLine (double x1, double y1, double x2, double y2, struct line *line)
{
if (y1 == y2)
line->valid = 0;
*/
static void
-computeAcc (tarc, lw, def, acc)
- miArc *tarc;
- int lw;
- struct arc_def *def;
- struct accelerators *acc;
+computeAcc (miArc *tarc, int lw, struct arc_def *def, struct accelerators *acc)
{
def->w = ((double) tarc->width) / 2.0;
def->h = ((double) tarc->height) / 2.0;
*/
static void
-computeBound (def, bound, acc, right, left)
- struct arc_def *def;
- struct arc_bound *bound;
- struct accelerators *acc;
- miArcFacePtr right, left;
+computeBound (struct arc_def *def, struct arc_bound *bound,
+ struct accelerators *acc, miArcFacePtr right, miArcFacePtr left)
{
double t;
double innerTaily;
*/
static double
-hookEllipseY (scan_y, bound, acc, left)
- double scan_y;
- struct arc_bound *bound;
- struct accelerators *acc;
- int left;
+hookEllipseY (double scan_y, struct arc_bound *bound,
+ struct accelerators *acc, int left)
{
double ret;
*/
static double
-hookX (scan_y, def, bound, acc, left)
- double scan_y;
- struct arc_def *def;
- struct arc_bound *bound;
- struct accelerators *acc;
- int left;
+hookX (double scan_y, struct arc_def *def,
+ struct arc_bound *bound, struct accelerators *acc, int left)
{
double ellipse_y, x;
double maxMin;
*/
static void
-arcSpan (y, lx, lw, rx, rw, def, bounds, acc, mask)
- int y;
- int lx;
- int lw;
- int rx;
- int rw;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
- int mask;
+arcSpan (int y, int lx, int lw, int rx, int rw,
+ struct arc_def *def, struct arc_bound *bounds,
+ struct accelerators *acc, int mask)
{
int linx, loutx, rinx, routx;
double x, altx;
}
static void
-arcSpan0 (lx, lw, rx, rw, def, bounds, acc, mask)
- int lx;
- int lw;
- int rx;
- int rw;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
- int mask;
+arcSpan0 (int lx, int lw, int rx, int rw,
+ struct arc_def *def, struct arc_bound *bounds,
+ struct accelerators *acc, int mask)
{
double x;
}
static void
-tailSpan (y, lw, rw, def, bounds, acc, mask)
- int y;
- int lw;
- int rw;
- struct arc_def *def;
- struct arc_bound *bounds;
- struct accelerators *acc;
- int mask;
+tailSpan (int y, int lw, int rw,
+ struct arc_def *def, struct arc_bound *bounds,
+ struct accelerators *acc, int mask)
{
double yy, xalt, x, lx, rx;
int n;
# define allocFinalSpan() (freeFinalSpans ?\
((tmpFinalSpan = freeFinalSpans), \
(freeFinalSpans = freeFinalSpans->next), \
- (tmpFinalSpan->next = 0), \
+ (tmpFinalSpan->next = NULL), \
tmpFinalSpan) : \
realAllocSpan ())
static struct finalSpanChunk *chunks;
struct finalSpan *
-realAllocSpan ()
+realAllocSpan (void)
{
register struct finalSpanChunk *newChunk;
register struct finalSpan *span;
span->next = span+1;
span++;
}
- span->next = 0;
+ span->next = NULL;
span = newChunk->data;
- span->next = 0;
+ span->next = NULL;
return span;
}
static void
-disposeFinalSpans ()
+disposeFinalSpans (void)
{
struct finalSpanChunk *chunk, *next;
next = chunk->next;
g_free (chunk);
}
- chunks = 0;
- freeFinalSpans = 0;
+ chunks = NULL;
+ freeFinalSpans = NULL;
g_free(finalSpans);
- finalSpans = 0;
+ finalSpans = NULL;
}
static void
-fillSpans (pDrawable, pGC)
- GdkDrawable* pDrawable;
- GdkGC* pGC;
+fillSpans (GdkDrawable *pDrawable, GdkGC *pGC)
{
register struct finalSpan *span;
register GdkSpan* xSpan;
realFindSpan (y))
static struct finalSpan **
-realFindSpan (y)
- int y;
+realFindSpan (int y)
{
struct finalSpan **newSpans;
int newSize, newMiny, newMaxy;
}
static void
-newFinalSpan (y, xmin, xmax)
- int y;
- register int xmin, xmax;
+newFinalSpan (int y, register int xmin, register int xmax)
{
register struct finalSpan *x;
register struct finalSpan **f;
f = findSpan (y);
if (!f)
return;
- oldx = 0;
+ oldx = NULL;
for (;;) {
- prev = 0;
+ prev = NULL;
for (x = *f; x; x=x->next) {
if (x == oldx) {
prev = x;
}
static void
-mirrorSppPoint (quadrant, sppPoint)
- int quadrant;
- SppPointPtr sppPoint;
+mirrorSppPoint (int quadrant, SppPointPtr sppPoint)
{
switch (quadrant) {
case 0:
struct arc_def def;
struct accelerators acc;
int startq, endq, curq;
- int rightq, leftq, righta, lefta;
+ int rightq, leftq = 0, righta = 0, lefta = 0;
miArcFacePtr passRight, passLeft;
- int q0, q1, mask;
+ int q0 = 0, q1 = 0, mask;
struct band {
int a0, a1;
int mask;
computeAcc (tarc, l, &def, &acc);
for (j = 0; j < sweepno; j++) {
mask = sweep[j].mask;
- passRight = passLeft = 0;
+ passRight = passLeft = NULL;
if (mask & (1 << rightq)) {
if (sweep[j].a0 == righta)
passRight = right;
}
static void
-drawQuadrant (def, acc, a0, a1, mask, right, left, spdata)
- struct arc_def *def;
- struct accelerators *acc;
- int a0, a1;
- int mask;
- miArcFacePtr right, left;
- miArcSpanData *spdata;
+drawQuadrant (struct arc_def *def, struct accelerators *acc,
+ int a0, int a1, int mask, miArcFacePtr right,
+ miArcFacePtr left, miArcSpanData *spdata)
{
struct arc_bound bound;
double yy, x, xalt;