mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-05-28 14:02:51 +00:00
LibWeb: Introduce RecordingPainter to serialize painting commands
This modification introduces a new layer to the painting process. The stacking context traversal no longer immediately calls the Gfx::Painter methods. Instead, it writes serialized painting commands into newly introduced RecordingPainter. Created list of commands is executed later to produce resulting bitmap. Producing painting command list will make it easier to add new optimizations: - It's simpler to check if the painting result is not visible in the viewport at the command level rather than during stacking context traversal. - Run painting in a separate thread. The painting thread can process serialized painting commands, while the main thread can work on the next paintable tree and safely invalidate the previous one. - As we consider GPU-accelerated painting support, it would be easier to back each painting command rather than constructing an alternative for the entire Gfx::Painter API.
This commit is contained in:
parent
8ebb4e8047
commit
063e66cae9
Notes:
sideshowbarker
2024-07-18 22:57:59 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 063e66cae9
Pull-request: https://github.com/SerenityOS/serenity/pull/21459
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/awesomekling
49 changed files with 1970 additions and 441 deletions
|
@ -106,10 +106,12 @@ void SVGDecodedImageData::render(Gfx::IntSize size) const
|
|||
m_document->navigable()->set_viewport_rect({ 0, 0, size.width(), size.height() });
|
||||
m_document->update_layout();
|
||||
|
||||
Gfx::Painter painter(*m_bitmap);
|
||||
PaintContext context(painter, m_page_client->palette(), m_page_client->device_pixels_per_css_pixel());
|
||||
Painting::RecordingPainter recording_painter;
|
||||
PaintContext context(recording_painter, m_page_client->palette(), m_page_client->device_pixels_per_css_pixel());
|
||||
|
||||
m_document->paintable()->paint_all_phases(context);
|
||||
|
||||
recording_painter.execute(*m_bitmap);
|
||||
}
|
||||
|
||||
RefPtr<Gfx::Bitmap const> SVGDecodedImageData::bitmap(size_t, Gfx::IntSize size) const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue