mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-28 19:59:17 +00:00
LibWeb+LibGfx: Replace usage of Gfx::PaintStyle in fill{stoke}_commands
...with a struct defined in LibWeb. This is a step towards uncoupling LibWeb from LibGfx, so we can try third-party libraries for painting.
This commit is contained in:
parent
6e419db26c
commit
7a04a95c8a
Notes:
sideshowbarker
2024-07-16 18:06:41 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 7a04a95c8a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/143
Reviewed-by: https://github.com/alimpfard ✅
Reviewed-by: https://github.com/awesomekling
16 changed files with 242 additions and 42 deletions
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/Bindings/SVGRadialGradientElementPrototype.h>
|
||||
#include <LibWeb/Painting/PaintStyle.h>
|
||||
#include <LibWeb/SVG/AttributeNames.h>
|
||||
#include <LibWeb/SVG/SVGRadialGradientElement.h>
|
||||
|
||||
|
@ -160,7 +161,7 @@ NumberPercentage SVGRadialGradientElement::end_circle_radius_impl(HashTable<SVGG
|
|||
return NumberPercentage::create_percentage(50);
|
||||
}
|
||||
|
||||
Optional<Gfx::PaintStyle const&> SVGRadialGradientElement::to_gfx_paint_style(SVGPaintContext const& paint_context) const
|
||||
Optional<Painting::PaintStyle> SVGRadialGradientElement::to_gfx_paint_style(SVGPaintContext const& paint_context) const
|
||||
{
|
||||
auto units = gradient_units();
|
||||
Gfx::FloatPoint start_center;
|
||||
|
@ -200,8 +201,7 @@ Optional<Gfx::PaintStyle const&> SVGRadialGradientElement::to_gfx_paint_style(SV
|
|||
}
|
||||
|
||||
if (!m_paint_style) {
|
||||
m_paint_style = Gfx::SVGRadialGradientPaintStyle::create(start_center, start_radius, end_center, end_radius)
|
||||
.release_value_but_fixme_should_propagate_errors();
|
||||
m_paint_style = Painting::SVGRadialGradientPaintStyle::create(start_center, start_radius, end_center, end_radius);
|
||||
// FIXME: Update stops in DOM changes:
|
||||
add_color_stops(*m_paint_style);
|
||||
} else {
|
||||
|
@ -211,7 +211,7 @@ Optional<Gfx::PaintStyle const&> SVGRadialGradientElement::to_gfx_paint_style(SV
|
|||
m_paint_style->set_end_radius(end_radius);
|
||||
}
|
||||
m_paint_style->set_gradient_transform(gradient_paint_transform(paint_context));
|
||||
m_paint_style->set_spread_method(to_gfx_spread_method(spread_method()));
|
||||
m_paint_style->set_spread_method(to_painting_spread_method(spread_method()));
|
||||
return *m_paint_style;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue