diff --git a/quicktex/s3tc/bc1/BC1Decoder.cpp b/quicktex/s3tc/bc1/BC1Decoder.cpp index 772ffd2..90ebdfb 100644 --- a/quicktex/s3tc/bc1/BC1Decoder.cpp +++ b/quicktex/s3tc/bc1/BC1Decoder.cpp @@ -36,7 +36,7 @@ ColorBlock<4, 4> BC1Decoder::DecodeBlock(const BC1Block &block, bool use_3color) const auto l = block.GetColor0Raw(); const auto h = block.GetColor1Raw(); const auto selectors = block.GetSelectors(); - const auto colors = _interpolator->InterpolateBC1(l, h, use_3color); + const auto colors = _interpolator->Interpolate565BC1(l, h, use_3color); for (unsigned y = 0; y < 4; y++) { for (unsigned x = 0; x < 4; x++) { diff --git a/quicktex/s3tc/interpolator/Interpolator.cpp b/quicktex/s3tc/interpolator/Interpolator.cpp index 6312c10..79e5081 100644 --- a/quicktex/s3tc/interpolator/Interpolator.cpp +++ b/quicktex/s3tc/interpolator/Interpolator.cpp @@ -50,7 +50,7 @@ uint8_t Interpolator::Interpolate6(uint8_t v0, uint8_t v1) const { return Interp uint8_t Interpolator::InterpolateHalf5(uint8_t v0, uint8_t v1) const { return InterpolateHalf8(scale5To8(v0), scale5To8(v1)); } uint8_t Interpolator::InterpolateHalf6(uint8_t v0, uint8_t v1) const { return InterpolateHalf8(scale6To8(v0), scale6To8(v1)); } -std::array Interpolator::InterpolateBC1(uint16_t low, uint16_t high, bool allow_3color) const { +std::array Interpolator::Interpolate565BC1(uint16_t low, uint16_t high, bool allow_3color) const { bool use_3color = allow_3color && (high >= low); return InterpolateBC1(Color::Unpack565Unscaled(low), Color::Unpack565Unscaled(high), use_3color); } diff --git a/quicktex/s3tc/interpolator/Interpolator.h b/quicktex/s3tc/interpolator/Interpolator.h index e4e47d8..0c948a1 100644 --- a/quicktex/s3tc/interpolator/Interpolator.h +++ b/quicktex/s3tc/interpolator/Interpolator.h @@ -94,10 +94,18 @@ class Interpolator { * Generates the 4 colors for a BC1 block from the given 5:6:5-packed colors * @param low first 5:6:5 color for the block * @param high second 5:6:5 color for the block - * @return and array of 4 Color values, with indices matching BC1 selectors + * @param allow_3color if true, a different interpolation mode will be used if high >= low + * @return an array of 4 Color values, with indices matching BC1 selectors */ - virtual std::array InterpolateBC1(uint16_t low, uint16_t high, bool allow_3color = true) const; + std::array Interpolate565BC1(uint16_t low, uint16_t high, bool allow_3color = true) const; + /** + * Generates the 4 colors for a BC1 block from the given + * @param low the first color for the block, as a seperated 5:6:5 Color object + * @param high the second color for the block, as a seperated 5:6:5 Color object + * @param use_3color if the 3-color interpolation mode should be used + * @return an array of 4 Color values, with indices matching BC1 selectors + */ virtual std::array InterpolateBC1(Color low, Color high, bool use_3color) const; /**