From da9988e6706d4cc35bc6717942a5ad8017e368ae Mon Sep 17 00:00:00 2001 From: Colin James Wood Date: Sat, 9 May 2026 11:20:34 +0100 Subject: [PATCH] remove off by one errors on x/y LoopMax --- src/external/rlsw.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/external/rlsw.h b/src/external/rlsw.h index 3d23cef1e..f21a3b0ff 100644 --- a/src/external/rlsw.h +++ b/src/external/rlsw.h @@ -5449,7 +5449,7 @@ static void SW_RASTER_TRIANGLE_SPAN(const sw_vertex_t *start, const sw_vertex_t int x = xLoopStart; // Prevent pixels from beyond the buffer from processing. - int xLoopEnd = sw_clamp_int(xEnd, 0, RLSW.colorBuffer->width - 1); + int xLoopEnd = sw_clamp_int(xEnd, 0, RLSW.colorBuffer->width); while (x < xLoopEnd) { // Clamp last block to remaining pixels @@ -5744,9 +5744,9 @@ static void SW_RASTER_QUAD(const sw_vertex_t *a, const sw_vertex_t *b, // Intercept the boundaries to stay within the framebuffer. int yLoopMin = sw_clamp_int(yMin, 0, RLSW.colorBuffer->height - 1); - int yLoopMax = sw_clamp_int(yMax, 0, RLSW.colorBuffer->height - 1); + int yLoopMax = sw_clamp_int(yMax, 0, RLSW.colorBuffer->height); int xLoopMin = sw_clamp_int(xMin, 0, RLSW.colorBuffer->width - 1); - int xLoopMax = sw_clamp_int(xMax, 0, RLSW.colorBuffer->width - 1); + int xLoopMax = sw_clamp_int(xMax, 0, RLSW.colorBuffer->width); int dxMin = xLoopMin - xMin; #if defined(SW_ENABLE_DEPTH_TEST) || defined(SW_ENABLE_TEXTURE) int dyMin = yLoopMin - yMin;