summaryrefslogtreecommitdiff
path: root/SharedGraphics/GraphicsBitmap.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-02-11 09:47:10 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-02-11 09:47:10 +0100
commit443b043b4914d79be29bcf2aa7a3762a94459599 (patch)
tree845fefa8e5c5562e792d44c9b96313b6191bdfd0 /SharedGraphics/GraphicsBitmap.cpp
parent7abef6ba9eab50e11636e01aa48e69f2ced263fb (diff)
downloadserenity-443b043b4914d79be29bcf2aa7a3762a94459599.zip
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.
Diffstat (limited to 'SharedGraphics/GraphicsBitmap.cpp')
-rw-r--r--SharedGraphics/GraphicsBitmap.cpp19
1 files changed, 19 insertions, 0 deletions
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> 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> GraphicsBitmap::create_wrapper(const Size& size, RGBA32* data)