ladybird/Libraries/LibWeb/Painting/BackingStoreManager.h
Aliaksandr Kalenik 410e82c9fd
Some checks failed
CI / Linux, x86_64, Fuzzers, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, GNU (push) Waiting to run
CI / macOS, arm64, Sanitizer, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Build Dev Container Image / build (push) Has been cancelled
LibWeb: Rearrange code such that a lot less files include Command.h
With this change number of recompiled files after modification of
`Command.h` goes down from >1000 to <100.
2025-07-11 17:37:27 +02:00

55 lines
1.3 KiB
C++

/*
* Copyright (c) 2024-2025, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/HTML/Navigable.h>
namespace Web::Painting {
class BackingStoreManager : public JS::Cell {
GC_CELL(BackingStoreManager, JS::Cell);
GC_DECLARE_ALLOCATOR(BackingStoreManager);
public:
#ifdef AK_OS_MACOS
static void set_browser_mach_port(Core::MachPort&&);
#endif
enum class WindowResizingInProgress {
No,
Yes
};
void resize_backing_stores_if_needed(WindowResizingInProgress window_resize_in_progress);
void reallocate_backing_stores(Gfx::IntSize);
void restart_resize_timer();
struct BackingStore {
i32 bitmap_id { -1 };
RefPtr<Gfx::PaintingSurface> store;
};
BackingStore acquire_store_for_next_frame();
virtual void visit_edges(Cell::Visitor& visitor) override;
BackingStoreManager(HTML::Navigable&);
private:
void swap_back_and_front();
GC::Ref<HTML::Navigable> m_navigable;
i32 m_front_bitmap_id { -1 };
i32 m_back_bitmap_id { -1 };
RefPtr<Gfx::PaintingSurface> m_front_store;
RefPtr<Gfx::PaintingSurface> m_back_store;
int m_next_bitmap_id { 0 };
RefPtr<Core::Timer> m_backing_store_shrink_timer;
};
}