ladybird/Userland/Libraries/LibGfx/PathSkia.h
Andreas Kling 137038b185 LibWeb: Port painting to use the new Skia-backed Gfx::Path
SVG and and CSS border rendering now sits on top of SkPath instead of
the old Gfx::DeprecatedPath.

Due to an imperceptible (255, 255, 255) vs (255, 254, 255) color diff
in one ref test, I changed that test to not depend on border rendering
for a positive result, since that was incidental.
2024-08-20 09:30:05 +02:00

53 lines
1.7 KiB
C++

/*
* Copyright (c) 2024, Andreas Kling <andreas@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGfx/Path.h>
class SkPath;
namespace Gfx {
class PathImplSkia final : public PathImpl {
public:
static NonnullOwnPtr<Gfx::PathImplSkia> create();
virtual ~PathImplSkia() override;
virtual void clear() override;
virtual void move_to(Gfx::FloatPoint const&) override;
virtual void line_to(Gfx::FloatPoint const&) override;
virtual void close_all_subpaths() override;
virtual void close() override;
virtual void elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rotation, bool large_arc, bool sweep) override;
virtual void arc_to(FloatPoint point, float radius, bool large_arc, bool sweep) override;
virtual void quadratic_bezier_curve_to(FloatPoint through, FloatPoint point) override;
virtual void cubic_bezier_curve_to(FloatPoint c1, FloatPoint c2, FloatPoint p2) override;
virtual void text(Utf8View, Font const&) override;
virtual void append_path(Gfx::Path const&) override;
virtual void intersect(Gfx::Path const&) override;
[[nodiscard]] virtual bool is_empty() const override;
virtual Gfx::FloatPoint last_point() const override;
virtual Gfx::FloatRect bounding_box() const override;
virtual NonnullOwnPtr<PathImpl> clone() const override;
virtual NonnullOwnPtr<PathImpl> copy_transformed(Gfx::AffineTransform const&) const override;
virtual NonnullOwnPtr<PathImpl> place_text_along(Utf8View text, Font const&) const override;
SkPath const& sk_path() const { return *m_path; }
SkPath& sk_path() { return *m_path; }
private:
PathImplSkia();
Gfx::FloatPoint m_last_move_to;
NonnullOwnPtr<SkPath> m_path;
};
}