diff options
author | Andreas Kling <kling@serenityos.org> | 2020-05-12 18:52:51 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-05-12 19:04:03 +0200 |
commit | fbda28248ab401867c9c55e0e03567b4226dac8d (patch) | |
tree | 85209c4281f5dce560cc3a24009bff7864ce4762 /Libraries/LibGfx | |
parent | f8e3c8326de9c5a3de42542614575ab95357bff2 (diff) | |
download | serenity-fbda28248ab401867c9c55e0e03567b4226dac8d.zip |
LibGfx+IPCCompiler: Add IPC encoders for Color and ShareableBitmap
Diffstat (limited to 'Libraries/LibGfx')
-rw-r--r-- | Libraries/LibGfx/Color.cpp | 7 | ||||
-rw-r--r-- | Libraries/LibGfx/Color.h | 1 | ||||
-rw-r--r-- | Libraries/LibGfx/ShareableBitmap.cpp | 9 | ||||
-rw-r--r-- | Libraries/LibGfx/ShareableBitmap.h | 1 |
4 files changed, 18 insertions, 0 deletions
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 <LibGfx/Color.h> #include <LibGfx/SystemTheme.h> #include <LibIPC/Decoder.h> +#include <LibIPC/Encoder.h> #include <ctype.h> #include <stdio.h> #include <stdlib.h> @@ -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 <LibGfx/Bitmap.h> #include <LibGfx/ShareableBitmap.h> #include <LibIPC/Decoder.h> +#include <LibIPC/Encoder.h> 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&); } |