summaryrefslogtreecommitdiff
path: root/src/blitter
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-05-08 18:20:21 +0000
committerfrosch <frosch@openttd.org>2011-05-08 18:20:21 +0000
commitb7c6424104e6261599a00f81e7e2aa1754454a18 (patch)
tree1af756174ceee55cb65c7e8e4032d24ff561e2c0 /src/blitter
parentc4a15a6a9e5ef962122ec1158242afd1cc9f6e85 (diff)
downloadopenttd-b7c6424104e6261599a00f81e7e2aa1754454a18.tar.xz
(svn r22439) -Fix (r22291, r22426): Drawing lines of length zero failed.
Diffstat (limited to 'src/blitter')
-rw-r--r--src/blitter/base.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/blitter/base.cpp b/src/blitter/base.cpp
index cbaea29f9..bb8b9f234 100644
--- a/src/blitter/base.cpp
+++ b/src/blitter/base.cpp
@@ -36,6 +36,12 @@ void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_wid
stepx = 1;
}
+ if (dx == 0 && dy == 0) {
+ /* The algorithm below cannot handle this special case; make it work at least for line width 1 */
+ if (x >= 0 && x < screen_width && y >= 0 && y < screen_height) this->SetPixel(video, x, y, colour);
+ return;
+ }
+
int frac_diff = width * max(dx, dy);
if (width > 1) {
/* compute frac_diff = width * sqrt(dx*dx + dy*dy)