From 8993a710f8aadd21b0e7374c1e54cabf75837b3a Mon Sep 17 00:00:00 2001 From: Luke Wilde Date: Tue, 6 Jun 2023 20:38:48 +0100 Subject: [PATCH] LibGfx: Make it possible to stroke a path with a paint style --- Userland/Libraries/LibGfx/AntiAliasingPainter.cpp | 6 ++++++ Userland/Libraries/LibGfx/AntiAliasingPainter.h | 1 + 2 files changed, 7 insertions(+) diff --git a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp index 05ab9bf9a55..f3b088fdf61 100644 --- a/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp +++ b/Userland/Libraries/LibGfx/AntiAliasingPainter.cpp @@ -198,6 +198,12 @@ void AntiAliasingPainter::stroke_path(Path const& path, Color color, float thick fill_path(path.stroke_to_fill(thickness), color); } +void AntiAliasingPainter::stroke_path(Path const& path, Gfx::PaintStyle const& paint_style, float thickness) +{ + // FIXME: Cache this? Probably at a higher level such as in LibWeb? + fill_path(path.stroke_to_fill(thickness), paint_style); +} + void AntiAliasingPainter::fill_rect(FloatRect const& float_rect, Color color) { // Draw the integer part of the rectangle: diff --git a/Userland/Libraries/LibGfx/AntiAliasingPainter.h b/Userland/Libraries/LibGfx/AntiAliasingPainter.h index ba6338e9c20..a6a1ed87902 100644 --- a/Userland/Libraries/LibGfx/AntiAliasingPainter.h +++ b/Userland/Libraries/LibGfx/AntiAliasingPainter.h @@ -37,6 +37,7 @@ public: void fill_path(Path const&, PaintStyle const& paint_style, Painter::WindingRule rule = Painter::WindingRule::Nonzero); void stroke_path(Path const&, Color, float thickness); + void stroke_path(Path const&, PaintStyle const& paint_style, float thickness); void translate(float dx, float dy) { m_transform.translate(dx, dy); } void translate(FloatPoint delta) { m_transform.translate(delta); }