Skip to content

Commit da9988e

Browse files
remove off by one errors on x/y LoopMax
1 parent b1a00ff commit da9988e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/external/rlsw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5449,7 +5449,7 @@ static void SW_RASTER_TRIANGLE_SPAN(const sw_vertex_t *start, const sw_vertex_t
54495449

54505450
int x = xLoopStart;
54515451
// Prevent pixels from beyond the buffer from processing.
5452-
int xLoopEnd = sw_clamp_int(xEnd, 0, RLSW.colorBuffer->width - 1);
5452+
int xLoopEnd = sw_clamp_int(xEnd, 0, RLSW.colorBuffer->width);
54535453
while (x < xLoopEnd)
54545454
{
54555455
// 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,
57445744

57455745
// Intercept the boundaries to stay within the framebuffer.
57465746
int yLoopMin = sw_clamp_int(yMin, 0, RLSW.colorBuffer->height - 1);
5747-
int yLoopMax = sw_clamp_int(yMax, 0, RLSW.colorBuffer->height - 1);
5747+
int yLoopMax = sw_clamp_int(yMax, 0, RLSW.colorBuffer->height);
57485748
int xLoopMin = sw_clamp_int(xMin, 0, RLSW.colorBuffer->width - 1);
5749-
int xLoopMax = sw_clamp_int(xMax, 0, RLSW.colorBuffer->width - 1);
5749+
int xLoopMax = sw_clamp_int(xMax, 0, RLSW.colorBuffer->width);
57505750
int dxMin = xLoopMin - xMin;
57515751
#if defined(SW_ENABLE_DEPTH_TEST) || defined(SW_ENABLE_TEXTURE)
57525752
int dyMin = yLoopMin - yMin;

0 commit comments

Comments
 (0)