diff options
author | Max Horn | 2006-04-14 01:47:33 +0000 |
---|---|---|
committer | Max Horn | 2006-04-14 01:47:33 +0000 |
commit | 507281610935fb2adcbae0c5f0d6239defdd8ffa (patch) | |
tree | aca606e79c6f5717414c4bdd97bdcd050cdb6f49 /graphics/primitives.cpp | |
parent | 6d386838323173e0dc25ec129f8e248dc80b0b21 (diff) | |
download | scummvm-rg350-507281610935fb2adcbae0c5f0d6239defdd8ffa.tar.gz scummvm-rg350-507281610935fb2adcbae0c5f0d6239defdd8ffa.tar.bz2 scummvm-rg350-507281610935fb2adcbae0c5f0d6239defdd8ffa.zip |
Use const keyword to help compiler optimize code
svn-id: r21866
Diffstat (limited to 'graphics/primitives.cpp')
-rw-r--r-- | graphics/primitives.cpp | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/graphics/primitives.cpp b/graphics/primitives.cpp index 791e9de64b..0b3d154fcf 100644 --- a/graphics/primitives.cpp +++ b/graphics/primitives.cpp @@ -26,22 +26,22 @@ namespace Graphics { void drawLine(int x0, int y0, int x1, int y1, int color, void (*plotProc)(int, int, int, void *), void *data) { // Bresenham's line algorithm, as described by Wikipedia - bool steep = ABS(y1 - y0) > ABS(x1 - x0); + const bool steep = ABS(y1 - y0) > ABS(x1 - x0); if (steep) { SWAP(x0, y0); SWAP(x1, y1); } - int delta_x = ABS(x1 - x0); - int delta_y = ABS(y1 - y0); - int err = 0; - int delta_err = delta_y; + const int delta_x = ABS(x1 - x0); + const int delta_y = ABS(y1 - y0); + const int delta_err = delta_y; int x = x0; int y = y0; + int err = 0; - int x_step = (x0 < x1) ? 1 : -1; - int y_step = (y0 < y1) ? 1 : -1; + const int x_step = (x0 < x1) ? 1 : -1; + const int y_step = (y0 < y1) ? 1 : -1; if (steep) (*plotProc)(y, x, color, data); |