From 71f50b6e94845cda078f08fbdc8a1cf19cc5d086 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 15 Jan 2021 23:16:33 +0100 Subject: [PATCH] LibGUI: Window icons no longer need to be backed by shbufs This allows us to remove Window::create_shared_bitmap() entirely. --- Userland/Libraries/LibGUI/Window.cpp | 14 +------------- Userland/Libraries/LibGUI/Window.h | 1 - 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/Userland/Libraries/LibGUI/Window.cpp b/Userland/Libraries/LibGUI/Window.cpp index baab010b6a..175bf1da7c 100644 --- a/Userland/Libraries/LibGUI/Window.cpp +++ b/Userland/Libraries/LibGUI/Window.cpp @@ -710,18 +710,6 @@ void Window::flip(const Vector& dirty_rects) m_back_store->bitmap().set_volatile(); } -RefPtr Window::create_shared_bitmap(Gfx::BitmapFormat format, const Gfx::IntSize& size) -{ - ASSERT(WindowServerConnection::the().server_pid()); - ASSERT(!size.is_empty()); - size_t pitch = Gfx::Bitmap::minimum_pitch(size.width(), format); - size_t size_in_bytes = size.height() * pitch; - auto shared_buffer = SharedBuffer::create_with_size(size_in_bytes); - ASSERT(shared_buffer); - shared_buffer->share_with(WindowServerConnection::the().server_pid()); - return Gfx::Bitmap::create_with_shared_buffer(format, *shared_buffer, size); -} - OwnPtr Window::create_backing_store(const Gfx::IntSize& size) { auto format = m_has_alpha_channel ? Gfx::BitmapFormat::RGBA32 : Gfx::BitmapFormat::RGB32; @@ -759,7 +747,7 @@ void Window::set_icon(const Gfx::Bitmap* icon) Gfx::IntSize icon_size = icon ? icon->size() : Gfx::IntSize(16, 16); - m_icon = create_shared_bitmap(Gfx::BitmapFormat::RGBA32, icon_size); + m_icon = Gfx::Bitmap::create(Gfx::BitmapFormat::RGBA32, icon_size); ASSERT(m_icon); if (icon) { Painter painter(*m_icon); diff --git a/Userland/Libraries/LibGUI/Window.h b/Userland/Libraries/LibGUI/Window.h index 34d3b0d266..3b0ba8e2e8 100644 --- a/Userland/Libraries/LibGUI/Window.h +++ b/Userland/Libraries/LibGUI/Window.h @@ -223,7 +223,6 @@ private: void server_did_destroy(); OwnPtr create_backing_store(const Gfx::IntSize&); - RefPtr create_shared_bitmap(Gfx::BitmapFormat, const Gfx::IntSize&); void set_current_backing_store(WindowBackingStore&, bool flush_immediately = false); void flip(const Vector& dirty_rects); void force_update();