diff options
Diffstat (limited to 'graphics/primitives.cpp')
-rw-r--r-- | graphics/primitives.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/graphics/primitives.cpp b/graphics/primitives.cpp index 8663a61606..76c44b650d 100644 --- a/graphics/primitives.cpp +++ b/graphics/primitives.cpp @@ -262,13 +262,13 @@ void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*p do { if (filled) { - drawHLine(rect.left+x+r, rect.right-x-r, rect.top-y+r-stop, color, plotProc, data); - drawHLine(rect.left+x+r, rect.right-x-r, rect.bottom+y-r+stop, color, plotProc, data); + drawHLine(rect.left + x + r, rect.right - x - r, rect.top - y + r - stop, color, plotProc, data); + drawHLine(rect.left + x + r, rect.right - x - r, rect.bottom + y - r + stop, color, plotProc, data); } else { - (*plotProc)(rect.left+x+r, rect.top-y+r-stop, color, data); - (*plotProc)(rect.right-x-r, rect.top-y+r-stop, color, data); - (*plotProc)(rect.left+x+r, rect.bottom+y-r+stop, color, data); - (*plotProc)(rect.right-x-r, rect.bottom+y-r+stop, color, data); + (*plotProc)(rect.left + x + r, rect.top - y + r - stop, color, data); + (*plotProc)(rect.right - x - r, rect.top - y + r - stop, color, data); + (*plotProc)(rect.left + x + r, rect.bottom + y - r + stop, color, data); + (*plotProc)(rect.right - x - r, rect.bottom + y - r + stop, color, data); lastx = x; lasty = y; @@ -284,15 +284,15 @@ void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*p x = lastx; y = lasty; - drawHLine(rect.left+x+r, rect.right-x-r, rect.top-y+r-stop, color, plotProc, data); - drawHLine(rect.left+x+r, rect.right-x-r, rect.bottom+y-r+stop, color, plotProc, data); + drawHLine(rect.left + x + r, rect.right - x - r, rect.top - y + r - stop, color, plotProc, data); + drawHLine(rect.left + x + r, rect.right - x - r, rect.bottom + y - r + stop, color, plotProc, data); } for (int i = 0; i < dy; i++) { if (filled) { drawHLine(rect.left, rect.right, rect.top + r + i, color, plotProc, data); } else { - (*plotProc)(rect.left, rect.top + r + i, color, data); + (*plotProc)(rect.left, rect.top + r + i, color, data); (*plotProc)(rect.right, rect.top + r + i, color, data); } } @@ -307,13 +307,13 @@ void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*p do { if (filled) { - drawVLine(rect.left-x+r-stop, rect.top+y+r, rect.bottom-y-r, color, plotProc, data); - drawVLine(rect.right+x-r+stop, rect.top+y+r, rect.bottom-y-r, color, plotProc, data); + drawVLine(rect.left - x + r - stop, rect.top + y + r, rect.bottom - y - r, color, plotProc, data); + drawVLine(rect.right + x - r + stop, rect.top + y + r, rect.bottom - y - r, color, plotProc, data); } else { - (*plotProc)(rect.left-x+r-stop, rect.top+y+r, color, data); - (*plotProc)(rect.left-x+r-stop, rect.bottom-y-r, color, data); - (*plotProc)(rect.right+x-r+stop, rect.top+y+r, color, data); - (*plotProc)(rect.right+x-r+stop, rect.bottom-y-r, color, data); + (*plotProc)(rect.left - x + r - stop, rect.top + y + r, color, data); + (*plotProc)(rect.left - x + r - stop, rect.bottom - y - r, color, data); + (*plotProc)(rect.right + x - r + stop, rect.top + y + r, color, data); + (*plotProc)(rect.right + x - r + stop, rect.bottom - y - r, color, data); lastx = x; lasty = y; @@ -329,15 +329,15 @@ void drawRoundRect(Common::Rect &rect, int arc, int color, bool filled, void (*p if (!filled) { x = lastx; y = lasty; - drawVLine(rect.left-x+r-stop, rect.top+y+r, rect.bottom-y-r, color, plotProc, data); - drawVLine(rect.right+x-r+stop, rect.top+y+r, rect.bottom-y-r, color, plotProc, data); + drawVLine(rect.left - x + r - stop, rect.top + y + r, rect.bottom - y - r, color, plotProc, data); + drawVLine(rect.right + x - r + stop, rect.top + y + r, rect.bottom - y - r, color, plotProc, data); } for (int i = 0; i < dx; i++) { if (filled) { drawVLine(rect.left + r + i, rect.top, rect.bottom, color, plotProc, data); } else { - (*plotProc)(rect.left + r + i, rect.top, color, data); + (*plotProc)(rect.left + r + i, rect.top, color, data); (*plotProc)(rect.left + r + i, rect.bottom, color, data); } } @@ -385,14 +385,14 @@ void drawPolygonScan(int *polyX, int *polyY, int npoints, Common::Rect &bbox, in // http://members.chello.at/easyfilter/bresenham.html void drawEllipse(int x0, int y0, int x1, int y1, int color, bool filled, void (*plotProc)(int, int, int, void *), void *data) { - int a = abs(x1-x0), b = abs(y1-y0), b1 = b&1; /* values of diameter */ - long dx = 4*(1-a)*b*b, dy = 4*(b1+1)*a*a; /* error increment */ - long err = dx+dy+b1*a*a, e2; /* error of 1.step */ + int a = abs(x1 - x0), b = abs(y1 - y0), b1 = b & 1; /* values of diameter */ + long dx = 4 * (1 - a) * b * b, dy = 4 * (b1 + 1) * a * a; /* error increment */ + long err = dx + dy + b1 * a * a, e2; /* error of 1.step */ if (x0 > x1) { x0 = x1; x1 += a; } /* if called with swapped points */ if (y0 > y1) y0 = y1; /* .. exchange them */ - y0 += (b+1)/2; y1 = y0-b1; /* starting pixel */ - a *= 8*a; b1 = 8*b*b; + y0 += (b + 1) / 2; y1 = y0 - b1; /* starting pixel */ + a *= 8 * a; b1 = 8 * b * b; do { if (filled) { @@ -411,15 +411,15 @@ void drawEllipse(int x0, int y0, int x1, int y1, int color, bool filled, void (* while (y0-y1 < b) { /* too early stop of flat ellipses a=1 */ if (filled) { - drawHLine(x0-1, x0-1, y0, color, plotProc, data); /* -> finish tip of ellipse */ - drawHLine(x1+1, x1+1, y0, color, plotProc, data); - drawHLine(x0-1, x0-1, y1, color, plotProc, data); - drawHLine(x1+1, x1+1, y1, color, plotProc, data); + drawHLine(x0 - 1, x0 - 1, y0, color, plotProc, data); /* -> finish tip of ellipse */ + drawHLine(x1 + 1, x1 + 1, y0, color, plotProc, data); + drawHLine(x0 - 1, x0 - 1, y1, color, plotProc, data); + drawHLine(x1 + 1, x1 + 1, y1, color, plotProc, data); } else { - (*plotProc)(x0-1, y0, color, data); /* -> finish tip of ellipse */ - (*plotProc)(x1+1, y0, color, data); - (*plotProc)(x0-1, y1, color, data); - (*plotProc)(x1+1, y1, color, data); + (*plotProc)(x0 - 1, y0, color, data); /* -> finish tip of ellipse */ + (*plotProc)(x1 + 1, y0, color, data); + (*plotProc)(x0 - 1, y1, color, data); + (*plotProc)(x1 + 1, y1, color, data); } y0++; y1--; |