diff options
Diffstat (limited to 'Userland/Libraries/LibGfx')
-rw-r--r-- | Userland/Libraries/LibGfx/ShareableBitmap.cpp | 9 | ||||
-rw-r--r-- | Userland/Libraries/LibGfx/ShareableBitmap.h | 3 |
2 files changed, 11 insertions, 1 deletions
diff --git a/Userland/Libraries/LibGfx/ShareableBitmap.cpp b/Userland/Libraries/LibGfx/ShareableBitmap.cpp index 2ab5ece797..1edf498096 100644 --- a/Userland/Libraries/LibGfx/ShareableBitmap.cpp +++ b/Userland/Libraries/LibGfx/ShareableBitmap.cpp @@ -38,6 +38,11 @@ ShareableBitmap::ShareableBitmap(const Bitmap& bitmap) { } +ShareableBitmap::ShareableBitmap(NonnullRefPtr<Bitmap> bitmap, Tag) + : m_bitmap(move(bitmap)) +{ +} + } namespace IPC { @@ -70,7 +75,9 @@ bool decode(Decoder& decoder, Gfx::ShareableBitmap& shareable_bitmap) return false; auto bitmap = Gfx::Bitmap::create_with_anon_fd(Gfx::BitmapFormat::RGBA32, anon_file.take_fd(), size, Gfx::Bitmap::ShouldCloseAnonymousFile::Yes); - shareable_bitmap = bitmap->to_shareable_bitmap(); + if (!bitmap) + return false; + shareable_bitmap = Gfx::ShareableBitmap { bitmap.release_nonnull(), Gfx::ShareableBitmap::ConstructWithKnownGoodBitmap }; return true; } diff --git a/Userland/Libraries/LibGfx/ShareableBitmap.h b/Userland/Libraries/LibGfx/ShareableBitmap.h index 06ef331c54..d6eecd3cbb 100644 --- a/Userland/Libraries/LibGfx/ShareableBitmap.h +++ b/Userland/Libraries/LibGfx/ShareableBitmap.h @@ -37,6 +37,9 @@ public: ShareableBitmap() { } explicit ShareableBitmap(const Gfx::Bitmap&); + enum Tag { ConstructWithKnownGoodBitmap }; + ShareableBitmap(NonnullRefPtr<Gfx::Bitmap>, Tag); + bool is_valid() const { return m_bitmap; } const Bitmap* bitmap() const { return m_bitmap; } |