diff options
author | asynts <asynts@gmail.com> | 2020-10-09 15:44:52 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-10-09 20:52:17 +0200 |
commit | 3b601cd4bdfb2003356eb6d764352cf092d00b14 (patch) | |
tree | 37aa0d2ce92afeb84ea231c2d654a53854d393ca | |
parent | cf6980848bce11c148fb8fc29070d58cdffaf6e8 (diff) | |
download | serenity-3b601cd4bdfb2003356eb6d764352cf092d00b14.zip |
LibGfx: Add formatter for Rect.
-rw-r--r-- | Libraries/LibGfx/Rect.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Libraries/LibGfx/Rect.h b/Libraries/LibGfx/Rect.h index 50a6bad661..8697587283 100644 --- a/Libraries/LibGfx/Rect.h +++ b/Libraries/LibGfx/Rect.h @@ -26,6 +26,7 @@ #pragma once +#include <AK/Format.h> #include <LibGfx/Orientation.h> #include <LibGfx/Point.h> #include <LibGfx/Size.h> @@ -411,6 +412,18 @@ ALWAYS_INLINE IntRect enclosing_int_rect(const FloatRect& float_rect) } +namespace AK { + +template<typename T> +struct Formatter<Gfx::Rect<T>> : Formatter<StringView> { + void format(TypeErasedFormatParams& params, FormatBuilder& builder, const Gfx::Rect<T>& value) + { + Formatter<StringView>::format(params, builder, value.to_string()); + } +}; + +} + namespace IPC { bool decode(Decoder&, Gfx::IntRect&); |