From d09e8978c2b36a1ebe08ca2ab53a7c912ff5ceb1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 19 Mar 2022 20:51:40 +0100 Subject: LibGfx: Be more aggressive when splitting bezier curves Significantly reduce the tolerance when splitting bezier curves. This gives a smoother final appearance at the cost of drawing more lines. --- Userland/Libraries/LibGfx/Painter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Userland/Libraries/LibGfx/Painter.cpp') diff --git a/Userland/Libraries/LibGfx/Painter.cpp b/Userland/Libraries/LibGfx/Painter.cpp index fa0e73d5f9..5eb47f775d 100644 --- a/Userland/Libraries/LibGfx/Painter.cpp +++ b/Userland/Libraries/LibGfx/Painter.cpp @@ -1925,7 +1925,7 @@ void Painter::draw_triangle_wave(IntPoint const& a_p1, IntPoint const& a_p2, Col static bool can_approximate_bezier_curve(FloatPoint const& p1, FloatPoint const& p2, FloatPoint const& control) { - constexpr static int tolerance = 15; + constexpr float tolerance = 0.0015f; auto p1x = 3 * control.x() - 2 * p1.x() - p2.x(); auto p1y = 3 * control.y() - 2 * p1.y() - p2.y(); @@ -1999,7 +1999,7 @@ void Painter::for_each_line_segment_on_cubic_bezier_curve(FloatPoint const& cont static bool can_approximate_cubic_bezier_curve(FloatPoint const& p1, FloatPoint const& p2, FloatPoint const& control_0, FloatPoint const& control_1) { - constexpr float tolerance = 15; // Arbitrary, seems like 10-30 produces nice results. + constexpr float tolerance = 0.0015f; auto ax = 3 * control_0.x() - 2 * p1.x() - p2.x(); auto ay = 3 * control_0.y() - 2 * p1.y() - p2.y(); -- cgit v1.2.3