1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:37:46 +00:00

LibWeb: Implement border radius corner clipping in GPU painter

It is implemented in the way identical to how it works in CPU painter:
1. SampleUnderCorners command saves pixels within corners into a
   texture.
2. BlitCornerClipping command uses the texture prepared earlier to
   restore pixels within corners.
This commit is contained in:
Aliaksandr Kalenik 2023-12-17 14:34:44 +01:00 committed by Andreas Kling
parent 177e7df1c5
commit bd08b1815f
6 changed files with 127 additions and 13 deletions

View file

@ -71,10 +71,25 @@ private:
int stacking_context_depth { 0 };
};
struct BorderRadiusCornerClipper {
RefPtr<AccelGfx::Canvas> corners_sample_canvas;
Gfx::FloatRect page_top_left_rect;
Gfx::FloatRect page_top_right_rect;
Gfx::FloatRect page_bottom_right_rect;
Gfx::FloatRect page_bottom_left_rect;
Gfx::FloatRect sample_canvas_top_left_rect;
Gfx::FloatRect sample_canvas_top_right_rect;
Gfx::FloatRect sample_canvas_bottom_right_rect;
Gfx::FloatRect sample_canvas_bottom_left_rect;
};
[[nodiscard]] AccelGfx::Painter const& painter() const { return *m_stacking_contexts.last().painter; }
[[nodiscard]] AccelGfx::Painter& painter() { return *m_stacking_contexts.last().painter; }
Vector<StackingContext> m_stacking_contexts;
Vector<OwnPtr<BorderRadiusCornerClipper>> m_corner_clippers;
};
}