From 977b2498e8254e629db7f8b2b35ced1d3e59024a Mon Sep 17 00:00:00 2001 From: Stefan Haun <tux@netz39.de> Date: Sat, 24 Aug 2019 16:13:40 +0200 Subject: [PATCH] gfx: Fix line drawing algorithm Lines have been one pixel too short. --- lib/gfx/gfx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gfx/gfx.c b/lib/gfx/gfx.c index dd92ecdc..9d27d2a5 100644 --- a/lib/gfx/gfx.c +++ b/lib/gfx/gfx.c @@ -198,7 +198,7 @@ static void plot_line_low( int d = 2 * dy - dx; int y = y0; - for (int x = x0; x < x1; x++) { + for (int x = x0; x <= x1; x++) { if (t > 1) { gfx_circle_fill(reg, x, y, t, c); } else { @@ -231,7 +231,7 @@ static void plot_line_high( int d = 2 * dx - dy; int x = x0; - for (int y = y0; y < y1; y++) { + for (int y = y0; y <= y1; y++) { if (t > 1) { gfx_circle_fill(reg, x, y, t, c); } else { -- GitLab