From dcb7c299bfdc8db0b357be9e81aa81baf7834963 Mon Sep 17 00:00:00 2001 From: MacDue Date: Sun, 16 Jul 2023 16:27:30 +0100 Subject: [PATCH] LibGfx: Use stroke_to_fill() for Painter::stroke_path() --- Userland/Libraries/LibGfx/Painter.cpp | 34 +-------------------------- 1 file changed, 1 insertion(+), 33 deletions(-) diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index f86c5a9e24..27a1e8431f 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -2418,41 +2418,9 @@ PainterStateSaver::~PainterStateSaver() void Painter::stroke_path(Path const& path, Color color, int thickness) { - VERIFY(scale() == 1); // FIXME: Add scaling support. - if (thickness <= 0) return; - - FloatPoint cursor; - - for (auto& segment : path.segments()) { - switch (segment->type()) { - case Segment::Type::Invalid: - VERIFY_NOT_REACHED(); - break; - case Segment::Type::MoveTo: - cursor = segment->point(); - break; - case Segment::Type::LineTo: - draw_line(cursor.to_type(), segment->point().to_type(), color, thickness); - cursor = segment->point(); - break; - case Segment::Type::QuadraticBezierCurveTo: { - auto through = static_cast(*segment).through(); - draw_quadratic_bezier_curve(through.to_type(), cursor.to_type(), segment->point().to_type(), color, thickness); - cursor = segment->point(); - break; - } - case Segment::Type::CubicBezierCurveTo: { - auto& curve = static_cast(*segment); - auto through_0 = curve.through_0(); - auto through_1 = curve.through_1(); - draw_cubic_bezier_curve(through_0.to_type(), through_1.to_type(), cursor.to_type(), segment->point().to_type(), color, thickness); - cursor = segment->point(); - break; - } - } - } + fill_path(path.stroke_to_fill(thickness), color); } void Painter::blit_disabled(IntPoint location, Gfx::Bitmap const& bitmap, IntRect const& rect, Palette const& palette)