blob: 9164e913eebcfa0d45b033af9008a08e15cdc5cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/*
* ========================================================
*
* 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
|