mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Paint conic-gradient()
s
This is a first pass at painting conic-gradient()s, I've yet to try to optimize this much, but I feel like you could do better than atan2 in a loop.
This commit is contained in:
parent
49497044de
commit
fdcc73d4b1
Notes:
sideshowbarker
2024-07-17 17:38:29 +09:00
Author: https://github.com/MacDue
Commit: fdcc73d4b1
Pull-request: https://github.com/SerenityOS/serenity/pull/15870
Reviewed-by: https://github.com/linusg ✅
4 changed files with 129 additions and 66 deletions
|
@ -1976,12 +1976,17 @@ String ConicGradientStyleValue::to_string() const
|
|||
return builder.to_string();
|
||||
}
|
||||
|
||||
void ConicGradientStyleValue::resolve_for_size(Layout::Node const&, Gfx::FloatSize const&) const
|
||||
void ConicGradientStyleValue::resolve_for_size(Layout::Node const& node, Gfx::FloatSize const& size) const
|
||||
{
|
||||
if (!m_resolved.has_value())
|
||||
m_resolved = ResolvedData { Painting::resolve_conic_gradient_data(node, *this), {} };
|
||||
m_resolved->position = m_position.resolved(node, Gfx::FloatRect { { 0, 0 }, size });
|
||||
}
|
||||
|
||||
void ConicGradientStyleValue::paint(PaintContext&, Gfx::IntRect const&, CSS::ImageRendering) const
|
||||
void ConicGradientStyleValue::paint(PaintContext& context, Gfx::IntRect const& dest_rect, CSS::ImageRendering) const
|
||||
{
|
||||
VERIFY(m_resolved.has_value());
|
||||
Painting::paint_conic_gradient(context, dest_rect, m_resolved->data, m_resolved->position.to_rounded<int>());
|
||||
}
|
||||
|
||||
bool ConicGradientStyleValue::equals(StyleValue const&) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue