diff --git a/BPTCEncoder/src/RGBAEndpoints.cpp b/BPTCEncoder/src/RGBAEndpoints.cpp index 9b36e63..7a52f6b 100755 --- a/BPTCEncoder/src/RGBAEndpoints.cpp +++ b/BPTCEncoder/src/RGBAEndpoints.cpp @@ -91,7 +91,7 @@ static inline uint32 CountBitsInMask(uint8 n) { "subl %%ecx, %%eax;" "movl %%eax, %0;" : "=Q"(ans) - : "r"(n) + : "b"(n) : "%eax", "%ecx" ); return ans; diff --git a/IO/CMakeLists.txt b/IO/CMakeLists.txt index a09685e..35ee590 100644 --- a/IO/CMakeLists.txt +++ b/IO/CMakeLists.txt @@ -23,6 +23,7 @@ CONFIGURE_FILE( INCLUDE_DIRECTORIES( ${TexC_BINARY_DIR}/IO/include ) INCLUDE_DIRECTORIES( ${TexC_SOURCE_DIR}/IO/include ) +INCLUDE_DIRECTORIES( ${TexC_SOURCE_DIR}/Core/include ) ADD_LIBRARY(TexCompIO ${SOURCES} diff --git a/IO/config/ImageLoader.h.in b/IO/config/ImageLoader.h.in index cf447cf..ed0fe3d 100644 --- a/IO/config/ImageLoader.h.in +++ b/IO/config/ImageLoader.h.in @@ -2,13 +2,14 @@ #define _IMAGE_LOADER_H_ #include "ImageFileFormat.h" +#include "TexCompTypes.h" class ImageLoader { protected: - unsigned int m_Width; - unsigned int m_Height; + uint32 m_Width; + uint32 m_Height; unsigned int m_RedChannelPrecision; unsigned char *m_RedData; diff --git a/IO/src/ImageLoaderPNG.cpp b/IO/src/ImageLoaderPNG.cpp index cac1850..bfefedd 100644 --- a/IO/src/ImageLoaderPNG.cpp +++ b/IO/src/ImageLoaderPNG.cpp @@ -43,7 +43,10 @@ ImageLoaderPNG::~ImageLoaderPNG() { bool ImageLoaderPNG::ReadData() { const int kNumSigBytesToRead = 8; - const int numSigNoMatch = png_sig_cmp(m_RawData, 0, kNumSigBytesToRead); + uint8 pngSigBuf[kNumSigBytesToRead]; + memcpy(pngSigBuf, m_RawData, kNumSigBytesToRead); + + const int numSigNoMatch = png_sig_cmp(pngSigBuf, 0, kNumSigBytesToRead); if(numSigNoMatch) { ReportError("Incorrect PNG signature"); return false; @@ -74,7 +77,7 @@ bool ImageLoaderPNG::ReadData() { int colorType = -1; if( 1 != png_get_IHDR(png_ptr, info_ptr, - &m_Width, &m_Height, + (png_uint_32 *)(&m_Width), (png_uint_32 *)(&m_Height), &bitDepth, &colorType, NULL, NULL, NULL) ) { @@ -90,7 +93,7 @@ bool ImageLoaderPNG::ReadData() { } const int numPixels = m_Width * m_Height; - unsigned int bpr = png_get_rowbytes(png_ptr, info_ptr); + png_uint_32 bpr = png_get_rowbytes(png_ptr, info_ptr); png_bytep rowData = new png_byte[bpr]; switch(colorType) {