# HG changeset patch # User frosch # Date 2011-05-08 18:20:21 # Node ID 64bea15c6ec59766ebb1af592a35453f8bd74e0a # Parent aac1870b6ea1062ce94df51a6fa6907132ebb438 (svn r22439) -Fix (r22291, r22426): Drawing lines of length zero failed. diff --git a/src/blitter/base.cpp b/src/blitter/base.cpp --- a/src/blitter/base.cpp +++ b/src/blitter/base.cpp @@ -36,6 +36,12 @@ void Blitter::DrawLine(void *video, int 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)