diff options
author | Crax97 <gsolimeno97@gmail.com> | 2022-08-29 22:47:33 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-08-31 12:20:55 +0200 |
commit | 059a9c71a0ee4a592a5781f818d583459a44c14c (patch) | |
tree | ab321953d074e37d327d137ee3e95ef3d58511fe /Userland | |
parent | aa466723eb37315d0dc43af7e7078976499bea78 (diff) | |
download | serenity-059a9c71a0ee4a592a5781f818d583459a44c14c.zip |
LibGfx: Add Point::to_ceiled method for getting a ceiled Point
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibGfx/Point.h | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGfx/Point.h b/Userland/Libraries/LibGfx/Point.h index 4aae55d35c..51a775f722 100644 --- a/Userland/Libraries/LibGfx/Point.h +++ b/Userland/Libraries/LibGfx/Point.h @@ -246,13 +246,19 @@ public: return Point<U>(roundf(x()), roundf(y())); } + template<typename U> + requires FloatingPoint<T> + [[nodiscard]] Point<U> to_ceiled() const + { + return Point<U>(ceil(x()), ceil(y())); + } + [[nodiscard]] String to_string() const; private: T m_x { 0 }; T m_y { 0 }; }; - using IntPoint = Point<int>; using FloatPoint = Point<float>; |