1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 06:37:44 +00:00

LibGfx: Add Size<T>::to_rounded<I>()

Currently this is only specialized for rounding to integer types.
This commit is contained in:
MacDue 2022-07-31 01:20:51 +01:00 committed by Andreas Kling
parent 77f0a66d2f
commit 264543b90a

View file

@ -164,6 +164,12 @@ public:
[[nodiscard]] String to_string() const;
template<Integral I>
[[nodiscard]] Size<I> to_rounded() const
{
return Size<I>(round_to<I>(width()), round_to<I>(height()));
}
private:
T m_width { 0 };
T m_height { 0 };