[refactor] Organize INT

This commit is contained in:
2026-06-05 18:29:11 +08:00
Unverified
parent 7c66610c13
commit da03b301fb
17 changed files with 79 additions and 59 deletions
+7 -7
View File
@@ -3,10 +3,10 @@
#include <graphics/draw.h>
#include <common.h>
void pf_print_char(char c, unsigned int basex, unsigned int basey, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color) {
for (unsigned int y = 0; y < 16; y++) {
unsigned char data = hankaku_pixels[c][y];
for (int x = 7; x >= 0; x--) {
void pf_print_char(char c, SUINT32 basex, SUINT32 basey, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color) {
for (SUINT32 y = 0; y < 16; y++) {
SUINT8 data = hankaku_pixels[c][y];
for (SSINT32 x = 7; x >= 0; x--) {
// 解码Hankaku字体
/*
既然都在这了,就讲一下Hankaku字体是如何解码的
@@ -14,7 +14,7 @@ void pf_print_char(char c, unsigned int basex, unsigned int basey, EFI_GRAPHICS_
{0x00, 0x82, 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00}
每一个Hex代表一行,比如0x82就是一行,转换成Bin得到10000010,1代表有像素,0代表没像素
*/
unsigned int current = data & 1;
SUINT32 current = data & 1;
data >>= 1;
if (current)
draw_pixel(basex + x, basey + y, color);
@@ -22,8 +22,8 @@ void pf_print_char(char c, unsigned int basex, unsigned int basey, EFI_GRAPHICS_
}
}
void pf_print(const char* text, unsigned int basex, unsigned int basey, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color) {
for (unsigned int i = 0; i < strlen(text); i++) {
void pf_print(const char* text, SUINT32 basex, SUINT32 basey, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color) {
for (SUINT32 i = 0; i < strlen(text); i++) {
char c = text[i];
pf_print_char(c, basex + i * 8, basey, color); // 只要 字数 * 8 + basex 不爆hr就没事
}