diff options
author | Andreas Kling <kling@serenityos.org> | 2021-06-12 10:24:04 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-06-12 11:19:29 +0200 |
commit | 9038bc675fa43ff9acb4aadcdca2dd181e7d712d (patch) | |
tree | 54f1f437a69f12010529c73d6ea44b95a73a06ca /Userland/Applications/PixelPaint/Layer.h | |
parent | c7f7c1f7f0914132f77f3e8bf38ba9e416fa97aa (diff) | |
download | serenity-9038bc675fa43ff9acb4aadcdca2dd181e7d712d.zip |
PixelPaint: Guarantee that constructed Layer always has a Gfx::Bitmap
Hoist any allocation failures so that layer factories never return a
bitmap-less layer.
Diffstat (limited to 'Userland/Applications/PixelPaint/Layer.h')
-rw-r--r-- | Userland/Applications/PixelPaint/Layer.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Userland/Applications/PixelPaint/Layer.h b/Userland/Applications/PixelPaint/Layer.h index 846aab6ee5..c6b52e252e 100644 --- a/Userland/Applications/PixelPaint/Layer.h +++ b/Userland/Applications/PixelPaint/Layer.h @@ -25,7 +25,7 @@ class Layer public: static RefPtr<Layer> try_create_with_size(Image&, Gfx::IntSize const&, String name); - static RefPtr<Layer> try_create_with_bitmap(Image&, Gfx::Bitmap const&, String name); + static RefPtr<Layer> try_create_with_bitmap(Image&, NonnullRefPtr<Gfx::Bitmap>, String name); static RefPtr<Layer> try_create_snapshot(Image&, Layer const&); ~Layer() { } @@ -57,14 +57,13 @@ public: void set_opacity_percent(int); private: - Layer(Image&, Gfx::IntSize const&, String name); - Layer(Image&, Gfx::Bitmap const&, String name); + Layer(Image&, NonnullRefPtr<Gfx::Bitmap>, String name); Image& m_image; String m_name; Gfx::IntPoint m_location; - RefPtr<Gfx::Bitmap> m_bitmap; + NonnullRefPtr<Gfx::Bitmap> m_bitmap; bool m_selected { false }; bool m_visible { true }; |