[Scummvm-cvs-logs] SF.net SVN: scummvm: [21866] scummvm/trunk/graphics/primitives.cpp
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Thu Apr 13 18:48:04 CEST 2006
Revision: 21866
Author: fingolfin
Date: 2006-04-13 18:47:33 -0700 (Thu, 13 Apr 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=21866&view=rev
Log Message:
-----------
Use const keyword to help compiler optimize code
Modified Paths:
--------------
scummvm/trunk/graphics/primitives.cpp
Modified: scummvm/trunk/graphics/primitives.cpp
===================================================================
--- scummvm/trunk/graphics/primitives.cpp 2006-04-14 01:26:51 UTC (rev 21865)
+++ scummvm/trunk/graphics/primitives.cpp 2006-04-14 01:47:33 UTC (rev 21866)
@@ -26,22 +26,22 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list