From 1ecb2cf28cf12cc9d678da38c6c8245a0f56a0ea Mon Sep 17 00:00:00 2001 From: MacDue Date: Sat, 19 Aug 2023 19:24:00 +0100 Subject: [PATCH] LibGfx: Add FIXME for SVG/canvas radial gradients The current implementation assumes the focal point is the center of the start circle, for most cases the difference this makes is very subtle, but becomes more apparent with spreadMethod=repeat/reflect. --- Userland/Libraries/LibGfx/GradientPainting.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Libraries/LibGfx/GradientPainting.cpp b/Userland/Libraries/LibGfx/GradientPainting.cpp index bb2e02449d..a37edb9612 100644 --- a/Userland/Libraries/LibGfx/GradientPainting.cpp +++ b/Userland/Libraries/LibGfx/GradientPainting.cpp @@ -499,6 +499,12 @@ static auto create_radial_gradient_between_two_circles(Gfx::FloatPoint start_cen // - Start circle larger than end circle (outside end circle) // - Start circle or end circle radius == 0 + // FIXME: This does not render the SVG spreadMethod=repeat/reflect correctly if + // focal radius > 0 and the focal point is not centered within the end circle. + // It does not render spreadMethod=pad correctly in this case either, but it's really subtle. + // It may be worth trying Skia's approach: https://skia.org/docs/dev/design/conical/ + // (Yes, this gradient actually is a two-point conical gradient) + return Gradient { move(gradient_line), [=](float x, float y) {