diff --git a/Userland/Libraries/LibGfx/Line.h b/Userland/Libraries/LibGfx/Line.h index f1438cd1b5..4cfff5124e 100644 --- a/Userland/Libraries/LibGfx/Line.h +++ b/Userland/Libraries/LibGfx/Line.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -153,3 +154,15 @@ inline String FloatLine::to_string() const } } + +namespace AK { + +template +struct Formatter> : Formatter { + ErrorOr format(FormatBuilder& builder, Gfx::Line const& value) + { + return Formatter::format(builder, "[{},{} -> {},{}]"sv, value.a().x(), value.a().y(), value.b().x(), value.b().y()); + } +}; + +} diff --git a/Userland/Libraries/LibGfx/Point.h b/Userland/Libraries/LibGfx/Point.h index 51a775f722..360eb91db3 100644 --- a/Userland/Libraries/LibGfx/Point.h +++ b/Userland/Libraries/LibGfx/Point.h @@ -285,10 +285,10 @@ inline Point cubic_interpolate(Point const& p1, Point const& p2, Point< namespace AK { template -struct Formatter> : Formatter { +struct Formatter> : Formatter { ErrorOr format(FormatBuilder& builder, Gfx::Point const& value) { - return Formatter::format(builder, value.to_string()); + return Formatter::format(builder, "[{},{}]"sv, value.x(), value.y()); } }; diff --git a/Userland/Libraries/LibGfx/Rect.h b/Userland/Libraries/LibGfx/Rect.h index 819d1b1dd7..4a204c5a4a 100644 --- a/Userland/Libraries/LibGfx/Rect.h +++ b/Userland/Libraries/LibGfx/Rect.h @@ -1026,10 +1026,10 @@ using FloatRect = Rect; namespace AK { template -struct Formatter> : Formatter { +struct Formatter> : Formatter { ErrorOr format(FormatBuilder& builder, Gfx::Rect const& value) { - return Formatter::format(builder, value.to_string()); + return Formatter::format(builder, "[{},{} {}x{}]"sv, value.x(), value.y(), value.width(), value.height()); } }; diff --git a/Userland/Libraries/LibGfx/Size.h b/Userland/Libraries/LibGfx/Size.h index 79aa3c1a57..dc8722048b 100644 --- a/Userland/Libraries/LibGfx/Size.h +++ b/Userland/Libraries/LibGfx/Size.h @@ -183,10 +183,10 @@ using FloatSize = Size; namespace AK { template -struct Formatter> : Formatter { +struct Formatter> : Formatter { ErrorOr format(FormatBuilder& builder, Gfx::Size const& value) { - return Formatter::format(builder, value.to_string()); + return Formatter::format(builder, "[{}x{}]"sv, value.width(), value.height()); } };