This commit is contained in:
2026-04-11 16:46:10 +08:00
parent 462f19f754
commit 48dc5e9857
7 changed files with 208 additions and 6 deletions

View File

@@ -1,4 +1,5 @@
#include <clks/framebuffer.h>
#include <clks/string.h>
#include <clks/types.h>
#include "psf_font.h"
@@ -103,6 +104,45 @@ void clks_fb_clear(u32 rgb) {
}
}
void clks_fb_scroll_up(u32 pixel_rows, u32 fill_rgb) {
usize row_bytes;
usize move_bytes;
u32 y;
u32 x;
if (clks_fb.ready == CLKS_FALSE) {
return;
}
if (clks_fb.info.bpp != 32) {
return;
}
if (pixel_rows == 0U) {
return;
}
if (pixel_rows >= clks_fb.info.height) {
clks_fb_clear(fill_rgb);
return;
}
row_bytes = (usize)clks_fb.info.pitch;
move_bytes = (usize)(clks_fb.info.height - pixel_rows) * row_bytes;
clks_memmove(
(void *)clks_fb.address,
(const void *)(clks_fb.address + ((usize)pixel_rows * row_bytes)),
move_bytes
);
for (y = clks_fb.info.height - pixel_rows; y < clks_fb.info.height; y++) {
for (x = 0U; x < clks_fb.info.width; x++) {
clks_fb_put_pixel(x, y, fill_rgb);
}
}
}
void clks_fb_draw_char(u32 x, u32 y, char ch, u32 fg_rgb, u32 bg_rgb) {
const u8 *glyph;
u32 row;