Truly independent web browser
LibGfx: Remove IPC coding of transforms, matrices and color stops
Aliaksandr Kalenikbec700df1ef1
diff --git a/Libraries/LibGfx/AffineTransform.cpp b/Libraries/LibGfx/AffineTransform.cppindex f25b1acf833..a348f3f6ed1 100644--- a/Libraries/LibGfx/AffineTransform.cpp+++ b/Libraries/LibGfx/AffineTransform.cpp@@ -8,8 +8,6 @@#include <AK/Optional.h>#include <LibGfx/AffineTransform.h>#include <LibGfx/Rect.h>-#include <LibIPC/Decoder.h>-#include <LibIPC/Encoder.h>namespace Gfx {@@ -250,31 +248,3 @@ Matrix<4, float> AffineTransform::to_matrix() const}}--namespace IPC {--template<>-ErrorOr<void> encode(Encoder& encoder, Gfx::AffineTransform const& transform)-{- TRY(encoder.encode(transform.a()));- TRY(encoder.encode(transform.b()));- TRY(encoder.encode(transform.c()));- TRY(encoder.encode(transform.d()));- TRY(encoder.encode(transform.e()));- TRY(encoder.encode(transform.f()));- return {};-}--template<>-ErrorOr<Gfx::AffineTransform> decode(Decoder& decoder)-{- auto a = TRY(decoder.decode<float>());- auto b = TRY(decoder.decode<float>());- auto c = TRY(decoder.decode<float>());- auto d = TRY(decoder.decode<float>());- auto e = TRY(decoder.decode<float>());- auto f = TRY(decoder.decode<float>());- return Gfx::AffineTransform { a, b, c, d, e, f };-}--}diff --git a/Libraries/LibGfx/AffineTransform.h b/Libraries/LibGfx/AffineTransform.hindex 5db9d6e67db..94492f424d5 100644--- a/Libraries/LibGfx/AffineTransform.h+++ b/Libraries/LibGfx/AffineTransform.h@@ -11,7 +11,6 @@#include <AK/Forward.h>#include <LibGfx/Forward.h>#include <LibGfx/Matrix.h>-#include <LibIPC/Forward.h>namespace Gfx {@@ -98,13 +97,3 @@ struct AK::Formatter<Gfx::AffineTransform> : Formatter<FormatString> {return Formatter<FormatString>::format(builder, "[{} {} {} {} {} {}]"sv, value.a(), value.b(), value.c(), value.d(), value.e(), value.f());}};--namespace IPC {--template<>-ErrorOr<void> encode(Encoder&, Gfx::AffineTransform const&);--template<>-ErrorOr<Gfx::AffineTransform> decode(Decoder&);--}diff --git a/Libraries/LibGfx/CMakeLists.txt b/Libraries/LibGfx/CMakeLists.txtindex 9ff7416b88e..ab662ba03b1 100644--- a/Libraries/LibGfx/CMakeLists.txt+++ b/Libraries/LibGfx/CMakeLists.txt@@ -23,9 +23,7 @@ set(SOURCESFont/WOFF2/Loader.cppFontCascadeList.cppGpuDeviceIdentity.cpp- Gradients.cppLinuxDmaBufHandle.cpp- Matrix4x4.cppDecodedImageFrame.cppRustProcessState.cppImageFormats/BMPWriter.cppdiff --git a/Libraries/LibGfx/Gradients.cpp b/Libraries/LibGfx/Gradients.cppdeleted file mode 100644index 25548a74bbc..00000000000--- a/Libraries/LibGfx/Gradients.cpp+++ /dev/null@@ -1,31 +0,0 @@-/*- * Copyright (c) 2026, Aliaksandr Kalenik <[email protected]>- *- * SPDX-License-Identifier: BSD-2-Clause- */--#include <LibGfx/Gradients.h>-#include <LibIPC/Decoder.h>-#include <LibIPC/Encoder.h>--namespace IPC {--template<>-ErrorOr<void> encode(Encoder& encoder, Gfx::ColorStop const& color_stop)-{- TRY(encoder.encode(color_stop.color));- TRY(encoder.encode(color_stop.position));- TRY(encoder.encode(color_stop.transition_hint));- return {};-}--template<>-ErrorOr<Gfx::ColorStop> decode(Decoder& decoder)-{- auto color = TRY(decoder.decode<Gfx::Color>());- auto position = TRY(decoder.decode<float>());- auto transition_hint = TRY(decoder.decode<Optional<float>>());- return Gfx::ColorStop { color, position, transition_hint };-}--}diff --git a/Libraries/LibGfx/Gradients.h b/Libraries/LibGfx/Gradients.hindex c902d4c2954..58be7c00fa2 100644--- a/Libraries/LibGfx/Gradients.h+++ b/Libraries/LibGfx/Gradients.h@@ -9,7 +9,6 @@#include <AK/Math.h>#include <LibGfx/Color.h>#include <LibGfx/Size.h>-#include <LibIPC/Forward.h>namespace Gfx {@@ -44,13 +43,3 @@ inline float calculate_gradient_length(Size<T> gradient_size, float gradient_ang}}--namespace IPC {--template<>-ErrorOr<void> encode(Encoder&, Gfx::ColorStop const&);--template<>-ErrorOr<Gfx::ColorStop> decode(Decoder&);--}diff --git a/Libraries/LibGfx/Matrix4x4.cpp b/Libraries/LibGfx/Matrix4x4.cppdeleted file mode 100644index 828a763f1b6..00000000000--- a/Libraries/LibGfx/Matrix4x4.cpp+++ /dev/null@@ -1,30 +0,0 @@-/*- * Copyright (c) 2026-present, the Ladybird developers.- *- * SPDX-License-Identifier: BSD-2-Clause- */--#include <LibGfx/Matrix4x4.h>-#include <LibIPC/Decoder.h>-#include <LibIPC/Encoder.h>--namespace IPC {--template<>-ErrorOr<void> encode(Encoder& encoder, Gfx::FloatMatrix4x4 const& matrix)-{- static constexpr size_t element_count = Gfx::FloatMatrix4x4::Size * Gfx::FloatMatrix4x4::Size;- TRY(encoder.append(reinterpret_cast<u8 const*>(matrix.elements()), element_count * sizeof(float)));- return {};-}--template<>-ErrorOr<Gfx::FloatMatrix4x4> decode(Decoder& decoder)-{- static constexpr size_t element_count = Gfx::FloatMatrix4x4::Size * Gfx::FloatMatrix4x4::Size;- Gfx::FloatMatrix4x4 matrix;- TRY(decoder.decode_into(Bytes { reinterpret_cast<u8*>(matrix.elements()), element_count * sizeof(float) }));- return matrix;-}--}diff --git a/Libraries/LibGfx/Matrix4x4.h b/Libraries/LibGfx/Matrix4x4.hindex 23a9d7b6dbb..1c5f36d7e95 100644--- a/Libraries/LibGfx/Matrix4x4.h+++ b/Libraries/LibGfx/Matrix4x4.h@@ -11,7 +11,6 @@#include <LibGfx/Matrix.h>#include <LibGfx/Vector3.h>#include <LibGfx/Vector4.h>-#include <LibIPC/Forward.h>namespace Gfx {@@ -139,13 +138,3 @@ typedef Matrix4x4<double> DoubleMatrix4x4;using Gfx::DoubleMatrix4x4;using Gfx::FloatMatrix4x4;using Gfx::Matrix4x4;--namespace IPC {--template<>-ErrorOr<void> encode(Encoder&, Gfx::FloatMatrix4x4 const&);--template<>-ErrorOr<Gfx::FloatMatrix4x4> decode(Decoder&);--}