Some small code style fixes

This commit is contained in:
Pavel Krajcevski 2013-09-06 13:37:50 -04:00
parent 5ac6872dc7
commit 09b5680245
4 changed files with 11 additions and 10 deletions

View File

@ -183,7 +183,7 @@ void Image::BilinearUpscale(uint32 times, EWrapMode wrapMode) {
bottomRight.GetBitDepth(debugDepth);
assert(CompareBitDepths(bitDepth, debugDepth));
#endif //NDEBUG
#endif // NDEBUG
// bilerp each channel....
const uint16 scaleMask = (scale * scale) - 1;
@ -314,7 +314,7 @@ void Image::DebugOutput(const char *filename) const {
::Image img(m_Height, m_Width, outPixels);
char debugFilename[256];
sprintf(debugFilename, "%s.png", filename);
snprintf(debugFilename, sizeof(debugFilename), "%s.png", filename);
::ImageFile imgFile(debugFilename, eFileFormat_PNG, img);
imgFile.Write();

View File

@ -68,13 +68,13 @@
#endif // OUTPUT_DEBUG_IMAGE
class ImageTester {
public:
ImageTester(const char *filename) {
public:
explicit ImageTester(const char *filename) {
pvrtexture::CPVRTexture pvrTex(filename);
const uint8 *data = static_cast<const uint8 *>(pvrTex.getDataPtr());
ASSERT_TRUE(data);
const pvrtexture::CPVRTextureHeader &hdr = pvrTex.getHeader();
const uint32 w = hdr.getWidth();
const uint32 h = hdr.getHeight();
@ -98,7 +98,7 @@ public:
#ifdef OUTPUT_DEBUG_IMAGE
char dbgfname[256];
sprintf(dbgfname, "Debug%s.png", filename);
snprintf(dbgfname, sizeof(dgbfname), "Debug%s.png", filename);
::ImageFile imgFile(dbgfname, eFileFormat_PNG, ::Image(w, h, outPixels));
imgFile.Write();
#endif // OUTPUT_DEBUG_IMAGE

View File

@ -75,7 +75,8 @@ TEST(Decompressor, DecompressWhite) {
for(int i = 0; i < kWidth; i++) {
for(int j = 0; j < kHeight; j++) {
const uint32 *pixelData = reinterpret_cast<const uint32 *>(outData);
EXPECT_EQ(PixelPrinter(pixelData[j*kWidth + i]), PixelPrinter(0xFFFFFFFF));
const uint32 p = pixelData[j*kWidth + i];
EXPECT_EQ(PixelPrinter(p), PixelPrinter(0xFFFFFFFF));
}
}
}
@ -99,7 +100,8 @@ TEST(Decompressor, DecompressGray) {
for(int i = 0; i < kWidth; i++) {
for(int j = 0; j < kHeight; j++) {
const uint32 *pixelData = reinterpret_cast<const uint32 *>(outData);
EXPECT_EQ(PixelPrinter(pixelData[j*kWidth + i]), PixelPrinter(0xFF818080));
const uint32 p = pixelData[j*kWidth + i];
EXPECT_EQ(PixelPrinter(p), PixelPrinter(0xFF818080));
}
}
}

View File

@ -54,13 +54,12 @@
#define PVRTCENCODER_TEST_TESTUTILS_H_
#include "Core/include/TexCompTypes.h"
#include <iostream>
class PixelPrinter {
private:
uint32 m_PixelValue;
public:
PixelPrinter(uint32 p) : m_PixelValue(p) { }
explicit PixelPrinter(uint32 p) : m_PixelValue(p) { }
bool operator==(const PixelPrinter &other) const {
return other.m_PixelValue == this->m_PixelValue;
}