From 7659575cfa52b6fd9eea9c1256b325f84261e29f Mon Sep 17 00:00:00 2001 From: frosch Date: Sat, 2 Apr 2011 15:07:58 +0000 Subject: (svn r22290) -Codechange: Somewhat deduplicate one line of code. --- src/blitter/base.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/blitter') 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); } } } -- cgit v1.2.3-54-g00ecf