1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 09:37:34 +00:00

LibWeb/Painting: Do not paint box outer shadows not visible in viewport

This change separates the box outer shadow metrics calculations into a
separate function. This function is then used to obtain the shadow
bounding rectangle and skip painting if the entire shadow is outside
of the viewport.
This commit is contained in:
Aliaksandr Kalenik 2023-10-19 01:16:01 +02:00 committed by Andreas Kling
parent 596bc76b7a
commit 99217bf6db
3 changed files with 192 additions and 40 deletions

View file

@ -328,6 +328,9 @@ CommandResult PaintConicGradient::execute(CommandExecutionState& state) const
CommandResult PaintOuterBoxShadow::execute(CommandExecutionState& state) const
{
auto bounding_rect = get_outer_box_shadow_bounding_rect(outer_box_shadow_params);
if (state.would_be_fully_clipped_by_painter(bounding_rect))
return CommandResult::Continue;
auto& painter = state.painter();
paint_outer_box_shadow(painter, outer_box_shadow_params);
return CommandResult::Continue;