From 98ffd3cdb14572d5f84d7bf9121b8694ab01f667 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Sun, 24 Aug 2025 13:24:17 +0100 Subject: [PATCH] Fix: Off-by-one when drawing diagonal lines (#14523) --- src/blitter/common.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/blitter/common.hpp b/src/blitter/common.hpp index f1ea61c0ec..af94dadbdd 100644 --- a/src/blitter/common.hpp +++ b/src/blitter/common.hpp @@ -82,7 +82,7 @@ void Blitter::DrawLineGeneric(int x1, int y1, int x2, int y2, int screen_width, frac_low += dx; y_low -= stepy; } - while (frac_high >= 0) { + while (frac_high >= dy) { frac_high -= dx; y_high += stepy; } @@ -145,7 +145,7 @@ void Blitter::DrawLineGeneric(int x1, int y1, int x2, int y2, int screen_width, frac_low += dy; x_low -= stepx; } - while (frac_high >= 0) { + while (frac_high >= dx) { frac_high -= dy; x_high += stepx; }