diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-04-19 08:40:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-19 08:40:12 +0200 |
| commit | f87797692777540eede1d4739199b444bd15340a (patch) | |
| tree | 646ae3f61ebcd3f83c888912c5f72efc0a8c25b0 /dev/kernel/src/Gfx | |
| parent | ee1edba85ea13627871e1ed005931bd502b86ab8 (diff) | |
| parent | 1740a0dff822d7666b8c1f056b6c411ef6b0f9fd (diff) | |
NeKernel: 0.0.10.0.1-release
# NeKernel: 0.0.1
## Features (not all included):
- New extended File System.
- Kernel and Bootloader (NeKernel and BootZ)
- Process Scheduler.
- NeKernel's Preferred Executable Format.
- SysChk.
- Explicit Partition Map scheme.
#### NOTE: The GPT scheme is in WiP! Please run NeKernel on QEMU!
Diffstat (limited to 'dev/kernel/src/Gfx')
| -rw-r--r-- | dev/kernel/src/Gfx/FBDeviceInterface.cc | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/dev/kernel/src/Gfx/FBDeviceInterface.cc b/dev/kernel/src/Gfx/FBDeviceInterface.cc new file mode 100644 index 00000000..c2eb2ca7 --- /dev/null +++ b/dev/kernel/src/Gfx/FBDeviceInterface.cc @@ -0,0 +1,69 @@ +/* ------------------------------------------- + + Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved. + +------------------------------------------- */ + +#include <GfxKit/FB.h> + +using namespace Kernel; + +/// @brief Class constructor +/// @param Out Drive output +/// @param In Drive input +/// @param Cleanup Drive cleanup. +FBDeviceInterface::FBDeviceInterface(void (*out)(IDeviceObject* self, FBDevicePacket* outpacket), + void (*in)(IDeviceObject* self, FBDevicePacket* inpacket)) + : IDeviceObject(out, in) +{ +} + +/// @brief Class desctructor +FBDeviceInterface::~FBDeviceInterface() = default; + +/// @brief Output operator. +/// @param mnt the disk mountpoint. +/// @return the class itself after operation. +FBDeviceInterface& FBDeviceInterface::operator<<(FBDevicePacket* pckt) +{ + if (!pckt) + return *this; + + if (pckt->fHeight == 0 || pckt->fWidth == 0) + return *this; + + if (pckt->fX > kHandoverHeader->f_GOP.f_Width || + pckt->fY > kHandoverHeader->f_GOP.f_Height) + return *this; + + FBDrawInRegion(pckt->fColor, pckt->fHeight, pckt->fWidth, pckt->fY, pckt->fX); + + return *this; +} + +/// @brief Input operator. +/// @param mnt the disk mountpoint. +/// @return the class itself after operation. +FBDeviceInterface& FBDeviceInterface::operator>>(FBDevicePacket* pckt) +{ + if (!pckt) + return *this; + + if (pckt->fX > kHandoverHeader->f_GOP.f_Width || + pckt->fY > kHandoverHeader->f_GOP.f_Height) + return *this; + + pckt->fColor = *(((Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * + pckt->fX + + 4 * pckt->fY))); + + return *this; +} + +/// @brief Returns the name of the device interface. +/// @return it's name as a string. +const Char* FBDeviceInterface::Name() const +{ + return "/dev/fb{}"; +}
\ No newline at end of file |
