Flatten indices properly

This commit is contained in:
Pavel Krajcevski 2014-11-05 18:04:40 -05:00
parent a303bd4844
commit 072b74f7b3

View file

@ -159,10 +159,10 @@ bool ImageLoader::LoadFromPixelBuffer(const uint32 *data, bool flipY) {
for (uint32 j = 0; j < m_Height; j++) {
for (uint32 i = 0; i < m_Width; i++) {
uint32 idx = j*m_Height + i;
uint32 idx = j*m_Width + i;
uint32 pIdx = idx;
if(flipY)
idx = (m_Height - j - 1)*m_Height + i;
idx = (m_Height - j - 1)*m_Width + i;
uint32 pixel = data[idx];
m_RedData[pIdx] = static_cast<uint8>(pixel & 0xFF);
m_GreenData[pIdx] = static_cast<uint8>((pixel >> 8) & 0xFF);