From e59541e30a008df3f62de18e1b9331830462e7c6 Mon Sep 17 00:00:00 2001 From: Pavel Krajcevski Date: Tue, 2 Sep 2014 16:39:11 -0400 Subject: [PATCH] Add #define guard to including IO with PVRTC --- PVRTCEncoder/CMakeLists.txt | 6 +++++- PVRTCEncoder/config/PVRTCDefines.h.in | 1 + PVRTCEncoder/src/PVRTCImage.cpp | 8 +++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/PVRTCEncoder/CMakeLists.txt b/PVRTCEncoder/CMakeLists.txt index 555c1dd..026222b 100644 --- a/PVRTCEncoder/CMakeLists.txt +++ b/PVRTCEncoder/CMakeLists.txt @@ -68,6 +68,8 @@ SET( SOURCES src/PVRTCImage.cpp ) +OPTION(DEBUG_PVRTC_DECODER "Output intermediate images during PVRTC decoding." OFF) + CONFIGURE_FILE( "config/PVRTCDefines.h.in" "include/PVRTCDefines.h" @@ -87,7 +89,9 @@ ADD_LIBRARY( PVRTCEncoder ) 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 ) TARGET_LINK_LIBRARIES( PVRTCEncoder ${PVRTEXLIB_LIBRARIES} ) diff --git a/PVRTCEncoder/config/PVRTCDefines.h.in b/PVRTCEncoder/config/PVRTCDefines.h.in index 9aabc8d..d5aaa5f 100644 --- a/PVRTCEncoder/config/PVRTCDefines.h.in +++ b/PVRTCEncoder/config/PVRTCDefines.h.in @@ -51,3 +51,4 @@ */ #cmakedefine PVRTEXLIB_FOUND +#cmakedefine DEBUG_PVRTC_DECODER diff --git a/PVRTCEncoder/src/PVRTCImage.cpp b/PVRTCEncoder/src/PVRTCImage.cpp index 2300176..a3c1f2d 100644 --- a/PVRTCEncoder/src/PVRTCImage.cpp +++ b/PVRTCEncoder/src/PVRTCImage.cpp @@ -66,7 +66,9 @@ #include "Pixel.h" using FasTC::Pixel; -#include "../../IO/include/ImageFile.h" +#ifdef DEBUG_PVRTC_DECODER +# include "../../IO/include/ImageFile.h" +#endif template 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; } +#ifdef DEBUG_PVRTC_DECODER void Image::DebugOutput(const char *filename) const { uint32 *outPixels = new uint32[GetWidth() * GetHeight()]; 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); imgFile.Write(); } +#else +void Image::DebugOutput(const char *filename) const { } +#endif // DEBUG_PVRTC_DECODER } // namespace PVRTCC