Some drawing performance improvements
This commit is contained in:
@@ -7,20 +7,6 @@ gfx_context kernel_fb;
|
||||
gfx_context *term_fb;
|
||||
static int setup = 0;
|
||||
|
||||
static void draw_border(gfx_context *ctx, uint32_t clr)
|
||||
{
|
||||
for(uint64_t x = 0; x < ctx->width; x++)
|
||||
{
|
||||
putpixel(ctx, x, 0, clr);
|
||||
putpixel(ctx, x, ctx->height-1, clr);
|
||||
}
|
||||
for(uint64_t y = 0; y < ctx->height; y++)
|
||||
{
|
||||
putpixel(ctx, 0, y, clr);
|
||||
putpixel(ctx, ctx->width-1, y, clr);
|
||||
}
|
||||
}
|
||||
|
||||
void fbterm_movecursor(unsigned int cursor)
|
||||
{
|
||||
(void) cursor;
|
||||
@@ -34,7 +20,7 @@ void fbterm_flush(struct vga_cell *buffer)
|
||||
{
|
||||
for(int col=0; col < VGA_COLS; col++)
|
||||
{
|
||||
putCharacter(term_fb, col*8, row*16, 0xFFFFFF, 0, (char)buffer[i++].c);
|
||||
putCharacter(term_fb, col*8, row*16, 0xebdbb2, 0x282828, (char)buffer[i++].c);
|
||||
}
|
||||
}
|
||||
flip(term_fb);
|
||||
@@ -45,9 +31,9 @@ void fbterm_init(struct fbinfo *fbinfo)
|
||||
kernel_fb.width = fbinfo->framebuffer_width;
|
||||
kernel_fb.height = fbinfo->framebuffer_height;
|
||||
kernel_fb.bpp = fbinfo->framebuffer_bpp/8;
|
||||
kernel_fb.pitch = fbinfo->framebuffer_pitch;
|
||||
kernel_fb.pitch = fbinfo->framebuffer_pitch/kernel_fb.bpp;
|
||||
kernel_fb.addr = P2V(fbinfo->framebuffer_addr);
|
||||
kernel_fb.size = kernel_fb.pitch * (kernel_fb.height);
|
||||
kernel_fb.size = fbinfo->framebuffer_pitch * (kernel_fb.height);
|
||||
kernel_fb.buffer = calloc(1, kernel_fb.size);
|
||||
|
||||
for(uintptr_t p = (uintptr_t)kernel_fb.addr; p < ((uintptr_t)kernel_fb.addr + kernel_fb.size); p += PAGE_SIZE)
|
||||
@@ -55,10 +41,10 @@ void fbterm_init(struct fbinfo *fbinfo)
|
||||
vmm_set_page(kernel_P4, p, V2P(p), PAGE_WRITE | PAGE_PRESENT);
|
||||
}
|
||||
|
||||
term_fb = framebuffer_make_subcontext(&kernel_fb, 20, 20, 8*VGA_COLS+8, 16*VGA_ROWS+8);
|
||||
draw_border(term_fb, RGB(255, 0, 0));
|
||||
flip(term_fb);
|
||||
draw_rect(&kernel_fb, 20, 20, 8*VGA_COLS+8, 16*VGA_ROWS+8, RGB(255, 0, 0));
|
||||
flip(&kernel_fb);
|
||||
term_fb = framebuffer_make_subcontext(&kernel_fb, 24, 24, 8*VGA_COLS, 16*VGA_ROWS);
|
||||
flip(term_fb);
|
||||
setup = 1;
|
||||
|
||||
draw_line(&kernel_fb, 750, 850, 120, 120, RGB(255,0,0));
|
||||
|
||||
Reference in New Issue
Block a user