1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 17:58:11 +00:00
serenity/WindowServer/WSFrameBuffer.cpp
Andreas Kling f7ca6d254d Tear out or duplicate what's unique for WindowServer from Widgets.
This turned into a huge refactoring that somehow also includes
making locks recursive/reentrant.
2019-01-16 16:03:50 +01:00

46 lines
784 B
C++

#include "WSFrameBuffer.h"
#include <Widgets/GraphicsBitmap.h>
#include <AK/Assertions.h>
WSFrameBuffer* s_the;
void WSFrameBuffer::initialize()
{
s_the = nullptr;
}
WSFrameBuffer& WSFrameBuffer::the()
{
ASSERT(s_the);
return *s_the;
}
WSFrameBuffer::WSFrameBuffer(unsigned width, unsigned height)
: WSScreen(width, height)
{
ASSERT(!s_the);
s_the = this;
}
WSFrameBuffer::WSFrameBuffer(RGBA32* data, unsigned width, unsigned height)
: WSScreen(width, height)
, m_data(data)
{
ASSERT(!s_the);
s_the = this;
}
WSFrameBuffer::~WSFrameBuffer()
{
}
void WSFrameBuffer::show()
{
}
RGBA32* WSFrameBuffer::scanline(int y)
{
unsigned pitch = sizeof(RGBA32) * width();
return reinterpret_cast<RGBA32*>(((byte*)m_data) + (y * pitch));
}