From 5339d016c07bf717ee388f4feb73544087324af0 Mon Sep 17 00:00:00 2001 From: Amlal El Mahrouss Date: Sat, 6 Jan 2024 09:14:11 +0100 Subject: git: port from mercurial repo. Signed-off-by: Amlal El Mahrouss --- Source/Framebuffer.cxx | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Source/Framebuffer.cxx (limited to 'Source/Framebuffer.cxx') diff --git a/Source/Framebuffer.cxx b/Source/Framebuffer.cxx new file mode 100644 index 00000000..045e405a --- /dev/null +++ b/Source/Framebuffer.cxx @@ -0,0 +1,39 @@ +/* + * ======================================================== + * + * hCore + * Copyright 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