Minor tweaks

This commit is contained in:
Andrew Cassidy 2021-04-02 18:34:14 -07:00
parent 831e86fda6
commit 639ce6ad14
3 changed files with 24 additions and 23 deletions

View File

@ -54,6 +54,7 @@ target_compile_definitions(test_quicktex PRIVATE -DCUSTOM_SYS_PATH="${CMAKE_HOME
# enable openMP if available # enable openMP if available
if (OpenMP_CXX_FOUND) if (OpenMP_CXX_FOUND)
target_link_libraries(_quicktex PUBLIC OpenMP::OpenMP_CXX) target_link_libraries(_quicktex PUBLIC OpenMP::OpenMP_CXX)
target_link_libraries(test_quicktex PUBLIC OpenMP::OpenMP_CXX)
endif () endif ()
# Set module features, like C/C++ standards # Set module features, like C/C++ standards

View File

@ -123,7 +123,7 @@ class RawTexture : public Texture {
} }
return block; return block;
}; }
template <int N, int M> void SetBlock(int block_x, int block_y, const ColorBlock<N, M> &block) { template <int N, int M> void SetBlock(int block_x, int block_y, const ColorBlock<N, M> &block) {
if (block_x < 0) throw std::invalid_argument("x value out of range."); if (block_x < 0) throw std::invalid_argument("x value out of range.");
@ -145,7 +145,7 @@ class RawTexture : public Texture {
for (int y = 0; y < M; y++) { SetPixel((pixel_x + x) % _width, (pixel_y + y) % _height, block.Get(x, y)); } for (int y = 0; y < M; y++) { SetPixel((pixel_x + x) % _width, (pixel_y + y) % _height, block.Get(x, y)); }
} }
} }
}; }
virtual const uint8_t *Data() const noexcept override { return reinterpret_cast<const uint8_t *>(_pixels); } virtual const uint8_t *Data() const noexcept override { return reinterpret_cast<const uint8_t *>(_pixels); }
virtual uint8_t *Data() noexcept override { return reinterpret_cast<uint8_t *>(_pixels); } virtual uint8_t *Data() noexcept override { return reinterpret_cast<uint8_t *>(_pixels); }

View File

@ -127,27 +127,27 @@ class Interpolator {
} }
}; };
class InterpolatorRound : public Interpolator { class InterpolatorRound final : public Interpolator {
public: public:
uint8_t Interpolate5(uint8_t v0, uint8_t v1) const override; virtual uint8_t Interpolate5(uint8_t v0, uint8_t v1) const override;
uint8_t Interpolate6(uint8_t v0, uint8_t v1) const override; virtual uint8_t Interpolate6(uint8_t v0, uint8_t v1) const override;
uint8_t Interpolate8(uint8_t v0, uint8_t v1) const override; virtual uint8_t Interpolate8(uint8_t v0, uint8_t v1) const override;
Type GetType() const noexcept override { return Type::IdealRound; } virtual Type GetType() const noexcept override { return Type::IdealRound; }
}; };
class InterpolatorNvidia : public Interpolator { class InterpolatorNvidia final : public Interpolator {
public: public:
uint8_t Interpolate5(uint8_t v0, uint8_t v1) const override; virtual uint8_t Interpolate5(uint8_t v0, uint8_t v1) const override;
uint8_t Interpolate6(uint8_t v0, uint8_t v1) const override; virtual uint8_t Interpolate6(uint8_t v0, uint8_t v1) const override;
uint8_t InterpolateHalf5(uint8_t v0, uint8_t v1) const override; virtual uint8_t InterpolateHalf5(uint8_t v0, uint8_t v1) const override;
uint8_t InterpolateHalf6(uint8_t v0, uint8_t v1) const override; virtual uint8_t InterpolateHalf6(uint8_t v0, uint8_t v1) const override;
std::array<Color, 4> InterpolateBC1(Color low, Color high, bool use_3color) const override; virtual std::array<Color, 4> InterpolateBC1(Color low, Color high, bool use_3color) const override;
Type GetType() const noexcept override { return Type::Nvidia; } virtual Type GetType() const noexcept override { return Type::Nvidia; }
bool CanInterpolate8Bit() const noexcept override { return false; } virtual bool CanInterpolate8Bit() const noexcept override { return false; }
private: private:
Color InterpolateColor565(const Color &c0, const Color &c1) const { Color InterpolateColor565(const Color &c0, const Color &c1) const {
@ -159,16 +159,16 @@ class InterpolatorNvidia : public Interpolator {
} }
}; };
class InterpolatorAMD : public Interpolator { class InterpolatorAMD final : public Interpolator {
public: public:
uint8_t Interpolate5(uint8_t v0, uint8_t v1) const override; virtual uint8_t Interpolate5(uint8_t v0, uint8_t v1) const override;
uint8_t Interpolate6(uint8_t v0, uint8_t v1) const override; virtual uint8_t Interpolate6(uint8_t v0, uint8_t v1) const override;
uint8_t Interpolate8(uint8_t v0, uint8_t v1) const override; virtual uint8_t Interpolate8(uint8_t v0, uint8_t v1) const override;
uint8_t InterpolateHalf5(uint8_t v0, uint8_t v1) const override; virtual uint8_t InterpolateHalf5(uint8_t v0, uint8_t v1) const override;
uint8_t InterpolateHalf6(uint8_t v0, uint8_t v1) const override; virtual uint8_t InterpolateHalf6(uint8_t v0, uint8_t v1) const override;
uint8_t InterpolateHalf8(uint8_t v0, uint8_t v1) const override; virtual uint8_t InterpolateHalf8(uint8_t v0, uint8_t v1) const override;
Type GetType() const noexcept override { return Type::AMD; } virtual Type GetType() const noexcept override { return Type::AMD; }
}; };
} // namespace quicktex::s3tc } // namespace quicktex::s3tc