From eba8b7ddd0a455d9e49f32dcae712c5612c0093c Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Fri, 26 Jan 2024 22:26:48 +0100 Subject: Kernel: Major repository refactor. Rework the repo into Private and Public modules. Signed-off-by: Amlal El Mahrouss --- Private/Source/Framebuffer.cxx | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Private/Source/Framebuffer.cxx (limited to 'Private/Source/Framebuffer.cxx') 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 + +namespace hCore +{ + Framebuffer::Framebuffer(hCore::Ref &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(m_FrameBufferAddr->m_Base + width_and_height); + + return nullptr; + } + + Ref& 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 -- cgit v1.2.3