1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 10:18:13 +00:00

LibWeb: Remove ClearRect command in RecordingPainter

There is only one usage of ClearRect command and it could be replaced
with FillRect to make set of commands in RecordingPainter smaller.
This commit is contained in:
Aliaksandr Kalenik 2023-10-21 16:46:59 +02:00 committed by Andreas Kling
parent 8922574133
commit f32764975a
3 changed files with 1 additions and 27 deletions

View file

@ -31,15 +31,6 @@ struct CommandExecutionState {
Vector<StackingContext> stacking_contexts;
};
CommandResult ClearRect::execute(CommandExecutionState& state) const
{
if (state.would_be_fully_clipped_by_painter(rect))
return CommandResult::Continue;
state.painter().clear_rect(rect, color);
return CommandResult::Continue;
}
CommandResult FillRectWithRoundedCorners::execute(CommandExecutionState& state) const
{
if (state.would_be_fully_clipped_by_painter(rect))
@ -506,14 +497,6 @@ void RecordingPainter::blit_corner_clipping(NonnullRefPtr<BorderRadiusCornerClip
push_command(BlitCornerClipping { corner_clipper });
}
void RecordingPainter::clear_rect(Gfx::IntRect const& rect, Color color)
{
push_command(ClearRect {
.rect = rect,
.color = color,
});
}
void RecordingPainter::fill_rect(Gfx::IntRect const& rect, Color color)
{
push_command(FillRect {

View file

@ -40,13 +40,6 @@ enum class CommandResult {
SkipStackingContext,
};
struct ClearRect {
Gfx::IntRect rect;
Color color;
[[nodiscard]] CommandResult execute(CommandExecutionState&) const;
};
struct DrawTextRun {
Color color;
Gfx::IntPoint baseline_start;
@ -347,7 +340,6 @@ struct BlitCornerClipping {
};
using PaintingCommand = Variant<
ClearRect,
DrawTextRun,
DrawText,
FillRect,
@ -387,7 +379,6 @@ using PaintingCommand = Variant<
class RecordingPainter {
public:
void clear_rect(Gfx::IntRect const& rect, Color color);
void fill_rect(Gfx::IntRect const& rect, Color color);
struct FillPathUsingColorParams {

View file

@ -133,7 +133,7 @@ void PageHost::paint(Web::DevicePixelRect const& content_rect, Gfx::Bitmap& targ
Web::PaintContext context(recording_painter, palette(), device_pixels_per_css_pixel());
if (background_color.alpha() < 255)
recording_painter.clear_rect(bitmap_rect, Web::CSS::SystemColor::canvas());
recording_painter.fill_rect(bitmap_rect, Web::CSS::SystemColor::canvas());
recording_painter.fill_rect(bitmap_rect, background_color);
if (!document->paintable())