From f6a2d6af0b88e91c1512c88a1c2f15b0378d76f1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 18 Sep 2021 12:03:36 +0200 Subject: [PATCH] LibGfx: Add Point::to_rounded() --- Userland/Libraries/LibGfx/Point.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Userland/Libraries/LibGfx/Point.h b/Userland/Libraries/LibGfx/Point.h index 7b9faebe16..88afb4147d 100644 --- a/Userland/Libraries/LibGfx/Point.h +++ b/Userland/Libraries/LibGfx/Point.h @@ -13,6 +13,7 @@ #include #include #include +#include namespace Gfx { @@ -239,6 +240,12 @@ public: return Point(*this); } + template + [[nodiscard]] Point to_rounded() const + { + return Point(roundf(x()), roundf(y())); + } + [[nodiscard]] String to_string() const; private: