Finish the hooking up of the compression library to the core library

This commit is contained in:
Pavel Krajcevski 2012-08-28 19:42:28 -04:00
parent b9350e3876
commit 213d98f985
5 changed files with 26 additions and 3 deletions

View file

@ -13,6 +13,6 @@ ADD_EXECUTABLE(
${SOURCES}
)
TARGET_LINK_LIBRARIES( tc BPTCEncoder )
TARGET_LINK_LIBRARIES( tc TexCompIO )
TARGET_LINK_LIBRARIES( tc TexCompCore )
TARGET_LINK_LIBRARIES( tc BPTCEncoder )

View file

@ -9,8 +9,12 @@ SET( HEADERS
"include/CompressedImage.h"
)
INCLUDE_DIRECTORIES( ${TexC_BINARY_DIR}/IO/include )
INCLUDE_DIRECTORIES( ${TexC_SOURCE_DIR}/BPTCEncoder/include )
INCLUDE_DIRECTORIES( ${TexC_BINARY_DIR}/BPTCEncoder/include )
INCLUDE_DIRECTORIES( ${TexC_SOURCE_DIR}/IO/include )
INCLUDE_DIRECTORIES( ${TexC_BINARY_DIR}/IO/include )
INCLUDE_DIRECTORIES( ${TexC_SOURCE_DIR}/Core/include )
ADD_LIBRARY( TexCompCore
@ -19,3 +23,4 @@ ADD_LIBRARY( TexCompCore
)
TARGET_LINK_LIBRARIES( TexCompCore TexCompIO )
TARGET_LINK_LIBRARIES( TexCompCore BPTCEncoder )

View file

@ -1,3 +1,4 @@
#include "BC7Compressor.h"
#include "TexComp.h"
#include <stdlib.h>
@ -10,6 +11,18 @@ SCompressionSettings:: SCompressionSettings()
{}
static CompressionFunc ChooseFuncFromSettings(const SCompressionSettings &s) {
switch(s.format) {
case eCompressionFormat_BPTC:
{
if(s.bUseSIMD) {
return BC7C::CompressImageBC7SIMD;
}
else {
return BC7C::CompressImageBC7;
}
}
break;
}
return NULL;
}

View file

@ -180,6 +180,10 @@ bool ImageFile::LoadImage(const unsigned char *rawImageData) {
break;
}
// Read the image data!
if(!loader->ReadData())
return false;
m_Width = loader->GetWidth();
m_Height = loader->GetHeight();

View file

@ -43,7 +43,8 @@ ImageLoaderPNG::~ImageLoaderPNG() {
bool ImageLoaderPNG::ReadData() {
const int kNumSigBytesToRead = 8;
if(!png_sig_cmp(m_RawData, 0, kNumSigBytesToRead)) {
const int numSigNoMatch = png_sig_cmp(m_RawData, 0, kNumSigBytesToRead);
if(numSigNoMatch) {
ReportError("Incorrect PNG signature");
return false;
}