BackingStoreManager.h 935 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*
  2. * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <LibWeb/Page/Page.h>
  8. #include <WebContent/Forward.h>
  9. namespace WebContent {
  10. class BackingStoreManager {
  11. public:
  12. enum class WindowResizingInProgress {
  13. No,
  14. Yes
  15. };
  16. void resize_backing_stores_if_needed(WindowResizingInProgress window_resize_in_progress);
  17. void restart_resize_timer();
  18. RefPtr<Gfx::Bitmap> back_bitmap() { return m_back_bitmap; }
  19. i32 front_id() const { return m_front_bitmap_id; }
  20. void swap_back_and_front();
  21. BackingStoreManager(PageClient&);
  22. private:
  23. PageClient& m_page_client;
  24. i32 m_front_bitmap_id { -1 };
  25. i32 m_back_bitmap_id { -1 };
  26. RefPtr<Gfx::Bitmap> m_front_bitmap;
  27. RefPtr<Gfx::Bitmap> m_back_bitmap;
  28. int m_next_bitmap_id { 0 };
  29. RefPtr<Core::Timer> m_backing_store_shrink_timer;
  30. };
  31. }