From b8492006da2db7d037afa3c7f7f48f4e6972864d Mon Sep 17 00:00:00 2001 From: MacDue Date: Wed, 30 Nov 2022 00:08:06 +0000 Subject: [PATCH] LibGfx: Disable line intersection stroking for 1px lines 1px lines are already connected, so this just makes things look worse and is often painting in the wrong spot anyway. --- .../Libraries/LibGfx/AntiAliasingPainter.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp index 75ff3c12b0..d67bceb734 100644 --- a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp +++ b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp @@ -228,16 +228,15 @@ void AntiAliasingPainter::stroke_path(Path const& path, Color color, float thick cursor = segment.point(); break; case Segment::Type::LineTo: - if (!first_line.has_value()) - first_line = FloatLine(cursor, segment.point()); - draw_line(cursor, segment.point(), color, thickness); - if (previous_was_line) { - stroke_segment_intersection(cursor, segment.point(), last_line, color, thickness); + if (thickness > 1) { + if (!first_line.has_value()) + first_line = FloatLine(cursor, segment.point()); + if (previous_was_line) + stroke_segment_intersection(cursor, segment.point(), last_line, color, thickness); + last_line.set_a(cursor); + last_line.set_b(segment.point()); } - - last_line.set_a(cursor); - last_line.set_b(segment.point()); cursor = segment.point(); break; case Segment::Type::QuadraticBezierCurveTo: { @@ -264,8 +263,8 @@ void AntiAliasingPainter::stroke_path(Path const& path, Color color, float thick previous_was_line = segment.type() == Segment::Type::LineTo; } - // check if the figure was started and closed as line at the same position - if (previous_was_line && path.segments().size() >= 2 && path.segments().first().point() == cursor && (path.segments().first().type() == Segment::Type::LineTo || (path.segments().first().type() == Segment::Type::MoveTo && path.segments()[1].type() == Segment::Type::LineTo))) + // Check if the figure was started and closed as line at the same position. + if (thickness > 1 && previous_was_line && path.segments().size() >= 2 && path.segments().first().point() == cursor && (path.segments().first().type() == Segment::Type::LineTo || (path.segments().first().type() == Segment::Type::MoveTo && path.segments()[1].type() == Segment::Type::LineTo))) stroke_segment_intersection(first_line.value().a(), first_line.value().b(), last_line, color, thickness); }