mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 16:57:36 +00:00
Meta+Userland: Pass Gfx::Color by value
Gfx::Color is always 4 bytes (it's just a wrapper over u32) it's less work just to pass the color directly. This also updates IPCCompiler to prevent from generating Gfx::Color const &, which makes replacement easier.
This commit is contained in:
parent
f76c7f3788
commit
bbc149ebb9
28 changed files with 65 additions and 54 deletions
|
@ -32,7 +32,7 @@ void Card::paint(GUI::Painter& painter) const
|
|||
painter.blit(position(), bitmap, bitmap->rect());
|
||||
}
|
||||
|
||||
void Card::clear(GUI::Painter& painter, Color const& background_color) const
|
||||
void Card::clear(GUI::Painter& painter, Color background_color) const
|
||||
{
|
||||
painter.fill_rect({ old_position(), { width, height } }, background_color);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ void Card::save_old_position()
|
|||
m_old_position_valid = true;
|
||||
}
|
||||
|
||||
void Card::clear_and_paint(GUI::Painter& painter, Color const& background_color)
|
||||
void Card::clear_and_paint(GUI::Painter& painter, Color background_color)
|
||||
{
|
||||
if (is_old_position_valid())
|
||||
clear(painter, background_color);
|
||||
|
|
|
@ -108,8 +108,8 @@ public:
|
|||
void save_old_position();
|
||||
|
||||
void paint(GUI::Painter&) const;
|
||||
void clear(GUI::Painter&, Color const& background_color) const;
|
||||
void clear_and_paint(GUI::Painter& painter, Color const& background_color);
|
||||
void clear(GUI::Painter&, Color background_color) const;
|
||||
void clear_and_paint(GUI::Painter& painter, Color background_color);
|
||||
|
||||
private:
|
||||
Card(Suit, Rank);
|
||||
|
|
|
@ -121,7 +121,7 @@ Gfx::Color CardGame::background_color() const
|
|||
return palette().color(background_role());
|
||||
}
|
||||
|
||||
void CardGame::set_background_color(Gfx::Color const& color)
|
||||
void CardGame::set_background_color(Gfx::Color color)
|
||||
{
|
||||
auto new_palette = palette();
|
||||
new_palette.set_color(Gfx::ColorRole::Background, color);
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
virtual ~CardGame() = default;
|
||||
|
||||
Gfx::Color background_color() const;
|
||||
void set_background_color(Gfx::Color const&);
|
||||
void set_background_color(Gfx::Color);
|
||||
|
||||
NonnullRefPtrVector<CardStack>& stacks() { return m_stacks; }
|
||||
NonnullRefPtrVector<CardStack> const& stacks() const { return m_stacks; }
|
||||
|
|
|
@ -32,7 +32,7 @@ void CardStack::clear()
|
|||
m_stack_positions.clear();
|
||||
}
|
||||
|
||||
void CardStack::paint(GUI::Painter& painter, Gfx::Color const& background_color)
|
||||
void CardStack::paint(GUI::Painter& painter, Gfx::Color background_color)
|
||||
{
|
||||
auto draw_background_if_empty = [&]() {
|
||||
size_t number_of_moving_cards = 0;
|
||||
|
|
|
@ -50,7 +50,7 @@ public:
|
|||
|
||||
bool is_allowed_to_push(Card const&, size_t stack_size = 1, MovementRule movement_rule = MovementRule::Alternating) const;
|
||||
void add_all_grabbed_cards(Gfx::IntPoint const& click_location, NonnullRefPtrVector<Card>& grabbed, MovementRule movement_rule = MovementRule::Alternating);
|
||||
void paint(GUI::Painter&, Gfx::Color const& background_color);
|
||||
void paint(GUI::Painter&, Gfx::Color background_color);
|
||||
void clear();
|
||||
|
||||
private:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue