mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-03-06 13:35:03 +00:00
Start refactoring graphics system to have per-window backing stores.
It was fun for everyone to share a single framebuffer but it was also kinda really awful. Let's move towards having a "GraphicsBitmap" as the backing store for each Window. This is going to need a lot of refactoring so let's get started.
This commit is contained in:
25
Widgets/GraphicsBitmap.cpp
Normal file
25
Widgets/GraphicsBitmap.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
#include "GraphicsBitmap.h"
|
||||
#include <AK/kmalloc.h>
|
||||
|
||||
RetainPtr<GraphicsBitmap> GraphicsBitmap::create(const Size& size)
|
||||
{
|
||||
return adopt(*new GraphicsBitmap(size));
|
||||
}
|
||||
|
||||
GraphicsBitmap::GraphicsBitmap(const Size& size)
|
||||
: m_size(size)
|
||||
{
|
||||
m_data = (byte*)kmalloc(size.width() * size.height() * 4);
|
||||
}
|
||||
|
||||
GraphicsBitmap::~GraphicsBitmap()
|
||||
{
|
||||
kfree(m_data);
|
||||
}
|
||||
|
||||
dword* GraphicsBitmap::scanline(int y)
|
||||
{
|
||||
unsigned pitch = m_size.width() * 4;
|
||||
return (dword*)(((byte*)m_data) + (y * pitch));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user