From 0a139e90fb624cf1ba337a9c83950b4a10a1d7f9 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 30 Jun 2018 20:27:04 +0300 Subject: [PATCH] - restored initial clamping for blend colors https://forum.zdoom.org/viewtopic.php?t=61134 --- src/v_draw.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/v_draw.cpp b/src/v_draw.cpp index 49e445995..20d49bc10 100644 --- a/src/v_draw.cpp +++ b/src/v_draw.cpp @@ -1418,7 +1418,11 @@ void DFrameBuffer::DrawBlend(sector_t * viewsector) V_AddBlend(player->BlendR, player->BlendG, player->BlendB, player->BlendA, blend); } - screen->Dim(PalEntry(255, uint8_t(blend[0] * 255), uint8_t(blend[1] * 255), uint8_t(blend[2] * 255)), blend[3], 0, 0, screen->GetWidth(), screen->GetHeight()); + const float br = clamp(blend[0] * 255.f, 0.f, 255.f); + const float bg = clamp(blend[1] * 255.f, 0.f, 255.f); + const float bb = clamp(blend[2] * 255.f, 0.f, 255.f); + const PalEntry bcolor(255, uint8_t(br), uint8_t(bg), uint8_t(bb)); + screen->Dim(bcolor, blend[3], 0, 0, screen->GetWidth(), screen->GetHeight()); }