aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi/miarc.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-05-16 20:50:58 +0000
committermarha <marha@users.sourceforge.net>2010-05-16 20:50:58 +0000
commit1c94119ae26b94a60bb2c2b33494ed43c3b8a52f (patch)
treecfe0c736c95314edac7d9f1065be9c13026ed0c1 /xorg-server/mi/miarc.c
parent6b29aa4559aeb6f795caee047561654bfa0a1954 (diff)
downloadvcxsrv-1c94119ae26b94a60bb2c2b33494ed43c3b8a52f.tar.gz
vcxsrv-1c94119ae26b94a60bb2c2b33494ed43c3b8a52f.tar.bz2
vcxsrv-1c94119ae26b94a60bb2c2b33494ed43c3b8a52f.zip
svn merge -r588:HEAD ^/branches/released .
Diffstat (limited to 'xorg-server/mi/miarc.c')
-rw-r--r--xorg-server/mi/miarc.c102
1 files changed, 50 insertions, 52 deletions
diff --git a/xorg-server/mi/miarc.c b/xorg-server/mi/miarc.c
index bdc08459e..d9a28d058 100644
--- a/xorg-server/mi/miarc.c
+++ b/xorg-server/mi/miarc.c
@@ -217,16 +217,6 @@ typedef struct _miPolyArc {
miArcJoinPtr joins;
} miPolyArcRec, *miPolyArcPtr;
-#define GCValsFunction 0
-#define GCValsForeground 1
-#define GCValsBackground 2
-#define GCValsLineWidth 3
-#define GCValsCapStyle 4
-#define GCValsJoinStyle 5
-#define GCValsMask (GCFunction | GCForeground | GCBackground | \
- GCLineWidth | GCCapStyle | GCJoinStyle)
-static CARD32 gcvals[6];
-
static void fillSpans(DrawablePtr pDrawable, GCPtr pGC);
static void newFinalSpan(int y, int xmin, int xmax);
static void drawArc(xArc *tarc, int l, int a0, int a1, miArcFacePtr right,
@@ -804,7 +794,7 @@ miComputeWideEllipse(int lw, xArc *parc)
if (!lw)
lw = 1;
k = (parc->height >> 1) + ((lw - 1) >> 1);
- spdata = xalloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2));
+ spdata = malloc(sizeof(miArcSpanData) + sizeof(miArcSpan) * (k + 2));
if (!spdata)
return NULL;
spdata->spans = (miArcSpan *)(spdata + 1);
@@ -835,14 +825,14 @@ miFillWideEllipse(
yorgu = parc->height + pGC->lineWidth;
n = (sizeof(int) * 2) * yorgu;
- widths = xalloc(n + (sizeof(DDXPointRec) * 2) * yorgu);
+ widths = malloc(n + (sizeof(DDXPointRec) * 2) * yorgu);
if (!widths)
return;
points = (DDXPointPtr)((char *)widths + n);
spdata = miComputeWideEllipse((int)pGC->lineWidth, parc);
if (!spdata)
{
- xfree(widths);
+ free(widths);
return;
}
pts = points;
@@ -931,10 +921,10 @@ miFillWideEllipse(
wids += 2;
}
}
- xfree(spdata);
+ free(spdata);
(*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE);
- xfree(widths);
+ free(widths);
}
/*
@@ -1049,13 +1039,18 @@ miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
pGCTo = GetScratchGC(1, pDraw->pScreen);
if (!pGCTo)
return;
- gcvals[GCValsFunction] = GXcopy;
- gcvals[GCValsForeground] = 1;
- gcvals[GCValsBackground] = 0;
- gcvals[GCValsLineWidth] = pGC->lineWidth;
- gcvals[GCValsCapStyle] = pGC->capStyle;
- gcvals[GCValsJoinStyle] = pGC->joinStyle;
- dixChangeGC(NullClient, pGCTo, GCValsMask, gcvals, NULL);
+ {
+ ChangeGCVal gcvals[6];
+ gcvals[0].val = GXcopy;
+ gcvals[1].val = 1;
+ gcvals[2].val = 0;
+ gcvals[3].val = pGC->lineWidth;
+ gcvals[4].val = pGC->capStyle;
+ gcvals[5].val = pGC->joinStyle;
+ ChangeGC(NullClient, pGCTo, GCFunction |
+ GCForeground | GCBackground | GCLineWidth |
+ GCCapStyle | GCJoinStyle, gcvals);
+ }
/* allocate a 1 bit deep pixmap of the appropriate size, and
* validate it */
@@ -1094,11 +1089,14 @@ miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
iphase >= 0;
iphase--)
{
+ ChangeGCVal gcval;
if (iphase == 1) {
- dixChangeGC (NullClient, pGC, GCForeground, &bg, NULL);
+ gcval.val = bg;
+ ChangeGC (NullClient, pGC, GCForeground, &gcval);
ValidateGC (pDraw, pGC);
} else if (pGC->lineStyle == LineDoubleDash) {
- dixChangeGC (NullClient, pGC, GCForeground, &fg, NULL);
+ gcval.val = fg;
+ ChangeGC (NullClient, pGC, GCForeground, &gcval);
ValidateGC (pDraw, pGC);
}
for (i = 0; i < polyArcs[iphase].narcs; i++) {
@@ -1270,7 +1268,7 @@ miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
arc.height = width;
arc.angle1 = -miDatan2 (corner.y - center.y, corner.x - center.x);
arc.angle2 = a;
- pArcPts = xalloc (3 * sizeof (SppPointRec));
+ pArcPts = malloc(3 * sizeof (SppPointRec));
if (!pArcPts)
return;
pArcPts[0].x = otherCorner.x;
@@ -1286,7 +1284,7 @@ miArcJoin(DrawablePtr pDraw, GCPtr pGC, miArcFacePtr pLeft,
* rest of the line */
miFillSppPoly(pDraw, pGC, cpt, pArcPts, xOrg, yOrg, xFtrans, yFtrans);
}
- xfree(pArcPts);
+ free(pArcPts);
return;
case JoinMiter:
/*
@@ -1417,7 +1415,7 @@ miRoundCap(
* rest of the line */
miFillSppPoly(pDraw, pGC, cpt, pArcPts, -xOrg, -yOrg, xFtrans, yFtrans);
}
- xfree(pArcPts);
+ free(pArcPts);
}
/*
@@ -1515,10 +1513,10 @@ miDatan2 (double dy, double dx)
* This procedure allocates the space necessary to fit the arc points.
* Sometimes it's convenient for those points to be at the end of an existing
* array. (For example, if we want to leave a spare point to make sectors
- * instead of segments.) So we pass in the xalloc()ed chunk that contains the
+ * instead of segments.) So we pass in the malloc()ed chunk that contains the
* array and an index saying where we should start stashing the points.
* If there isn't an array already, we just pass in a null pointer and
- * count on xrealloc() to handle the null pointer correctly.
+ * count on realloc() to handle the null pointer correctly.
*/
static int
miGetArcPts(
@@ -1565,7 +1563,7 @@ miGetArcPts(
count++;
cdt = 2 * miDcos(dt);
- if (!(poly = (SppPointPtr) xrealloc((pointer)*ppPts,
+ if (!(poly = (SppPointPtr) realloc((pointer)*ppPts,
(cpt + count) * sizeof(SppPointRec))))
return(0);
*ppPts = poly;
@@ -1628,7 +1626,7 @@ addCap (
if (*ncapsp == *sizep)
{
newsize = *sizep + ADD_REALLOC_STEP;
- cap = (miArcCapPtr) xrealloc (*capsp,
+ cap = (miArcCapPtr) realloc(*capsp,
newsize * sizeof (**capsp));
if (!cap)
return;
@@ -1659,7 +1657,7 @@ addJoin (
if (*njoinsp == *sizep)
{
newsize = *sizep + ADD_REALLOC_STEP;
- join = (miArcJoinPtr) xrealloc (*joinsp,
+ join = (miArcJoinPtr) realloc(*joinsp,
newsize * sizeof (**joinsp));
if (!join)
return;
@@ -1689,7 +1687,7 @@ addArc (
if (*narcsp == *sizep)
{
newsize = *sizep + ADD_REALLOC_STEP;
- arc = (miArcDataPtr) xrealloc (*arcsp,
+ arc = (miArcDataPtr) realloc(*arcsp,
newsize * sizeof (**arcsp));
if (!arc)
return NULL;
@@ -1714,13 +1712,13 @@ miFreeArcs(
iphase--)
{
if (arcs[iphase].narcs > 0)
- xfree(arcs[iphase].arcs);
+ free(arcs[iphase].arcs);
if (arcs[iphase].njoins > 0)
- xfree(arcs[iphase].joins);
+ free(arcs[iphase].joins);
if (arcs[iphase].ncaps > 0)
- xfree(arcs[iphase].caps);
+ free(arcs[iphase].caps);
}
- xfree(arcs);
+ free(arcs);
}
/*
@@ -1804,13 +1802,13 @@ miComputeArcs (
isDoubleDash = (pGC->lineStyle == LineDoubleDash);
dashOffset = pGC->dashOffset;
- data = xalloc (narcs * sizeof (struct arcData));
+ data = malloc(narcs * sizeof (struct arcData));
if (!data)
return NULL;
- arcs = xalloc (sizeof (*arcs) * (isDoubleDash ? 2 : 1));
+ arcs = malloc(sizeof (*arcs) * (isDoubleDash ? 2 : 1));
if (!arcs)
{
- xfree(data);
+ free(data);
return NULL;
}
for (i = 0; i < narcs; i++) {
@@ -2159,11 +2157,11 @@ miComputeArcs (
arcs[iphase].arcs[arcs[iphase].narcs-1].cap =
arcs[iphase].ncaps;
}
- xfree(data);
+ free(data);
return arcs;
arcfail:
miFreeArcs(arcs, pGC);
- xfree(data);
+ free(data);
return NULL;
}
@@ -3020,7 +3018,7 @@ realAllocSpan (void)
struct finalSpan *span;
int i;
- newChunk = xalloc (sizeof (struct finalSpanChunk));
+ newChunk = malloc(sizeof (struct finalSpanChunk));
if (!newChunk)
return (struct finalSpan *) NULL;
newChunk->next = chunks;
@@ -3043,11 +3041,11 @@ disposeFinalSpans (void)
for (chunk = chunks; chunk; chunk = next) {
next = chunk->next;
- xfree (chunk);
+ free(chunk);
}
chunks = 0;
freeFinalSpans = 0;
- xfree(finalSpans);
+ free(finalSpans);
finalSpans = 0;
}
@@ -3067,8 +3065,8 @@ fillSpans (
if (nspans == 0)
return;
- xSpan = xSpans = xalloc (nspans * sizeof (DDXPointRec));
- xWidth = xWidths = xalloc (nspans * sizeof (int));
+ xSpan = xSpans = malloc(nspans * sizeof (DDXPointRec));
+ xWidth = xWidths = malloc(nspans * sizeof (int));
if (xSpans && xWidths)
{
i = 0;
@@ -3088,9 +3086,9 @@ fillSpans (
}
disposeFinalSpans ();
if (xSpans)
- xfree (xSpans);
+ free(xSpans);
if (xWidths)
- xfree (xWidths);
+ free(xWidths);
finalMiny = 0;
finalMaxy = -1;
finalSize = 0;
@@ -3125,7 +3123,7 @@ realFindSpan (int y)
else
change = SPAN_REALLOC;
newSize = finalSize + change;
- newSpans = xalloc(newSize * sizeof (struct finalSpan *));
+ newSpans = malloc(newSize * sizeof (struct finalSpan *));
if (!newSpans)
return NULL;
newMiny = finalMiny;
@@ -3138,7 +3136,7 @@ realFindSpan (int y)
memmove(((char *) newSpans) + (finalMiny-newMiny) * sizeof (struct finalSpan *),
(char *) finalSpans,
finalSize * sizeof (struct finalSpan *));
- xfree (finalSpans);
+ free(finalSpans);
}
if ((i = finalMiny - newMiny) > 0)
bzero ((char *)newSpans, i * sizeof (struct finalSpan *));
@@ -3481,7 +3479,7 @@ drawArc (
left->counterClock = temp;
}
}
- xfree(spdata);
+ free(spdata);
}
static void