From 60aba4c9f3b41a478fc597bdc6a87c314012f4ca Mon Sep 17 00:00:00 2001 From: MacDue Date: Mon, 21 Mar 2022 01:46:46 +0000 Subject: LibGfx: Implement AntiAliasingPainter::draw_ellipse() This commit adds draw_ellipse() and moves the shared code for circles and ellipses to draw_ellipse_part(). draw_ellipse_part() can draw an entire circle in one call using 8-way symmetry and an ellipse in two calls using 4-way symmetry. --- Userland/Applications/PixelPaint/Tools/EllipseTool.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Userland/Applications/PixelPaint') diff --git a/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp b/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp index d4e6f8d31a..7ca58328d2 100644 --- a/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp +++ b/Userland/Applications/PixelPaint/Tools/EllipseTool.cpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace PixelPaint { @@ -35,9 +36,11 @@ void EllipseTool::draw_using(GUI::Painter& painter, Gfx::IntPoint const& start_p case FillMode::Outline: painter.draw_ellipse_intersecting(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button), thickness); break; - case FillMode::Fill: - painter.fill_ellipse(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button)); + case FillMode::Fill: { + Gfx::AntiAliasingPainter aa_painter { painter }; + aa_painter.draw_ellipse(ellipse_intersecting_rect, m_editor->color_for(m_drawing_button)); break; + } default: VERIFY_NOT_REACHED(); } -- cgit v1.2.3