From 70d4097b3449f14bb7792fb60f6a1280de57eba4 Mon Sep 17 00:00:00 2001 From: Magnus Norddahl Date: Sun, 6 Nov 2016 07:33:17 +0100 Subject: [PATCH] Fix clamping bug when r_mipmap is off --- src/r_things.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/r_things.cpp b/src/r_things.cpp index 4f6d5fcc2..8f91b1740 100644 --- a/src/r_things.cpp +++ b/src/r_things.cpp @@ -275,9 +275,9 @@ void R_DrawMaskedColumnBgra(FTexture *tex, fixed_t col, bool useRt, bool unmaske int mipmap_offset = 0; int mip_width = tex->GetWidth(); int mip_height = tex->GetHeight(); + uint32_t xpos = (uint32_t)((((uint64_t)xoffset) << FRACBITS) / mip_width); if (r_mipmap && tex->Mipmapped() && mip_width > 1 && mip_height > 1) { - uint32_t xpos = (uint32_t)((((uint64_t)xoffset) << FRACBITS) / mip_width); int level = (int)lod; while (level > 0 && mip_width > 1 && mip_height > 1) { @@ -286,8 +286,8 @@ void R_DrawMaskedColumnBgra(FTexture *tex, fixed_t col, bool useRt, bool unmaske mip_width = MAX(mip_width >> 1, 1); mip_height = MAX(mip_height >> 1, 1); } - xoffset = (xpos >> FRACBITS) * mip_width; } + xoffset = (xpos >> FRACBITS) * mip_width; const uint32_t *pixels = tex->GetPixelsBgra() + mipmap_offset;