mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
PixelPaint: Move selection from ImageEditor to Image
This is preparation for making selection state undoable.
This commit is contained in:
parent
67596d9546
commit
d571159aeb
8 changed files with 70 additions and 32 deletions
|
@ -10,15 +10,16 @@
|
|||
|
||||
namespace PixelPaint {
|
||||
|
||||
Selection::Selection(ImageEditor& editor)
|
||||
: m_editor(editor)
|
||||
Selection::Selection(Image& image)
|
||||
: m_image(image)
|
||||
{
|
||||
}
|
||||
|
||||
void Selection::clear()
|
||||
{
|
||||
m_mask = {};
|
||||
m_editor.update();
|
||||
for (auto* client : m_clients)
|
||||
client->selection_did_change();
|
||||
}
|
||||
|
||||
void Selection::merge(Mask const& mask, MergeMode mode)
|
||||
|
@ -41,4 +42,16 @@ void Selection::merge(Mask const& mask, MergeMode mode)
|
|||
}
|
||||
}
|
||||
|
||||
void Selection::add_client(SelectionClient& client)
|
||||
{
|
||||
VERIFY(!m_clients.contains(&client));
|
||||
m_clients.set(&client);
|
||||
}
|
||||
|
||||
void Selection::remove_client(SelectionClient& client)
|
||||
{
|
||||
VERIFY(m_clients.contains(&client));
|
||||
m_clients.remove(&client);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue