From ab0dbbfa6e7e4aa66aeca06c9e87d4096bbb3429 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Fri, 30 Aug 2013 18:45:14 -0400 Subject: [PATCH] Bugfix The bug was that bitIdx was not being taken into account when we realized that there was enough pixel depth to stay within the current byte when reading pixel values. --- PVRTCEncoder/src/Pixel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PVRTCEncoder/src/Pixel.cpp b/PVRTCEncoder/src/Pixel.cpp index 69d3c3c..1c97a80 100644 --- a/PVRTCEncoder/src/Pixel.cpp +++ b/PVRTCEncoder/src/Pixel.cpp @@ -88,7 +88,7 @@ namespace PVRTCC { if(0 == depth) { channel = 0xFF; } else if(depth + bitIdx < 8) { - channel = bits[byteIdx] & ((1 << depth) - 1); + channel = (bits[byteIdx] >> bitIdx) & ((1 << depth) - 1); bitIdx += depth; } else { const uint32 numLowBits = 8 - bitIdx;