Mercurial > hg > openttd
changeset 17667:c682f04b4d6d draft
(svn r22439) -Fix (r22291, r22426): Drawing lines of length zero failed.
author | frosch <frosch@openttd.org> |
---|---|
date | Sun, 08 May 2011 18:20:21 +0000 |
parents | 5d6298e29f12 |
children | ae1eac0520e3 |
files | src/blitter/base.cpp |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/blitter/base.cpp +++ b/src/blitter/base.cpp @@ -36,6 +36,12 @@ 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)