diff --git a/PVRTCEncoder/src/Image.cpp b/PVRTCEncoder/src/Image.cpp index cbca9d3..1cc997f 100644 --- a/PVRTCEncoder/src/Image.cpp +++ b/PVRTCEncoder/src/Image.cpp @@ -252,7 +252,11 @@ void Image::ExpandTo8888() { } } -const Pixel &Image::GetPixel(int32 i, int32 j, EWrapMode wrapMode) { +const Pixel &Image::GetPixel(int32 i, int32 j, EWrapMode wrapMode) const { + return m_Pixels[GetPixelIndex(i, j, wrapMode)]; +} + +const uint32 Image::GetPixelIndex(int32 i, int32 j, EWrapMode wrapMode) const { while(i < 0) { if(wrapMode == eWrapMode_Clamp) { i = 0; diff --git a/PVRTCEncoder/src/Image.h b/PVRTCEncoder/src/Image.h index 8550d2a..e7b35e6 100644 --- a/PVRTCEncoder/src/Image.h +++ b/PVRTCEncoder/src/Image.h @@ -87,7 +87,8 @@ class Image { Pixel *m_Pixels; Pixel *m_FractionalPixels; - const Pixel &GetPixel(int32 i, int32 j, EWrapMode wrapMode = eWrapMode_Clamp); + const uint32 GetPixelIndex(int32 i, int32 j, EWrapMode wrapMode = eWrapMode_Clamp) const; + const Pixel &GetPixel(int32 i, int32 j, EWrapMode wrapMode = eWrapMode_Clamp) const; }; } // namespace PVRTCC