From b7c6424104e6261599a00f81e7e2aa1754454a18 Mon Sep 17 00:00:00 2001 From: frosch Date: Sun, 8 May 2011 18:20:21 +0000 Subject: (svn r22439) -Fix (r22291, r22426): Drawing lines of length zero failed. --- src/blitter/base.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/blitter/base.cpp') 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) -- cgit v1.2.3-54-g00ecf