From 934c27d34a89d0badf4ba9b9296f57afdabb15cb Mon Sep 17 00:00:00 2001 From: Randy Heit Date: Fri, 5 Oct 2012 04:21:34 +0000 Subject: [PATCH] - Fixed: R_GetColumn() needs to clamp negative column indexes to be inside the texture if the texture's width isn't a power of 2. SVN r3881 (trunk) --- src/r_draw.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/r_draw.cpp b/src/r_draw.cpp index 60a0e46e4..165394652 100644 --- a/src/r_draw.cpp +++ b/src/r_draw.cpp @@ -2153,6 +2153,14 @@ void tmvline4_revsubclamp () const BYTE *R_GetColumn (FTexture *tex, int col) { + int width; + + // If the texture's width isn't a power of 2, then we need to make it a + // positive offset for proper clamping. + if (col < 0 && (width = tex->GetWidth()) != (1 << tex->WidthBits)) + { + col = width + (col % width); + } return tex->GetColumn (col, NULL); }