LibWeb: Don't draw shadows if shadow offset and blur are not set

This commit is contained in:
Tim Ledbetter 2025-10-21 10:22:49 +01:00 committed by Jelle Raaijmakers
commit 13f551612c
Notes: github-actions[bot] 2025-10-21 16:56:48 +00:00
4 changed files with 48 additions and 6 deletions

View file

@ -1064,6 +1064,8 @@ void CanvasRenderingContext2D::paint_shadow_for_fill_internal(Gfx::Path const& p
return;
auto& state = this->drawing_state();
if (state.shadow_blur == 0.0f && state.shadow_offset_x == 0.0f && state.shadow_offset_y == 0.0f)
return;
if (state.current_compositing_and_blending_operator == Gfx::CompositingAndBlendingOperator::Copy)
return;
@ -1098,6 +1100,9 @@ void CanvasRenderingContext2D::paint_shadow_for_stroke_internal(Gfx::Path const&
if (state.current_compositing_and_blending_operator == Gfx::CompositingAndBlendingOperator::Copy)
return;
if (state.shadow_blur == 0.0f && state.shadow_offset_x == 0.0f && state.shadow_offset_y == 0.0f)
return;
auto alpha = state.global_alpha * (state.shadow_color.alpha() / 255.0f);
auto fill_style_color = state.fill_style.as_color();
if (fill_style_color.has_value() && fill_style_color->alpha() > 0)