mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:37:35 +00:00
Build Painter & friends into LibC. Use it in the GUI test app.
This commit is contained in:
parent
bfef4afa6a
commit
b673c1a77d
16 changed files with 105 additions and 50 deletions
|
@ -1,19 +1,18 @@
|
|||
#include "GraphicsBitmap.h"
|
||||
#include "EventLoop.h"
|
||||
#include <AK/kmalloc.h>
|
||||
|
||||
#ifdef KERNEL
|
||||
#include "Process.h"
|
||||
#include "MemoryManager.h"
|
||||
#endif
|
||||
|
||||
#ifdef KERNEL
|
||||
RetainPtr<GraphicsBitmap> GraphicsBitmap::create(Process& process, const Size& size)
|
||||
{
|
||||
return adopt(*new GraphicsBitmap(process, size));
|
||||
}
|
||||
|
||||
RetainPtr<GraphicsBitmap> GraphicsBitmap::create_wrapper(const Size& size, RGBA32* data)
|
||||
{
|
||||
return adopt(*new GraphicsBitmap(size, data));
|
||||
}
|
||||
|
||||
GraphicsBitmap::GraphicsBitmap(Process& process, const Size& size)
|
||||
: m_size(size)
|
||||
, m_pitch(size.width() * sizeof(RGBA32))
|
||||
|
@ -34,6 +33,12 @@ GraphicsBitmap::GraphicsBitmap(Process& process, const Size& size)
|
|||
}
|
||||
m_data = (RGBA32*)m_server_region->linearAddress.asPtr();
|
||||
}
|
||||
#endif
|
||||
|
||||
RetainPtr<GraphicsBitmap> GraphicsBitmap::create_wrapper(const Size& size, RGBA32* data)
|
||||
{
|
||||
return adopt(*new GraphicsBitmap(size, data));
|
||||
}
|
||||
|
||||
GraphicsBitmap::GraphicsBitmap(const Size& size, RGBA32* data)
|
||||
: m_size(size)
|
||||
|
@ -44,10 +49,12 @@ GraphicsBitmap::GraphicsBitmap(const Size& size, RGBA32* data)
|
|||
|
||||
GraphicsBitmap::~GraphicsBitmap()
|
||||
{
|
||||
#ifdef KERNEL
|
||||
if (m_client_region)
|
||||
m_client_process->deallocate_region(*m_client_region);
|
||||
if (m_server_region)
|
||||
EventLoop::main().server_process().deallocate_region(*m_server_region);
|
||||
#endif
|
||||
m_data = nullptr;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue