Browse Source

LibGUI: Window icons no longer need to be backed by shbufs

This allows us to remove Window::create_shared_bitmap() entirely.
Andreas Kling 4 years ago
parent
commit
71f50b6e94
2 changed files with 1 additions and 14 deletions
  1. 1 13
      Userland/Libraries/LibGUI/Window.cpp
  2. 0 1
      Userland/Libraries/LibGUI/Window.h

+ 1 - 13
Userland/Libraries/LibGUI/Window.cpp

@@ -710,18 +710,6 @@ void Window::flip(const Vector<Gfx::IntRect, 32>& dirty_rects)
     m_back_store->bitmap().set_volatile();
 }
 
-RefPtr<Gfx::Bitmap> 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<WindowBackingStore> 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);

+ 0 - 1
Userland/Libraries/LibGUI/Window.h

@@ -223,7 +223,6 @@ private:
     void server_did_destroy();
 
     OwnPtr<WindowBackingStore> create_backing_store(const Gfx::IntSize&);
-    RefPtr<Gfx::Bitmap> create_shared_bitmap(Gfx::BitmapFormat, const Gfx::IntSize&);
     void set_current_backing_store(WindowBackingStore&, bool flush_immediately = false);
     void flip(const Vector<Gfx::IntRect, 32>& dirty_rects);
     void force_update();