summaryrefslogtreecommitdiff
path: root/xserver/mi/miwideline.c
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2008-11-02 15:26:35 +0000
commitdbca69c8a4f3e2d1ccb4f89152213b2861b33af6 (patch)
treef8963ef73903a7b4374adc2354dffbaa905112ac /xserver/mi/miwideline.c
parent33b2029f322f3c238b7ba528083195ad8dde33e1 (diff)
xserver 1.5.2. tested by ckuethe@, oga@, and others.
Diffstat (limited to 'xserver/mi/miwideline.c')
-rw-r--r--xserver/mi/miwideline.c269
1 files changed, 122 insertions, 147 deletions
diff --git a/xserver/mi/miwideline.c b/xserver/mi/miwideline.c
index d57c2eaa7..f080ca11d 100644
--- a/xserver/mi/miwideline.c
+++ b/xserver/mi/miwideline.c
@@ -52,14 +52,10 @@ from The Open Group.
#include "miwideline.h"
#include "mi.h"
-#ifdef ICEILTEMPDECL
-ICEILTEMPDECL
-#endif
-
-static void miLineArc(DrawablePtr pDraw, register GCPtr pGC,
+static void miLineArc(DrawablePtr pDraw, GCPtr pGC,
unsigned long pixel, SpanDataPtr spanData,
- register LineFacePtr leftFace,
- register LineFacePtr rightFace,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace,
double xorg, double yorg, Bool isInt);
@@ -67,24 +63,18 @@ static void miLineArc(DrawablePtr pDraw, register GCPtr pGC,
* spans-based polygon filler
*/
-void
-miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
- left, right, left_count, right_count)
- DrawablePtr pDrawable;
- GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- int y; /* start y coordinate */
- int overall_height; /* height of entire segment */
- PolyEdgePtr left, right;
- int left_count, right_count;
+static void
+miFillPolyHelper (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
+ SpanDataPtr spanData, int y, int overall_height,
+ PolyEdgePtr left, PolyEdgePtr right,
+ int left_count, int right_count)
{
- register int left_x = 0, left_e = 0;
+ int left_x = 0, left_e = 0;
int left_stepx = 0;
int left_signdx = 0;
int left_dy = 0, left_dx = 0;
- register int right_x = 0, right_e = 0;
+ int right_x = 0, right_e = 0;
int right_stepx = 0;
int right_signdx = 0;
int right_dy = 0, right_dx = 0;
@@ -92,10 +82,10 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
int height = 0;
int left_height = 0, right_height = 0;
- register DDXPointPtr ppt;
+ DDXPointPtr ppt;
DDXPointPtr pptInit = NULL;
- register int *pwidth;
- int *pwidthInit = NULL;
+ int *pwidth;
+ int *pwidthInit = NULL;
XID oldPixel;
int xorg;
Spans spanRec;
@@ -105,13 +95,13 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
if (!spanData)
{
- pptInit = (DDXPointPtr) ALLOCATE_LOCAL (overall_height * sizeof(*ppt));
+ pptInit = (DDXPointPtr) xalloc (overall_height * sizeof(*ppt));
if (!pptInit)
return;
- pwidthInit = (int *) ALLOCATE_LOCAL (overall_height * sizeof(*pwidth));
+ pwidthInit = (int *) xalloc (overall_height * sizeof(*pwidth));
if (!pwidthInit)
{
- DEALLOCATE_LOCAL (pptInit);
+ xfree (pptInit);
return;
}
ppt = pptInit;
@@ -177,8 +167,8 @@ miFillPolyHelper (pDrawable, pGC, pixel, spanData, y, overall_height,
if (!spanData)
{
(*pGC->ops->FillSpans) (pDrawable, pGC, ppt - pptInit, pptInit, pwidthInit, TRUE);
- DEALLOCATE_LOCAL (pwidthInit);
- DEALLOCATE_LOCAL (pptInit);
+ xfree (pwidthInit);
+ xfree (pptInit);
if (pixel != oldPixel)
{
DoChangeGC (pGC, GCForeground, &oldPixel, FALSE);
@@ -203,8 +193,8 @@ miFillRectPolyHelper (
int w,
int h)
{
- register DDXPointPtr ppt;
- register int *pwidth;
+ DDXPointPtr ppt;
+ int *pwidth;
XID oldPixel;
Spans spanRec;
xRectangle rect;
@@ -265,10 +255,10 @@ _X_EXPORT /* static */ int
miPolyBuildEdge (x0, y0, k, dx, dy, xi, yi, left, edge)
double x0, y0;
double k; /* x0 * dy - y0 * dx */
- register int dx, dy;
+ int dx, dy;
int xi, yi;
int left;
- register PolyEdgePtr edge;
+ PolyEdgePtr edge;
{
int x, y, e;
int xady;
@@ -322,23 +312,23 @@ miPolyBuildEdge (x0, y0, k, dx, dy, xi, yi, left, edge)
_X_EXPORT /* static */ int
miPolyBuildPoly (vertices, slopes, count, xi, yi, left, right, pnleft, pnright, h)
- register PolyVertexPtr vertices;
- register PolySlopePtr slopes;
- int count;
- int xi, yi;
- PolyEdgePtr left, right;
- int *pnleft, *pnright;
- int *h;
+ PolyVertexPtr vertices;
+ PolySlopePtr slopes;
+ int count;
+ int xi, yi;
+ PolyEdgePtr left, right;
+ int *pnleft, *pnright;
+ int *h;
{
- int top, bottom;
- double miny, maxy;
- register int i;
- int j;
- int clockwise;
- int slopeoff;
- register int s;
- register int nright, nleft;
- int y, lasty = 0, bottomy, topy = 0;
+ int top, bottom;
+ double miny, maxy;
+ int i;
+ int j;
+ int clockwise;
+ int slopeoff;
+ int s;
+ int nright, nleft;
+ int y, lasty = 0, bottomy, topy = 0;
/* find the top of the polygon */
maxy = miny = vertices[0].y;
@@ -467,12 +457,12 @@ miLineOnePoint (
static void
miLineJoin (
- DrawablePtr pDrawable,
- GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- register LineFacePtr pLeft,
- register LineFacePtr pRight)
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ LineFacePtr pLeft,
+ LineFacePtr pRight)
{
double mx = 0, my = 0;
double denom = 0.0;
@@ -624,9 +614,9 @@ miLineArcI (
DDXPointPtr points,
int *widths)
{
- register DDXPointPtr tpts, bpts;
- register int *twids, *bwids;
- register int x, y, e, ex, slw;
+ DDXPointPtr tpts, bpts;
+ int *twids, *bwids;
+ int x, y, e, ex, slw;
tpts = points;
twids = widths;
@@ -717,8 +707,8 @@ miLineArcD (
int edgey2,
Bool edgeleft2)
{
- register DDXPointPtr pts;
- register int *wids;
+ DDXPointPtr pts;
+ int *wids;
double radius, x0, y0, el, er, yk, xlk, xrk, k;
int xbase, ybase, y, boty, xl, xr, xcl, xcr;
int ymin, ymax;
@@ -873,11 +863,8 @@ miLineArcD (
return (pts - points);
}
-int
-miRoundJoinFace (face, edge, leftEdge)
- register LineFacePtr face;
- register PolyEdgePtr edge;
- Bool *leftEdge;
+static int
+miRoundJoinFace (LineFacePtr face, PolyEdgePtr edge, Bool *leftEdge)
{
int y;
int dx, dy;
@@ -924,7 +911,7 @@ miRoundJoinFace (face, edge, leftEdge)
_X_EXPORT void
miRoundJoinClip (pLeft, pRight, edge1, edge2, y1, y2, left1, left2)
- register LineFacePtr pLeft, pRight;
+ LineFacePtr pLeft, pRight;
PolyEdgePtr edge1, edge2;
int *y1, *y2;
Bool *left1, *left2;
@@ -949,14 +936,14 @@ miRoundJoinClip (pLeft, pRight, edge1, edge2, y1, y2, left1, left2)
_X_EXPORT int
miRoundCapClip (face, isInt, edge, leftEdge)
- register LineFacePtr face;
+ LineFacePtr face;
Bool isInt;
- register PolyEdgePtr edge;
+ PolyEdgePtr edge;
Bool *leftEdge;
{
- int y;
- register int dx, dy;
- double xa, ya, k;
+ int y;
+ int dx, dy;
+ double xa, ya, k;
Bool left;
dx = -face->dy;
@@ -999,15 +986,15 @@ miRoundCapClip (face, isInt, edge, leftEdge)
static void
miLineArc (
- DrawablePtr pDraw,
- register GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- register LineFacePtr leftFace,
- register LineFacePtr rightFace,
- double xorg,
- double yorg,
- Bool isInt)
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace,
+ double xorg,
+ double yorg,
+ Bool isInt)
{
DDXPointPtr points;
int *widths;
@@ -1058,13 +1045,13 @@ miLineArc (
}
if (!spanData)
{
- points = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * pGC->lineWidth);
+ points = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * pGC->lineWidth);
if (!points)
return;
- widths = (int *)ALLOCATE_LOCAL(sizeof(int) * pGC->lineWidth);
+ widths = (int *)xalloc(sizeof(int) * pGC->lineWidth);
if (!widths)
{
- DEALLOCATE_LOCAL(points);
+ xfree(points);
return;
}
oldPixel = pGC->fgPixel;
@@ -1099,8 +1086,8 @@ miLineArc (
if (!spanData)
{
(*pGC->ops->FillSpans)(pDraw, pGC, n, points, widths, TRUE);
- DEALLOCATE_LOCAL(widths);
- DEALLOCATE_LOCAL(points);
+ xfree(widths);
+ xfree(points);
if (pixel != oldPixel)
{
DoChangeGC(pGC, GCForeground, &oldPixel, FALSE);
@@ -1114,16 +1101,10 @@ miLineArc (
}
}
-void
-miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg, isInt)
- DrawablePtr pDrawable;
- register GCPtr pGC;
- unsigned long pixel;
- SpanDataPtr spanData;
- register LineFacePtr face;
- Bool isLeft;
- double xorg, yorg;
- Bool isInt;
+static void
+miLineProjectingCap (DrawablePtr pDrawable, GCPtr pGC, unsigned long pixel,
+ SpanDataPtr spanData, LineFacePtr face, Bool isLeft,
+ double xorg, double yorg, Bool isInt)
{
int xorgi = 0, yorgi = 0;
int lw;
@@ -1286,18 +1267,18 @@ miLineProjectingCap (pDrawable, pGC, pixel, spanData, face, isLeft, xorg, yorg,
static void
miWideSegment (
- DrawablePtr pDrawable,
- GCPtr pGC,
- unsigned long pixel,
- SpanDataPtr spanData,
- register int x1,
- register int y1,
- register int x2,
- register int y2,
- Bool projectLeft,
- Bool projectRight,
- register LineFacePtr leftFace,
- register LineFacePtr rightFace)
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ unsigned long pixel,
+ SpanDataPtr spanData,
+ int x1,
+ int y1,
+ int x2,
+ int y2,
+ Bool projectLeft,
+ Bool projectRight,
+ LineFacePtr leftFace,
+ LineFacePtr rightFace)
{
double l, L, r;
double xa, ya;
@@ -1506,11 +1487,8 @@ miWideSegment (
}
}
-SpanDataPtr
-miSetupSpanData (pGC, spanData, npt)
- register GCPtr pGC;
- SpanDataPtr spanData;
- int npt;
+static SpanDataPtr
+miSetupSpanData (GCPtr pGC, SpanDataPtr spanData, int npt)
{
if ((npt < 3 && pGC->capStyle != CapRound) || miSpansEasyRop(pGC->alu))
return (SpanDataPtr) NULL;
@@ -1520,11 +1498,8 @@ miSetupSpanData (pGC, spanData, npt)
return spanData;
}
-void
-miCleanupSpanData (pDrawable, pGC, spanData)
- DrawablePtr pDrawable;
- GCPtr pGC;
- SpanDataPtr spanData;
+static void
+miCleanupSpanData (DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData)
{
if (pGC->lineStyle == LineDoubleDash)
{
@@ -1552,21 +1527,21 @@ miCleanupSpanData (pDrawable, pGC, spanData)
_X_EXPORT void
miWideLine (pDrawable, pGC, mode, npt, pPts)
DrawablePtr pDrawable;
- register GCPtr pGC;
+ GCPtr pGC;
int mode;
- register int npt;
- register DDXPointPtr pPts;
+ int npt;
+ DDXPointPtr pPts;
{
- int x1, y1, x2, y2;
- SpanDataRec spanDataRec;
- SpanDataPtr spanData;
- unsigned long pixel;
- Bool projectLeft, projectRight;
- LineFaceRec leftFace, rightFace, prevRightFace;
- LineFaceRec firstFace;
- register int first;
- Bool somethingDrawn = FALSE;
- Bool selfJoin;
+ int x1, y1, x2, y2;
+ SpanDataRec spanDataRec;
+ SpanDataPtr spanData;
+ long pixel;
+ Bool projectLeft, projectRight;
+ LineFaceRec leftFace, rightFace, prevRightFace;
+ LineFaceRec firstFace;
+ int first;
+ Bool somethingDrawn = FALSE;
+ Bool selfJoin;
spanData = miSetupSpanData (pGC, &spanDataRec, npt);
pixel = pGC->fgPixel;
@@ -1693,7 +1668,7 @@ miWideLine (pDrawable, pGC, mode, npt, pPts)
static void
miWideDashSegment (
DrawablePtr pDrawable,
- register GCPtr pGC,
+ GCPtr pGC,
SpanDataPtr spanData,
int *pDashOffset,
int *pDashIndex,
@@ -2050,25 +2025,25 @@ miWideDashSegment (
_X_EXPORT void
miWideDash (pDrawable, pGC, mode, npt, pPts)
DrawablePtr pDrawable;
- register GCPtr pGC;
+ GCPtr pGC;
int mode;
- register int npt;
- register DDXPointPtr pPts;
+ int npt;
+ DDXPointPtr pPts;
{
- int x1, y1, x2, y2;
- unsigned long pixel;
- Bool projectLeft, projectRight;
- LineFaceRec leftFace, rightFace, prevRightFace;
- LineFaceRec firstFace;
- int first;
- int dashIndex, dashOffset;
- register int prevDashIndex;
- SpanDataRec spanDataRec;
- SpanDataPtr spanData;
- Bool somethingDrawn = FALSE;
- Bool selfJoin;
- Bool endIsFg = FALSE, startIsFg = FALSE;
- Bool firstIsFg = FALSE, prevIsFg = FALSE;
+ int x1, y1, x2, y2;
+ unsigned long pixel;
+ Bool projectLeft, projectRight;
+ LineFaceRec leftFace, rightFace, prevRightFace;
+ LineFaceRec firstFace;
+ int first;
+ int dashIndex, dashOffset;
+ int prevDashIndex;
+ SpanDataRec spanDataRec;
+ SpanDataPtr spanData;
+ Bool somethingDrawn = FALSE;
+ Bool selfJoin;
+ Bool endIsFg = FALSE, startIsFg = FALSE;
+ Bool firstIsFg = FALSE, prevIsFg = FALSE;
#if 0
/* XXX backward compatibility */