Moving 2D canvas rasterization into the Compositor process needs a wire format for canvas mutations that does not depend on LibWeb state. Add CanvasCommandList as an apply-once log of drawing operations whose operands are Gfx value types and whose IPC encoders can be shared by WebContent and the compositor side.
31 lines
775 B
C++
31 lines
775 B
C++
/*
|
|
* Copyright (c) 2026, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
*
|
|
* 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 };
|
|
}
|
|
|
|
}
|