diff --git a/src/rendering/polyrenderer/drawers/screen_blend.cpp b/src/rendering/polyrenderer/drawers/screen_blend.cpp index 9dee914ca..a8a7d1a8d 100644 --- a/src/rendering/polyrenderer/drawers/screen_blend.cpp +++ b/src/rendering/polyrenderer/drawers/screen_blend.cpp @@ -547,6 +547,10 @@ void BlendColorColormap(int y, int x0, int x1, PolyTriangleThreadData* thread) g = (startG + ((gray * rangeG) >> 8)) << 1; b = (startB + ((gray * rangeB) >> 8)) << 1; + r = MIN(r, (uint32_t)255); + g = MIN(g, (uint32_t)255); + b = MIN(b, (uint32_t)255); + line[x] = MAKEARGB(a, r, g, b); } } diff --git a/src/rendering/polyrenderer/drawers/screen_shader.cpp b/src/rendering/polyrenderer/drawers/screen_shader.cpp index aec34f3e0..af23172a6 100644 --- a/src/rendering/polyrenderer/drawers/screen_shader.cpp +++ b/src/rendering/polyrenderer/drawers/screen_shader.cpp @@ -561,6 +561,10 @@ static void MainFP(int x0, int x1, PolyTriangleThreadData* thread) g = (startG + ((gray * rangeG) >> 8)) << 1; b = (startB + ((gray * rangeB) >> 8)) << 1; + r = MIN(r, (uint32_t)255); + g = MIN(g, (uint32_t)255); + b = MIN(b, (uint32_t)255); + fragcolor[x] = MAKEARGB(a, r, g, b); } }