ladybird/Libraries/LibGfx/Path.cpp
Aliaksandr Kalenik 36a366e2e9 LibGfx: Add path serialization helpers
Display list commands need a representation for paths that can live in
the command byte stream instead of owning a Gfx::Path object. Expose a
small LibGfx helper that serializes a Path to Skia's byte format and
reconstructs it from those bytes.

This is preparation for making path paint commands trivially
destructible and suitable for a flat display-list buffer that can
eventually be transferred over IPC.
2026-05-08 20:45:17 +02:00

26 lines
451 B
C++

/*
* Copyright (c) 2024, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibGfx/Path.h>
#include <LibGfx/PathSkia.h>
namespace Gfx {
Path Path::from_serialized_bytes(ReadonlyBytes bytes)
{
Gfx::Path path;
path.impl().deserialize_from_bytes(bytes);
return path;
}
NonnullOwnPtr<Gfx::PathImpl> PathImpl::create()
{
return PathImplSkia::create();
}
PathImpl::~PathImpl() = default;
}