From add40a2de207cadf4d851aacff7ca73745b7bbdb Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 17 Aug 2025 15:26:23 +0100 Subject: [PATCH] Fix #10222: Off by one drawing even-width horizontal/vertical lines --- src/blitter/common.hpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/blitter/common.hpp b/src/blitter/common.hpp index 0347aa8002..f1ea61c0ec 100644 --- a/src/blitter/common.hpp +++ b/src/blitter/common.hpp @@ -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; }