mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-04 07:36:50 +00:00
LibWeb: Add save and restore commands in recording painter
This change is a preparation before introducing Skia painter in an upcoming change. It's needed because Skia does not have an API to implement ClearClipRect command. It only allows to return previous clip rect by popping from its internal state stack. A bit more context: initially we had save and restore commands, but their frequent use led to many reallocations of vector during painting commands recording. To resolve this, we switched to SegmentedVector to store commands list, which allows fast appends. Now, having many save and restore commands no longer causes noticeable performance issue.
This commit is contained in:
committed by
Andreas Kling
parent
0e705f431e
commit
8a7cd8055f
@@ -89,15 +89,21 @@ CommandResult CommandExecutorGPU::draw_scaled_immutable_bitmap(DrawScaledImmutab
|
||||
return CommandResult::Continue;
|
||||
}
|
||||
|
||||
CommandResult CommandExecutorGPU::set_clip_rect(SetClipRect const& command)
|
||||
CommandResult CommandExecutorGPU::save(Save const&)
|
||||
{
|
||||
painter().set_clip_rect(command.rect);
|
||||
painter().save();
|
||||
return CommandResult::Continue;
|
||||
}
|
||||
|
||||
CommandResult CommandExecutorGPU::clear_clip_rect(ClearClipRect const&)
|
||||
CommandResult CommandExecutorGPU::restore(Restore const&)
|
||||
{
|
||||
painter().clear_clip_rect();
|
||||
painter().restore();
|
||||
return CommandResult::Continue;
|
||||
}
|
||||
|
||||
CommandResult CommandExecutorGPU::add_clip_rect(AddClipRect const& command)
|
||||
{
|
||||
painter().set_clip_rect(command.rect);
|
||||
return CommandResult::Continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user