mirror of
https://github.com/limine-bootloader/limine
synced 2024-11-27 11:00:28 +03:00
VBE: Pass struct char around by pointer instead of by value
This commit is contained in:
parent
3c3a132e88
commit
b830c71d90
BIN
limine.bin
BIN
limine.bin
Binary file not shown.
@ -122,28 +122,28 @@ struct vbe_char {
|
||||
uint32_t bg;
|
||||
};
|
||||
|
||||
void vbe_plot_char(struct vbe_char c, int x, int y) {
|
||||
uint8_t *glyph = &vga_font[c.c * VGA_FONT_HEIGHT];
|
||||
void vbe_plot_char(struct vbe_char *c, int x, int y) {
|
||||
uint8_t *glyph = &vga_font[c->c * VGA_FONT_HEIGHT];
|
||||
|
||||
vbe_plot_bg_blent_rect(x, y, VGA_FONT_WIDTH, VGA_FONT_HEIGHT, c.bg);
|
||||
vbe_plot_bg_blent_rect(x, y, VGA_FONT_WIDTH, VGA_FONT_HEIGHT, c->bg);
|
||||
|
||||
for (int i = 0; i < VGA_FONT_HEIGHT; i++) {
|
||||
for (int j = 0; j < VGA_FONT_WIDTH; j++) {
|
||||
if ((glyph[i] & (0x80 >> j)))
|
||||
vbe_plot_bg_blent_px(x + j, y + i, c.fg);
|
||||
vbe_plot_bg_blent_px(x + j, y + i, c->fg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void plot_char_grid(struct vbe_char c, int x, int y) {
|
||||
static void plot_char_grid(struct vbe_char *c, int x, int y) {
|
||||
vbe_plot_char(c, x * VGA_FONT_WIDTH + frame_width,
|
||||
y * VGA_FONT_HEIGHT + frame_height);
|
||||
grid[x + y * cols] = c;
|
||||
grid[x + y * cols] = *c;
|
||||
}
|
||||
|
||||
static void clear_cursor(void) {
|
||||
if (cursor_status) {
|
||||
vbe_plot_char(grid[cursor_x + cursor_y * cols],
|
||||
vbe_plot_char(&grid[cursor_x + cursor_y * cols],
|
||||
cursor_x * VGA_FONT_WIDTH + frame_width,
|
||||
cursor_y * VGA_FONT_HEIGHT + frame_height);
|
||||
}
|
||||
@ -154,7 +154,7 @@ static void draw_cursor(void) {
|
||||
c.fg = cursor_fg;
|
||||
c.bg = cursor_bg;
|
||||
if (cursor_status)
|
||||
vbe_plot_char(c, cursor_x * VGA_FONT_WIDTH + frame_width,
|
||||
vbe_plot_char(&c, cursor_x * VGA_FONT_WIDTH + frame_width,
|
||||
cursor_y * VGA_FONT_HEIGHT + frame_height);
|
||||
}
|
||||
|
||||
@ -162,7 +162,7 @@ static void scroll(void) {
|
||||
clear_cursor();
|
||||
|
||||
for (int i = cols; i < rows * cols; i++) {
|
||||
plot_char_grid(grid[i], (i - cols) % cols, (i - cols) / cols);
|
||||
plot_char_grid(&grid[i], (i - cols) % cols, (i - cols) / cols);
|
||||
}
|
||||
|
||||
// Clear the last line of the screen.
|
||||
@ -171,7 +171,7 @@ static void scroll(void) {
|
||||
empty.fg = text_fg;
|
||||
empty.bg = text_bg;
|
||||
for (int i = rows * cols - cols; i < rows * cols; i++) {
|
||||
plot_char_grid(empty, i % cols, i / cols);
|
||||
plot_char_grid(&empty, i % cols, i / cols);
|
||||
}
|
||||
|
||||
draw_cursor();
|
||||
@ -185,7 +185,7 @@ void vbe_clear(bool move) {
|
||||
empty.fg = text_fg;
|
||||
empty.bg = text_bg;
|
||||
for (int i = 0; i < rows * cols; i++) {
|
||||
plot_char_grid(empty, i % cols, i / cols);
|
||||
plot_char_grid(&empty, i % cols, i / cols);
|
||||
}
|
||||
|
||||
if (move) {
|
||||
@ -257,7 +257,7 @@ void vbe_putchar(char c) {
|
||||
ch.c = c;
|
||||
ch.fg = text_fg;
|
||||
ch.bg = text_bg;
|
||||
plot_char_grid(ch, cursor_x++, cursor_y);
|
||||
plot_char_grid(&ch, cursor_x++, cursor_y);
|
||||
if (cursor_x == cols) {
|
||||
cursor_x = 0;
|
||||
cursor_y++;
|
||||
|
@ -316,7 +316,6 @@ void stivale2_load(char *cmdline, int boot_drive) {
|
||||
void *tag_memmap = conv_mem_alloc_aligned(sizeof(struct e820_entry_t) * memmap_entries, 1);
|
||||
memcpy(tag_memmap, memmap, sizeof(struct e820_entry_t) * memmap_entries);
|
||||
|
||||
print_memmap(memmap, memmap_entries);
|
||||
append_tag(&stivale2_struct, (struct stivale2_tag *)tag);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user