1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:47:44 +00:00

LibGfx: Simplify segmentizing paths

Remove SplitLineSegment and replace it with a FloatLine, nobody was
interested in its extra fields anymore. Also, remove the sorting of
the split segments, this really should not have been done here
anyway, and is not required by the rasterizer anymore. Keeping the
segments in stroke order will also make it possible to generate
stroked path geometry (in future).
This commit is contained in:
MacDue 2023-06-03 23:40:03 +01:00 committed by Andreas Kling
parent 910bff9e94
commit 6abc51d9f8
4 changed files with 21 additions and 49 deletions

View file

@ -30,15 +30,13 @@
namespace Gfx {
static Vector<Detail::Edge> prepare_edges(ReadonlySpan<Path::SplitLineSegment> lines, unsigned samples_per_pixel, FloatPoint origin)
static Vector<Detail::Edge> prepare_edges(ReadonlySpan<FloatLine> lines, unsigned samples_per_pixel, FloatPoint origin)
{
// FIXME: split_lines() gives similar information, but the form it's in is not that useful (and is const anyway).
Vector<Detail::Edge> edges;
edges.ensure_capacity(lines.size());
for (auto& line : lines) {
auto p0 = line.from - origin;
auto p1 = line.to - origin;
auto p0 = line.a() - origin;
auto p1 = line.b() - origin;
p0.scale_by(1, samples_per_pixel);
p1.scale_by(1, samples_per_pixel);