summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibGfx/Painter.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-03-19 20:51:40 +0100
committerAndreas Kling <kling@serenityos.org>2022-03-19 22:04:43 +0100
commitd09e8978c2b36a1ebe08ca2ab53a7c912ff5ceb1 (patch)
tree77c1cc648809e531ffa759291ec28cabbb9d7c48 /Userland/Libraries/LibGfx/Painter.cpp
parent0b861e0c9da13443e78e8a88a34fbc28d15fbbee (diff)
downloadserenity-d09e8978c2b36a1ebe08ca2ab53a7c912ff5ceb1.zip
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.
Diffstat (limited to 'Userland/Libraries/LibGfx/Painter.cpp')
-rw-r--r--Userland/Libraries/LibGfx/Painter.cpp4
1 files changed, 2 insertions, 2 deletions
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();