mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 10:07:15 +02:00
LibWeb: Use ExternalContentSource for canvas painting
present() now snapshots the PaintingSurface into an ImmutableBitmap and publishes it to the ExternalContentSource, so the rendering thread never touches the live GPU surface — eliminating the data race described in the ExternalContentSource commit (problem 1). Canvas elements are registered with Page and presented once per frame from the event loop, rather than on every individual draw call in CRC2D::did_draw(). A dirty flag on HTMLCanvasElement ensures the snapshot is only taken when content has actually changed, and makes the present() call in CanvasPaintable::paint() a no-op when the surface has already been snapshotted for the current frame.
This commit is contained in:
committed by
Alexander Kalenik
parent
8a31ecdf39
commit
004e5f851e
Notes:
github-actions[bot]
2026-02-20 17:42:50 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/004e5f851e1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8037
@@ -392,6 +392,10 @@ void EventLoop::update_the_rendering()
|
||||
for (auto& document : docs)
|
||||
document->page().update_all_media_element_video_sinks();
|
||||
|
||||
// AD-HOC: Present all canvas element surfaces in documents' pages.
|
||||
for (auto& document : docs)
|
||||
document->page().present_all_canvas_element_surfaces();
|
||||
|
||||
// FIXME: 4. Unnecessary rendering: Remove from docs any Document object doc for which all of the following are true:
|
||||
|
||||
// FIXME: 5. Remove from docs all Document objects for which the user agent believes that it's preferable to skip updating the rendering for other reasons.
|
||||
|
||||
Reference in New Issue
Block a user