diff --git a/DevTools/IPCCompiler/main.cpp b/DevTools/IPCCompiler/main.cpp index 7af89e9a5e..c73ad776f9 100644 --- a/DevTools/IPCCompiler/main.cpp +++ b/DevTools/IPCCompiler/main.cpp @@ -343,13 +343,7 @@ int main(int argc, char** argv) out() << " stream << endpoint_magic();"; out() << " stream << (int)MessageID::" << name << ";"; for (auto& parameter : parameters) { - if (parameter.type == "Gfx::Color") { - out() << " stream << m_" << parameter.name << ".value();"; - } else if (parameter.type == "Gfx::ShareableBitmap") { - out() << " stream << m_" << parameter.name << ".shbuf_id();"; - out() << " stream << m_" << parameter.name << ".width();"; - out() << " stream << m_" << parameter.name << ".height();"; - } else if (parameter.type.starts_with("Optional<")) { + if (parameter.type.starts_with("Optional<")) { out() << " stream << m_" << parameter.name << ".has_value();"; out() << " if (m_" << parameter.name << ".has_value())"; out() << " stream << m_" << parameter.name << ".value();"; diff --git a/Libraries/LibGfx/Color.cpp b/Libraries/LibGfx/Color.cpp index 41e9a013ea..e64c6f4096 100644 --- a/Libraries/LibGfx/Color.cpp +++ b/Libraries/LibGfx/Color.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -433,6 +434,12 @@ const LogStream& operator<<(const LogStream& stream, Color value) return stream << value.to_string(); } +bool IPC::encode(IPC::Encoder& encoder, const Color& color) +{ + encoder << color.value(); + return true; +} + bool IPC::decode(IPC::Decoder& decoder, Color& color) { u32 rgba = 0; diff --git a/Libraries/LibGfx/Color.h b/Libraries/LibGfx/Color.h index f1601aa8df..106e6cb3ad 100644 --- a/Libraries/LibGfx/Color.h +++ b/Libraries/LibGfx/Color.h @@ -282,5 +282,6 @@ const LogStream& operator<<(const LogStream&, Color); using Gfx::Color; namespace IPC { +bool encode(Encoder&, const Gfx::Color&); bool decode(Decoder&, Gfx::Color&); } diff --git a/Libraries/LibGfx/ShareableBitmap.cpp b/Libraries/LibGfx/ShareableBitmap.cpp index db73b59bc2..606c857cce 100644 --- a/Libraries/LibGfx/ShareableBitmap.cpp +++ b/Libraries/LibGfx/ShareableBitmap.cpp @@ -28,6 +28,7 @@ #include #include #include +#include namespace Gfx { @@ -40,6 +41,14 @@ ShareableBitmap::ShareableBitmap(const Bitmap& bitmap) namespace IPC { +bool encode(Encoder& encoder, const Gfx::ShareableBitmap& shareable_bitmap) +{ + encoder << shareable_bitmap.shbuf_id(); + encoder << shareable_bitmap.width(); + encoder << shareable_bitmap.height(); + return true; +} + bool decode(Decoder& decoder, Gfx::ShareableBitmap& shareable_bitmap) { i32 shbuf_id = 0; diff --git a/Libraries/LibGfx/ShareableBitmap.h b/Libraries/LibGfx/ShareableBitmap.h index 9cf86f08ff..8dd63d14ac 100644 --- a/Libraries/LibGfx/ShareableBitmap.h +++ b/Libraries/LibGfx/ShareableBitmap.h @@ -57,5 +57,6 @@ private: } namespace IPC { +bool encode(Encoder&, const Gfx::ShareableBitmap&); bool decode(Decoder&, Gfx::ShareableBitmap&); }