Split apart the index calculation and pixel lookup functions

This commit is contained in:
Pavel Krajcevski 2013-09-18 18:03:08 -04:00
parent 16cc7f4a93
commit e609075d04
2 changed files with 7 additions and 2 deletions

View file

@ -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;

View file

@ -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