summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2023-04-07 13:25:15 +0100
committerLinus Groh <mail@linusgroh.de>2023-04-09 18:42:45 +0200
commit78aad28dbab77be8e38a087e38a5b7c992206998 (patch)
treef4b35e557effed8f3c45a54aa3f84d8bf1020f18
parent26e56bdd0856fb09900ec9255569e44e70653430 (diff)
downloadserenity-78aad28dbab77be8e38a087e38a5b7c992206998.zip
LibGfx: Add Point::to_floored<T>()
-rw-r--r--Userland/Libraries/LibGfx/Point.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibGfx/Point.h b/Userland/Libraries/LibGfx/Point.h
index 67c3ce89b8..606a4162c9 100644
--- a/Userland/Libraries/LibGfx/Point.h
+++ b/Userland/Libraries/LibGfx/Point.h
@@ -247,6 +247,13 @@ public:
return Point<U>(ceil(x()), ceil(y()));
}
+ template<typename U>
+ requires FloatingPoint<T>
+ [[nodiscard]] Point<U> to_floored() const
+ {
+ return Point<U>(AK::floor(x()), AK::floor(y()));
+ }
+
[[nodiscard]] DeprecatedString to_deprecated_string() const;
private: