diff --git a/Libraries/LibGfx/Path.cpp b/Libraries/LibGfx/Path.cpp index 67474d8901..8758bd0274 100644 --- a/Libraries/LibGfx/Path.cpp +++ b/Libraries/LibGfx/Path.cpp @@ -6,6 +6,8 @@ #include #include +#include +#include namespace Gfx { @@ -24,3 +26,20 @@ NonnullOwnPtr PathImpl::create() PathImpl::~PathImpl() = default; } + +namespace IPC { + +template<> +ErrorOr encode(Encoder& encoder, Gfx::Path const& path) +{ + return encoder.encode(path.serialize_to_bytes()); +} + +template<> +ErrorOr decode(Decoder& decoder) +{ + auto path_data = TRY(decoder.decode>()); + return Gfx::Path::from_serialized_bytes(path_data); +} + +} diff --git a/Libraries/LibGfx/Path.h b/Libraries/LibGfx/Path.h index 3ef00104b1..1526e01c8f 100644 --- a/Libraries/LibGfx/Path.h +++ b/Libraries/LibGfx/Path.h @@ -15,6 +15,7 @@ #include #include #include +#include namespace Gfx { @@ -140,3 +141,13 @@ private: }; } + +namespace IPC { + +template<> +ErrorOr encode(Encoder&, Gfx::Path const&); + +template<> +ErrorOr decode(Decoder&); + +}