From c38dead3ea7e177728d90cd815cf4eead0c9f534 Mon Sep 17 00:00:00 2001 From: marha Date: Sat, 15 May 2010 16:28:11 +0000 Subject: xserver git update 15/5/2010 --- xorg-server/mi/miarc.c | 102 ++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 52 deletions(-) (limited to 'xorg-server/mi/miarc.c') diff --git a/xorg-server/mi/miarc.c b/xorg-server/mi/miarc.c index d182d2592..3b4a628e4 100644 --- a/xorg-server/mi/miarc.c +++ b/xorg-server/mi/miarc.c @@ -213,16 +213,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, @@ -800,7 +790,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); @@ -831,14 +821,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; @@ -927,10 +917,10 @@ miFillWideEllipse( wids += 2; } } - xfree(spdata); + free(spdata); (*pGC->ops->FillSpans)(pDraw, pGC, pts - points, points, widths, FALSE); - xfree(widths); + free(widths); } /* @@ -1045,13 +1035,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 */ @@ -1090,11 +1085,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++) { @@ -1266,7 +1264,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; @@ -1282,7 +1280,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: /* @@ -1413,7 +1411,7 @@ miRoundCap( * rest of the line */ miFillSppPoly(pDraw, pGC, cpt, pArcPts, -xOrg, -yOrg, xFtrans, yFtrans); } - xfree(pArcPts); + free(pArcPts); } /* @@ -1511,10 +1509,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( @@ -1561,7 +1559,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; @@ -1624,7 +1622,7 @@ addCap ( if (*ncapsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; - cap = (miArcCapPtr) xrealloc (*capsp, + cap = (miArcCapPtr) realloc(*capsp, newsize * sizeof (**capsp)); if (!cap) return; @@ -1655,7 +1653,7 @@ addJoin ( if (*njoinsp == *sizep) { newsize = *sizep + ADD_REALLOC_STEP; - join = (miArcJoinPtr) xrealloc (*joinsp, + join = (miArcJoinPtr) realloc(*joinsp, newsize * sizeof (**joinsp)); if (!join) return; @@ -1685,7 +1683,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; @@ -1710,13 +1708,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); } /* @@ -1800,13 +1798,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++) { @@ -2155,11 +2153,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; } @@ -3016,7 +3014,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; @@ -3039,11 +3037,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; } @@ -3063,8 +3061,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; @@ -3084,9 +3082,9 @@ fillSpans ( } disposeFinalSpans (); if (xSpans) - xfree (xSpans); + free(xSpans); if (xWidths) - xfree (xWidths); + free(xWidths); finalMiny = 0; finalMaxy = -1; finalSize = 0; @@ -3121,7 +3119,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; @@ -3134,7 +3132,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 *)); @@ -3477,7 +3475,7 @@ drawArc ( left->counterClock = temp; } } - xfree(spdata); + free(spdata); } static void -- cgit v1.2.3