Some small aesthetic fixes

This commit is contained in:
Pavel Krajcevski 2014-11-05 17:24:28 -05:00
parent dbde06edf1
commit a303bd4844
3 changed files with 8 additions and 9 deletions

View file

@ -605,7 +605,8 @@ namespace ASTCC {
uint32 Ds = (1024 + (blockWidth/2)) / (blockWidth - 1); uint32 Ds = (1024 + (blockWidth/2)) / (blockWidth - 1);
uint32 Dt = (1024 + (blockHeight/2)) / (blockHeight - 1); uint32 Dt = (1024 + (blockHeight/2)) / (blockHeight - 1);
for(uint32 plane = 0; plane < (params.m_bDualPlane? 2U : 1U); plane++) const uint32 kPlaneScale = params.m_bDualPlane? 2U : 1U;
for(uint32 plane = 0; plane < kPlaneScale; plane++)
for(uint32 t = 0; t < blockHeight; t++) for(uint32 t = 0; t < blockHeight; t++)
for(uint32 s = 0; s < blockWidth; s++) { for(uint32 s = 0; s < blockWidth; s++) {
uint32 cs = Ds * s; uint32 cs = Ds * s;
@ -630,8 +631,7 @@ namespace ASTCC {
#define FIND_TEXEL(tidx, bidx) \ #define FIND_TEXEL(tidx, bidx) \
uint32 p##bidx = 0; \ uint32 p##bidx = 0; \
do { \ do { \
if(w##bidx > 0) { \ if((tidx) < (params.m_Width * params.m_Height)) { \
assert((tidx) < (params.m_Width * params.m_Height)); \
p##bidx = unquantized[plane][(tidx)]; \ p##bidx = unquantized[plane][(tidx)]; \
} \ } \
} \ } \

View file

@ -157,8 +157,8 @@ bool ImageLoader::LoadFromPixelBuffer(const uint32 *data, bool flipY) {
m_BlueData = new uint8[nPixels]; m_BlueData = new uint8[nPixels];
m_AlphaData = new uint8[nPixels]; m_AlphaData = new uint8[nPixels];
for (uint32 i = 0; i < m_Width; i++) {
for (uint32 j = 0; j < m_Height; j++) { 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_Height + i;
uint32 pIdx = idx; uint32 pIdx = idx;
if(flipY) if(flipY)
@ -186,9 +186,6 @@ FasTC::Image<> *ImageLoader::LoadImage() {
if(!ReadData()) if(!ReadData())
return NULL; return NULL;
m_Width = GetWidth();
m_Height = GetHeight();
// Create RGBA buffer // Create RGBA buffer
const unsigned int dataSz = 4 * GetWidth() * GetHeight(); const unsigned int dataSz = 4 * GetWidth() * GetHeight();
m_PixelData = new unsigned char[dataSz]; m_PixelData = new unsigned char[dataSz];

View file

@ -69,7 +69,9 @@ ImageLoaderTGA::~ImageLoaderTGA() { }
bool ImageLoaderTGA::ReadData() { bool ImageLoaderTGA::ReadData() {
Targa tga; Targa tga;
targa_loadFromData(&tga, m_RawData, m_NumRawDataBytes); if (targa_loadFromData(&tga, m_RawData, m_NumRawDataBytes) < 0) {
return false;
}
m_Width = tga.width; m_Width = tga.width;
m_Height = tga.height; m_Height = tga.height;