mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:27:34 +00:00
Solitaire: Refactor painting logic to accomodate to-be-added widgets
A series of events led to this change: The goal is to add more widgets to the Solitaire GML, such as a GUI::Statusbar. To do so without this change, the window ends up with some black artifacts between the main Solitaire frame and the added elements, because the GML specifies the main widget to have fill_with_background_color=false. However, setting that property to true results in the background color of the widget interferring with the Solitaire frame trying to manually paint its background green. This results in flickering and some elements in the Solitaire frame being painted over by the main background color. To avoid all of that behavior, this sets fill_with_background_color=true and the Solitaire frame's background color to green in the GML. Further, the frame now only queues a paint update on the specific Gfx::Rect areas that need to be updated. This also means we no longer need to track if a stack of cards is dirty, because we only trigger a paint event for dirty stacks.
This commit is contained in:
parent
bb7b76e505
commit
4fc9c1d710
5 changed files with 58 additions and 65 deletions
|
@ -24,7 +24,6 @@ public:
|
|||
CardStack();
|
||||
CardStack(const Gfx::IntPoint& position, Type type);
|
||||
|
||||
bool is_dirty() const { return m_dirty; }
|
||||
bool is_empty() const { return m_stack.is_empty(); }
|
||||
bool is_focused() const { return m_focused; }
|
||||
Type type() const { return m_type; }
|
||||
|
@ -34,7 +33,6 @@ public:
|
|||
const Gfx::IntRect& bounding_box() const { return m_bounding_box; }
|
||||
|
||||
void set_focused(bool focused) { m_focused = focused; }
|
||||
void set_dirty() { m_dirty = true; };
|
||||
|
||||
void push(NonnullRefPtr<Card> card);
|
||||
NonnullRefPtr<Card> pop();
|
||||
|
@ -77,7 +75,6 @@ private:
|
|||
Type m_type { Invalid };
|
||||
StackRules m_rules;
|
||||
bool m_focused { false };
|
||||
bool m_dirty { false };
|
||||
Gfx::IntRect m_base;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue