LibGfx+LibWeb: Cache SkImage in ImmutableBitmap

By caching the SkImage that is reused across repaints, we allow Skia t
optimize GPU texture caching.

ImmutableBitmap is chosen to own the SkImage because it guarantees that
the underlying pixels cannot be modified. This is not the case for
Gfx::Bitmap, where invalidating the SkImage would be challenging since
it exposes pointers to underlying data through methods like scanline().
This commit is contained in:
Aliaksandr Kalenik
2024-11-09 05:48:17 +01:00
committed by Alexander Kalenik
parent 460803d2da
commit 698bca686e
20 changed files with 186 additions and 118 deletions

View File

@@ -53,7 +53,7 @@ void WebGLRenderingContextBase::present()
// FIXME: Is this the operation it means?
m_context->gl_flush();
m_context->present(canvas_element().surface()->create_snapshot()->bitmap());
m_context->present();
// "By default, after compositing the contents of the drawing buffer shall be cleared to their default values, as shown in the table above.
// This default behavior can be changed by setting the preserveDrawingBuffer attribute of the WebGLContextAttributes object.