From 443b043b4914d79be29bcf2aa7a3762a94459599 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 11 Feb 2019 09:47:10 +0100 Subject: WindowServer: Start implementing a menu system. I'm going with a global top-of-the-screen menu instead of per-window menus. The basic idea is that menus will live in the WindowServer and clients can create menus via WindowServer requests. --- SharedGraphics/GraphicsBitmap.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'SharedGraphics/GraphicsBitmap.cpp') diff --git a/SharedGraphics/GraphicsBitmap.cpp b/SharedGraphics/GraphicsBitmap.cpp index 0c9dc70519..5d0183b806 100644 --- a/SharedGraphics/GraphicsBitmap.cpp +++ b/SharedGraphics/GraphicsBitmap.cpp @@ -39,6 +39,25 @@ GraphicsBitmap::GraphicsBitmap(Process& process, const Size& size) m_data = (RGBA32*)m_server_region->laddr().as_ptr(); } + +RetainPtr GraphicsBitmap::create_kernel_only(const Size& size) +{ + return adopt(*new GraphicsBitmap(size)); +} + +GraphicsBitmap::GraphicsBitmap(const Size& size) + : m_size(size) + , m_pitch(size.width() * sizeof(RGBA32)) +{ + InterruptDisabler disabler; + size_t size_in_bytes = size.width() * size.height() * sizeof(RGBA32); + auto vmo = VMObject::create_anonymous(size_in_bytes); + auto& server = WSMessageLoop::the().server_process(); + m_server_region = server.allocate_region_with_vmo(LinearAddress(), size_in_bytes, move(vmo), 0, "GraphicsBitmap (server)", true, false); + m_server_region->set_shared(true); + m_server_region->set_is_bitmap(true); + m_data = (RGBA32*)m_server_region->laddr().as_ptr(); +} #endif RetainPtr GraphicsBitmap::create_wrapper(const Size& size, RGBA32* data) -- cgit v1.2.3