LibGfx+LibWeb: Reuse DisplayListPlayer and PaintingSurface when possible

Previously, we were reinstantiating the DisplayListPlayer and
PaintingSurface on every paint.
This commit is contained in:
Jelle Raaijmakers 2025-01-29 10:24:57 +01:00 committed by Alexander Kalenik
commit 342cb7addf
Notes: github-actions[bot] 2025-01-31 12:29:12 +00:00
12 changed files with 107 additions and 104 deletions

View file

@ -14,15 +14,16 @@
#include <LibWeb/Page/Page.h>
#include <LibWeb/Painting/DisplayListPlayerSkia.h>
#include <LibWeb/StorageAPI/StorageShed.h>
#ifdef USE_VULKAN
# include <LibGfx/VulkanContext.h>
#endif
#include <WebContent/BackingStoreManager.h>
#ifdef AK_OS_MACOS
# include <LibGfx/MetalContext.h>
#endif
#ifdef USE_VULKAN
# include <LibGfx/VulkanContext.h>
#endif
namespace Web::HTML {
// https://html.spec.whatwg.org/multipage/document-sequences.html#traversable-navigable
@ -110,6 +111,8 @@ public:
StorageAPI::StorageShed& storage_shed() { return m_storage_shed; }
StorageAPI::StorageShed const& storage_shed() const { return m_storage_shed; }
void set_viewport_size(CSSPixelSize) override;
private:
TraversableNavigable(GC::Ref<Page>);
@ -131,6 +134,8 @@ private:
[[nodiscard]] bool can_go_forward() const;
NonnullRefPtr<Gfx::PaintingSurface> painting_surface_for_backing_store(Painting::BackingStore&);
// https://html.spec.whatwg.org/multipage/document-sequences.html#tn-current-session-history-step
int m_current_session_history_step { 0 };
@ -154,6 +159,8 @@ private:
String m_window_handle;
RefPtr<Gfx::SkiaBackendContext> m_skia_backend_context;
OwnPtr<Painting::DisplayListPlayerSkia> m_skia_player;
HashMap<Gfx::Bitmap*, NonnullRefPtr<Gfx::PaintingSurface>> m_bitmap_to_surface;
};
struct BrowsingContextAndDocument {