mirror of
https://github.com/yuzu-emu/FasTC.git
synced 2025-07-15 23:37:32 +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;"
|
"subl %%ecx, %%eax;"
|
||||||
"movl %%eax, %0;"
|
"movl %%eax, %0;"
|
||||||
: "=Q"(ans)
|
: "=Q"(ans)
|
||||||
: "r"(n)
|
: "b"(n)
|
||||||
: "%eax", "%ecx"
|
: "%eax", "%ecx"
|
||||||
);
|
);
|
||||||
return ans;
|
return ans;
|
||||||
|
|
|
@ -23,6 +23,7 @@ CONFIGURE_FILE(
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES( ${TexC_BINARY_DIR}/IO/include )
|
INCLUDE_DIRECTORIES( ${TexC_BINARY_DIR}/IO/include )
|
||||||
INCLUDE_DIRECTORIES( ${TexC_SOURCE_DIR}/IO/include )
|
INCLUDE_DIRECTORIES( ${TexC_SOURCE_DIR}/IO/include )
|
||||||
|
INCLUDE_DIRECTORIES( ${TexC_SOURCE_DIR}/Core/include )
|
||||||
|
|
||||||
ADD_LIBRARY(TexCompIO
|
ADD_LIBRARY(TexCompIO
|
||||||
${SOURCES}
|
${SOURCES}
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
#define _IMAGE_LOADER_H_
|
#define _IMAGE_LOADER_H_
|
||||||
|
|
||||||
#include "ImageFileFormat.h"
|
#include "ImageFileFormat.h"
|
||||||
|
#include "TexCompTypes.h"
|
||||||
|
|
||||||
class ImageLoader {
|
class ImageLoader {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
unsigned int m_Width;
|
uint32 m_Width;
|
||||||
unsigned int m_Height;
|
uint32 m_Height;
|
||||||
|
|
||||||
unsigned int m_RedChannelPrecision;
|
unsigned int m_RedChannelPrecision;
|
||||||
unsigned char *m_RedData;
|
unsigned char *m_RedData;
|
||||||
|
|
|
@ -43,7 +43,10 @@ ImageLoaderPNG::~ImageLoaderPNG() {
|
||||||
bool ImageLoaderPNG::ReadData() {
|
bool ImageLoaderPNG::ReadData() {
|
||||||
|
|
||||||
const int kNumSigBytesToRead = 8;
|
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) {
|
if(numSigNoMatch) {
|
||||||
ReportError("Incorrect PNG signature");
|
ReportError("Incorrect PNG signature");
|
||||||
return false;
|
return false;
|
||||||
|
@ -74,7 +77,7 @@ bool ImageLoaderPNG::ReadData() {
|
||||||
int colorType = -1;
|
int colorType = -1;
|
||||||
|
|
||||||
if( 1 != png_get_IHDR(png_ptr, info_ptr,
|
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,
|
&bitDepth, &colorType,
|
||||||
NULL, NULL, NULL)
|
NULL, NULL, NULL)
|
||||||
) {
|
) {
|
||||||
|
@ -90,7 +93,7 @@ bool ImageLoaderPNG::ReadData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const int numPixels = m_Width * m_Height;
|
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];
|
png_bytep rowData = new png_byte[bpr];
|
||||||
|
|
||||||
switch(colorType) {
|
switch(colorType) {
|
||||||
|
|
Loading…
Reference in a new issue