Fix virtual overloading

This commit is contained in:
Andrew Cassidy 2021-04-02 18:51:38 -07:00
parent 639ce6ad14
commit 6831c3f6c9
3 changed files with 12 additions and 4 deletions

View File

@ -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++) {

View File

@ -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<Color, 4> Interpolator::InterpolateBC1(uint16_t low, uint16_t high, bool allow_3color) const {
std::array<Color, 4> 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);
}

View File

@ -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<Color, 4> InterpolateBC1(uint16_t low, uint16_t high, bool allow_3color = true) const;
std::array<Color, 4> 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<Color, 4> InterpolateBC1(Color low, Color high, bool use_3color) const;
/**