From 264543b90a525df59f478ea7a0e326750d3bb202 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sun, 31 Jul 2022 01:20:51 +0100 Subject: [PATCH] LibGfx: Add Size::to_rounded() Currently this is only specialized for rounding to integer types. --- Userland/Libraries/LibGfx/Size.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Libraries/LibGfx/Size.h b/Userland/Libraries/LibGfx/Size.h index 5fa136ba45..79aa3c1a57 100644 --- a/Userland/Libraries/LibGfx/Size.h +++ b/Userland/Libraries/LibGfx/Size.h @@ -164,6 +164,12 @@ public: [[nodiscard]] String to_string() const; + template + [[nodiscard]] Size to_rounded() const + { + return Size(round_to(width()), round_to(height())); + } + private: T m_width { 0 }; T m_height { 0 };