1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
/* -------------------------------------------
Copyright (C) 2024-2025, Amlal El Mahrouss, all rights reserved.
------------------------------------------- */
#pragma once
#include <NewKit/Defines.h>
#define fb_init() Kernel::UInt32 kCGCursor = 0
#define fb_color(R, G, B) RGB(R, G, B)
#define fb_get_clear_clr() RGB(0x20, 0x20, 0x20)
#define fb_clear() kCGCursor = 0UL
#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; \
} \
}
/// @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; \
} \
}
/// @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(); \
} \
}
/// @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; \
} \
}
/// @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; \
} \
}
#else
#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y)
#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y)
#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y)
#define FBClearRegion(height, width, base_x, base_y)
#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)
#define FBDrawBitMapInRegionA(reg_ptr, height, width, base_x, base_y)
#define FBDrawBitMapInRegion(reg_ptr, height, width, base_x, base_y)
#define FBDrawBitMapInRegionToRgn(_Rgn, reg_ptr, height, width, base_x, base_y)
#define FBClearRegion(height, width, base_x, base_y)
#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__
#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
|