LibGfx: Rename Path => DeprecatedPath

This commit is contained in:
Andreas Kling 2024-08-08 10:22:03 +02:00 committed by Andreas Kling
parent de50d27870
commit c8f09312f7
Notes: github-actions[bot] 2024-08-20 07:38:22 +00:00
61 changed files with 216 additions and 216 deletions

View File

@ -31,6 +31,7 @@ shared_library("LibGfx") {
"Color.cpp",
"DeltaE.cpp",
"DeprecatedPainter.cpp",
"DeprecatedPath.cpp",
"EdgeFlagPathRasterizer.cpp",
"Filters/ColorBlindnessFilter.cpp",
"Filters/FastBoxBlurFilter.cpp",
@ -80,7 +81,6 @@ shared_library("LibGfx") {
"ImageFormats/WebPWriterLossless.cpp",
"ImmutableBitmap.cpp",
"Palette.cpp",
"Path.cpp",
"PathClipper.cpp",
"Point.cpp",
"Rect.cpp",

View File

@ -193,7 +193,7 @@ void AntiAliasingPainter::draw_line(FloatPoint actual_from, FloatPoint actual_to
draw_anti_aliased_line(actual_from, actual_to, color, thickness, style, alternate_color, line_length_mode);
}
void AntiAliasingPainter::stroke_path(Path const& path, Color color, float thickness)
void AntiAliasingPainter::stroke_path(DeprecatedPath const& path, Color color, float thickness)
{
if (thickness <= 0)
return;
@ -201,7 +201,7 @@ void AntiAliasingPainter::stroke_path(Path const& path, Color color, float thick
fill_path(path.stroke_to_fill(thickness), color);
}
void AntiAliasingPainter::stroke_path(Path const& path, Gfx::PaintStyle const& paint_style, float thickness, float opacity)
void AntiAliasingPainter::stroke_path(DeprecatedPath const& path, Gfx::PaintStyle const& paint_style, float thickness, float opacity)
{
if (thickness <= 0)
return;

View File

@ -7,10 +7,10 @@
#pragma once
#include <LibGfx/Color.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/Forward.h>
#include <LibGfx/LineStyle.h>
#include <LibGfx/PaintStyle.h>
#include <LibGfx/Path.h>
#include <LibGfx/Quad.h>
#include <LibGfx/WindingRule.h>
@ -37,11 +37,11 @@ public:
draw_line(line.a(), line.b(), color, thickness, style, alternate_color, line_length_mode);
}
void fill_path(Path const&, Color, WindingRule rule = WindingRule::Nonzero);
void fill_path(Path const&, PaintStyle const& paint_style, float opacity = 1.0f, WindingRule rule = WindingRule::Nonzero);
void fill_path(DeprecatedPath const&, Color, WindingRule rule = WindingRule::Nonzero);
void fill_path(DeprecatedPath const&, PaintStyle const& paint_style, float opacity = 1.0f, WindingRule rule = WindingRule::Nonzero);
void stroke_path(Path const&, Color, float thickness);
void stroke_path(Path const&, PaintStyle const& paint_style, float thickness, float opacity = 1.0f);
void stroke_path(DeprecatedPath const&, Color, float thickness);
void stroke_path(DeprecatedPath const&, PaintStyle const& paint_style, float thickness, float opacity = 1.0f);
void translate(float dx, float dy) { m_transform.translate(dx, dy); }
void translate(FloatPoint delta) { m_transform.translate(delta); }

View File

@ -8,6 +8,7 @@ set(SOURCES
Color.cpp
DeltaE.cpp
DeprecatedPainter.cpp
DeprecatedPath.cpp
EdgeFlagPathRasterizer.cpp
FontCascadeList.cpp
Font/Emoji.cpp
@ -56,7 +57,6 @@ set(SOURCES
ImmutableBitmap.cpp
MedianCut.cpp
Palette.cpp
Path.cpp
PathClipper.cpp
Painter.cpp
PainterSkia.cpp

View File

@ -20,8 +20,8 @@
#include <AK/Stack.h>
#include <AK/StdLibExtras.h>
#include <AK/Utf8View.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/Palette.h>
#include <LibGfx/Path.h>
#include <LibGfx/Quad.h>
#include <LibGfx/TextLayout.h>
#include <stdio.h>
@ -1227,7 +1227,7 @@ DeprecatedPainterStateSaver::~DeprecatedPainterStateSaver()
m_painter.restore();
}
void DeprecatedPainter::stroke_path(Path const& path, Color color, int thickness)
void DeprecatedPainter::stroke_path(DeprecatedPath const& path, Color color, int thickness)
{
if (thickness <= 0)
return;

View File

@ -79,10 +79,10 @@ public:
static void for_each_line_segment_on_cubic_bezier_curve(FloatPoint control_point_0, FloatPoint control_point_1, FloatPoint p1, FloatPoint p2, Function<void(FloatPoint, FloatPoint)>&);
static void for_each_line_segment_on_cubic_bezier_curve(FloatPoint control_point_0, FloatPoint control_point_1, FloatPoint p1, FloatPoint p2, Function<void(FloatPoint, FloatPoint)>&&);
void stroke_path(Path const&, Color, int thickness);
void stroke_path(DeprecatedPath const&, Color, int thickness);
void fill_path(Path const&, Color, WindingRule rule = WindingRule::Nonzero);
void fill_path(Path const&, PaintStyle const& paint_style, float opacity = 1.0f, WindingRule rule = WindingRule::Nonzero);
void fill_path(DeprecatedPath const&, Color, WindingRule rule = WindingRule::Nonzero);
void fill_path(DeprecatedPath const&, PaintStyle const& paint_style, float opacity = 1.0f, WindingRule rule = WindingRule::Nonzero);
void add_clip_rect(IntRect const& rect);
void clear_clip_rect();

View File

@ -9,13 +9,13 @@
#include <AK/TypeCasts.h>
#include <LibGfx/BoundingBox.h>
#include <LibGfx/DeprecatedPainter.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/Font/ScaledFont.h>
#include <LibGfx/Path.h>
#include <LibGfx/TextLayout.h>
namespace Gfx {
void Path::approximate_elliptical_arc_with_cubic_beziers(FloatPoint center, FloatSize radii, float x_axis_rotation, float theta, float theta_delta)
void DeprecatedPath::approximate_elliptical_arc_with_cubic_beziers(FloatPoint center, FloatSize radii, float x_axis_rotation, float theta, float theta_delta)
{
float sin_x_rotation;
float cos_x_rotation;
@ -63,7 +63,7 @@ void Path::approximate_elliptical_arc_with_cubic_beziers(FloatPoint center, Floa
approximate_arc_between(prev, t);
}
void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rotation, bool large_arc, bool sweep)
void DeprecatedPath::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rotation, bool large_arc, bool sweep)
{
auto next_point = point;
@ -77,7 +77,7 @@ void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rot
// Step 1 of out-of-range radii correction
if (rx == 0.0 || ry == 0.0) {
append_segment<PathSegment::LineTo>(next_point);
append_segment<DeprecatedPathSegment::LineTo>(next_point);
return;
}
@ -158,7 +158,7 @@ void Path::elliptical_arc_to(FloatPoint point, FloatSize radii, float x_axis_rot
theta_delta);
}
void Path::text(Utf8View text, Font const& font)
void DeprecatedPath::text(Utf8View text, Font const& font)
{
if (!is<ScaledFont>(font)) {
// FIXME: This API only accepts Gfx::Font for ease of use.
@ -178,7 +178,7 @@ void Path::text(Utf8View text, Font const& font)
IncludeLeftBearing::Yes);
}
Path Path::place_text_along(Utf8View text, Font const& font) const
DeprecatedPath DeprecatedPath::place_text_along(Utf8View text, Font const& font) const
{
if (!is<ScaledFont>(font)) {
// FIXME: This API only accepts Gfx::Font for ease of use.
@ -206,7 +206,7 @@ Path Path::place_text_along(Utf8View text, Font const& font) const
};
auto& scaled_font = static_cast<Gfx::ScaledFont const&>(font);
Gfx::Path result_path;
Gfx::DeprecatedPath result_path;
Gfx::for_each_glyph_position(
{}, text, font, [&](Gfx::DrawGlyphOrEmoji glyph_or_emoji) {
auto* glyph = glyph_or_emoji.get_pointer<Gfx::DrawGlyph>();
@ -223,7 +223,7 @@ Path Path::place_text_along(Utf8View text, Font const& font) const
// Find the angle between the start and end points on the path.
auto delta = *end - *start;
auto angle = AK::atan2(delta.y(), delta.x());
Gfx::Path glyph_path;
Gfx::DeprecatedPath glyph_path;
// Rotate the glyph then move it to start point.
scaled_font.append_glyph_path_to(glyph_path, glyph->glyph_id);
auto transform = Gfx::AffineTransform {}
@ -237,13 +237,13 @@ Path Path::place_text_along(Utf8View text, Font const& font) const
return result_path;
}
void Path::close()
void DeprecatedPath::close()
{
// If there's no `moveto` starting this subpath assume the start is (0, 0).
FloatPoint first_point_in_subpath = { 0, 0 };
for (auto it = end(); it-- != begin();) {
auto segment = *it;
if (segment.command() == PathSegment::MoveTo) {
if (segment.command() == DeprecatedPathSegment::MoveTo) {
first_point_in_subpath = segment.point();
break;
}
@ -252,7 +252,7 @@ void Path::close()
line_to(first_point_in_subpath);
}
void Path::close_all_subpaths()
void DeprecatedPath::close_all_subpaths()
{
auto it = begin();
// Note: Get the end outside the loop as closing subpaths will move the end.
@ -261,7 +261,7 @@ void Path::close_all_subpaths()
// If there's no `moveto` starting this subpath assume the start is (0, 0).
FloatPoint first_point_in_subpath = { 0, 0 };
auto segment = *it;
if (segment.command() == PathSegment::MoveTo) {
if (segment.command() == DeprecatedPathSegment::MoveTo) {
first_point_in_subpath = segment.point();
++it;
}
@ -269,7 +269,7 @@ void Path::close_all_subpaths()
FloatPoint cursor = first_point_in_subpath;
while (it < end) {
auto segment = *it;
if (segment.command() == PathSegment::MoveTo)
if (segment.command() == DeprecatedPathSegment::MoveTo)
break;
cursor = segment.point();
++it;
@ -282,26 +282,26 @@ void Path::close_all_subpaths()
}
}
ByteString Path::to_byte_string() const
ByteString DeprecatedPath::to_byte_string() const
{
// Dumps this path as an SVG compatible string.
StringBuilder builder;
if (is_empty() || m_commands.first() != PathSegment::MoveTo)
if (is_empty() || m_commands.first() != DeprecatedPathSegment::MoveTo)
builder.append("M 0,0"sv);
for (auto segment : *this) {
if (!builder.is_empty())
builder.append(' ');
switch (segment.command()) {
case PathSegment::MoveTo:
case DeprecatedPathSegment::MoveTo:
builder.append('M');
break;
case PathSegment::LineTo:
case DeprecatedPathSegment::LineTo:
builder.append('L');
break;
case PathSegment::QuadraticBezierCurveTo:
case DeprecatedPathSegment::QuadraticBezierCurveTo:
builder.append('Q');
break;
case PathSegment::CubicBezierCurveTo:
case DeprecatedPathSegment::CubicBezierCurveTo:
builder.append('C');
break;
}
@ -311,7 +311,7 @@ ByteString Path::to_byte_string() const
return builder.to_byte_string();
}
void Path::segmentize_path()
void DeprecatedPath::segmentize_path()
{
Vector<FloatLine> segments;
FloatBoundingBox bounding_box;
@ -324,20 +324,20 @@ void Path::segmentize_path()
FloatPoint cursor { 0, 0 };
for (auto segment : *this) {
switch (segment.command()) {
case PathSegment::MoveTo:
case DeprecatedPathSegment::MoveTo:
bounding_box.add_point(segment.point());
break;
case PathSegment::LineTo: {
case DeprecatedPathSegment::LineTo: {
add_line(cursor, segment.point());
break;
}
case PathSegment::QuadraticBezierCurveTo: {
case DeprecatedPathSegment::QuadraticBezierCurveTo: {
DeprecatedPainter::for_each_line_segment_on_bezier_curve(segment.through(), cursor, segment.point(), [&](FloatPoint p0, FloatPoint p1) {
add_line(p0, p1);
});
break;
}
case PathSegment::CubicBezierCurveTo: {
case DeprecatedPathSegment::CubicBezierCurveTo: {
DeprecatedPainter::for_each_line_segment_on_cubic_bezier_curve(segment.through_0(), segment.through_1(), cursor, segment.point(), [&](FloatPoint p0, FloatPoint p1) {
add_line(p0, p1);
});
@ -350,9 +350,9 @@ void Path::segmentize_path()
m_split_lines = SplitLines { move(segments), bounding_box };
}
Path Path::copy_transformed(Gfx::AffineTransform const& transform) const
DeprecatedPath DeprecatedPath::copy_transformed(Gfx::AffineTransform const& transform) const
{
Path result;
DeprecatedPath result;
result.m_commands = m_commands;
result.m_points.ensure_capacity(m_points.size());
for (auto point : m_points)
@ -388,7 +388,7 @@ private:
ReadonlySpan<T> m_span;
};
Path Path::stroke_to_fill(float thickness) const
DeprecatedPath DeprecatedPath::stroke_to_fill(float thickness) const
{
// Note: This convolves a polygon with the path using the algorithm described
// in https://keithp.com/~keithp/talks/cairo2003.pdf (3.1 Stroking Splines via Convolution)
@ -397,7 +397,7 @@ Path Path::stroke_to_fill(float thickness) const
auto lines = split_lines();
if (lines.is_empty())
return Path {};
return DeprecatedPath {};
// Paths can be disconnected, which a pain to deal with, so split it up.
Vector<Vector<FloatPoint>> segments;
@ -476,7 +476,7 @@ Path Path::stroke_to_fill(float thickness) const
return (target_angle - current_angle) <= AK::Pi<float>;
};
Path convolution;
DeprecatedPath convolution;
for (auto& segment : segments) {
RoundTrip<FloatPoint> shape { segment };

View File

@ -16,9 +16,9 @@
namespace Gfx {
class Path;
class DeprecatedPath;
class PathSegment {
class DeprecatedPathSegment {
public:
enum Command : u8 {
MoveTo,
@ -60,7 +60,7 @@ public:
VERIFY_NOT_REACHED();
}
PathSegment(Command command, ReadonlySpan<FloatPoint> points)
DeprecatedPathSegment(Command command, ReadonlySpan<FloatPoint> points)
: m_command(command)
, m_points(points) {};
@ -85,7 +85,7 @@ public:
PathSegmentIterator operator++()
{
if (m_command_index < m_commands.size())
m_point_index += PathSegment::points_per_command(m_commands[m_command_index++]);
m_point_index += DeprecatedPathSegment::points_per_command(m_commands[m_command_index++]);
return *this;
}
PathSegmentIterator operator++(int)
@ -98,7 +98,7 @@ public:
PathSegmentIterator operator--()
{
if (m_command_index > 0)
m_point_index -= PathSegment::points_per_command(m_commands[--m_command_index]);
m_point_index -= DeprecatedPathSegment::points_per_command(m_commands[--m_command_index]);
return *this;
}
PathSegmentIterator operator--(int)
@ -108,10 +108,10 @@ public:
return old;
}
PathSegment operator*() const
DeprecatedPathSegment operator*() const
{
auto command = m_commands[m_command_index];
return PathSegment { command, m_points.span().slice(m_point_index, PathSegment::points_per_command(command)) };
return DeprecatedPathSegment { command, m_points.span().slice(m_point_index, DeprecatedPathSegment::points_per_command(command)) };
}
PathSegmentIterator& operator=(PathSegmentIterator const& other)
@ -122,10 +122,10 @@ public:
}
PathSegmentIterator(PathSegmentIterator const&) = default;
friend Path;
friend DeprecatedPath;
private:
PathSegmentIterator(Vector<FloatPoint> const& points, Vector<PathSegment::Command> const& commands, size_t point_index = 0, size_t command_index = 0)
PathSegmentIterator(Vector<FloatPoint> const& points, Vector<DeprecatedPathSegment::Command> const& commands, size_t point_index = 0, size_t command_index = 0)
: m_points(points)
, m_commands(commands)
, m_point_index(point_index)
@ -133,25 +133,25 @@ private:
{
}
// Note: Store reference to vectors from Gfx::Path so appending segments does not invalidate iterators.
// Note: Store reference to vectors from Gfx::DeprecatedPath so appending segments does not invalidate iterators.
Vector<FloatPoint> const& m_points;
Vector<PathSegment::Command> const& m_commands;
Vector<DeprecatedPathSegment::Command> const& m_commands;
size_t m_point_index { 0 };
size_t m_command_index { 0 };
};
class Path {
class DeprecatedPath {
public:
Path() = default;
DeprecatedPath() = default;
void move_to(FloatPoint point)
{
append_segment<PathSegment::MoveTo>(point);
append_segment<DeprecatedPathSegment::MoveTo>(point);
}
void line_to(FloatPoint point)
{
append_segment<PathSegment::LineTo>(point);
append_segment<DeprecatedPathSegment::LineTo>(point);
invalidate_split_lines();
}
@ -167,13 +167,13 @@ public:
void quadratic_bezier_curve_to(FloatPoint through, FloatPoint point)
{
append_segment<PathSegment::QuadraticBezierCurveTo>(through, point);
append_segment<DeprecatedPathSegment::QuadraticBezierCurveTo>(through, point);
invalidate_split_lines();
}
void cubic_bezier_curve_to(FloatPoint c1, FloatPoint c2, FloatPoint p2)
{
append_segment<PathSegment::CubicBezierCurveTo>(c1, c2, p2);
append_segment<DeprecatedPathSegment::CubicBezierCurveTo>(c1, c2, p2);
invalidate_split_lines();
}
@ -195,16 +195,16 @@ public:
void close();
void close_all_subpaths();
Path stroke_to_fill(float thickness) const;
DeprecatedPath stroke_to_fill(float thickness) const;
Path place_text_along(Utf8View text, Font const&) const;
DeprecatedPath place_text_along(Utf8View text, Font const&) const;
Path copy_transformed(AffineTransform const&) const;
DeprecatedPath copy_transformed(AffineTransform const&) const;
ReadonlySpan<FloatLine> split_lines() const
{
if (!m_split_lines.has_value()) {
const_cast<Path*>(this)->segmentize_path();
const_cast<DeprecatedPath*>(this)->segmentize_path();
VERIFY(m_split_lines.has_value());
}
return m_split_lines->lines;
@ -216,7 +216,7 @@ public:
return m_split_lines->bounding_box;
}
void append_path(Path const& path)
void append_path(DeprecatedPath const& path)
{
m_commands.extend(path.m_commands);
m_points.extend(path.m_points);
@ -242,7 +242,7 @@ public:
void clear()
{
*this = Path {};
*this = DeprecatedPath {};
}
private:
@ -254,11 +254,11 @@ private:
}
void segmentize_path();
template<PathSegment::Command command, typename... Args>
template<DeprecatedPathSegment::Command command, typename... Args>
void append_segment(Args&&... args)
{
constexpr auto point_count = sizeof...(Args);
static_assert(point_count == PathSegment::points_per_command(command));
static_assert(point_count == DeprecatedPathSegment::points_per_command(command));
FloatPoint points[] { args... };
// Note: This should maintain the invariant that `m_points.last()` is always the last point in the path.
m_points.append(points, point_count);
@ -266,7 +266,7 @@ private:
}
Vector<FloatPoint> m_points {};
Vector<PathSegment::Command> m_commands {};
Vector<DeprecatedPathSegment::Command> m_commands {};
struct SplitLines {
Vector<FloatLine> lines;

View File

@ -99,13 +99,13 @@ EdgeFlagPathRasterizer<SamplesPerPixel>::EdgeFlagPathRasterizer(IntSize size)
}
template<unsigned SamplesPerPixel>
void EdgeFlagPathRasterizer<SamplesPerPixel>::fill(DeprecatedPainter& painter, Path const& path, Color color, WindingRule winding_rule, FloatPoint offset)
void EdgeFlagPathRasterizer<SamplesPerPixel>::fill(DeprecatedPainter& painter, DeprecatedPath const& path, Color color, WindingRule winding_rule, FloatPoint offset)
{
fill_internal(painter, path, color, winding_rule, offset);
}
template<unsigned SamplesPerPixel>
void EdgeFlagPathRasterizer<SamplesPerPixel>::fill(DeprecatedPainter& painter, Path const& path, PaintStyle const& style, float opacity, WindingRule winding_rule, FloatPoint offset)
void EdgeFlagPathRasterizer<SamplesPerPixel>::fill(DeprecatedPainter& painter, DeprecatedPath const& path, PaintStyle const& style, float opacity, WindingRule winding_rule, FloatPoint offset)
{
style.paint(enclosing_int_rect(path.bounding_box()), [&](PaintStyle::SamplerFunction sampler) {
if (opacity == 0.0f)
@ -122,7 +122,7 @@ void EdgeFlagPathRasterizer<SamplesPerPixel>::fill(DeprecatedPainter& painter, P
}
template<unsigned SamplesPerPixel>
void EdgeFlagPathRasterizer<SamplesPerPixel>::fill_internal(DeprecatedPainter& painter, Path const& path, auto color_or_function, WindingRule winding_rule, FloatPoint offset)
void EdgeFlagPathRasterizer<SamplesPerPixel>::fill_internal(DeprecatedPainter& painter, DeprecatedPath const& path, auto color_or_function, WindingRule winding_rule, FloatPoint offset)
{
auto bounding_box = enclosing_int_rect(path.bounding_box().translated(offset));
auto dest_rect = bounding_box.translated(painter.translation());
@ -430,7 +430,7 @@ FLATTEN __attribute__((hot)) void EdgeFlagPathRasterizer<SamplesPerPixel>::write
color_or_function, write_scanline_with_fast_fills, write_scanline_pixelwise);
}
static IntSize path_bounds(Gfx::Path const& path)
static IntSize path_bounds(Gfx::DeprecatedPath const& path)
{
return enclosing_int_rect(path.bounding_box()).size();
}
@ -439,25 +439,25 @@ static IntSize path_bounds(Gfx::Path const& path)
// since it would be harder to turn it off for the standard painter.
// The samples are reduced to 8 for Gfx::DeprecatedPainter though as a "speedy" option.
void DeprecatedPainter::fill_path(Path const& path, Color color, WindingRule winding_rule)
void DeprecatedPainter::fill_path(DeprecatedPath const& path, Color color, WindingRule winding_rule)
{
EdgeFlagPathRasterizer<8> rasterizer(path_bounds(path));
rasterizer.fill(*this, path, color, winding_rule);
}
void DeprecatedPainter::fill_path(Path const& path, PaintStyle const& paint_style, float opacity, WindingRule winding_rule)
void DeprecatedPainter::fill_path(DeprecatedPath const& path, PaintStyle const& paint_style, float opacity, WindingRule winding_rule)
{
EdgeFlagPathRasterizer<8> rasterizer(path_bounds(path));
rasterizer.fill(*this, path, paint_style, opacity, winding_rule);
}
void AntiAliasingPainter::fill_path(Path const& path, Color color, WindingRule winding_rule)
void AntiAliasingPainter::fill_path(DeprecatedPath const& path, Color color, WindingRule winding_rule)
{
EdgeFlagPathRasterizer<32> rasterizer(path_bounds(path));
rasterizer.fill(m_underlying_painter, path, color, winding_rule, m_transform.translation());
}
void AntiAliasingPainter::fill_path(Path const& path, PaintStyle const& paint_style, float opacity, WindingRule winding_rule)
void AntiAliasingPainter::fill_path(DeprecatedPath const& path, PaintStyle const& paint_style, float opacity, WindingRule winding_rule)
{
EdgeFlagPathRasterizer<32> rasterizer(path_bounds(path));
rasterizer.fill(m_underlying_painter, path, paint_style, opacity, winding_rule, m_transform.translation());

View File

@ -11,9 +11,9 @@
#include <AK/IntegralMath.h>
#include <AK/Vector.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/Forward.h>
#include <LibGfx/PaintStyle.h>
#include <LibGfx/Path.h>
#include <LibGfx/WindingRule.h>
namespace Gfx {
@ -147,8 +147,8 @@ class EdgeFlagPathRasterizer {
public:
EdgeFlagPathRasterizer(IntSize);
void fill(DeprecatedPainter&, Path const&, Color, WindingRule, FloatPoint offset = {});
void fill(DeprecatedPainter&, Path const&, PaintStyle const&, float opacity, WindingRule, FloatPoint offset = {});
void fill(DeprecatedPainter&, DeprecatedPath const&, Color, WindingRule, FloatPoint offset = {});
void fill(DeprecatedPainter&, DeprecatedPath const&, PaintStyle const&, float opacity, WindingRule, FloatPoint offset = {});
private:
using SubpixelSample = Detail::Sample<SamplesPerPixel>;
@ -174,7 +174,7 @@ private:
}
};
void fill_internal(DeprecatedPainter&, Path const&, auto color_or_function, WindingRule, FloatPoint offset);
void fill_internal(DeprecatedPainter&, DeprecatedPath const&, auto color_or_function, WindingRule, FloatPoint offset);
Detail::Edge* plot_edges_for_scanline(int scanline, auto plot_edge, EdgeExtent&, Detail::Edge* active_edges = nullptr);
template<WindingRule>

View File

@ -75,7 +75,7 @@ public:
virtual u16 weight() const = 0;
virtual bool contains_glyph(u32 code_point) const = 0;
virtual bool append_glyph_path_to(Gfx::Path&, u32 glyph_id) const = 0;
virtual bool append_glyph_path_to(Gfx::DeprecatedPath&, u32 glyph_id) const = 0;
virtual u32 glyph_id_for_code_point(u32 code_point) const = 0;
virtual float glyph_left_bearing(u32 code_point) const = 0;
virtual float glyph_width(u32 code_point) const = 0;

View File

@ -6,8 +6,8 @@
#include <LibGfx/AntiAliasingPainter.h>
#include <LibGfx/DeprecatedPainter.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/Font/OpenType/Glyf.h>
#include <LibGfx/Path.h>
#include <LibGfx/Point.h>
namespace OpenType {
@ -246,7 +246,7 @@ ReadonlyBytes Glyf::Glyph::program() const
return m_slice.slice(instructions_start + 2, num_instructions);
}
void Glyf::Glyph::append_path_impl(Gfx::Path& path, Gfx::AffineTransform const& transform) const
void Glyf::Glyph::append_path_impl(Gfx::DeprecatedPath& path, Gfx::AffineTransform const& transform) const
{
if (m_num_contours == 0)
return;
@ -302,7 +302,7 @@ void Glyf::Glyph::append_path_impl(Gfx::Path& path, Gfx::AffineTransform const&
}
}
bool Glyf::Glyph::append_simple_path(Gfx::Path& path, i16 font_ascender, i16 font_descender, float x_scale, float y_scale) const
bool Glyf::Glyph::append_simple_path(Gfx::DeprecatedPath& path, i16 font_ascender, i16 font_descender, float x_scale, float y_scale) const
{
if (m_xmin > m_xmax) [[unlikely]] {
dbgln("OpenType: Glyph has invalid xMin ({}) > xMax ({})", m_xmin, m_xmax);

View File

@ -11,9 +11,9 @@
#include <AK/Vector.h>
#include <LibGfx/AffineTransform.h>
#include <LibGfx/Bitmap.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Font/OpenType/Tables.h>
#include <LibGfx/Path.h>
#include <LibGfx/Size.h>
#include <math.h>
@ -74,7 +74,7 @@ public:
}
template<typename GlyphCb>
bool append_path(Gfx::Path& path, i16 font_ascender, i16 font_descender, float x_scale, float y_scale, GlyphCb glyph_callback) const
bool append_path(Gfx::DeprecatedPath& path, i16 font_ascender, i16 font_descender, float x_scale, float y_scale, GlyphCb glyph_callback) const
{
switch (m_type) {
case Type::Simple:
@ -118,11 +118,11 @@ public:
u32 m_offset { 0 };
};
void append_path_impl(Gfx::Path&, Gfx::AffineTransform const&) const;
bool append_simple_path(Gfx::Path&, i16 ascender, i16 descender, float x_scale, float y_scale) const;
void append_path_impl(Gfx::DeprecatedPath&, Gfx::AffineTransform const&) const;
bool append_simple_path(Gfx::DeprecatedPath&, i16 ascender, i16 descender, float x_scale, float y_scale) const;
template<typename GlyphCb>
void resolve_composite_path_loop(Gfx::Path& path, Gfx::AffineTransform const& transform, GlyphCb glyph_callback) const
void resolve_composite_path_loop(Gfx::DeprecatedPath& path, Gfx::AffineTransform const& transform, GlyphCb glyph_callback) const
{
ComponentIterator component_iterator(m_slice);
@ -147,7 +147,7 @@ public:
}
template<typename GlyphCb>
bool append_composite_path(Gfx::Path& path, i16 font_ascender, float x_scale, float y_scale, GlyphCb glyph_callback) const
bool append_composite_path(Gfx::DeprecatedPath& path, i16 font_ascender, float x_scale, float y_scale, GlyphCb glyph_callback) const
{
auto affine = Gfx::AffineTransform()
.translate(path.last_point())

View File

@ -526,7 +526,7 @@ Typeface::AscenderAndDescender Typeface::resolve_ascender_and_descender() const
return { ascender, descender };
}
Optional<Glyf::Glyph> Typeface::extract_and_append_glyph_path_to(Gfx::Path& path, u32 glyph_id, i16 ascender, i16 descender, float x_scale, float y_scale) const
Optional<Glyf::Glyph> Typeface::extract_and_append_glyph_path_to(Gfx::DeprecatedPath& path, u32 glyph_id, i16 ascender, i16 descender, float x_scale, float y_scale) const
{
if (!m_loca.has_value() || !m_glyf.has_value()) {
return {};
@ -560,7 +560,7 @@ Optional<Glyf::Glyph> Typeface::extract_and_append_glyph_path_to(Gfx::Path& path
return {};
}
bool Typeface::append_glyph_path_to(Gfx::Path& path, u32 glyph_id, float x_scale, float y_scale) const
bool Typeface::append_glyph_path_to(Gfx::DeprecatedPath& path, u32 glyph_id, float x_scale, float y_scale) const
{
auto ascender_and_descender = resolve_ascender_and_descender();
return extract_and_append_glyph_path_to(path, glyph_id, ascender_and_descender.ascender, ascender_and_descender.descender, x_scale, y_scale).has_value();

View File

@ -58,7 +58,7 @@ public:
virtual Gfx::ScaledGlyphMetrics glyph_metrics(u32 glyph_id, float x_scale, float y_scale, float point_width, float point_height) const override;
virtual float glyph_advance(u32 glyph_id, float x_scale, float y_scale, float point_width, float point_height) const override;
virtual float glyphs_horizontal_kerning(u32 left_glyph_id, u32 right_glyph_id, float x_scale) const override;
virtual bool append_glyph_path_to(Gfx::Path&, u32 glyph_id, float x_scale, float y_scale) const override;
virtual bool append_glyph_path_to(Gfx::DeprecatedPath&, u32 glyph_id, float x_scale, float y_scale) const override;
virtual u32 glyph_count() const override;
virtual u16 units_per_em() const override;
virtual u32 glyph_id_for_code_point(u32 code_point) const override;
@ -99,7 +99,7 @@ private:
AscenderAndDescender resolve_ascender_and_descender() const;
Optional<Glyf::Glyph> extract_and_append_glyph_path_to(Gfx::Path&, u32 glyph_id, i16 ascender, i16 descender, float x_scale, float y_scale) const;
Optional<Glyf::Glyph> extract_and_append_glyph_path_to(Gfx::DeprecatedPath&, u32 glyph_id, i16 ascender, i16 descender, float x_scale, float y_scale) const;
RefPtr<Gfx::Bitmap> color_bitmap(u32 glyph_id) const;

View File

@ -63,7 +63,7 @@ ALWAYS_INLINE float ScaledFont::unicode_view_width(T const& view) const
return longest_width;
}
bool ScaledFont::append_glyph_path_to(Gfx::Path& path, u32 glyph_id) const
bool ScaledFont::append_glyph_path_to(Gfx::DeprecatedPath& path, u32 glyph_id) const
{
return m_typeface->append_glyph_path_to(path, glyph_id, m_x_scale, m_y_scale);
}

View File

@ -35,7 +35,7 @@ public:
virtual float glyph_or_emoji_width(Utf8CodePointIterator&) const override;
virtual float glyphs_horizontal_kerning(u32 left_code_point, u32 right_code_point) const override;
virtual u32 glyph_id_for_code_point(u32 code_point) const override { return m_typeface->glyph_id_for_code_point(code_point); }
virtual bool append_glyph_path_to(Gfx::Path&, u32 glyph_id) const override;
virtual bool append_glyph_path_to(Gfx::DeprecatedPath&, u32 glyph_id) const override;
virtual float preferred_line_height() const override { return metrics().height() + metrics().line_gap; }
virtual int x_height() const override { return m_point_height; } // FIXME: Read from font
virtual u8 baseline() const override { return m_point_height; } // FIXME: Read from font

View File

@ -9,10 +9,10 @@
#include <AK/HashMap.h>
#include <AK/Noncopyable.h>
#include <AK/RefCounted.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/Font/Font.h>
#include <LibGfx/Font/FontData.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Path.h>
#define POINTS_PER_INCH 72.0f
#define DEFAULT_DPI 96
@ -51,7 +51,7 @@ public:
virtual ScaledGlyphMetrics glyph_metrics(u32 glyph_id, float x_scale, float y_scale, float point_width, float point_height) const = 0;
virtual float glyph_advance(u32 glyph_id, float x_scale, float y_scale, float point_width, float point_height) const = 0;
virtual float glyphs_horizontal_kerning(u32 left_glyph_id, u32 right_glyph_id, float x_scale) const = 0;
virtual bool append_glyph_path_to(Gfx::Path&, u32 glyph_id, float x_scale, float y_scale) const = 0;
virtual bool append_glyph_path_to(Gfx::DeprecatedPath&, u32 glyph_id, float x_scale, float y_scale) const = 0;
virtual u32 glyph_count() const = 0;
virtual u16 units_per_em() const = 0;

View File

@ -30,7 +30,7 @@ class DeprecatedPainter;
class Painter;
class Palette;
class PaletteImpl;
class Path;
class DeprecatedPath;
class ShareableBitmap;
struct SystemTheme;

View File

@ -255,9 +255,9 @@ public:
return FloatLine { TRY(read_point()), TRY(read_point()) };
}
ErrorOr<Path> read_path(u32 segment_count)
ErrorOr<DeprecatedPath> read_path(u32 segment_count)
{
Path path;
DeprecatedPath path;
auto segment_lengths = TRY(FixedArray<u32>::create(segment_count));
for (auto& command_count : segment_lengths) {
command_count = TRY(read_var_uint()) + 1;
@ -367,8 +367,8 @@ ErrorOr<NonnullRefPtr<TinyVGDecodedImageData>> TinyVGDecodedImageData::decode(St
auto color_table = TRY(decode_color_table(stream, header.color_encoding, header.color_count));
TinyVGReader reader { stream, header, color_table.span() };
auto rectangle_to_path = [](FloatRect const& rect) -> Path {
Path path;
auto rectangle_to_path = [](FloatRect const& rect) -> DeprecatedPath {
DeprecatedPath path;
path.move_to({ rect.x(), rect.y() });
path.line_to({ rect.x() + rect.width(), rect.y() });
path.line_to({ rect.x() + rect.width(), rect.y() + rect.height() });
@ -390,7 +390,7 @@ ErrorOr<NonnullRefPtr<TinyVGDecodedImageData>> TinyVGDecodedImageData::decode(St
break;
case Command::FillPolygon: {
auto header = TRY(reader.read_fill_command_header(style_type));
Path polygon;
DeprecatedPath polygon;
polygon.move_to(TRY(reader.read_point()));
for (u32 i = 0; i < header.count - 1; i++)
polygon.line_to(TRY(reader.read_point()));
@ -413,7 +413,7 @@ ErrorOr<NonnullRefPtr<TinyVGDecodedImageData>> TinyVGDecodedImageData::decode(St
}
case Command::DrawLines: {
auto header = TRY(reader.read_draw_command_header(style_type));
Path path;
DeprecatedPath path;
for (u32 i = 0; i < header.count; i++) {
auto line = TRY(reader.read_line());
path.move_to(line.a());
@ -425,7 +425,7 @@ ErrorOr<NonnullRefPtr<TinyVGDecodedImageData>> TinyVGDecodedImageData::decode(St
case Command::DrawLineStrip:
case Command::DrawLineLoop: {
auto header = TRY(reader.read_draw_command_header(style_type));
Path path;
DeprecatedPath path;
path.move_to(TRY(reader.read_point()));
for (u32 i = 0; i < header.count - 1; i++)
path.line_to(TRY(reader.read_point()));
@ -442,7 +442,7 @@ ErrorOr<NonnullRefPtr<TinyVGDecodedImageData>> TinyVGDecodedImageData::decode(St
}
case Command::OutlineFillPolygon: {
auto header = TRY(reader.read_outline_fill_command_header(style_type));
Path polygon;
DeprecatedPath polygon;
polygon.move_to(TRY(reader.read_point()));
for (u32 i = 0; i < header.count - 1; i++)
polygon.line_to(TRY(reader.read_point()));

View File

@ -10,10 +10,10 @@
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
#include <LibGfx/Color.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/Forward.h>
#include <LibGfx/ImageFormats/ImageDecoder.h>
#include <LibGfx/PaintStyle.h>
#include <LibGfx/Path.h>
#include <LibGfx/VectorGraphic.h>
namespace Gfx {
@ -41,7 +41,7 @@ public:
using Style = Variant<Color, NonnullRefPtr<SVGGradientPaintStyle>>;
struct DrawCommand {
Path path;
DeprecatedPath path;
Optional<Style> fill {};
Optional<Style> stroke {};
float stroke_width { 0.0f };

View File

@ -25,11 +25,11 @@ public:
virtual void draw_bitmap(Gfx::FloatRect const& dst_rect, Gfx::Bitmap const& src_bitmap, Gfx::IntRect const& src_rect, Gfx::ScalingMode, float global_alpha) = 0;
virtual void stroke_path(Gfx::Path const&, Gfx::Color, float thickness) = 0;
virtual void stroke_path(Gfx::Path const&, Gfx::PaintStyle const&, float thickness, float global_alpha) = 0;
virtual void stroke_path(Gfx::DeprecatedPath const&, Gfx::Color, float thickness) = 0;
virtual void stroke_path(Gfx::DeprecatedPath const&, Gfx::PaintStyle const&, float thickness, float global_alpha) = 0;
virtual void fill_path(Gfx::Path const&, Gfx::Color, Gfx::WindingRule) = 0;
virtual void fill_path(Gfx::Path const&, Gfx::PaintStyle const&, float global_alpha, Gfx::WindingRule) = 0;
virtual void fill_path(Gfx::DeprecatedPath const&, Gfx::Color, Gfx::WindingRule) = 0;
virtual void fill_path(Gfx::DeprecatedPath const&, Gfx::PaintStyle const&, float global_alpha, Gfx::WindingRule) = 0;
virtual void set_transform(Gfx::AffineTransform const&) = 0;

View File

@ -7,8 +7,8 @@
#define AK_DONT_REPLACE_STD
#include <AK/OwnPtr.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/PainterSkia.h>
#include <LibGfx/Path.h>
#include <AK/TypeCasts.h>
#include <core/SkBitmap.h>
@ -56,7 +56,7 @@ static constexpr SkColor to_skia_color(Gfx::Color const& color)
return SkColorSetARGB(color.alpha(), color.red(), color.green(), color.blue());
}
static SkPath to_skia_path(Gfx::Path const& path)
static SkPath to_skia_path(Gfx::DeprecatedPath const& path)
{
Optional<Gfx::FloatPoint> subpath_start_point;
Optional<Gfx::FloatPoint> subpath_last_point;
@ -68,20 +68,20 @@ static SkPath to_skia_path(Gfx::Path const& path)
for (auto const& segment : path) {
auto point = segment.point();
switch (segment.command()) {
case Gfx::PathSegment::Command::MoveTo: {
case Gfx::DeprecatedPathSegment::Command::MoveTo: {
if (subpath_start_point.has_value() && subpath_last_point.has_value())
close_subpath_if_needed(subpath_last_point.value());
subpath_start_point = point;
path_builder.moveTo({ point.x(), point.y() });
break;
}
case Gfx::PathSegment::Command::LineTo: {
case Gfx::DeprecatedPathSegment::Command::LineTo: {
if (!subpath_start_point.has_value())
subpath_start_point = Gfx::FloatPoint { 0.0f, 0.0f };
path_builder.lineTo({ point.x(), point.y() });
break;
}
case Gfx::PathSegment::Command::QuadraticBezierCurveTo: {
case Gfx::DeprecatedPathSegment::Command::QuadraticBezierCurveTo: {
if (!subpath_start_point.has_value())
subpath_start_point = Gfx::FloatPoint { 0.0f, 0.0f };
SkPoint pt1 = { segment.through().x(), segment.through().y() };
@ -89,7 +89,7 @@ static SkPath to_skia_path(Gfx::Path const& path)
path_builder.quadTo(pt1, pt2);
break;
}
case Gfx::PathSegment::Command::CubicBezierCurveTo: {
case Gfx::DeprecatedPathSegment::Command::CubicBezierCurveTo: {
if (!subpath_start_point.has_value())
subpath_start_point = Gfx::FloatPoint { 0.0f, 0.0f };
SkPoint pt1 = { segment.through_0().x(), segment.through_0().y() };
@ -200,7 +200,7 @@ void PainterSkia::set_transform(Gfx::AffineTransform const& transform)
impl().canvas()->setMatrix(matrix);
}
void PainterSkia::stroke_path(Gfx::Path const& path, Gfx::Color color, float thickness)
void PainterSkia::stroke_path(Gfx::DeprecatedPath const& path, Gfx::Color color, float thickness)
{
// Skia treats zero thickness as a special case and will draw a hairline, while we want to draw nothing.
if (!thickness)
@ -278,7 +278,7 @@ static SkPaint to_skia_paint(Gfx::PaintStyle const& style, Gfx::FloatRect const&
return {};
}
void PainterSkia::stroke_path(Gfx::Path const& path, Gfx::PaintStyle const& paint_style, float thickness, float global_alpha)
void PainterSkia::stroke_path(Gfx::DeprecatedPath const& path, Gfx::PaintStyle const& paint_style, float thickness, float global_alpha)
{
// Skia treats zero thickness as a special case and will draw a hairline, while we want to draw nothing.
if (!thickness)
@ -293,7 +293,7 @@ void PainterSkia::stroke_path(Gfx::Path const& path, Gfx::PaintStyle const& pain
impl().canvas()->drawPath(sk_path, paint);
}
void PainterSkia::fill_path(Gfx::Path const& path, Gfx::Color color, Gfx::WindingRule winding_rule)
void PainterSkia::fill_path(Gfx::DeprecatedPath const& path, Gfx::Color color, Gfx::WindingRule winding_rule)
{
SkPaint paint;
paint.setAntiAlias(true);
@ -303,7 +303,7 @@ void PainterSkia::fill_path(Gfx::Path const& path, Gfx::Color color, Gfx::Windin
impl().canvas()->drawPath(sk_path, paint);
}
void PainterSkia::fill_path(Gfx::Path const& path, Gfx::PaintStyle const& paint_style, float global_alpha, Gfx::WindingRule winding_rule)
void PainterSkia::fill_path(Gfx::DeprecatedPath const& path, Gfx::PaintStyle const& paint_style, float global_alpha, Gfx::WindingRule winding_rule)
{
auto sk_path = to_skia_path(path);
sk_path.setFillType(to_skia_path_fill_type(winding_rule));

View File

@ -20,10 +20,10 @@ public:
virtual void clear_rect(Gfx::FloatRect const&, Color) override;
virtual void fill_rect(Gfx::FloatRect const&, Color) override;
virtual void draw_bitmap(Gfx::FloatRect const& dst_rect, Gfx::Bitmap const& src_bitmap, Gfx::IntRect const& src_rect, Gfx::ScalingMode, float global_alpha) override;
virtual void stroke_path(Gfx::Path const&, Gfx::Color, float thickness) override;
virtual void stroke_path(Gfx::Path const&, Gfx::PaintStyle const&, float thickness, float global_alpha) override;
virtual void fill_path(Gfx::Path const&, Gfx::Color, Gfx::WindingRule) override;
virtual void fill_path(Gfx::Path const&, Gfx::PaintStyle const&, float global_alpha, Gfx::WindingRule) override;
virtual void stroke_path(Gfx::DeprecatedPath const&, Gfx::Color, float thickness) override;
virtual void stroke_path(Gfx::DeprecatedPath const&, Gfx::PaintStyle const&, float thickness, float global_alpha) override;
virtual void fill_path(Gfx::DeprecatedPath const&, Gfx::Color, Gfx::WindingRule) override;
virtual void fill_path(Gfx::DeprecatedPath const&, Gfx::PaintStyle const&, float global_alpha, Gfx::WindingRule) override;
virtual void set_transform(Gfx::AffineTransform const&) override;
virtual void save() override;
virtual void restore() override;

View File

@ -7,14 +7,14 @@
#pragma once
#include <LibGfx/Bitmap.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Path.h>
#include <LibGfx/WindingRule.h>
namespace Gfx {
struct ClipPath {
Path path;
DeprecatedPath path;
WindingRule winding_rule;
};

View File

@ -8,9 +8,9 @@
namespace Web::CSS {
Gfx::Path Polygon::to_path(CSSPixelRect reference_box, Layout::Node const& node) const
Gfx::DeprecatedPath Polygon::to_path(CSSPixelRect reference_box, Layout::Node const& node) const
{
Gfx::Path path;
Gfx::DeprecatedPath path;
bool first = true;
for (auto const& point : points) {
Gfx::FloatPoint resolved_point {
@ -44,7 +44,7 @@ String Polygon::to_string() const
BasicShapeStyleValue::~BasicShapeStyleValue() = default;
Gfx::Path BasicShapeStyleValue::to_path(CSSPixelRect reference_box, Layout::Node const& node) const
Gfx::DeprecatedPath BasicShapeStyleValue::to_path(CSSPixelRect reference_box, Layout::Node const& node) const
{
return m_basic_shape.visit([&](auto const& shape) {
return shape.to_path(reference_box, node);

View File

@ -7,7 +7,7 @@
#pragma once
#include <AK/Variant.h>
#include <LibGfx/Path.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibWeb/CSS/CSSStyleValue.h>
#include <LibWeb/CSS/PercentageOr.h>
@ -20,7 +20,7 @@ struct Polygon {
LengthPercentage y;
};
Gfx::Path to_path(CSSPixelRect reference_box, Layout::Node const&) const;
Gfx::DeprecatedPath to_path(CSSPixelRect reference_box, Layout::Node const&) const;
String to_string() const;
bool operator==(Polygon const&) const = default;
@ -46,7 +46,7 @@ public:
bool properties_equal(BasicShapeStyleValue const& other) const { return m_basic_shape == other.m_basic_shape; }
Gfx::Path to_path(CSSPixelRect reference_box, Layout::Node const&) const;
Gfx::DeprecatedPath to_path(CSSPixelRect reference_box, Layout::Node const&) const;
private:
BasicShapeStyleValue(BasicShape basic_shape)

View File

@ -6,7 +6,7 @@
#pragma once
#include <LibGfx/Path.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibWeb/Geometry/DOMPointReadOnly.h>
#include <LibWeb/HTML/Canvas/CanvasState.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
@ -30,8 +30,8 @@ public:
WebIDL::ExceptionOr<void> arc(float x, float y, float radius, float start_angle, float end_angle, bool counter_clockwise);
WebIDL::ExceptionOr<void> ellipse(float x, float y, float radius_x, float radius_y, float rotation, float start_angle, float end_angle, bool counter_clockwise);
Gfx::Path& path() { return m_path; }
Gfx::Path const& path() const { return m_path; }
Gfx::DeprecatedPath& path() { return m_path; }
Gfx::DeprecatedPath const& path() const { return m_path; }
protected:
explicit CanvasPath(Bindings::PlatformObject& self)
@ -52,7 +52,7 @@ private:
JS::NonnullGCPtr<Bindings::PlatformObject> m_self;
Optional<CanvasState const&> m_canvas_state;
Gfx::Path m_path;
Gfx::DeprecatedPath m_path;
};
}

View File

@ -71,7 +71,7 @@ JS::NonnullGCPtr<HTMLCanvasElement> CanvasRenderingContext2D::canvas_for_binding
return *m_element;
}
Gfx::Path CanvasRenderingContext2D::rect_path(float x, float y, float width, float height)
Gfx::DeprecatedPath CanvasRenderingContext2D::rect_path(float x, float y, float width, float height)
{
auto& drawing_state = this->drawing_state();
@ -80,7 +80,7 @@ Gfx::Path CanvasRenderingContext2D::rect_path(float x, float y, float width, flo
auto bottom_left = drawing_state.transform.map(Gfx::FloatPoint(x, y + height));
auto bottom_right = drawing_state.transform.map(Gfx::FloatPoint(x + width, y + height));
Gfx::Path path;
Gfx::DeprecatedPath path;
path.move_to(top_left);
path.line_to(top_right);
path.line_to(bottom_right);
@ -191,7 +191,7 @@ Gfx::Painter* CanvasRenderingContext2D::painter()
return m_painter.ptr();
}
Gfx::Path CanvasRenderingContext2D::text_path(StringView text, float x, float y, Optional<double> max_width)
Gfx::DeprecatedPath CanvasRenderingContext2D::text_path(StringView text, float x, float y, Optional<double> max_width)
{
if (max_width.has_value() && max_width.value() <= 0)
return {};
@ -199,7 +199,7 @@ Gfx::Path CanvasRenderingContext2D::text_path(StringView text, float x, float y,
auto& drawing_state = this->drawing_state();
auto font = current_font();
Gfx::Path path;
Gfx::DeprecatedPath path;
path.move_to({ x, y });
path.text(Utf8View { text }, *font);
@ -260,7 +260,7 @@ void CanvasRenderingContext2D::begin_path()
path().clear();
}
void CanvasRenderingContext2D::stroke_internal(Gfx::Path const& path)
void CanvasRenderingContext2D::stroke_internal(Gfx::DeprecatedPath const& path)
{
auto* painter = this->painter();
if (!painter)
@ -298,7 +298,7 @@ static Gfx::WindingRule parse_fill_rule(StringView fill_rule)
return Gfx::WindingRule::Nonzero;
}
void CanvasRenderingContext2D::fill_internal(Gfx::Path const& path, Gfx::WindingRule winding_rule)
void CanvasRenderingContext2D::fill_internal(Gfx::DeprecatedPath const& path, Gfx::WindingRule winding_rule)
{
auto* painter = this->painter();
if (!painter)
@ -543,7 +543,7 @@ CanvasRenderingContext2D::PreparedText CanvasRenderingContext2D::prepare_text(By
return prepared_text;
}
void CanvasRenderingContext2D::clip_internal(Gfx::Path& path, Gfx::WindingRule winding_rule)
void CanvasRenderingContext2D::clip_internal(Gfx::DeprecatedPath& path, Gfx::WindingRule winding_rule)
{
// FIXME: This should calculate the new clip path by intersecting the given path with the current one.
// See: https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-clip-dev

View File

@ -11,9 +11,9 @@
#include <AK/Variant.h>
#include <LibGfx/AffineTransform.h>
#include <LibGfx/Color.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/Forward.h>
#include <LibGfx/Painter.h>
#include <LibGfx/Path.h>
#include <LibGfx/PathClipper.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/HTML/Canvas/CanvasCompositing.h>
@ -124,13 +124,13 @@ private:
PreparedText prepare_text(ByteString const& text, float max_width = INFINITY);
Gfx::Path rect_path(float x, float y, float width, float height);
Gfx::DeprecatedPath rect_path(float x, float y, float width, float height);
Gfx::Path text_path(StringView text, float x, float y, Optional<double> max_width);
Gfx::DeprecatedPath text_path(StringView text, float x, float y, Optional<double> max_width);
void stroke_internal(Gfx::Path const&);
void fill_internal(Gfx::Path const&, Gfx::WindingRule);
void clip_internal(Gfx::Path&, Gfx::WindingRule);
void stroke_internal(Gfx::DeprecatedPath const&);
void fill_internal(Gfx::DeprecatedPath const&, Gfx::WindingRule);
void clip_internal(Gfx::DeprecatedPath&, Gfx::WindingRule);
JS::NonnullGCPtr<HTMLCanvasElement> m_element;
OwnPtr<Gfx::Painter> m_painter;

View File

@ -7,7 +7,7 @@
#pragma once
#include <AK/RefCounted.h>
#include <LibGfx/Path.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/Geometry/DOMMatrixReadOnly.h>
#include <LibWeb/HTML/Canvas/CanvasPath.h>

View File

@ -132,7 +132,7 @@ struct LayoutState {
void set_table_cell_coordinates(Painting::PaintableBox::TableCellCoordinates const& table_cell_coordinates) { m_table_cell_coordinates = table_cell_coordinates; }
auto const& table_cell_coordinates() const { return m_table_cell_coordinates; }
void set_computed_svg_path(Gfx::Path const& svg_path) { m_computed_svg_path = svg_path; }
void set_computed_svg_path(Gfx::DeprecatedPath const& svg_path) { m_computed_svg_path = svg_path; }
auto& computed_svg_path() { return m_computed_svg_path; }
void set_computed_svg_transforms(Painting::SVGGraphicsPaintable::ComputedTransforms const& computed_transforms) { m_computed_svg_transforms = computed_transforms; }
@ -163,7 +163,7 @@ struct LayoutState {
Optional<Painting::PaintableBox::BordersDataWithElementKind> m_override_borders_data;
Optional<Painting::PaintableBox::TableCellCoordinates> m_table_cell_coordinates;
Optional<Gfx::Path> m_computed_svg_path;
Optional<Gfx::DeprecatedPath> m_computed_svg_path;
Optional<Painting::SVGGraphicsPaintable::ComputedTransforms> m_computed_svg_transforms;
};

View File

@ -301,7 +301,7 @@ void SVGFormattingContext::layout_nested_viewport(Box const& viewport)
nested_context.run(static_cast<Box const&>(viewport), LayoutMode::Normal, *m_available_space);
}
Gfx::Path SVGFormattingContext::compute_path_for_text(SVGTextBox const& text_box)
Gfx::DeprecatedPath SVGFormattingContext::compute_path_for_text(SVGTextBox const& text_box)
{
auto& text_element = static_cast<SVG::SVGTextPositioningElement const&>(text_box.dom_node());
auto& font = text_box.first_available_font();
@ -333,13 +333,13 @@ Gfx::Path SVGFormattingContext::compute_path_for_text(SVGTextBox const& text_box
VERIFY_NOT_REACHED();
}
Gfx::Path path;
Gfx::DeprecatedPath path;
path.move_to(text_offset);
path.text(text_utf8, font);
return path;
}
Gfx::Path SVGFormattingContext::compute_path_for_text_path(SVGTextPathBox const& text_path_box)
Gfx::DeprecatedPath SVGFormattingContext::compute_path_for_text_path(SVGTextPathBox const& text_path_box)
{
auto& text_path_element = static_cast<SVG::SVGTextPathElement const&>(text_path_box.dom_node());
auto path_or_shape = text_path_element.path_or_shape();
@ -363,7 +363,7 @@ void SVGFormattingContext::layout_path_like_element(SVGGraphicsBox const& graphi
.multiply(m_current_viewbox_transform)
.multiply(graphics_box_state.computed_svg_transforms()->svg_transform());
Gfx::Path path;
Gfx::DeprecatedPath path;
if (is<SVGGeometryBox>(graphics_box)) {
auto& geometry_box = static_cast<SVGGeometryBox const&>(graphics_box);
path = const_cast<SVGGeometryBox&>(geometry_box).dom_node().get_path(m_viewport_size);

View File

@ -6,7 +6,7 @@
#pragma once
#include <LibGfx/Path.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibWeb/Forward.h>
#include <LibWeb/Layout/FormattingContext.h>
#include <LibWeb/Layout/SVGSVGBox.h>
@ -32,8 +32,8 @@ private:
void layout_path_like_element(SVGGraphicsBox const&);
void layout_mask_or_clip(SVGBox const&);
Gfx::Path compute_path_for_text(SVGTextBox const&);
Gfx::Path compute_path_for_text_path(SVGTextPathBox const&);
Gfx::DeprecatedPath compute_path_for_text(SVGTextBox const&);
Gfx::DeprecatedPath compute_path_for_text_path(SVGTextPathBox const&);
Gfx::AffineTransform m_parent_viewbox_transform {};

View File

@ -61,7 +61,7 @@ Gfx::Color border_color(BorderEdge edge, BordersDataDevicePixels const& borders_
return border_data.color;
}
void paint_border(DisplayListRecorder& painter, BorderEdge edge, DevicePixelRect const& rect, Gfx::AntiAliasingPainter::CornerRadius const& radius, Gfx::AntiAliasingPainter::CornerRadius const& opposite_radius, BordersDataDevicePixels const& borders_data, Gfx::Path& path, bool last)
void paint_border(DisplayListRecorder& painter, BorderEdge edge, DevicePixelRect const& rect, Gfx::AntiAliasingPainter::CornerRadius const& radius, Gfx::AntiAliasingPainter::CornerRadius const& opposite_radius, BordersDataDevicePixels const& borders_data, Gfx::DeprecatedPath& path, bool last)
{
auto const& border_data = [&] {
switch (edge) {
@ -553,7 +553,7 @@ void paint_all_borders(DisplayListRecorder& painter, DevicePixelRect const& bord
borders.enqueue(borders.dequeue());
}
Gfx::Path path;
Gfx::DeprecatedPath path;
for (BorderEdge edge : borders) {
switch (edge) {
case BorderEdge::Top:

View File

@ -26,7 +26,7 @@ enum class BorderEdge {
// Returns OptionalNone if there is no outline to paint.
Optional<BordersData> borders_data_for_outline(Layout::Node const&, Color outline_color, CSS::OutlineStyle outline_style, CSSPixels outline_width);
void paint_border(DisplayListRecorder& painter, BorderEdge edge, DevicePixelRect const& rect, Gfx::AntiAliasingPainter::CornerRadius const& radius, Gfx::AntiAliasingPainter::CornerRadius const& opposite_radius, BordersDataDevicePixels const& borders_data, Gfx::Path& path, bool last);
void paint_border(DisplayListRecorder& painter, BorderEdge edge, DevicePixelRect const& rect, Gfx::AntiAliasingPainter::CornerRadius const& radius, Gfx::AntiAliasingPainter::CornerRadius const& opposite_radius, BordersDataDevicePixels const& borders_data, Gfx::DeprecatedPath& path, bool last);
void paint_all_borders(DisplayListRecorder& painter, DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const&);
Gfx::Color border_color(BorderEdge edge, BordersDataDevicePixels const& borders_data);

View File

@ -18,9 +18,9 @@ namespace Web::Painting {
JS_DEFINE_ALLOCATOR(CheckBoxPaintable);
static Gfx::Path check_mark_path(Gfx::IntRect checkbox_rect)
static Gfx::DeprecatedPath check_mark_path(Gfx::IntRect checkbox_rect)
{
Gfx::Path path;
Gfx::DeprecatedPath path;
path.move_to({ 72, 14 });
path.line_to({ 37, 64 });
path.line_to({ 19, 47 });

View File

@ -178,7 +178,7 @@ struct FillRectWithRoundedCorners {
struct FillPathUsingColor {
Gfx::IntRect path_bounding_rect;
Gfx::Path path;
Gfx::DeprecatedPath path;
Color color;
Gfx::WindingRule winding_rule;
Gfx::FloatPoint aa_translation;
@ -194,7 +194,7 @@ struct FillPathUsingColor {
struct FillPathUsingPaintStyle {
Gfx::IntRect path_bounding_rect;
Gfx::Path path;
Gfx::DeprecatedPath path;
PaintStyle paint_style;
Gfx::WindingRule winding_rule;
float opacity;
@ -211,7 +211,7 @@ struct FillPathUsingPaintStyle {
struct StrokePathUsingColor {
Gfx::IntRect path_bounding_rect;
Gfx::Path path;
Gfx::DeprecatedPath path;
Color color;
float thickness;
Gfx::FloatPoint aa_translation;
@ -227,7 +227,7 @@ struct StrokePathUsingColor {
struct StrokePathUsingPaintStyle {
Gfx::IntRect path_bounding_rect;
Gfx::Path path;
Gfx::DeprecatedPath path;
PaintStyle paint_style;
float thickness;
float opacity = 1.0f;

View File

@ -237,7 +237,7 @@ static SkColor4f to_skia_color4f(Gfx::Color const& color)
};
}
static SkPath to_skia_path(Gfx::Path const& path)
static SkPath to_skia_path(Gfx::DeprecatedPath const& path)
{
Optional<Gfx::FloatPoint> subpath_start_point;
Optional<Gfx::FloatPoint> subpath_last_point;
@ -249,20 +249,20 @@ static SkPath to_skia_path(Gfx::Path const& path)
for (auto const& segment : path) {
auto point = segment.point();
switch (segment.command()) {
case Gfx::PathSegment::Command::MoveTo: {
case Gfx::DeprecatedPathSegment::Command::MoveTo: {
if (subpath_start_point.has_value() && subpath_last_point.has_value())
close_subpath_if_needed(subpath_last_point.value());
subpath_start_point = point;
path_builder.moveTo({ point.x(), point.y() });
break;
}
case Gfx::PathSegment::Command::LineTo: {
case Gfx::DeprecatedPathSegment::Command::LineTo: {
if (!subpath_start_point.has_value())
subpath_start_point = Gfx::FloatPoint { 0.0f, 0.0f };
path_builder.lineTo({ point.x(), point.y() });
break;
}
case Gfx::PathSegment::Command::QuadraticBezierCurveTo: {
case Gfx::DeprecatedPathSegment::Command::QuadraticBezierCurveTo: {
if (!subpath_start_point.has_value())
subpath_start_point = Gfx::FloatPoint { 0.0f, 0.0f };
SkPoint pt1 = { segment.through().x(), segment.through().y() };
@ -270,7 +270,7 @@ static SkPath to_skia_path(Gfx::Path const& path)
path_builder.quadTo(pt1, pt2);
break;
}
case Gfx::PathSegment::Command::CubicBezierCurveTo: {
case Gfx::DeprecatedPathSegment::Command::CubicBezierCurveTo: {
if (!subpath_start_point.has_value())
subpath_start_point = Gfx::FloatPoint { 0.0f, 0.0f };
SkPoint pt1 = { segment.through_0().x(), segment.through_0().y() };

View File

@ -43,7 +43,7 @@ public:
void fill_rect(Gfx::IntRect const& rect, Color color);
struct FillPathUsingColorParams {
Gfx::Path path;
Gfx::DeprecatedPath path;
Gfx::Color color;
Gfx::WindingRule winding_rule = Gfx::WindingRule::EvenOdd;
Optional<Gfx::FloatPoint> translation = {};
@ -51,7 +51,7 @@ public:
void fill_path(FillPathUsingColorParams params);
struct FillPathUsingPaintStyleParams {
Gfx::Path path;
Gfx::DeprecatedPath path;
PaintStyle paint_style;
Gfx::WindingRule winding_rule = Gfx::WindingRule::EvenOdd;
float opacity;
@ -60,7 +60,7 @@ public:
void fill_path(FillPathUsingPaintStyleParams params);
struct StrokePathUsingColorParams {
Gfx::Path path;
Gfx::DeprecatedPath path;
Gfx::Color color;
float thickness;
Optional<Gfx::FloatPoint> translation = {};
@ -68,7 +68,7 @@ public:
void stroke_path(StrokePathUsingColorParams params);
struct StrokePathUsingPaintStyleParams {
Gfx::Path path;
Gfx::DeprecatedPath path;
PaintStyle paint_style;
float thickness;
float opacity;

View File

@ -83,7 +83,7 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
// FIXME: If the image is directional, it must respond to the writing mode of the element, similar to the bidi-sensitive images feature of the Images 4 module.
// Draw an equilateral triangle pointing right.
auto path = Gfx::Path();
auto path = Gfx::DeprecatedPath();
path.move_to({ left, top });
path.line_to({ left + sin_60_deg * (right - left), (top + bottom) / 2 });
path.line_to({ left, bottom });
@ -97,7 +97,7 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
// FIXME: If the image is directional, it must respond to the writing mode of the element, similar to the bidi-sensitive images feature of the Images 4 module.
// Draw an equilateral triangle pointing down.
auto path = Gfx::Path();
auto path = Gfx::DeprecatedPath();
path.move_to({ left, top });
path.line_to({ right, top });
path.line_to({ (left + right) / 2, top + sin_60_deg * (bottom - top) });

View File

@ -46,7 +46,7 @@ Optional<DevicePixelPoint> MediaPaintable::mouse_position(PaintContext& context,
void MediaPaintable::fill_triangle(DisplayListRecorder& painter, Gfx::IntPoint location, Array<Gfx::IntPoint, 3> coordinates, Color color)
{
Gfx::Path path;
Gfx::DeprecatedPath path;
path.move_to((coordinates[0] + location).to_type<float>());
path.line_to((coordinates[1] + location).to_type<float>());
path.line_to((coordinates[2] + location).to_type<float>());
@ -217,7 +217,7 @@ void MediaPaintable::paint_control_bar_speaker(PaintContext& context, HTML::HTML
auto speaker_button_is_hovered = rect_is_hovered(media_element, components.speaker_button_rect, mouse_position);
auto speaker_button_color = control_button_color(speaker_button_is_hovered);
Gfx::Path path;
Gfx::DeprecatedPath path;
path.move_to(device_point(0, 4));
path.line_to(device_point(5, 4));

View File

@ -72,7 +72,7 @@ void SVGPathPaintable::paint(PaintContext& context, PaintPhase phase) const
auto maybe_view_box = svg_node->dom_node().view_box();
auto paint_transform = computed_transforms().svg_to_device_pixels_transform(context);
Gfx::Path path = computed_path()->copy_transformed(paint_transform);
Gfx::DeprecatedPath path = computed_path()->copy_transformed(paint_transform);
// Fills are computed as though all subpaths are closed (https://svgwg.org/svg2-draft/painting.html#FillProperties)
auto closed_path = [&] {

View File

@ -24,17 +24,17 @@ public:
Layout::SVGGraphicsBox const& layout_box() const;
void set_computed_path(Gfx::Path path)
void set_computed_path(Gfx::DeprecatedPath path)
{
m_computed_path = move(path);
}
Optional<Gfx::Path> const& computed_path() const { return m_computed_path; }
Optional<Gfx::DeprecatedPath> const& computed_path() const { return m_computed_path; }
protected:
SVGPathPaintable(Layout::SVGGraphicsBox const&);
Optional<Gfx::Path> m_computed_path = {};
Optional<Gfx::DeprecatedPath> m_computed_path = {};
};
}

View File

@ -46,7 +46,7 @@ void SVGCircleElement::apply_presentational_hints(CSS::StyleProperties& style) c
style.set_property(CSS::PropertyID::R, r_value.release_nonnull());
}
Gfx::Path SVGCircleElement::get_path(CSSPixelSize viewport_size)
Gfx::DeprecatedPath SVGCircleElement::get_path(CSSPixelSize viewport_size)
{
auto node = layout_node();
auto cx = float(node->computed_values().cx().to_px(*node, viewport_size.width()));
@ -59,7 +59,7 @@ Gfx::Path SVGCircleElement::get_path(CSSPixelSize viewport_size)
if (r == 0)
return {};
Gfx::Path path;
Gfx::DeprecatedPath path;
bool large_arc = false;
bool sweep = true;

View File

@ -20,7 +20,7 @@ public:
virtual void apply_presentational_hints(CSS::StyleProperties&) const override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
virtual Gfx::DeprecatedPath get_path(CSSPixelSize viewport_size) override;
JS::NonnullGCPtr<SVGAnimatedLength> cx() const;
JS::NonnullGCPtr<SVGAnimatedLength> cy() const;

View File

@ -40,13 +40,13 @@ void SVGEllipseElement::attribute_changed(FlyString const& name, Optional<String
}
}
Gfx::Path SVGEllipseElement::get_path(CSSPixelSize)
Gfx::DeprecatedPath SVGEllipseElement::get_path(CSSPixelSize)
{
float rx = m_radius_x.value_or(0);
float ry = m_radius_y.value_or(0);
float cx = m_center_x.value_or(0);
float cy = m_center_y.value_or(0);
Gfx::Path path;
Gfx::DeprecatedPath path;
// A computed value of zero for either dimension, or a computed value of auto for both dimensions, disables rendering of the element.
if (rx == 0 || ry == 0)

View File

@ -20,7 +20,7 @@ public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
virtual Gfx::DeprecatedPath get_path(CSSPixelSize viewport_size) override;
JS::NonnullGCPtr<SVGAnimatedLength> cx() const;
JS::NonnullGCPtr<SVGAnimatedLength> cy() const;

View File

@ -18,7 +18,7 @@ class SVGGeometryElement : public SVGGraphicsElement {
public:
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) = 0;
virtual Gfx::DeprecatedPath get_path(CSSPixelSize viewport_size) = 0;
float get_total_length();
JS::NonnullGCPtr<Geometry::DOMPoint> get_point_at_length(float distance);

View File

@ -7,8 +7,8 @@
#pragma once
#include <LibGfx/DeprecatedPath.h>
#include <LibGfx/PaintStyle.h>
#include <LibGfx/Path.h>
#include <LibWeb/DOM/Node.h>
#include <LibWeb/SVG/AttributeParser.h>
#include <LibWeb/SVG/SVGAnimatedTransformList.h>

View File

@ -40,12 +40,12 @@ void SVGLineElement::attribute_changed(FlyString const& name, Optional<String> c
}
}
Gfx::Path SVGLineElement::get_path(CSSPixelSize viewport_size)
Gfx::DeprecatedPath SVGLineElement::get_path(CSSPixelSize viewport_size)
{
auto const viewport_width = viewport_size.width().to_float();
auto const viewport_height = viewport_size.height().to_float();
Gfx::Path path;
Gfx::DeprecatedPath path;
float const x1 = m_x1.value_or({ 0, false }).resolve_relative_to(viewport_width);
float const y1 = m_y1.value_or({ 0, false }).resolve_relative_to(viewport_height);
float const x2 = m_x2.value_or({ 0, false }).resolve_relative_to(viewport_width);

View File

@ -20,7 +20,7 @@ public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
virtual Gfx::DeprecatedPath get_path(CSSPixelSize viewport_size) override;
JS::NonnullGCPtr<SVGAnimatedLength> x1() const;
JS::NonnullGCPtr<SVGAnimatedLength> y1() const;

View File

@ -6,7 +6,7 @@
#include <AK/Debug.h>
#include <AK/Optional.h>
#include <LibGfx/Path.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibWeb/Bindings/SVGPathElementPrototype.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h>
@ -104,9 +104,9 @@ void SVGPathElement::attribute_changed(FlyString const& name, Optional<String> c
m_instructions = AttributeParser::parse_path_data(value.value_or(String {}));
}
Gfx::Path path_from_path_instructions(ReadonlySpan<PathInstruction> instructions)
Gfx::DeprecatedPath path_from_path_instructions(ReadonlySpan<PathInstruction> instructions)
{
Gfx::Path path;
Gfx::DeprecatedPath path;
Optional<Gfx::FloatPoint> previous_control_point;
PathInstructionType last_instruction = PathInstructionType::Invalid;
@ -272,7 +272,7 @@ Gfx::Path path_from_path_instructions(ReadonlySpan<PathInstruction> instructions
return path;
}
Gfx::Path SVGPathElement::get_path(CSSPixelSize)
Gfx::DeprecatedPath SVGPathElement::get_path(CSSPixelSize)
{
return path_from_path_instructions(m_instructions);
}

View File

@ -22,7 +22,7 @@ public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
virtual Gfx::DeprecatedPath get_path(CSSPixelSize viewport_size) override;
private:
SVGPathElement(DOM::Document&, DOM::QualifiedName);
@ -32,6 +32,6 @@ private:
Vector<PathInstruction> m_instructions;
};
Gfx::Path path_from_path_instructions(ReadonlySpan<PathInstruction>);
Gfx::DeprecatedPath path_from_path_instructions(ReadonlySpan<PathInstruction>);
}

View File

@ -33,9 +33,9 @@ void SVGPolygonElement::attribute_changed(FlyString const& name, Optional<String
m_points = AttributeParser::parse_points(value.value_or(String {}));
}
Gfx::Path SVGPolygonElement::get_path(CSSPixelSize)
Gfx::DeprecatedPath SVGPolygonElement::get_path(CSSPixelSize)
{
Gfx::Path path;
Gfx::DeprecatedPath path;
if (m_points.is_empty())
return path;

View File

@ -19,7 +19,7 @@ public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
virtual Gfx::DeprecatedPath get_path(CSSPixelSize viewport_size) override;
private:
SVGPolygonElement(DOM::Document&, DOM::QualifiedName);

View File

@ -33,9 +33,9 @@ void SVGPolylineElement::attribute_changed(FlyString const& name, Optional<Strin
m_points = AttributeParser::parse_points(value.value_or(String {}));
}
Gfx::Path SVGPolylineElement::get_path(CSSPixelSize)
Gfx::DeprecatedPath SVGPolylineElement::get_path(CSSPixelSize)
{
Gfx::Path path;
Gfx::DeprecatedPath path;
if (m_points.is_empty())
return path;

View File

@ -19,7 +19,7 @@ public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
virtual Gfx::DeprecatedPath get_path(CSSPixelSize viewport_size) override;
private:
SVGPolylineElement(DOM::Document&, DOM::QualifiedName);

View File

@ -46,14 +46,14 @@ void SVGRectElement::attribute_changed(FlyString const& name, Optional<String> c
}
}
Gfx::Path SVGRectElement::get_path(CSSPixelSize)
Gfx::DeprecatedPath SVGRectElement::get_path(CSSPixelSize)
{
float width = m_width.value_or(0);
float height = m_height.value_or(0);
float x = m_x.value_or(0);
float y = m_y.value_or(0);
Gfx::Path path;
Gfx::DeprecatedPath path;
// If width or height is zero, rendering is disabled.
if (width == 0 || height == 0)
return path;

View File

@ -20,7 +20,7 @@ public:
virtual void attribute_changed(FlyString const& name, Optional<String> const& old_value, Optional<String> const& value) override;
virtual Gfx::Path get_path(CSSPixelSize viewport_size) override;
virtual Gfx::DeprecatedPath get_path(CSSPixelSize viewport_size) override;
JS::NonnullGCPtr<SVGAnimatedLength> x() const;
JS::NonnullGCPtr<SVGAnimatedLength> y() const;

View File

@ -7,7 +7,7 @@
#pragma once
#include <AK/FlyString.h>
#include <LibGfx/Path.h>
#include <LibGfx/DeprecatedPath.h>
#include <LibWeb/DOM/DocumentObserver.h>
#include <LibWeb/SVG/SVGAnimatedLength.h>
#include <LibWeb/SVG/SVGGraphicsElement.h>