summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-04-02 15:07:58 +0000
committerfrosch <frosch@openttd.org>2011-04-02 15:07:58 +0000
commit7659575cfa52b6fd9eea9c1256b325f84261e29f (patch)
treeea7b89036276a7c42c64c5de148d4cda46e2f332 /src
parent43323e38b599160dd5a51c6f5b771bc405832d33 (diff)
downloadopenttd-7659575cfa52b6fd9eea9c1256b325f84261e29f.tar.xz
(svn r22290) -Codechange: Somewhat deduplicate one line of code.
Diffstat (limited to 'src')
-rw-r--r--src/blitter/base.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/blitter/base.cpp b/src/blitter/base.cpp
index b18e9c87a..9b2d007bf 100644
--- a/src/blitter/base.cpp
+++ b/src/blitter/base.cpp
@@ -47,28 +47,29 @@ void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_wid
stepx = 1;
}
- if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
if (dx > dy) {
frac = dy - (dx / 2);
+ x2 += stepx; // Make x2 the first column to not draw to
while (x != x2) {
+ if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
if (frac >= 0) {
y += stepy;
frac -= dx;
}
x += stepx;
frac += dy;
- if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
}
} else {
frac = dx - (dy / 2);
+ y2 += stepy; // Make y2 the first row to not draw to
while (y != y2) {
+ if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
if (frac >= 0) {
x += stepx;
frac -= dy;
}
y += stepy;
frac += dx;
- if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
}
}
}