diff options
Diffstat (limited to 'Userland/Applications/PixelPaint/Layer.cpp')
-rw-r--r-- | Userland/Applications/PixelPaint/Layer.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/Userland/Applications/PixelPaint/Layer.cpp b/Userland/Applications/PixelPaint/Layer.cpp index e5905ce9e3..bf90f60b3b 100644 --- a/Userland/Applications/PixelPaint/Layer.cpp +++ b/Userland/Applications/PixelPaint/Layer.cpp @@ -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; +} + } |