summaryrefslogtreecommitdiffhomepage
path: root/dev/modules/CoreGfx/CoreGfx.h
diff options
context:
space:
mode:
authorAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
committerAmlal <amlal@nekernel.org>2025-04-25 13:08:33 +0200
commitfb790b07aeba8e22e4190cf3e1834d11ecde6c96 (patch)
tree4cec7d1b321307b1d5935577631dae116a658a37 /dev/modules/CoreGfx/CoreGfx.h
parent63a2d92c5dfe976175cda024ec01905d11b43738 (diff)
dev: better .clang-format, ran format command.
Signed-off-by: Amlal <amlal@nekernel.org>
Diffstat (limited to 'dev/modules/CoreGfx/CoreGfx.h')
-rw-r--r--dev/modules/CoreGfx/CoreGfx.h171
1 files changed, 73 insertions, 98 deletions
diff --git a/dev/modules/CoreGfx/CoreGfx.h b/dev/modules/CoreGfx/CoreGfx.h
index 2e555c08..2ab8d6e8 100644
--- a/dev/modules/CoreGfx/CoreGfx.h
+++ b/dev/modules/CoreGfx/CoreGfx.h
@@ -1,6 +1,6 @@
/* -------------------------------------------
- Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
+ Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
@@ -18,100 +18,77 @@
#ifdef __NE_AMD64__
/// @brief Performs Alpha drawing on the framebuffer.
-#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y) \
- for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) \
- { \
- for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) \
- { \
- *(((Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \
- 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \
- i + \
- 4 * u))) |= (reg_ptr)[kCGCursor]; \
- \
- ++kCGCursor; \
- } \
- }
+#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y) \
+ for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) { \
+ for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) { \
+ *(((Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
+ 4 * kHandoverHeader->f_GOP.f_PixelPerLine * i + 4 * u))) |= \
+ (reg_ptr)[kCGCursor]; \
+ \
+ ++kCGCursor; \
+ } \
+ }
/// @brief Performs drawing on the framebuffer.
-#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y) \
- for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) \
- { \
- for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) \
- { \
- *(((Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \
- 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \
- i + \
- 4 * u))) = (reg_ptr)[kCGCursor]; \
- \
- ++kCGCursor; \
- } \
- }
-
-#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y) \
- for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) \
- { \
- for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) \
- { \
- *(((Kernel::UInt32*)(_Rgn + \
- 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \
- i + \
- 4 * u))) = (reg_ptr)[kCGCursor]; \
- \
- ++kCGCursor; \
- } \
- }
+#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y) \
+ for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) { \
+ for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) { \
+ *(((Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
+ 4 * kHandoverHeader->f_GOP.f_PixelPerLine * i + 4 * u))) = \
+ (reg_ptr)[kCGCursor]; \
+ \
+ ++kCGCursor; \
+ } \
+ }
+
+#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y) \
+ for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) { \
+ for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) { \
+ *(((Kernel::UInt32*) (_Rgn + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * i + 4 * u))) = \
+ (reg_ptr)[kCGCursor]; \
+ \
+ ++kCGCursor; \
+ } \
+ }
/// @brief Cleans a resource.
-#define FBClearRegion(height, width, base_x, base_y) \
- for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) \
- { \
- for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) \
- { \
- *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \
- 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \
- i + \
- 4 * u))) = fb_get_clear_clr(); \
- } \
- }
+#define FBClearRegion(height, width, base_x, base_y) \
+ for (Kernel::UInt32 i = base_x; i < (width + base_x); ++i) { \
+ for (Kernel::UInt32 u = base_y; u < (height + base_y); ++u) { \
+ *(((volatile Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
+ 4 * kHandoverHeader->f_GOP.f_PixelPerLine * i + 4 * u))) = \
+ fb_get_clear_clr(); \
+ } \
+ }
/// @brief Draws inside a zone.
-#define FBDrawInRegion(clr, height, width, base_x, base_y) \
- for (Kernel::UInt32 x_base = base_x; x_base < (width + base_x); ++x_base) \
- { \
- for (Kernel::UInt32 y_base = base_y; y_base < (height + base_y); ++y_base) \
- { \
- *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \
- 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \
- x_base + \
- 4 * y_base))) = clr; \
- } \
- }
+#define FBDrawInRegion(clr, height, width, base_x, base_y) \
+ for (Kernel::UInt32 x_base = base_x; x_base < (width + base_x); ++x_base) { \
+ for (Kernel::UInt32 y_base = base_y; y_base < (height + base_y); ++y_base) { \
+ *(((volatile Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
+ 4 * kHandoverHeader->f_GOP.f_PixelPerLine * x_base + \
+ 4 * y_base))) = clr; \
+ } \
+ }
/// @brief Draws inside a zone.
-#define FBDrawInRegionToRgn(_Rgn, clr, height, width, base_x, base_y) \
- for (Kernel::UInt32 x_base = base_x; x_base < (width + base_x); ++x_base) \
- { \
- for (Kernel::UInt32 y_base = base_y; y_base < (height + base_y); ++y_base) \
- { \
- *(((volatile Kernel::UInt32*)(_Rgn + \
- 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \
- x_base + \
- 4 * y_base))) = clr[kCGCursor]; \
- ++kCGCursor; \
- } \
- }
-
-#define FBDrawInRegionA(clr, height, width, base_x, base_y) \
- for (Kernel::UInt32 x_base = base_x; x_base < (width + base_x); ++x_base) \
- { \
- for (Kernel::UInt32 y_base = base_y; y_base < (height + base_y); ++y_base) \
- { \
- *(((volatile Kernel::UInt32*)(kHandoverHeader->f_GOP.f_The + \
- 4 * kHandoverHeader->f_GOP.f_PixelPerLine * \
- x_base + \
- 4 * y_base))) |= clr; \
- } \
- }
+#define FBDrawInRegionToRgn(_Rgn, clr, height, width, base_x, base_y) \
+ for (Kernel::UInt32 x_base = base_x; x_base < (width + base_x); ++x_base) { \
+ for (Kernel::UInt32 y_base = base_y; y_base < (height + base_y); ++y_base) { \
+ *(((volatile Kernel::UInt32*) (_Rgn + 4 * kHandoverHeader->f_GOP.f_PixelPerLine * x_base + \
+ 4 * y_base))) = clr[kCGCursor]; \
+ ++kCGCursor; \
+ } \
+ }
+
+#define FBDrawInRegionA(clr, height, width, base_x, base_y) \
+ for (Kernel::UInt32 x_base = base_x; x_base < (width + base_x); ++x_base) { \
+ for (Kernel::UInt32 y_base = base_y; y_base < (height + base_y); ++y_base) { \
+ *(((volatile Kernel::UInt32*) (kHandoverHeader->f_GOP.f_The + \
+ 4 * kHandoverHeader->f_GOP.f_PixelPerLine * x_base + \
+ 4 * y_base))) |= clr; \
+ } \
+ }
#else
#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y)
#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y)
@@ -127,17 +104,15 @@
#define FBDrawInRegion(clr, height, width, base_x, base_y)
#define FBDrawInRegionToRgn(_Rgn, clr, height, width, base_x, base_y)
#define FBDrawInRegionA(clr, height, width, base_x, base_y)
-#endif // __NE_AMD64__
+#endif // __NE_AMD64__
#ifndef CORE_GFX_ACCESSIBILITY_H
#include <modules/CoreGfx/CoreAccess.h>
-#endif // ifndef CORE_GFX_ACCESSIBILITY_H
-
-namespace FB
-{
- inline Void fb_clear_video() noexcept
- {
- FBDrawInRegion(fb_get_clear_clr(), FB::FBAccessibilty::Height(), FB::FBAccessibilty::Width(),
- 0, 0);
- }
-} // namespace FB \ No newline at end of file
+#endif // ifndef CORE_GFX_ACCESSIBILITY_H
+
+namespace FB {
+inline Void fb_clear_video() noexcept {
+ FBDrawInRegion(fb_get_clear_clr(), FB::FBAccessibilty::Height(), FB::FBAccessibilty::Width(), 0,
+ 0);
+}
+} // namespace FB \ No newline at end of file