1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 00:37:45 +00:00

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.
This commit is contained in:
MacDue 2022-03-21 01:46:46 +00:00 committed by Linus Groh
parent 6e52e6b554
commit 60aba4c9f3
3 changed files with 113 additions and 36 deletions

View file

@ -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();
}