miarc: Style cleanup for miWideArc

Outdent, normalize comment formatting, and use 'goto out' idiom for
error paths. No functional change.

Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Adam Jackson 2017-03-01 16:13:57 -05:00
parent fe5c340046
commit 9426c5500b

View File

@ -894,7 +894,7 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
int xMin, xMax, yMin, yMax; int xMin, xMax, yMin, yMax;
int pixmapWidth = 0, pixmapHeight = 0; int pixmapWidth = 0, pixmapHeight = 0;
int xOrg = 0, yOrg = 0; int xOrg = 0, yOrg = 0;
int width; int width = pGC->lineWidth;
Bool fTricky; Bool fTricky;
DrawablePtr pDrawTo; DrawablePtr pDrawTo;
CARD32 fg, bg; CARD32 fg, bg;
@ -904,17 +904,16 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
int iphase; int iphase;
int halfWidth; int halfWidth;
width = pGC->lineWidth;
if (width == 0 && pGC->lineStyle == LineSolid) { if (width == 0 && pGC->lineStyle == LineSolid) {
for (i = narcs, parc = parcs; --i >= 0; parc++) for (i = narcs, parc = parcs; --i >= 0; parc++)
miArcSegment(pDraw, pGC, *parc, (miArcFacePtr) 0, (miArcFacePtr) 0); miArcSegment(pDraw, pGC, *parc, NULL, NULL);
fillSpans(pDraw, pGC); fillSpans(pDraw, pGC);
return;
} }
else {
if ((pGC->lineStyle == LineSolid) && narcs) { if ((pGC->lineStyle == LineSolid) && narcs) {
while (parcs->width && parcs->height && while (parcs->width && parcs->height &&
(parcs->angle2 >= FULLCIRCLE || (parcs->angle2 >= FULLCIRCLE || parcs->angle2 <= -FULLCIRCLE)) {
parcs->angle2 <= -FULLCIRCLE)) {
miFillWideEllipse(pDraw, pGC, parcs); miFillWideEllipse(pDraw, pGC, parcs);
if (!--narcs) if (!--narcs)
return; return;
@ -973,7 +972,6 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
} }
/* set up scratch GC */ /* set up scratch GC */
pGCTo = GetScratchGC(1, pDraw->pScreen); pGCTo = GetScratchGC(1, pDraw->pScreen);
if (!pGCTo) if (!pGCTo)
return; return;
@ -991,8 +989,7 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
GCCapStyle | GCJoinStyle, gcvals); GCCapStyle | GCJoinStyle, gcvals);
} }
/* allocate a 1 bit deep pixmap of the appropriate size, and /* allocate a bitmap of the appropriate size, and validate it */
* validate it */
pDrawTo = (DrawablePtr) (*pDraw->pScreen->CreatePixmap) pDrawTo = (DrawablePtr) (*pDraw->pScreen->CreatePixmap)
(pDraw->pScreen, pixmapWidth, pixmapHeight, 1, (pDraw->pScreen, pixmapWidth, pixmapHeight, 1,
CREATE_PIXMAP_USAGE_SCRATCH); CREATE_PIXMAP_USAGE_SCRATCH);
@ -1006,24 +1003,19 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
fg = pGC->fgPixel; fg = pGC->fgPixel;
bg = pGC->bgPixel; bg = pGC->bgPixel;
/* the protocol sez these don't cause color changes */
if ((pGC->fillStyle == FillTiled) || if ((pGC->fillStyle == FillTiled) ||
(pGC->fillStyle == FillOpaqueStippled)) (pGC->fillStyle == FillOpaqueStippled))
bg = fg; /* the protocol sez these don't cause color changes */ bg = fg;
polyArcs = miComputeArcs(parcs, narcs, pGC); polyArcs = miComputeArcs(parcs, narcs, pGC);
if (!polyArcs)
if (!polyArcs) { goto out;
if (fTricky) {
(*pDraw->pScreen->DestroyPixmap) ((PixmapPtr) pDrawTo);
FreeScratchGC(pGCTo);
}
return;
}
cap[0] = cap[1] = 0; cap[0] = cap[1] = 0;
join[0] = join[1] = 0; join[0] = join[1] = 0;
for (iphase = ((pGC->lineStyle == LineDoubleDash) ? 1 : 0); for (iphase = (pGC->lineStyle == LineDoubleDash); iphase >= 0; iphase--) {
iphase >= 0; iphase--) {
ChangeGCVal gcval; ChangeGCVal gcval;
if (iphase == 1) { if (iphase == 1) {
@ -1045,9 +1037,7 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
&arcData->bounds[LEFT_END]); &arcData->bounds[LEFT_END]);
if (polyArcs[iphase].arcs[i].render) { if (polyArcs[iphase].arcs[i].render) {
fillSpans(pDrawTo, pGCTo); fillSpans(pDrawTo, pGCTo);
/* /* don't cap self-joining arcs */
* don't cap self-joining arcs
*/
if (polyArcs[iphase].arcs[i].selfJoin && if (polyArcs[iphase].arcs[i].selfJoin &&
cap[iphase] < polyArcs[iphase].arcs[i].cap) cap[iphase] < polyArcs[iphase].arcs[i].cap)
cap[iphase]++; cap[iphase]++;
@ -1104,12 +1094,12 @@ miWideArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc * parcs)
} }
miFreeArcs(polyArcs, pGC); miFreeArcs(polyArcs, pGC);
out:
if (fTricky) { if (fTricky) {
(*pGCTo->pScreen->DestroyPixmap) ((PixmapPtr) pDrawTo); (*pGCTo->pScreen->DestroyPixmap) ((PixmapPtr) pDrawTo);
FreeScratchGC(pGCTo); FreeScratchGC(pGCTo);
} }
} }
}
/* Find the index of the point with the smallest y.also return the /* Find the index of the point with the smallest y.also return the
* smallest and largest y */ * smallest and largest y */