mirror of
https://github.com/RGBCube/serenity
synced 2025-07-23 10:47:36 +00:00
LibWeb: Don't use paint styles for solid color CRC2D fills
It is faster to avoid the extra overhead/indirection of paint styles if possible.
This commit is contained in:
parent
87c103e210
commit
727ff6cf59
1 changed files with 8 additions and 2 deletions
|
@ -265,11 +265,17 @@ static Gfx::Painter::WindingRule parse_fill_rule(StringView fill_rule)
|
||||||
return Gfx::Painter::WindingRule::Nonzero;
|
return Gfx::Painter::WindingRule::Nonzero;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CanvasRenderingContext2D::fill_internal(Gfx::Path& path, StringView fill_rule)
|
void CanvasRenderingContext2D::fill_internal(Gfx::Path& path, StringView fill_rule_value)
|
||||||
{
|
{
|
||||||
draw_clipped([&](auto& painter) {
|
draw_clipped([&](auto& painter) {
|
||||||
path.close_all_subpaths();
|
path.close_all_subpaths();
|
||||||
painter.fill_path(path, *drawing_state().fill_style.to_gfx_paint_style(), parse_fill_rule(fill_rule));
|
auto& drawing_state = this->drawing_state();
|
||||||
|
auto fill_rule = parse_fill_rule(fill_rule_value);
|
||||||
|
if (auto color = drawing_state.fill_style.as_color(); color.has_value()) {
|
||||||
|
painter.fill_path(path, *color, fill_rule);
|
||||||
|
} else {
|
||||||
|
painter.fill_path(path, drawing_state.fill_style.to_gfx_paint_style(), fill_rule);
|
||||||
|
}
|
||||||
return path.bounding_box();
|
return path.bounding_box();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue