diff --git a/ChangeLog b/ChangeLog index 779da20..3b398bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ NVIDIA Texture Tools version 2.0.8 + * Fix float to fixed image conversion. Patch provided by Alex Pfaffe. Fixes issue 121. * ColorBlock::isSingleColor compares only RGB channels. Fixes issue 115. * Fix cmake build in msvc. Fixes issue 111. * Better estimate principal component. Fixes issue 120. diff --git a/src/nvtt/Compressor.cpp b/src/nvtt/Compressor.cpp index 6631b91..d7f6403 100644 --- a/src/nvtt/Compressor.cpp +++ b/src/nvtt/Compressor.cpp @@ -126,10 +126,8 @@ namespace nvtt // Convert linear float image to fixed image ready for compression. void toFixedImage(const InputOptions::Private & inputOptions) { - if (this->asFixedImage() == NULL) + if (m_floatImage != NULL) // apfaffe - We should check that we have a float image, if so convert it! { - nvDebugCheck(m_floatImage != NULL); - if (inputOptions.isNormalMap || inputOptions.outputGamma == 1.0f) { m_fixedImage = m_floatImage->createImage(); @@ -175,11 +173,12 @@ namespace nvtt const Image * asFixedImage() const { - if (m_inputImage != NULL) + // - apfaffe - switched logic to return the 'processed image' rather than the input! + if (m_fixedImage != NULL && m_fixedImage.ptr() != NULL) { - return m_inputImage; + return m_fixedImage.ptr(); } - return m_fixedImage.ptr(); + return m_inputImage; } Image * asMutableFixedImage()