From 059a9c71a0ee4a592a5781f818d583459a44c14c Mon Sep 17 00:00:00 2001 From: Crax97 Date: Mon, 29 Aug 2022 22:47:33 +0200 Subject: [PATCH] LibGfx: Add Point::to_ceiled method for getting a ceiled Point --- Userland/Libraries/LibGfx/Point.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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(roundf(x()), roundf(y())); } + template + requires FloatingPoint + [[nodiscard]] Point to_ceiled() const + { + return Point(ceil(x()), ceil(y())); + } + [[nodiscard]] String to_string() const; private: T m_x { 0 }; T m_y { 0 }; }; - using IntPoint = Point; using FloatPoint = Point;