summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Painting
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2022-06-05 14:45:24 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-05 16:16:17 +0100
commita705741be393ea5489fc598637e521c9ef718895 (patch)
treea633051226ea6871b8d2321d0b7a11d297c77f41 /Userland/Libraries/LibWeb/Painting
parent177d9b2a5a4541961df6a6264e21d42d8b4ce2dc (diff)
downloadserenity-a705741be393ea5489fc598637e521c9ef718895.zip
LibWeb: Paint list markers antialiased
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting')
-rw-r--r--Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp b/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp
index a1831429fd..8dedaec14d 100644
--- a/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp
+++ b/Userland/Libraries/LibWeb/Painting/MarkerPaintable.cpp
@@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
+#include <LibGfx/AntiAliasingPainter.h>
#include <LibGfx/StylePainter.h>
#include <LibWeb/Layout/ListItemMarkerBox.h>
#include <LibWeb/Painting/MarkerPaintable.h>
@@ -43,20 +44,17 @@ void MarkerPaintable::paint(PaintContext& context, PaintPhase phase) const
Gfx::IntRect marker_rect { 0, 0, marker_width, marker_width };
marker_rect.center_within(enclosing);
+ Gfx::AntiAliasingPainter aa_painter { context.painter() };
+
switch (layout_box().list_style_type()) {
case CSS::ListStyleType::Square:
context.painter().fill_rect(marker_rect, color);
break;
case CSS::ListStyleType::Circle:
- // For some reason for draw_ellipse() the ellipse is outside of the rect while for fill_ellipse() the ellipse is inside.
- // Scale the marker_rect with sqrt(2) to get an ellipse arc (circle) that appears as if it was inside of the marker_rect.
- marker_rect.set_height(marker_rect.height() / 1.41);
- marker_rect.set_width(marker_rect.width() / 1.41);
- marker_rect.center_within(enclosing);
- context.painter().draw_ellipse_intersecting(marker_rect, color);
+ aa_painter.draw_ellipse(marker_rect, color, 1);
break;
case CSS::ListStyleType::Disc:
- context.painter().fill_ellipse(marker_rect, color);
+ aa_painter.fill_ellipse(marker_rect, color);
break;
case CSS::ListStyleType::Decimal:
case CSS::ListStyleType::DecimalLeadingZero: