mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:37:36 +00:00
LibGUI: Add a WindowBackingStore class
Instead of storing the back/front buffers of a GUI::Window as just Gfx::Bitmap, wrap them in a WindowBackingStore class. This will allow us to add more information alongside the bitmaps while keeping the back/front swapping logic simple.
This commit is contained in:
parent
7e71de8f1f
commit
96f8fcdcba
2 changed files with 71 additions and 44 deletions
|
@ -40,6 +40,8 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
class WindowBackingStore;
|
||||
|
||||
class Window : public Core::Object {
|
||||
C_OBJECT(Window)
|
||||
public:
|
||||
|
@ -157,8 +159,7 @@ public:
|
|||
const Widget* hovered_widget() const { return m_hovered_widget.ptr(); }
|
||||
void set_hovered_widget(Widget*);
|
||||
|
||||
Gfx::Bitmap* front_bitmap() { return m_front_bitmap.ptr(); }
|
||||
Gfx::Bitmap* back_bitmap() { return m_back_bitmap.ptr(); }
|
||||
Gfx::Bitmap* back_bitmap();
|
||||
|
||||
Gfx::IntSize size_increment() const { return m_size_increment; }
|
||||
void set_size_increment(const Gfx::IntSize&);
|
||||
|
@ -221,14 +222,15 @@ private:
|
|||
|
||||
void server_did_destroy();
|
||||
|
||||
RefPtr<Gfx::Bitmap> create_backing_bitmap(const Gfx::IntSize&);
|
||||
OwnPtr<WindowBackingStore> create_backing_store(const Gfx::IntSize&);
|
||||
RefPtr<Gfx::Bitmap> create_shared_bitmap(Gfx::BitmapFormat, const Gfx::IntSize&);
|
||||
void set_current_backing_bitmap(Gfx::Bitmap&, bool flush_immediately = false);
|
||||
void set_current_backing_store(WindowBackingStore&, bool flush_immediately = false);
|
||||
void flip(const Vector<Gfx::IntRect, 32>& dirty_rects);
|
||||
void force_update();
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_front_bitmap;
|
||||
RefPtr<Gfx::Bitmap> m_back_bitmap;
|
||||
OwnPtr<WindowBackingStore> m_front_store;
|
||||
OwnPtr<WindowBackingStore> m_back_store;
|
||||
|
||||
RefPtr<Gfx::Bitmap> m_icon;
|
||||
RefPtr<Gfx::Bitmap> m_custom_cursor;
|
||||
int m_window_id { 0 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue