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