summaryrefslogtreecommitdiff
path: root/LibGUI/GWindow.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-08 12:22:55 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-08 12:24:05 +0100
commiteda086699287dcd8f6f858a5d3c0a43009dd9e59 (patch)
treec3a125d429f5602490d9fa140610f10d36d2ab2b /LibGUI/GWindow.cpp
parent0b5d5fc3c955baf3029286f2410005d652f9dc2d (diff)
downloadserenity-eda086699287dcd8f6f858a5d3c0a43009dd9e59.zip
Add a C++ helper class for working with shared buffers.
This is a bit more comfortable than passing the shared buffer ID manually everywhere and keeping track of size etc.
Diffstat (limited to 'LibGUI/GWindow.cpp')
-rw-r--r--LibGUI/GWindow.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/LibGUI/GWindow.cpp b/LibGUI/GWindow.cpp
index 84458fc503..39cd74d179 100644
--- a/LibGUI/GWindow.cpp
+++ b/LibGUI/GWindow.cpp
@@ -172,15 +172,12 @@ void GWindow::event(GEvent& event)
ASSERT(!paint_event.window_size().is_empty());
Size new_backing_store_size = paint_event.window_size();
size_t size_in_bytes = new_backing_store_size.area() * sizeof(RGBA32);
- void* buffer;
- int shared_buffer_id = create_shared_buffer(GEventLoop::main().server_pid(), size_in_bytes, (void**)&buffer);
- ASSERT(shared_buffer_id >= 0);
- ASSERT(buffer);
- ASSERT(buffer != (void*)-1);
+ auto shared_buffer = SharedBuffer::create(GEventLoop::main().server_pid(), size_in_bytes);
+ ASSERT(shared_buffer);
m_backing = GraphicsBitmap::create_with_shared_buffer(
m_has_alpha_channel ? GraphicsBitmap::Format::RGBA32 : GraphicsBitmap::Format::RGB32,
- shared_buffer_id,
- new_backing_store_size, (RGBA32*)buffer);
+ *shared_buffer,
+ new_backing_store_size);
}
if (rect.is_empty() || created_new_backing_store)
rect = m_main_widget->rect();