diff --git a/pipi/paint/aline_template.h b/pipi/paint/aline_template.h index 101be7b..8a56e6a 100644 --- a/pipi/paint/aline_template.h +++ b/pipi/paint/aline_template.h @@ -17,114 +17,116 @@ * aline_template.c: antialiased (Wu) line rendering template */ -float x1 = s->x1, y1 = s->y1, x2 = s->x2, y2 = s->y2; -float g, xd, yd, xgap, xend, yend, xf, yf, val1, val2; -int x, y, ix1, ix2, iy1, iy2; + float x1 = s->x1, y1 = s->y1, x2 = s->x2, y2 = s->y2; + float g, xd, yd, xgap, xend, yend, xf, yf, val1, val2; + int x, y, ix1, ix2, iy1, iy2; -xd = x2 - x1; -yd = y2 - y1; + xd = x2 - x1; + yd = y2 - y1; -/* "Horizontal" line (X greater than Y)*/ -if (fabsf(xd) > fabsf(yd)) { - if (x1 > x2) + /* "Horizontal" line (X greater than Y)*/ + if (fabsf(xd) > fabsf(yd)) { - float tmp; - tmp = x1; x1 = x2; x2 = tmp; - tmp = y1; y1 = y2; y2 = tmp; - xd = (x2-x1); - yd = (y2-y1); - } - g = yd/xd; - - xend = truncf(x1+0.5); - yend = y1 + g*(xend-x1); - xgap = fractinvf(x1+0.5); - ix1 = (int)xend; - iy1 = (int)yend; - val1 = fractinvf(yend)*xgap; - val2 = fractf(yend)*xgap; - - PLOT(ix1, iy1, val1); - PLOT(ix1, (iy1+1) x2) + { + float tmp; + tmp = x1; x1 = x2; x2 = tmp; + tmp = y1; y1 = y2; y2 = tmp; + xd = (x2-x1); + yd = (y2-y1); + } + g = yd/xd; + + xend = truncf(x1+0.5); + yend = y1 + g*(xend-x1); + xgap = fractinvf(x1+0.5); + ix1 = (int)xend; + iy1 = (int)yend; + val1 = fractinvf(yend)*xgap; + val2 = fractf(yend)*xgap; + + PLOT(ix1, iy1, val1); + PLOT(ix1, (iy1+1) x2) - { - float tmp; - tmp = x1; x1 = x2; x2 = tmp; - tmp = y1; y1 = y2; y2 = tmp; - xd = (x2-x1); - yd = (y2-y1); - } - - g = xd/yd; - - xend = truncf(x1+0.5); - yend = y1 + g*(xend-x1); - xgap = fractf(x1+0.5); - ix1 = (int)xend; - iy1 = (int)yend; - val1 = fractinvf(yend)*xgap; - val2 = fractf(yend)*xgap; - - PLOT(ix1, iy1, val1); - PLOT(ix1, (iy1+1) x2) + { + float tmp; + tmp = x1; x1 = x2; x2 = tmp; + tmp = y1; y1 = y2; y2 = tmp; + xd = (x2-x1); + yd = (y2-y1); + } + + g = xd/yd; + + xend = truncf(x1+0.5); + yend = y1 + g*(xend-x1); + xgap = fractf(x1+0.5); + ix1 = (int)xend; + iy1 = (int)yend; + val1 = fractinvf(yend)*xgap; + val2 = fractf(yend)*xgap; + + PLOT(ix1, iy1, val1); + PLOT(ix1, (iy1+1)