Compare commits
4 Commits
3ea49697a9
...
7c4f2c9d43
| Author | SHA1 | Date |
|---|---|---|
|
|
7c4f2c9d43 | |
|
|
6c8767b227 | |
|
|
c8302cdec4 | |
|
|
13bdaab5d5 |
|
|
@ -50,7 +50,7 @@ target_include_directories(
|
||||||
PUBLIC "./include"
|
PUBLIC "./include"
|
||||||
PRIVATE "./src")
|
PRIVATE "./src")
|
||||||
set_target_properties(hyprutils PROPERTIES VERSION ${hyprutils_VERSION}
|
set_target_properties(hyprutils PROPERTIES VERSION ${hyprutils_VERSION}
|
||||||
SOVERSION 7)
|
SOVERSION 8)
|
||||||
target_link_libraries(hyprutils PkgConfig::deps)
|
target_link_libraries(hyprutils PkgConfig::deps)
|
||||||
|
|
||||||
# tests
|
# tests
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
|
hyprutils (0.9.0-0.1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Non-maintainer upload
|
||||||
|
* New upstream release (Closes: #1117181)
|
||||||
|
* Breaking ABI changes: updated soversion to 8
|
||||||
|
|
||||||
|
-- Carl Keinath <carl.keinath@gmail.com> Sat, 04 Oct 2025 10:58:35 +0200
|
||||||
|
|
||||||
hyprutils (0.8.4-0.1) unstable; urgency=medium
|
hyprutils (0.8.4-0.1) unstable; urgency=medium
|
||||||
|
|
||||||
* Non-maintainer upload.
|
* Non-maintainer upload.
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ Section: libdevel
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Multi-Arch: same
|
Multi-Arch: same
|
||||||
Depends:
|
Depends:
|
||||||
libhyprutils7 (= ${binary:Version}),
|
libhyprutils8 (= ${binary:Version}),
|
||||||
${misc:Depends},
|
${misc:Depends},
|
||||||
Description: Utilities used across the Hyprland ecosystem (development files)
|
Description: Utilities used across the Hyprland ecosystem (development files)
|
||||||
Hyprutils is a small C++ library for utilities used across the Hyprland
|
Hyprutils is a small C++ library for utilities used across the Hyprland
|
||||||
|
|
@ -25,7 +25,7 @@ Description: Utilities used across the Hyprland ecosystem (development files)
|
||||||
.
|
.
|
||||||
This package contains the development files.
|
This package contains the development files.
|
||||||
|
|
||||||
Package: libhyprutils7
|
Package: libhyprutils8
|
||||||
Architecture: any
|
Architecture: any
|
||||||
Multi-Arch: same
|
Multi-Arch: same
|
||||||
Depends:
|
Depends:
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,8 @@ namespace Hyprutils {
|
||||||
public:
|
public:
|
||||||
/* Calculates a cubic bezier curve based on 2 control points (EXCLUDES the 0,0 and 1,1 points). */
|
/* Calculates a cubic bezier curve based on 2 control points (EXCLUDES the 0,0 and 1,1 points). */
|
||||||
void setup(const std::array<Hyprutils::Math::Vector2D, 2>& points);
|
void setup(const std::array<Hyprutils::Math::Vector2D, 2>& points);
|
||||||
|
/* Calculates a cubic bezier curve based on 4 control points. */
|
||||||
|
void setup4(const std::array<Hyprutils::Math::Vector2D, 4>& points);
|
||||||
|
|
||||||
float getYForT(float const& t) const;
|
float getYForT(float const& t) const;
|
||||||
float getXForT(float const& t) const;
|
float getXForT(float const& t) const;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <hyprutils/memory/Casts.hpp>
|
||||||
#include <hyprutils/math/Misc.hpp>
|
#include <hyprutils/math/Misc.hpp>
|
||||||
|
|
||||||
#include <format>
|
#include <format>
|
||||||
|
|
@ -9,10 +10,14 @@ namespace Hyprutils {
|
||||||
namespace Math {
|
namespace Math {
|
||||||
class Vector2D {
|
class Vector2D {
|
||||||
public:
|
public:
|
||||||
Vector2D(double, double);
|
constexpr Vector2D(double xx, double yy) : x(xx), y(yy) {
|
||||||
Vector2D(int, int);
|
;
|
||||||
Vector2D();
|
}
|
||||||
~Vector2D();
|
constexpr Vector2D(int xx, int yy) : x(Hyprutils::Memory::sc<double>(xx)), y(Hyprutils::Memory::sc<double>(yy)) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
constexpr Vector2D() = default;
|
||||||
|
~Vector2D() = default;
|
||||||
|
|
||||||
double x = 0;
|
double x = 0;
|
||||||
double y = 0;
|
double y = 0;
|
||||||
|
|
@ -20,71 +25,71 @@ namespace Hyprutils {
|
||||||
// returns the scale
|
// returns the scale
|
||||||
double normalize();
|
double normalize();
|
||||||
|
|
||||||
Vector2D operator+(const Vector2D& a) const {
|
constexpr Vector2D operator+(const Vector2D& a) const {
|
||||||
return Vector2D(this->x + a.x, this->y + a.y);
|
return Vector2D(this->x + a.x, this->y + a.y);
|
||||||
}
|
}
|
||||||
Vector2D operator-(const Vector2D& a) const {
|
constexpr Vector2D operator-(const Vector2D& a) const {
|
||||||
return Vector2D(this->x - a.x, this->y - a.y);
|
return Vector2D(this->x - a.x, this->y - a.y);
|
||||||
}
|
}
|
||||||
Vector2D operator-() const {
|
constexpr Vector2D operator-() const {
|
||||||
return Vector2D(-this->x, -this->y);
|
return Vector2D(-this->x, -this->y);
|
||||||
}
|
}
|
||||||
Vector2D operator*(const double& a) const {
|
constexpr Vector2D operator*(const double& a) const {
|
||||||
return Vector2D(this->x * a, this->y * a);
|
return Vector2D(this->x * a, this->y * a);
|
||||||
}
|
}
|
||||||
Vector2D operator/(const double& a) const {
|
constexpr Vector2D operator/(const double& a) const {
|
||||||
return Vector2D(this->x / a, this->y / a);
|
return Vector2D(this->x / a, this->y / a);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const Vector2D& a) const {
|
constexpr bool operator==(const Vector2D& a) const {
|
||||||
return a.x == x && a.y == y;
|
return a.x == x && a.y == y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const Vector2D& a) const {
|
constexpr bool operator!=(const Vector2D& a) const {
|
||||||
return a.x != x || a.y != y;
|
return a.x != x || a.y != y;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D operator*(const Vector2D& a) const {
|
constexpr Vector2D operator*(const Vector2D& a) const {
|
||||||
return Vector2D(this->x * a.x, this->y * a.y);
|
return Vector2D(this->x * a.x, this->y * a.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector2D operator/(const Vector2D& a) const {
|
constexpr Vector2D operator/(const Vector2D& a) const {
|
||||||
return Vector2D(this->x / a.x, this->y / a.y);
|
return Vector2D(this->x / a.x, this->y / a.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator>(const Vector2D& a) const {
|
constexpr bool operator>(const Vector2D& a) const {
|
||||||
return this->x > a.x && this->y > a.y;
|
return this->x > a.x && this->y > a.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator<(const Vector2D& a) const {
|
constexpr bool operator<(const Vector2D& a) const {
|
||||||
return this->x < a.x && this->y < a.y;
|
return this->x < a.x && this->y < a.y;
|
||||||
}
|
}
|
||||||
Vector2D& operator+=(const Vector2D& a) {
|
constexpr Vector2D& operator+=(const Vector2D& a) {
|
||||||
this->x += a.x;
|
this->x += a.x;
|
||||||
this->y += a.y;
|
this->y += a.y;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
Vector2D& operator-=(const Vector2D& a) {
|
constexpr Vector2D& operator-=(const Vector2D& a) {
|
||||||
this->x -= a.x;
|
this->x -= a.x;
|
||||||
this->y -= a.y;
|
this->y -= a.y;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
Vector2D& operator*=(const Vector2D& a) {
|
constexpr Vector2D& operator*=(const Vector2D& a) {
|
||||||
this->x *= a.x;
|
this->x *= a.x;
|
||||||
this->y *= a.y;
|
this->y *= a.y;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
Vector2D& operator/=(const Vector2D& a) {
|
constexpr Vector2D& operator/=(const Vector2D& a) {
|
||||||
this->x /= a.x;
|
this->x /= a.x;
|
||||||
this->y /= a.y;
|
this->y /= a.y;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
Vector2D& operator*=(const double& a) {
|
constexpr Vector2D& operator*=(const double& a) {
|
||||||
this->x *= a;
|
this->x *= a;
|
||||||
this->y *= a;
|
this->y *= a;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
Vector2D& operator/=(const double& a) {
|
constexpr Vector2D& operator/=(const double& a) {
|
||||||
this->x /= a;
|
this->x /= a;
|
||||||
this->y /= a;
|
this->y /= a;
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,9 @@ namespace Hyprutils::Memory {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class CAtomicSharedPointer {
|
class CAtomicSharedPointer {
|
||||||
template <typename X>
|
template <typename X>
|
||||||
using isConstructible = typename std::enable_if<std::is_constructible<T&, X&>::value>::type;
|
using isConstructible = std::enable_if_t<std::is_constructible_v<T&, X&>>;
|
||||||
template <typename X>
|
template <typename X>
|
||||||
using validHierarchy = typename std::enable_if<std::is_assignable<CAtomicSharedPointer<T>&, X>::value, CAtomicSharedPointer&>::type;
|
using validHierarchy = std::enable_if_t<std::is_assignable_v<CAtomicSharedPointer<T>&, X>, CAtomicSharedPointer&>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CAtomicSharedPointer(Impl_::impl_base* impl) noexcept : m_ptr(impl) {}
|
explicit CAtomicSharedPointer(Impl_::impl_base* impl) noexcept : m_ptr(impl) {}
|
||||||
|
|
@ -221,9 +221,9 @@ namespace Hyprutils::Memory {
|
||||||
class CAtomicWeakPointer {
|
class CAtomicWeakPointer {
|
||||||
|
|
||||||
template <typename X>
|
template <typename X>
|
||||||
using isConstructible = typename std::enable_if<std::is_constructible<T&, X&>::value>::type;
|
using isConstructible = std::enable_if_t<std::is_constructible_v<T&, X&>>;
|
||||||
template <typename X>
|
template <typename X>
|
||||||
using validHierarchy = typename std::enable_if<std::is_assignable<CAtomicWeakPointer<T>&, X>::value, CAtomicWeakPointer&>::type;
|
using validHierarchy = std::enable_if_t<std::is_assignable_v<CAtomicWeakPointer<T>&, X>, CAtomicWeakPointer&>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CAtomicWeakPointer(const CAtomicWeakPointer<T>& ref) {
|
CAtomicWeakPointer(const CAtomicWeakPointer<T>& ref) {
|
||||||
|
|
|
||||||
|
|
@ -27,5 +27,3 @@ namespace Hyprutils::Memory {
|
||||||
return std::bit_cast<To>(from);
|
return std::bit_cast<To>(from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ namespace Hyprutils {
|
||||||
namespace Impl_ {
|
namespace Impl_ {
|
||||||
class impl_base {
|
class impl_base {
|
||||||
public:
|
public:
|
||||||
virtual ~impl_base() {};
|
virtual ~impl_base() = default;
|
||||||
|
|
||||||
virtual void inc() noexcept = 0;
|
virtual void inc() noexcept = 0;
|
||||||
virtual void dec() noexcept = 0;
|
virtual void dec() noexcept = 0;
|
||||||
|
|
@ -57,13 +57,13 @@ namespace Hyprutils {
|
||||||
// this way, weak pointers will still be able to
|
// this way, weak pointers will still be able to
|
||||||
// reference and use, but no longer create shared ones.
|
// reference and use, but no longer create shared ones.
|
||||||
_destroying = true;
|
_destroying = true;
|
||||||
__deleter(_data);
|
_deleter(_data);
|
||||||
// now, we can reset the data and call it a day.
|
// now, we can reset the data and call it a day.
|
||||||
_data = nullptr;
|
_data = nullptr;
|
||||||
_destroying = false;
|
_destroying = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::default_delete<T> __deleter{};
|
std::default_delete<T> _deleter{};
|
||||||
|
|
||||||
//
|
//
|
||||||
virtual void inc() noexcept {
|
virtual void inc() noexcept {
|
||||||
|
|
|
||||||
|
|
@ -22,26 +22,23 @@ namespace Hyprutils {
|
||||||
class CSharedPointer {
|
class CSharedPointer {
|
||||||
public:
|
public:
|
||||||
template <typename X>
|
template <typename X>
|
||||||
using validHierarchy = typename std::enable_if<std::is_assignable<CSharedPointer<T>&, X>::value, CSharedPointer&>::type;
|
using validHierarchy = std::enable_if_t<std::is_assignable_v<CSharedPointer<T>&, X>, CSharedPointer&>;
|
||||||
template <typename X>
|
template <typename X>
|
||||||
using isConstructible = typename std::enable_if<std::is_constructible<T&, X&>::value>::type;
|
using isConstructible = std::enable_if_t<std::is_constructible_v<T&, X&>>;
|
||||||
|
|
||||||
/* creates a new shared pointer managing a resource
|
/* creates a new shared pointer managing a resource
|
||||||
avoid calling. Could duplicate ownership. Prefer makeShared */
|
avoid calling. Could duplicate ownership. Prefer makeShared */
|
||||||
explicit CSharedPointer(T* object) noexcept {
|
explicit CSharedPointer(T* object) noexcept : impl_(new Impl_::impl<T>(object)) {
|
||||||
impl_ = new Impl_::impl<T>(object);
|
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* creates a shared pointer from a reference */
|
/* creates a shared pointer from a reference */
|
||||||
template <typename U, typename = isConstructible<U>>
|
template <typename U, typename = isConstructible<U>>
|
||||||
CSharedPointer(const CSharedPointer<U>& ref) noexcept {
|
CSharedPointer(const CSharedPointer<U>& ref) noexcept : impl_(ref.impl_) {
|
||||||
impl_ = ref.impl_;
|
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
CSharedPointer(const CSharedPointer& ref) noexcept {
|
CSharedPointer(const CSharedPointer& ref) noexcept : impl_(ref.impl_) {
|
||||||
impl_ = ref.impl_;
|
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -55,8 +52,7 @@ namespace Hyprutils {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* allows weakPointer to create from an impl */
|
/* allows weakPointer to create from an impl */
|
||||||
CSharedPointer(Impl_::impl_base* implementation) noexcept {
|
CSharedPointer(Impl_::impl_base* implementation) noexcept : impl_(implementation) {
|
||||||
impl_ = implementation;
|
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,7 +95,7 @@ namespace Hyprutils {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CSharedPointer& operator=(CSharedPointer&& rhs) {
|
CSharedPointer& operator=(CSharedPointer&& rhs) noexcept {
|
||||||
std::swap(impl_, rhs.impl_);
|
std::swap(impl_, rhs.impl_);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,13 @@ namespace Hyprutils {
|
||||||
class CUniquePointer {
|
class CUniquePointer {
|
||||||
public:
|
public:
|
||||||
template <typename X>
|
template <typename X>
|
||||||
using validHierarchy = typename std::enable_if<std::is_assignable<CUniquePointer<T>&, X>::value, CUniquePointer&>::type;
|
using validHierarchy = std::enable_if_t<std::is_assignable_v<CUniquePointer<T>&, X>, CUniquePointer&>;
|
||||||
template <typename X>
|
template <typename X>
|
||||||
using isConstructible = typename std::enable_if<std::is_constructible<T&, X&>::value>::type;
|
using isConstructible = std::enable_if_t<std::is_constructible_v<T&, X&>>;
|
||||||
|
|
||||||
/* creates a new unique pointer managing a resource
|
/* creates a new unique pointer managing a resource
|
||||||
avoid calling. Could duplicate ownership. Prefer makeUnique */
|
avoid calling. Could duplicate ownership. Prefer makeUnique */
|
||||||
explicit CUniquePointer(T* object) noexcept {
|
explicit CUniquePointer(T* object) noexcept : impl_(new Impl_::impl<T>(object, false)) {
|
||||||
impl_ = new Impl_::impl<T>(object, false);
|
|
||||||
increment();
|
increment();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -63,7 +62,7 @@ namespace Hyprutils {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CUniquePointer& operator=(CUniquePointer&& rhs) {
|
CUniquePointer& operator=(CUniquePointer&& rhs) noexcept {
|
||||||
std::swap(impl_, rhs.impl_);
|
std::swap(impl_, rhs.impl_);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ namespace Hyprutils {
|
||||||
class CWeakPointer {
|
class CWeakPointer {
|
||||||
public:
|
public:
|
||||||
template <typename X>
|
template <typename X>
|
||||||
using validHierarchy = typename std::enable_if<std::is_assignable<CWeakPointer<T>&, X>::value, CWeakPointer&>::type;
|
using validHierarchy = std::enable_if_t<std::is_assignable_v<CWeakPointer<T>&, X>, CWeakPointer&>;
|
||||||
template <typename X>
|
template <typename X>
|
||||||
using isConstructible = typename std::enable_if<std::is_constructible<T&, X&>::value>::type;
|
using isConstructible = std::enable_if_t<std::is_constructible_v<T&, X&>>;
|
||||||
|
|
||||||
/* create a weak ptr from a reference */
|
/* create a weak ptr from a reference */
|
||||||
template <typename U, typename = isConstructible<U>>
|
template <typename U, typename = isConstructible<U>>
|
||||||
|
|
|
||||||
|
|
@ -9,12 +9,21 @@ using namespace Hyprutils::Math;
|
||||||
using namespace Hyprutils::Memory;
|
using namespace Hyprutils::Memory;
|
||||||
|
|
||||||
void CBezierCurve::setup(const std::array<Vector2D, 2>& pVec) {
|
void CBezierCurve::setup(const std::array<Vector2D, 2>& pVec) {
|
||||||
// Avoid reallocations by reserving enough memory upfront
|
setup4(std::array<Vector2D, 4>{
|
||||||
m_vPoints.resize(pVec.size() + 2);
|
|
||||||
m_vPoints = {
|
|
||||||
Vector2D(0, 0), // Start point
|
Vector2D(0, 0), // Start point
|
||||||
pVec[0], pVec[1], // Control points
|
pVec[0], pVec[1], // Control points
|
||||||
Vector2D(1, 1) // End point
|
Vector2D(1, 1) // End point
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBezierCurve::setup4(const std::array<Vector2D, 4>& 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)
|
if (m_vPoints.size() != 4)
|
||||||
|
|
@ -37,14 +46,14 @@ float CBezierCurve::getXForT(float const& t) const {
|
||||||
float t2 = t * t;
|
float t2 = t * t;
|
||||||
float t3 = t2 * t;
|
float t3 = t2 * t;
|
||||||
|
|
||||||
return (3 * t * (1 - t) * (1 - t) * m_vPoints[1].x) + (3 * t2 * (1 - t) * m_vPoints[2].x) + (t3 * m_vPoints[3].x);
|
return ((1 - t) * (1 - t) * (1 - t) * m_vPoints[0].x) + (3 * t * (1 - t) * (1 - t) * m_vPoints[1].x) + (3 * t2 * (1 - t) * m_vPoints[2].x) + (t3 * m_vPoints[3].x);
|
||||||
}
|
}
|
||||||
|
|
||||||
float CBezierCurve::getYForT(float const& t) const {
|
float CBezierCurve::getYForT(float const& t) const {
|
||||||
float t2 = t * t;
|
float t2 = t * t;
|
||||||
float t3 = t2 * t;
|
float t3 = t2 * t;
|
||||||
|
|
||||||
return (3 * t * (1 - t) * (1 - t) * m_vPoints[1].y) + (3 * t2 * (1 - t) * m_vPoints[2].y) + (t3 * m_vPoints[3].y);
|
return ((1 - t) * (1 - t) * (1 - t) * m_vPoints[0].y) +(3 * t * (1 - t) * (1 - t) * m_vPoints[1].y) + (3 * t2 * (1 - t) * m_vPoints[2].y) + (t3 * m_vPoints[3].y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Todo: this probably can be done better and faster
|
// Todo: this probably can be done better and faster
|
||||||
|
|
|
||||||
|
|
@ -145,16 +145,14 @@ CRegion& Hyprutils::Math::CRegion::scale(const Vector2D& scale) {
|
||||||
if (scale == Vector2D{1, 1})
|
if (scale == Vector2D{1, 1})
|
||||||
return *this;
|
return *this;
|
||||||
|
|
||||||
auto rects = getRects();
|
int rectsNum = 0;
|
||||||
|
auto RECTSARR = pixman_region32_rectangles(&m_rRegion, &rectsNum);
|
||||||
|
|
||||||
clear();
|
for (int i = 0; i < rectsNum; ++i) {
|
||||||
|
RECTSARR[i].x1 = std::floor(RECTSARR[i].x1 * scale.x);
|
||||||
for (auto& r : rects) {
|
RECTSARR[i].x2 = std::ceil(RECTSARR[i].x2 * scale.x);
|
||||||
r.x1 = std::floor(r.x1 * scale.x);
|
RECTSARR[i].y1 = std::floor(RECTSARR[i].y1 * scale.y);
|
||||||
r.y1 = std::floor(r.y1 * scale.y);
|
RECTSARR[i].y2 = std::ceil(RECTSARR[i].y2 * scale.y);
|
||||||
r.x2 = std::ceil(r.x2 * scale.x);
|
|
||||||
r.y2 = std::ceil(r.y2 * scale.y);
|
|
||||||
add(&r);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
|
|
|
||||||
|
|
@ -5,21 +5,6 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
using namespace Hyprutils::Math;
|
using namespace Hyprutils::Math;
|
||||||
using namespace Hyprutils::Memory;
|
|
||||||
|
|
||||||
Hyprutils::Math::Vector2D::Vector2D(double xx, double yy) : x(xx), y(yy) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
Hyprutils::Math::Vector2D::Vector2D(int xx, int yy) : x(sc<double>(xx)), y(sc<double>(yy)) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
Hyprutils::Math::Vector2D::Vector2D() : x(0), y(0) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
Hyprutils::Math::Vector2D::~Vector2D() {}
|
|
||||||
|
|
||||||
double Hyprutils::Math::Vector2D::normalize() {
|
double Hyprutils::Math::Vector2D::normalize() {
|
||||||
// get max abs
|
// get max abs
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue