summaryrefslogtreecommitdiffhomepage
path: root/Private/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Private/Source')
-rw-r--r--Private/Source/Framebuffer.cxx32
-rw-r--r--Private/Source/KernelHeap.cxx10
2 files changed, 33 insertions, 9 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
diff --git a/Private/Source/KernelHeap.cxx b/Private/Source/KernelHeap.cxx
index a38156f4..39648102 100644
--- a/Private/Source/KernelHeap.cxx
+++ b/Private/Source/KernelHeap.cxx
@@ -75,8 +75,9 @@ Int32 ke_delete_ke_heap(VoidPtr heapPtr) {
if (virtualAddress->hCRC32 != 0) {
if (virtualAddress->hCRC32 !=
ke_calculate_crc32((Char *)virtualAddress->hAddress,
- virtualAddress->hSizeAddress))
+ virtualAddress->hSizeAddress)) {
ke_stop(RUNTIME_CHECK_POINTER);
+ }
}
virtualAddress->hSizeAddress = 0UL;
@@ -112,8 +113,8 @@ Boolean ke_is_valid_heap(VoidPtr heapPtr) {
}
/// @brief Protect the heap pointer with a CRC32.
-/// @param heapPtr
-/// @return
+/// @param heapPtr
+/// @return
Boolean ke_protect_ke_heap(VoidPtr heapPtr) {
if (heapPtr) {
Detail::HeapInformationBlockPtr virtualAddress =
@@ -121,7 +122,8 @@ Boolean ke_protect_ke_heap(VoidPtr heapPtr) {
(UIntPtr)heapPtr - sizeof(Detail::HeapInformationBlock));
if (virtualAddress->hPresent && virtualAddress->hMagic == kHeapMagic) {
- virtualAddress->hCRC32 = ke_calculate_crc32((Char*)heapPtr, virtualAddress->hSizeAddress);
+ virtualAddress->hCRC32 =
+ ke_calculate_crc32((Char *)heapPtr, virtualAddress->hSizeAddress);
return true;
}
}