1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-21 03:12:41 +01:00

Fix #10222: Off by one drawing even-width horizontal/vertical lines

This commit is contained in:
Jonathan G Rennison
2025-08-17 15:26:23 +01:00
committed by Peter Nelson
parent 80f72d3722
commit add40a2de2

View File

@@ -78,11 +78,11 @@ void Blitter::DrawLineGeneric(int x1, int y1, int x2, int y2, int screen_width,
int frac_low = dy - frac_diff / 2;
int frac_high = dy + frac_diff / 2;
while (frac_low < -(dx / 2)) {
while (frac_low < -dx) {
frac_low += dx;
y_low -= stepy;
}
while (frac_high >= dx / 2) {
while (frac_high >= 0) {
frac_high -= dx;
y_high += stepy;
}
@@ -141,11 +141,11 @@ void Blitter::DrawLineGeneric(int x1, int y1, int x2, int y2, int screen_width,
int frac_low = dx - frac_diff / 2;
int frac_high = dx + frac_diff / 2;
while (frac_low < -(dy / 2)) {
while (frac_low < -dy) {
frac_low += dy;
x_low -= stepx;
}
while (frac_high >= dy / 2) {
while (frac_high >= 0) {
frac_high -= dy;
x_high += stepx;
}