summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibGfx/Bitmap.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/Userland/Libraries/LibGfx/Bitmap.cpp b/Userland/Libraries/LibGfx/Bitmap.cpp
index 5de2da2062..1d3097e207 100644
--- a/Userland/Libraries/LibGfx/Bitmap.cpp
+++ b/Userland/Libraries/LibGfx/Bitmap.cpp
@@ -103,6 +103,7 @@ RefPtr<Bitmap> Bitmap::create_purgeable(BitmapFormat format, const IntSize& size
return adopt(*new Bitmap(format, size, Purgeable::Yes, backing_store.value()));
}
+#ifdef __serenity__
RefPtr<Bitmap> Bitmap::create_shareable(BitmapFormat format, const IntSize& size)
{
if (size_would_overflow(format, size))
@@ -110,11 +111,13 @@ RefPtr<Bitmap> Bitmap::create_shareable(BitmapFormat format, const IntSize& size
const auto pitch = minimum_pitch(size.width(), format);
const auto data_size = size_in_bytes(pitch, size.height());
- auto shared_buffer = SharedBuffer::create_with_size(data_size);
- if (!shared_buffer)
+
+ auto anon_fd = anon_create(round_up_to_power_of_two(data_size, PAGE_SIZE), O_CLOEXEC);
+ if (anon_fd < 0)
return nullptr;
- return adopt(*new Bitmap(format, shared_buffer.release_nonnull(), size, Vector<RGBA32>()));
+ return Bitmap::create_with_anon_fd(format, anon_fd, size, ShouldCloseAnonymousFile::No);
}
+#endif
Bitmap::Bitmap(BitmapFormat format, const IntSize& size, Purgeable purgeable, const BackingStore& backing_store)
: m_size(size)