summaryrefslogtreecommitdiff
path: root/Userland/Applications/PixelPaint
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2022-03-21 01:46:46 +0000
committerLinus Groh <mail@linusgroh.de>2022-05-07 22:59:02 +0200
commit60aba4c9f3b41a478fc597bdc6a87c314012f4ca (patch)
treea899d2d2b6c6eba83e133dec4ef76dc90dbbe6f8 /Userland/Applications/PixelPaint
parent6e52e6b55494d42e398a15c786c6f035c8eca1c4 (diff)
downloadserenity-60aba4c9f3b41a478fc597bdc6a87c314012f4ca.zip
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.
Diffstat (limited to 'Userland/Applications/PixelPaint')
-rw-r--r--Userland/Applications/PixelPaint/Tools/EllipseTool.cpp7
1 files changed, 5 insertions, 2 deletions
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 <LibGUI/TextBox.h>
#include <LibGUI/ValueSlider.h>
#include <LibGfx/Rect.h>
+#include <LibGfx/AntiAliasingPainter.h>
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();
}