diff --git a/include/hyprutils/animation/BezierCurve.hpp b/include/hyprutils/animation/BezierCurve.hpp index 89b823b..b7398d5 100644 --- a/include/hyprutils/animation/BezierCurve.hpp +++ b/include/hyprutils/animation/BezierCurve.hpp @@ -14,7 +14,9 @@ namespace Hyprutils { class CBezierCurve { public: /* Calculates a cubic bezier curve based on 2 control points (EXCLUDES the 0,0 and 1,1 points). */ - void setup(const std::array& points); + void setup(const std::array& points); + /* Calculates a cubic bezier curve based on 4 control points. */ + void setup4(const std::array& points); float getYForT(float const& t) const; float getXForT(float const& t) const; diff --git a/include/hyprutils/memory/Casts.hpp b/include/hyprutils/memory/Casts.hpp index a40af73..c6d3092 100644 --- a/include/hyprutils/memory/Casts.hpp +++ b/include/hyprutils/memory/Casts.hpp @@ -27,5 +27,3 @@ namespace Hyprutils::Memory { return std::bit_cast(from); } } - - diff --git a/src/animation/AnimatedVariable.cpp b/src/animation/AnimatedVariable.cpp index 02ff25c..13115fd 100644 --- a/src/animation/AnimatedVariable.cpp +++ b/src/animation/AnimatedVariable.cpp @@ -6,7 +6,7 @@ using namespace Hyprutils::Animation; using namespace Hyprutils::Memory; static const std::string DEFAULTBEZIERNAME = "default"; -static const std::string DEFAULTSTYLE = ""; +static const std::string DEFAULTSTYLE = ""; #define SP CSharedPointer #define WP CWeakPointer diff --git a/src/animation/BezierCurve.cpp b/src/animation/BezierCurve.cpp index 005d7a8..b17c4b9 100644 --- a/src/animation/BezierCurve.cpp +++ b/src/animation/BezierCurve.cpp @@ -9,12 +9,21 @@ using namespace Hyprutils::Math; using namespace Hyprutils::Memory; void CBezierCurve::setup(const std::array& pVec) { - // Avoid reallocations by reserving enough memory upfront - m_vPoints.resize(pVec.size() + 2); - m_vPoints = { + setup4(std::array{ Vector2D(0, 0), // Start point pVec[0], pVec[1], // Control points Vector2D(1, 1) // End point + }); +} + +void CBezierCurve::setup4(const std::array& pVec) { + // Avoid reallocations by reserving enough memory upfront + m_vPoints.resize(4); + m_vPoints = { + pVec[0], + pVec[1], + pVec[2], + pVec[3], }; if (m_vPoints.size() != 4) diff --git a/src/string/ConstVarList.cpp b/src/string/ConstVarList.cpp index 4d47503..59606f2 100644 --- a/src/string/ConstVarList.cpp +++ b/src/string/ConstVarList.cpp @@ -25,8 +25,8 @@ CConstVarList::CConstVarList(const std::string& in, const size_t lastArgNo, cons if (in.empty()) return; - size_t idx = 0; - size_t pos = 0; + size_t idx = 0; + size_t pos = 0; std::ranges::replace_if(m_str, [&](const char& c) { return delim == 's' ? std::isspace(c) : c == delim; }, 0); for (const auto& s : m_str | std::views::split(0)) {