Add #define guard to including IO with PVRTC

This commit is contained in:
Pavel Krajcevski 2014-09-02 16:39:11 -04:00
parent 995eacd5b6
commit e59541e30a
3 changed files with 13 additions and 2 deletions

View file

@ -68,6 +68,8 @@ SET( SOURCES
src/PVRTCImage.cpp src/PVRTCImage.cpp
) )
OPTION(DEBUG_PVRTC_DECODER "Output intermediate images during PVRTC decoding." OFF)
CONFIGURE_FILE( CONFIGURE_FILE(
"config/PVRTCDefines.h.in" "config/PVRTCDefines.h.in"
"include/PVRTCDefines.h" "include/PVRTCDefines.h"
@ -87,7 +89,9 @@ ADD_LIBRARY( PVRTCEncoder
) )
TARGET_LINK_LIBRARIES( PVRTCEncoder FasTCBase ) TARGET_LINK_LIBRARIES( PVRTCEncoder FasTCBase )
TARGET_LINK_LIBRARIES( PVRTCEncoder FasTCIO ) IF( DEBUG_PVRTC_DECODER )
TARGET_LINK_LIBRARIES( PVRTCEncoder FasTCIO )
ENDIF( DEBUG_PVRTC_DECODER )
IF( PVRTEXLIB_FOUND ) IF( PVRTEXLIB_FOUND )
TARGET_LINK_LIBRARIES( PVRTCEncoder ${PVRTEXLIB_LIBRARIES} ) TARGET_LINK_LIBRARIES( PVRTCEncoder ${PVRTEXLIB_LIBRARIES} )

View file

@ -51,3 +51,4 @@
*/ */
#cmakedefine PVRTEXLIB_FOUND #cmakedefine PVRTEXLIB_FOUND
#cmakedefine DEBUG_PVRTC_DECODER

View file

@ -66,7 +66,9 @@
#include "Pixel.h" #include "Pixel.h"
using FasTC::Pixel; using FasTC::Pixel;
#include "../../IO/include/ImageFile.h" #ifdef DEBUG_PVRTC_DECODER
# include "../../IO/include/ImageFile.h"
#endif
template <typename T> template <typename T>
inline T Clamp(const T &v, const T &a, const T &b) { inline T Clamp(const T &v, const T &a, const T &b) {
@ -540,6 +542,7 @@ uint32 Image::GetPixelIndex(int32 i, int32 j, EWrapMode wrapMode) const {
return idx; return idx;
} }
#ifdef DEBUG_PVRTC_DECODER
void Image::DebugOutput(const char *filename) const { void Image::DebugOutput(const char *filename) const {
uint32 *outPixels = new uint32[GetWidth() * GetHeight()]; uint32 *outPixels = new uint32[GetWidth() * GetHeight()];
const uint8 fullDepth[4] = { 8, 8, 8, 8 }; const uint8 fullDepth[4] = { 8, 8, 8, 8 };
@ -561,5 +564,8 @@ void Image::DebugOutput(const char *filename) const {
::ImageFile imgFile(debugFilename, eFileFormat_PNG, img); ::ImageFile imgFile(debugFilename, eFileFormat_PNG, img);
imgFile.Write(); imgFile.Write();
} }
#else
void Image::DebugOutput(const char *filename) const { }
#endif // DEBUG_PVRTC_DECODER
} // namespace PVRTCC } // namespace PVRTCC