mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-09 02:56:10 +00:00
LibGfx: Slightly simplify Path::append_segment()
Rather than reorder the points here, just update the callers. No behaviour change.
This commit is contained in:
parent
4e4b9f440f
commit
0d7107e1d3
Notes:
sideshowbarker
2024-07-17 09:49:33 +09:00
Author: https://github.com/MacDue
Commit: 0d7107e1d3
Pull-request: https://github.com/SerenityOS/serenity/pull/23638
Reviewed-by: https://github.com/trflynn89
1 changed files with 7 additions and 7 deletions
|
@ -166,13 +166,13 @@ public:
|
|||
|
||||
void quadratic_bezier_curve_to(FloatPoint through, FloatPoint point)
|
||||
{
|
||||
append_segment<PathSegment::QuadraticBezierCurveTo>(point, through);
|
||||
append_segment<PathSegment::QuadraticBezierCurveTo>(through, point);
|
||||
invalidate_split_lines();
|
||||
}
|
||||
|
||||
void cubic_bezier_curve_to(FloatPoint c1, FloatPoint c2, FloatPoint p2)
|
||||
{
|
||||
append_segment<PathSegment::CubicBezierCurveTo>(p2, c1, c2);
|
||||
append_segment<PathSegment::CubicBezierCurveTo>(c1, c2, p2);
|
||||
invalidate_split_lines();
|
||||
}
|
||||
|
||||
|
@ -254,14 +254,14 @@ private:
|
|||
void segmentize_path();
|
||||
|
||||
template<PathSegment::Command command, typename... Args>
|
||||
void append_segment(FloatPoint point, Args&&... args)
|
||||
void append_segment(Args&&... args)
|
||||
{
|
||||
constexpr auto point_count = sizeof...(Args) + 1;
|
||||
constexpr auto point_count = sizeof...(Args);
|
||||
static_assert(point_count == PathSegment::points_per_command(command));
|
||||
m_commands.append(command);
|
||||
// Place the current path point after any extra control points so `m_points.last()` is always the last point.
|
||||
FloatPoint points[] { args..., point };
|
||||
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);
|
||||
m_commands.append(command);
|
||||
}
|
||||
|
||||
Vector<FloatPoint> m_points {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue