mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-01-23 03:21:12 +00:00
Fix some inconsistencies with different versions of libpng.
This commit is contained in:
parent
9fa011f8d1
commit
2fa4da80ed
|
@ -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;
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue