mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:27:43 +00:00
PixelPaint: Keep track of and expose the type of the edited bitmap
This can be either the content bitmap or the mask bitmap.
This commit is contained in:
parent
a180b5f442
commit
96829565d8
2 changed files with 33 additions and 0 deletions
|
@ -179,4 +179,25 @@ void Layer::create_mask()
|
|||
update_cached_bitmap();
|
||||
}
|
||||
|
||||
Gfx::Bitmap& Layer::currently_edited_bitmap()
|
||||
{
|
||||
switch (edit_mode()) {
|
||||
case EditMode::Mask:
|
||||
if (is_masked())
|
||||
return *mask_bitmap();
|
||||
[[fallthrough]];
|
||||
case EditMode::Content:
|
||||
return content_bitmap();
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
void Layer::set_edit_mode(Layer::EditMode mode)
|
||||
{
|
||||
if (m_edit_mode == mode)
|
||||
return;
|
||||
|
||||
m_edit_mode = mode;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue