summaryrefslogtreecommitdiffhomepage
path: root/Source/Framebuffer.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-06 09:14:11 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-06 09:14:11 +0100
commit5339d016c07bf717ee388f4feb73544087324af0 (patch)
tree94be6f67ed626091f24aee24ec3b3be03d01e4e7 /Source/Framebuffer.cxx
git: port from mercurial repo.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Source/Framebuffer.cxx')
-rw-r--r--Source/Framebuffer.cxx39
1 files changed, 39 insertions, 0 deletions
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 <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