From 639ce6ad14e077b51e067d0a54d588cbb538a433 Mon Sep 17 00:00:00 2001 From: drewcassidy Date: Fri, 2 Apr 2021 18:34:14 -0700 Subject: [PATCH] Minor tweaks --- CMakeLists.txt | 1 + quicktex/Texture.h | 4 +-- quicktex/s3tc/interpolator/Interpolator.h | 42 +++++++++++------------ 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bea7a22..32cfd68 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,6 +54,7 @@ target_compile_definitions(test_quicktex PRIVATE -DCUSTOM_SYS_PATH="${CMAKE_HOME # enable openMP if available if (OpenMP_CXX_FOUND) target_link_libraries(_quicktex PUBLIC OpenMP::OpenMP_CXX) + target_link_libraries(test_quicktex PUBLIC OpenMP::OpenMP_CXX) endif () # Set module features, like C/C++ standards diff --git a/quicktex/Texture.h b/quicktex/Texture.h index 167d984..e21ddf9 100644 --- a/quicktex/Texture.h +++ b/quicktex/Texture.h @@ -123,7 +123,7 @@ class RawTexture : public Texture { } return block; - }; + } template void SetBlock(int block_x, int block_y, const ColorBlock &block) { 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)); } } } - }; + } virtual const uint8_t *Data() const noexcept override { return reinterpret_cast(_pixels); } virtual uint8_t *Data() noexcept override { return reinterpret_cast(_pixels); } diff --git a/quicktex/s3tc/interpolator/Interpolator.h b/quicktex/s3tc/interpolator/Interpolator.h index b4b91a5..e4e47d8 100644 --- a/quicktex/s3tc/interpolator/Interpolator.h +++ b/quicktex/s3tc/interpolator/Interpolator.h @@ -127,27 +127,27 @@ class Interpolator { } }; -class InterpolatorRound : public Interpolator { +class InterpolatorRound final : public Interpolator { public: - uint8_t Interpolate5(uint8_t v0, uint8_t v1) const override; - 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 Interpolate5(uint8_t v0, uint8_t v1) const override; + virtual uint8_t Interpolate6(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: - 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 Interpolate5(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; - uint8_t InterpolateHalf6(uint8_t v0, uint8_t v1) const override; + virtual uint8_t InterpolateHalf5(uint8_t v0, uint8_t v1) const override; + virtual uint8_t InterpolateHalf6(uint8_t v0, uint8_t v1) const override; - std::array InterpolateBC1(Color low, Color high, bool use_3color) const override; + virtual std::array InterpolateBC1(Color low, Color high, bool use_3color) const override; - Type GetType() const noexcept override { return Type::Nvidia; } - bool CanInterpolate8Bit() const noexcept override { return false; } + virtual Type GetType() const noexcept override { return Type::Nvidia; } + virtual bool CanInterpolate8Bit() const noexcept override { return false; } private: 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: - uint8_t Interpolate5(uint8_t v0, uint8_t v1) const override; - 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 Interpolate5(uint8_t v0, uint8_t v1) const override; + virtual uint8_t Interpolate6(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; - 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 InterpolateHalf5(uint8_t v0, uint8_t v1) const override; + virtual uint8_t InterpolateHalf6(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 \ No newline at end of file