mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r22290) -Codechange: Somewhat deduplicate one line of code.
This commit is contained in:
parent
43323e38b5
commit
7659575cfa
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user