summaryrefslogtreecommitdiffhomepage
path: root/Kernel/Sources
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Sources')
-rw-r--r--Kernel/Sources/Framebuffer.cxx136
1 files changed, 77 insertions, 59 deletions
diff --git a/Kernel/Sources/Framebuffer.cxx b/Kernel/Sources/Framebuffer.cxx
index 2e0333d7..440bd3a4 100644
--- a/Kernel/Sources/Framebuffer.cxx
+++ b/Kernel/Sources/Framebuffer.cxx
@@ -9,88 +9,106 @@
01/02/24: Added file (amlel)
02/02/24: Add documentation (amlel)
+ 07/07/07: Moved Framebuffer methods into Kernel::
------------------------------------------- */
#include <KernelKit/Framebuffer.hpp>
+#include <HintKit/CompilerHint.hxx>
/**
* @brief Framebuffer object implementation.
*
*/
-using namespace Kernel;
-
namespace Kernel
{
- const UInt32 kRgbRed = 0x000000FF;
- const UInt32 kRgbGreen = 0x0000FF00;
- const UInt32 kRgbBlue = 0x00FF0000;
- const UInt32 kRgbBlack = 0x00000000;
- const UInt32 kRgbWhite = 0xFFFFFFFF;
-} // namespace Kernel
+ Framebuffer::Framebuffer(_Input Ref<FramebufferContext*>& addr)
+ : fFrameBufferAddr(addr)
+ {
+ }
-/**
- * @brief Get Pixel at
- *
- * @param pos position of pixel.
- * @return volatile*
- */
-volatile UIntPtr* Framebuffer::operator[](const UIntPtr& pos)
-{
- return (UIntPtr*)(fFrameBufferAddr->fBase * pos);
-}
+ /**
+ * @brief Get Pixel at **pos**
+ *
+ * @param pos position of pixel.
+ * @return volatile*
+ */
+ _Output volatile UIntPtr* Framebuffer::operator[](_Input 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;
-}
-
-/// @brief Set color kind of framebuffer.
-/// @param colour
-/// @return
-const FramebufferColorKind& Framebuffer::Color(
- const FramebufferColorKind& colour)
-{
- if (fColour != FramebufferColorKind::INVALID &&
- colour != FramebufferColorKind::INVALID)
+ /// @brief Boolean operator.
+ Framebuffer::operator bool()
{
- fColour = colour;
+ return fFrameBufferAddr.Leak()->fBase != 0 &&
+ fColour != FramebufferColorKind::INVALID &&
+ fFrameBufferAddr.Leak()->fBase != kBadPtr;
}
- return fColour;
-}
+ /// @brief Set color kind of framebuffer.
+ /// @param colour
+ /// @return
+ _Output 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;
-}
+ /// @brief Leak framebuffer context.
+ /// @return The reference of the framebuffer context.
+ _Output Ref<FramebufferContext*>& Framebuffer::Leak()
+ {
+ return this->fFrameBufferAddr;
+ }
-Framebuffer& Framebuffer::DrawRect(SizeT width, SizeT height, SizeT x, SizeT y, UInt32 color)
-{
- for (Kernel::SizeT i = x; i < width + x; ++i)
+ /// @brief Draws a rectangle.
+ /// @param width
+ /// @param height
+ /// @param x
+ /// @param y
+ /// @param color
+ /// @return
+ _Output Framebuffer& Framebuffer::DrawRect(SizeT width, SizeT height,
+ SizeT x, SizeT y, UInt32 color)
{
- for (Kernel::SizeT u = y; u < height + y; ++u)
+ for (Kernel::SizeT i = x; i < width + x; ++i)
{
- *(((volatile Kernel::UInt32*)(fFrameBufferAddr.Leak()->fBase +
- 4 * fFrameBufferAddr.Leak()->fBpp * i +
- 4 * u))) = color;
+ for (Kernel::SizeT u = y; u < height + y; ++u)
+ {
+ *(((volatile Kernel::UInt32*)(fFrameBufferAddr.Leak()->fBase +
+ 4 * fFrameBufferAddr.Leak()->fBpp * i +
+ 4 * u))) = color;
+ }
}
+
+ return *this;
}
- return *this;
-}
+ /// @brief Put a pixel on the screen.
+ /// @param x
+ /// @param y
+ /// @param color
+ /// @return
+ _Output Framebuffer& Framebuffer::PutPixel(SizeT x, SizeT y, UInt32 color)
+ {
+ *(((volatile Kernel::UInt32*)(fFrameBufferAddr.Leak()->fBase +
+ 4 * fFrameBufferAddr.Leak()->fBpp * x +
+ 4 * y))) = color;
-Framebuffer& Framebuffer::PutPixel(SizeT x, SizeT y, UInt32 color)
-{
- *(((volatile Kernel::UInt32*)(fFrameBufferAddr.Leak()->fBase +
- 4 * fFrameBufferAddr.Leak()->fBpp * x +
- 4 * y))) = color;
+ return *this;
+ }
- return *this;
-} \ No newline at end of file
+ const UInt32 kRgbRed = 0x000000FF;
+ const UInt32 kRgbGreen = 0x0000FF00;
+ const UInt32 kRgbBlue = 0x00FF0000;
+ const UInt32 kRgbBlack = 0x00000000;
+ const UInt32 kRgbWhite = 0xFFFFFFFF;
+} // namespace Kernel