diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-26 22:26:48 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-01-26 22:27:09 +0100 |
| commit | eba8b7ddd0a455d9e49f32dcae712c5612c0093c (patch) | |
| tree | 749a3d34546d055507a920bce4ab10e8a9945719 /Private/Source/Framebuffer.cxx | |
| parent | dd192787a70a973f2474720aea49af3f6ddabb7a (diff) | |
Kernel: Major repository refactor.
Rework the repo into Private and Public modules.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Source/Framebuffer.cxx')
| -rw-r--r-- | Private/Source/Framebuffer.cxx | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Private/Source/Framebuffer.cxx b/Private/Source/Framebuffer.cxx new file mode 100644 index 00000000..208e90e9 --- /dev/null +++ b/Private/Source/Framebuffer.cxx @@ -0,0 +1,39 @@ +/* + * ======================================================== + * + * hCore + * Copyright 2024 Mahrouss Logic, all rights reserved. + * + * ======================================================== + */ + +#include <KernelKit/Framebuffer.hpp> + +namespace hCore +{ + Framebuffer::Framebuffer(hCore::Ref<FramebufferContext*> &addr) + : m_FrameBufferAddr(addr), m_Colour(FramebufferColorKind::RGB32) + {} + + Framebuffer::~Framebuffer() = default; + + volatile UIntPtr* Framebuffer::operator[](const UIntPtr& width_and_height) + { + if (m_FrameBufferAddr) + return reinterpret_cast<volatile hCore::UIntPtr*>(m_FrameBufferAddr->m_Base + width_and_height); + + return nullptr; + } + + Ref<FramebufferContext*>& Framebuffer::Leak() { return m_FrameBufferAddr; } + + Framebuffer::operator bool() { return m_FrameBufferAddr; } + + const FramebufferColorKind& Framebuffer::Color(const FramebufferColorKind& colour) + { + if (colour != FramebufferColorKind::INVALID) + m_Colour = colour; + + return m_Colour; + } +} // namespace hCore |
