[fix] Remove PF auto-pos

This commit is contained in:
2026-06-05 17:49:19 +08:00
Unverified
parent 1ba644168f
commit 5a31effcf1
3 changed files with 4 additions and 32 deletions
+2 -29
View File
@@ -3,15 +3,6 @@
#include <graphics/draw.h>
#include <common.h>
static unsigned int pf_x = 0;
static unsigned int pf_y = 1;
void pf_reset_position(void) {
// 其实应该还要清一下屏,后面思考一个安全的做法
pf_x = 0;
pf_y = 1;
}
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];
@@ -31,27 +22,9 @@ void pf_print_char(char c, unsigned int basex, unsigned int basey, EFI_GRAPHICS_
}
}
void pf_print(const char* text, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color) {
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++) {
char c = text[i];
if (c == '\n') {
pf_x = 0;
pf_y++;
if ((pf_y - 1) * 16 >= g_gfx.vr) {
gfx_clear();
pf_y = 1;
}
continue;
}
if (pf_x * 9 + 9 > g_gfx.hr) {
pf_x = 0;
pf_y++;
if ((pf_y - 1) * 16 >= g_gfx.vr) {
gfx_clear();
pf_y = 1;
}
}
pf_print_char(c, pf_x * 9, (pf_y - 1) * 16, color);
pf_x++;
pf_print_char(c, basex + i * 8, basey, color); // 只要 字数 * 8 + basex 不爆hr就没事
}
}
+1 -2
View File
@@ -4,5 +4,4 @@
void pf_print_char(char c, unsigned int basex, unsigned int basey,
EFI_GRAPHICS_OUTPUT_BLT_PIXEL color = {255, 255, 255, 255}); // Pixel Font 打印字符
void pf_print(const char* text, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color = {255, 255, 255, 255}); // Pixel Font 打印string
void pf_reset_position(void); // 重设Pixel Font Cursor位置
void pf_print(const char* text, unsigned int basex, unsigned int basey, EFI_GRAPHICS_OUTPUT_BLT_PIXEL color = {255, 255, 255, 255}); // Pixel Font 打印string
+1 -1
View File
@@ -130,7 +130,7 @@ extern "C" void kernel_main() {
fs_list();
}
pf_print("Welcome to Sylva OS!\n");
// pf_print("Welcome to Sylva OS!\n");
serial_write(" Kernel prepared well.\n");
// --- Interrupt infrastructure ---