(svn r22290) -Codechange: Somewhat deduplicate one line of code.

This commit is contained in:
frosch 2011-04-02 15:07:58 +00:00
parent 43323e38b5
commit 7659575cfa

View File

@ -47,28 +47,29 @@ void Blitter::DrawLine(void *video, int x, int y, int x2, int y2, int screen_wid
stepx = 1; stepx = 1;
} }
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
if (dx > dy) { if (dx > dy) {
frac = dy - (dx / 2); frac = dy - (dx / 2);
x2 += stepx; // Make x2 the first column to not draw to
while (x != x2) { while (x != x2) {
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
if (frac >= 0) { if (frac >= 0) {
y += stepy; y += stepy;
frac -= dx; frac -= dx;
} }
x += stepx; x += stepx;
frac += dy; frac += dy;
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
} }
} else { } else {
frac = dx - (dy / 2); frac = dx - (dy / 2);
y2 += stepy; // Make y2 the first row to not draw to
while (y != y2) { while (y != y2) {
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
if (frac >= 0) { if (frac >= 0) {
x += stepx; x += stepx;
frac -= dy; frac -= dy;
} }
y += stepy; y += stepy;
frac += dx; frac += dx;
if (x >= 0 && y >= 0 && x < screen_width && y < screen_height) this->SetPixel(video, x, y, colour);
} }
} }
} }