LibWeb+LibGfx: Replace BackingStore with PaintingSurface

Now, when Skia backend context is available by the time backing stores
are allocated, there is no need to have a separate BackingStore class.

This allows us to get rid of BackingStore -> PaintingSurface cache.
This commit is contained in:
Aliaksandr Kalenik 2025-06-27 04:39:16 +02:00 committed by Jelle Raaijmakers
parent 082053d781
commit c18314b942
Notes: github-actions[bot] 2025-07-04 14:14:05 +00:00
14 changed files with 52 additions and 189 deletions

View file

@ -29,12 +29,10 @@ public:
void start(DisplayListPlayerType);
void set_skia_player(OwnPtr<Painting::DisplayListPlayerSkia>&& player) { m_skia_player = move(player); }
void set_skia_backend_context(RefPtr<Gfx::SkiaBackendContext> context) { m_skia_backend_context = move(context); }
void enqueue_rendering_task(NonnullRefPtr<Painting::DisplayList>, Painting::ScrollStateSnapshot&&, NonnullRefPtr<Painting::BackingStore>, Function<void()>&& callback);
void clear_bitmap_to_surface_cache();
void enqueue_rendering_task(NonnullRefPtr<Painting::DisplayList>, Painting::ScrollStateSnapshot&&, NonnullRefPtr<Gfx::PaintingSurface>, Function<void()>&& callback);
private:
void rendering_thread_loop();
NonnullRefPtr<Gfx::PaintingSurface> painting_surface_for_backing_store(Painting::BackingStore& backing_store);
Core::EventLoop& m_main_thread_event_loop;
DisplayListPlayerType m_display_list_player_type;
@ -49,7 +47,7 @@ private:
struct Task {
NonnullRefPtr<Painting::DisplayList> display_list;
Painting::ScrollStateSnapshot scroll_state_snapshot;
NonnullRefPtr<Painting::BackingStore> backing_store;
NonnullRefPtr<Gfx::PaintingSurface> painting_surface;
Function<void()> callback;
};
// NOTE: Queue will only contain multiple items in case tasks were scheduled by screenshot requests.
@ -57,9 +55,6 @@ private:
Queue<Task> m_rendering_tasks;
Threading::Mutex m_rendering_task_mutex;
Threading::ConditionVariable m_rendering_task_ready_wake_condition { m_rendering_task_mutex };
HashMap<Gfx::Bitmap*, NonnullRefPtr<Gfx::PaintingSurface>> m_bitmap_to_surface;
bool m_needs_to_clear_bitmap_to_surface_cache { false };
};
}