LibWeb: Don't draw shadows for transparent gradient fills

This commit is contained in:
Tim Ledbetter 2025-10-21 11:04:52 +01:00 committed by Jelle Raaijmakers
parent 13f551612c
commit 0516c414d4
Notes: github-actions[bot] 2025-10-21 16:56:41 +00:00
6 changed files with 106 additions and 0 deletions

View file

@ -20,6 +20,7 @@ namespace Gfx {
class PaintStyle : public RefCounted<PaintStyle> {
public:
virtual ~PaintStyle() = default;
virtual bool is_visible() const { return true; }
};
class SolidColorPaintStyle : public PaintStyle {
@ -29,6 +30,8 @@ public:
return adopt_nonnull_ref_or_enomem(new (nothrow) SolidColorPaintStyle(color));
}
bool is_visible() const override { return m_color.alpha() > 0; }
Color const& color() const { return m_color; }
private:
@ -65,6 +68,11 @@ public:
Optional<float> repeat_length() const { return m_repeat_length; }
bool is_visible() const override
{
return any_of(m_color_stops, [](auto& stop) { return stop.color.alpha() > 0; });
}
private:
Vector<ColorStop, 4> m_color_stops;
Optional<float> m_repeat_length;