summaryrefslogtreecommitdiff
path: root/Libraries/LibGfx
diff options
context:
space:
mode:
Diffstat (limited to 'Libraries/LibGfx')
-rw-r--r--Libraries/LibGfx/Color.cpp6
-rw-r--r--Libraries/LibGfx/Color.h3
-rw-r--r--Libraries/LibGfx/Point.cpp9
-rw-r--r--Libraries/LibGfx/Point.h3
-rw-r--r--Libraries/LibGfx/Rect.cpp7
-rw-r--r--Libraries/LibGfx/Rect.h3
-rw-r--r--Libraries/LibGfx/Size.cpp9
-rw-r--r--Libraries/LibGfx/Size.h3
8 files changed, 25 insertions, 18 deletions
diff --git a/Libraries/LibGfx/Color.cpp b/Libraries/LibGfx/Color.cpp
index 851bc1d24b..01bb3988d4 100644
--- a/Libraries/LibGfx/Color.cpp
+++ b/Libraries/LibGfx/Color.cpp
@@ -31,6 +31,7 @@
#include <AK/Vector.h>
#include <LibGfx/Color.h>
#include <LibGfx/SystemTheme.h>
+#include <LibIPC/Decoder.h>
#include <ctype.h>
#include <stdio.h>
@@ -386,11 +387,10 @@ const LogStream& operator<<(const LogStream& stream, Color value)
return stream << value.to_string();
}
-bool IPC::decode(BufferStream& stream, Color& color)
+bool IPC::decode(IPC::Decoder& decoder, Color& color)
{
u32 rgba = 0;
- stream >> rgba;
- if (stream.handle_read_failure())
+ if (!decoder.decode(rgba))
return false;
color = Color::from_rgba(rgba);
return true;
diff --git a/Libraries/LibGfx/Color.h b/Libraries/LibGfx/Color.h
index 456e3f0724..490b3d7249 100644
--- a/Libraries/LibGfx/Color.h
+++ b/Libraries/LibGfx/Color.h
@@ -28,6 +28,7 @@
#include <AK/Forward.h>
#include <AK/StdLibExtras.h>
+#include <LibIPC/Forward.h>
namespace Gfx {
@@ -280,5 +281,5 @@ const LogStream& operator<<(const LogStream&, Color);
using Gfx::Color;
namespace IPC {
-bool decode(BufferStream&, Gfx::Color&);
+bool decode(Decoder&, Gfx::Color&);
}
diff --git a/Libraries/LibGfx/Point.cpp b/Libraries/LibGfx/Point.cpp
index 2371e75cb7..32bd115a48 100644
--- a/Libraries/LibGfx/Point.cpp
+++ b/Libraries/LibGfx/Point.cpp
@@ -27,6 +27,7 @@
#include <AK/BufferStream.h>
#include <AK/String.h>
#include <LibGfx/Point.h>
+#include <LibIPC/Decoder.h>
namespace Gfx {
@@ -44,13 +45,13 @@ const LogStream& operator<<(const LogStream& stream, const Point& value)
namespace IPC {
-bool decode(BufferStream& stream, Gfx::Point& point)
+bool decode(Decoder& decoder, Gfx::Point& point)
{
int x = 0;
int y = 0;
- stream >> x;
- stream >> y;
- if (stream.handle_read_failure())
+ if (!decoder.decode(x))
+ return false;
+ if (!decoder.decode(y))
return false;
point = { x, y };
return true;
diff --git a/Libraries/LibGfx/Point.h b/Libraries/LibGfx/Point.h
index 4007642d2a..67a123cb4c 100644
--- a/Libraries/LibGfx/Point.h
+++ b/Libraries/LibGfx/Point.h
@@ -29,6 +29,7 @@
#include <AK/Forward.h>
#include <AK/StdLibExtras.h>
#include <LibGfx/Orientation.h>
+#include <LibIPC/Forward.h>
#include <stdlib.h>
namespace Gfx {
@@ -162,5 +163,5 @@ const LogStream& operator<<(const LogStream&, const Point&);
}
namespace IPC {
-bool decode(BufferStream&, Gfx::Point&);
+bool decode(Decoder&, Gfx::Point&);
}
diff --git a/Libraries/LibGfx/Rect.cpp b/Libraries/LibGfx/Rect.cpp
index 5c39b15789..e3ec19b37b 100644
--- a/Libraries/LibGfx/Rect.cpp
+++ b/Libraries/LibGfx/Rect.cpp
@@ -28,6 +28,7 @@
#include <AK/String.h>
#include <AK/Vector.h>
#include <LibGfx/Rect.h>
+#include <LibIPC/Decoder.h>
namespace Gfx {
@@ -145,13 +146,13 @@ const LogStream& operator<<(const LogStream& stream, const Rect& value)
namespace IPC {
-bool decode(BufferStream& stream, Gfx::Rect& rect)
+bool decode(Decoder& decoder, Gfx::Rect& rect)
{
Gfx::Point point;
Gfx::Size size;
- if (!decode(stream, point))
+ if (!decoder.decode(point))
return false;
- if (!decode(stream, size))
+ if (!decoder.decode(size))
return false;
rect = { point, size };
return true;
diff --git a/Libraries/LibGfx/Rect.h b/Libraries/LibGfx/Rect.h
index d9109067f4..5a025cb282 100644
--- a/Libraries/LibGfx/Rect.h
+++ b/Libraries/LibGfx/Rect.h
@@ -31,6 +31,7 @@
#include <LibGfx/Point.h>
#include <LibGfx/Size.h>
#include <LibGfx/TextAlignment.h>
+#include <LibIPC/Forward.h>
#include <stdlib.h>
namespace Gfx {
@@ -337,5 +338,5 @@ const LogStream& operator<<(const LogStream&, const Rect&);
}
namespace IPC {
-bool decode(BufferStream&, Gfx::Rect&);
+bool decode(Decoder&, Gfx::Rect&);
}
diff --git a/Libraries/LibGfx/Size.cpp b/Libraries/LibGfx/Size.cpp
index 6274e2be8f..ce49aa678d 100644
--- a/Libraries/LibGfx/Size.cpp
+++ b/Libraries/LibGfx/Size.cpp
@@ -27,6 +27,7 @@
#include <AK/BufferStream.h>
#include <AK/String.h>
#include <LibGfx/Size.h>
+#include <LibIPC/Decoder.h>
namespace Gfx {
@@ -44,13 +45,13 @@ const LogStream& operator<<(const LogStream& stream, const Size& value)
namespace IPC {
-bool decode(BufferStream& stream, Gfx::Size& size)
+bool decode(Decoder& decoder, Gfx::Size& size)
{
int width = 0;
int height = 0;
- stream >> width;
- stream >> height;
- if (stream.handle_read_failure())
+ if (!decoder.decode(width))
+ return false;
+ if (!decoder.decode(height))
return false;
size = { width, height };
return true;
diff --git a/Libraries/LibGfx/Size.h b/Libraries/LibGfx/Size.h
index 4156d751d6..4ca7f0addb 100644
--- a/Libraries/LibGfx/Size.h
+++ b/Libraries/LibGfx/Size.h
@@ -28,6 +28,7 @@
#include <AK/Forward.h>
#include <LibGfx/Orientation.h>
+#include <LibIPC/Forward.h>
namespace Gfx {
@@ -113,5 +114,5 @@ const LogStream& operator<<(const LogStream&, const Size&);
}
namespace IPC {
-bool decode(BufferStream&, Gfx::Size&);
+bool decode(Decoder&, Gfx::Size&);
}