summaryrefslogtreecommitdiffhomepage
path: root/Private/Source/Framebuffer.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-25 20:17:53 +0100
committerAmlal El Mahrouss <amlal@el-mahrouss-logic.com>2024-03-25 20:17:53 +0100
commit3b3b36dcc6542e203475fe1d50ed89799e3f3fc6 (patch)
tree3d1e4cfba79343e2b5ef8db58c58271009a44937 /Private/Source/Framebuffer.cxx
parentd968190d1ba48638c1481be0d367ee3cea82ae55 (diff)
Kernel: implement some tickets, improved stuff.
Signed-off-by: Amlal El Mahrouss <amlal@el-mahrouss-logic.com>
Diffstat (limited to 'Private/Source/Framebuffer.cxx')
-rw-r--r--Private/Source/Framebuffer.cxx32
1 files changed, 27 insertions, 5 deletions
diff --git a/Private/Source/Framebuffer.cxx b/Private/Source/Framebuffer.cxx
index 6ea2fa5b..9c964a3c 100644
--- a/Private/Source/Framebuffer.cxx
+++ b/Private/Source/Framebuffer.cxx
@@ -33,13 +33,14 @@ volatile UIntPtr *Framebuffer::operator[](const UIntPtr &pos) {
/// @brief Boolean operator.
Framebuffer::operator bool() {
- return m_FrameBufferAddr.Leak()->m_Base != 0 && m_Colour != FramebufferColorKind::INVALID &&
- m_FrameBufferAddr.Leak()->m_Base != kBadPtr;
+ return m_FrameBufferAddr.Leak()->m_Base != 0 &&
+ m_Colour != FramebufferColorKind::INVALID &&
+ m_FrameBufferAddr.Leak()->m_Base != kBadPtr;
}
/// @brief Set color kind of framebuffer.
-/// @param colour
-/// @return
+/// @param colour
+/// @return
const FramebufferColorKind &Framebuffer::Color(
const FramebufferColorKind &colour) {
if (m_Colour != FramebufferColorKind::INVALID &&
@@ -50,8 +51,29 @@ const FramebufferColorKind &Framebuffer::Color(
return m_Colour;
}
-/// @brief Leak fraembuffer context.
+/// @brief Leak framebuffer context.
/// @return The reference of the framebuffer context.
Ref<FramebufferContext *> &Framebuffer::Leak() {
return this->m_FrameBufferAddr;
}
+
+Framebuffer &Framebuffer::DrawRect(SizeT width, SizeT height, SizeT x, SizeT y,
+ UInt32 color) {
+ for (HCore::SizeT i = x; i < width + x; ++i) {
+ for (HCore::SizeT u = y; u < height + y; ++u) {
+ *(((volatile HCore::UInt32 *)(m_FrameBufferAddr.Leak()->m_Base +
+ 4 * m_FrameBufferAddr.Leak()->m_Bpp * i +
+ 4 * u))) = color;
+ }
+ }
+
+ return *this;
+}
+
+Framebuffer &Framebuffer::PutPixel(SizeT x, SizeT y, UInt32 color) {
+ *(((volatile HCore::UInt32 *)(m_FrameBufferAddr.Leak()->m_Base +
+ 4 * m_FrameBufferAddr.Leak()->m_Bpp * x +
+ 4 * y))) = color;
+
+ return *this;
+} \ No newline at end of file