diff options
| author | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-05 21:10:18 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal.elmahrouss@icloud.com> | 2024-05-05 21:10:18 +0200 |
| commit | f95d8bf159d10b5a9521dcaa0bc37aa0e9dfc02b (patch) | |
| tree | bf8186f1a0521a64983bb0bca4f7b54883542195 /Private/Source/Framebuffer.cxx | |
| parent | 5a903c1d8f80ca8d7bc5fbea0aea710ce0133f9d (diff) | |
MHR-23: Add run_format.sh, kernel patches.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Private/Source/Framebuffer.cxx')
| -rw-r--r-- | Private/Source/Framebuffer.cxx | 87 |
1 files changed, 48 insertions, 39 deletions
diff --git a/Private/Source/Framebuffer.cxx b/Private/Source/Framebuffer.cxx index 5dc54c81..625af242 100644 --- a/Private/Source/Framebuffer.cxx +++ b/Private/Source/Framebuffer.cxx @@ -21,12 +21,13 @@ using namespace NewOS; -namespace NewOS { -const UInt32 kRgbRed = 0x000000FF; -const UInt32 kRgbGreen = 0x0000FF00; -const UInt32 kRgbBlue = 0x00FF0000; -const UInt32 kRgbBlack = 0x00000000; -const UInt32 kRgbWhite = 0xFFFFFFFF; +namespace NewOS +{ + const UInt32 kRgbRed = 0x000000FF; + const UInt32 kRgbGreen = 0x0000FF00; + const UInt32 kRgbBlue = 0x00FF0000; + const UInt32 kRgbBlack = 0x00000000; + const UInt32 kRgbWhite = 0xFFFFFFFF; } // namespace NewOS /** @@ -35,53 +36,61 @@ const UInt32 kRgbWhite = 0xFFFFFFFF; * @param pos position of pixel. * @return volatile* */ -volatile UIntPtr *Framebuffer::operator[](const UIntPtr &pos) { - return (UIntPtr *)(fFrameBufferAddr->fBase * pos); +volatile UIntPtr* Framebuffer::operator[](const UIntPtr& pos) +{ + return (UIntPtr*)(fFrameBufferAddr->fBase * pos); } /// @brief Boolean operator. -Framebuffer::operator bool() { - return fFrameBufferAddr.Leak()->fBase != 0 && - fColour != FramebufferColorKind::INVALID && - fFrameBufferAddr.Leak()->fBase != kBadPtr; +Framebuffer::operator bool() +{ + return fFrameBufferAddr.Leak()->fBase != 0 && + fColour != FramebufferColorKind::INVALID && + fFrameBufferAddr.Leak()->fBase != kBadPtr; } /// @brief Set color kind of framebuffer. /// @param colour /// @return -const FramebufferColorKind &Framebuffer::Color( - const FramebufferColorKind &colour) { - if (fColour != FramebufferColorKind::INVALID && - colour != FramebufferColorKind::INVALID) { - fColour = colour; - } - - return fColour; +const FramebufferColorKind& Framebuffer::Color( + const FramebufferColorKind& colour) +{ + if (fColour != FramebufferColorKind::INVALID && + colour != FramebufferColorKind::INVALID) + { + fColour = colour; + } + + return fColour; } /// @brief Leak framebuffer context. /// @return The reference of the framebuffer context. -Ref<FramebufferContext *> &Framebuffer::Leak() { - return this->fFrameBufferAddr; +Ref<FramebufferContext*>& Framebuffer::Leak() +{ + return this->fFrameBufferAddr; } -Framebuffer &Framebuffer::DrawRect(SizeT width, SizeT height, SizeT x, SizeT y, - UInt32 color) { - for (NewOS::SizeT i = x; i < width + x; ++i) { - for (NewOS::SizeT u = y; u < height + y; ++u) { - *(((volatile NewOS::UInt32 *)(fFrameBufferAddr.Leak()->fBase + - 4 * fFrameBufferAddr.Leak()->fBpp * i + - 4 * u))) = color; - } - } - - return *this; +Framebuffer& Framebuffer::DrawRect(SizeT width, SizeT height, SizeT x, SizeT y, UInt32 color) +{ + for (NewOS::SizeT i = x; i < width + x; ++i) + { + for (NewOS::SizeT u = y; u < height + y; ++u) + { + *(((volatile NewOS::UInt32*)(fFrameBufferAddr.Leak()->fBase + + 4 * fFrameBufferAddr.Leak()->fBpp * i + + 4 * u))) = color; + } + } + + return *this; } -Framebuffer &Framebuffer::PutPixel(SizeT x, SizeT y, UInt32 color) { - *(((volatile NewOS::UInt32 *)(fFrameBufferAddr.Leak()->fBase + - 4 * fFrameBufferAddr.Leak()->fBpp * x + - 4 * y))) = color; - - return *this; +Framebuffer& Framebuffer::PutPixel(SizeT x, SizeT y, UInt32 color) +{ + *(((volatile NewOS::UInt32*)(fFrameBufferAddr.Leak()->fBase + + 4 * fFrameBufferAddr.Leak()->fBpp * x + + 4 * y))) = color; + + return *this; }
\ No newline at end of file |
