mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 18:37:34 +00:00
LibWeb: Introduce dedicated painting command for borders
Currently, in CPU painter, border painting is implemented by building a Gfx::Path that is filled by Gfx::AntiAliasingPainter. In the GPU painter, we will likely want to do something different, and with a special command, it becomes possible. Also, by making this change, the CPU executor also benefits because now we can skip building paths for borders that are out of the viewport.
This commit is contained in:
parent
70353b79af
commit
29ff1f67be
11 changed files with 50 additions and 12 deletions
|
@ -302,6 +302,14 @@ struct BlitCornerClipping {
|
|||
[[nodiscard]] Gfx::IntRect bounding_rect() const;
|
||||
};
|
||||
|
||||
struct PaintBorders {
|
||||
DevicePixelRect border_rect;
|
||||
CornerRadii corner_radii;
|
||||
BordersDataDevicePixels borders_data;
|
||||
|
||||
[[nodiscard]] Gfx::IntRect bounding_rect() const { return border_rect.to_type<int>(); }
|
||||
};
|
||||
|
||||
using PaintingCommand = Variant<
|
||||
DrawGlyphRun,
|
||||
DrawText,
|
||||
|
@ -333,7 +341,8 @@ using PaintingCommand = Variant<
|
|||
DrawRect,
|
||||
DrawTriangleWave,
|
||||
SampleUnderCorners,
|
||||
BlitCornerClipping>;
|
||||
BlitCornerClipping,
|
||||
PaintBorders>;
|
||||
|
||||
class PaintingCommandExecutor {
|
||||
public:
|
||||
|
@ -370,6 +379,7 @@ public:
|
|||
virtual CommandResult draw_triangle_wave(Gfx::IntPoint const& p1, Gfx::IntPoint const& p2, Color const& color, int amplitude, int thickness) = 0;
|
||||
virtual CommandResult sample_under_corners(BorderRadiusCornerClipper&) = 0;
|
||||
virtual CommandResult blit_corner_clipping(BorderRadiusCornerClipper&) = 0;
|
||||
virtual CommandResult paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data) = 0;
|
||||
|
||||
virtual bool would_be_fully_clipped_by_painter(Gfx::IntRect) const = 0;
|
||||
|
||||
|
@ -476,6 +486,8 @@ public:
|
|||
|
||||
void draw_triangle_wave(Gfx::IntPoint a_p1, Gfx::IntPoint a_p2, Color color, int amplitude, int thickness);
|
||||
|
||||
void paint_borders(DevicePixelRect const& border_rect, CornerRadii const& corner_radii, BordersDataDevicePixels const& borders_data);
|
||||
|
||||
void execute(PaintingCommandExecutor&);
|
||||
|
||||
RecordingPainter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue