Agglomerate more mallocs to speed-up gfxterm.
This commit is contained in:
parent
22b06e9685
commit
85002bf34a
15 changed files with 254 additions and 187 deletions
|
@ -175,7 +175,7 @@ set_term_color (grub_uint8_t term_color)
|
|||
static void
|
||||
clear_char (struct grub_colored_char *c)
|
||||
{
|
||||
grub_free (c->code.combining);
|
||||
grub_unicode_destroy_glyph (&c->code);
|
||||
grub_unicode_set_glyph_from_code (&c->code, ' ');
|
||||
c->fg_color = virtual_screen.fg_color;
|
||||
c->bg_color = virtual_screen.bg_color;
|
||||
|
@ -191,7 +191,7 @@ grub_virtual_screen_free (void)
|
|||
for (i = 0;
|
||||
i < virtual_screen.columns * virtual_screen.rows;
|
||||
i++)
|
||||
grub_free (virtual_screen.text_buffer[i].code.combining);
|
||||
grub_unicode_destroy_glyph (&virtual_screen.text_buffer[i].code);
|
||||
grub_free (virtual_screen.text_buffer);
|
||||
}
|
||||
|
||||
|
@ -267,7 +267,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y,
|
|||
/* Clear out text buffer. */
|
||||
for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++)
|
||||
{
|
||||
virtual_screen.text_buffer[i].code.combining = 0;
|
||||
virtual_screen.text_buffer[i].code.ncomb = 0;
|
||||
clear_char (&(virtual_screen.text_buffer[i]));
|
||||
}
|
||||
|
||||
|
@ -408,8 +408,8 @@ grub_gfxterm_term_fini (struct grub_term_output *term __attribute__ ((unused)))
|
|||
|
||||
for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++)
|
||||
{
|
||||
grub_free (virtual_screen.text_buffer[i].code.combining);
|
||||
virtual_screen.text_buffer[i].code.combining = 0;
|
||||
grub_unicode_destroy_glyph (&virtual_screen.text_buffer[i].code);
|
||||
virtual_screen.text_buffer[i].code.ncomb = 0;
|
||||
virtual_screen.text_buffer[i].code.base = 0;
|
||||
}
|
||||
|
||||
|
@ -651,7 +651,6 @@ paint_char (unsigned cx, unsigned cy)
|
|||
/* Mark character to be drawn. */
|
||||
dirty_region_add (virtual_screen.offset_x + x, virtual_screen.offset_y + y,
|
||||
width, height);
|
||||
grub_free (glyph);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -804,8 +803,8 @@ scroll_up (void)
|
|||
|
||||
/* Clear first line in text buffer. */
|
||||
for (i = 0; i < virtual_screen.columns; i++)
|
||||
grub_free (virtual_screen.text_buffer[i].code.combining);
|
||||
|
||||
grub_unicode_destroy_glyph (&virtual_screen.text_buffer[i].code);
|
||||
|
||||
/* Scroll text buffer with one line to up. */
|
||||
grub_memmove (virtual_screen.text_buffer,
|
||||
virtual_screen.text_buffer + virtual_screen.columns,
|
||||
|
@ -877,7 +876,7 @@ grub_gfxterm_putchar (struct grub_term_output *term,
|
|||
p = (virtual_screen.text_buffer +
|
||||
virtual_screen.cursor_x +
|
||||
virtual_screen.cursor_y * virtual_screen.columns);
|
||||
grub_free (p->code.combining);
|
||||
grub_unicode_destroy_glyph (&p->code);
|
||||
grub_unicode_set_glyph (&p->code, c);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
p->fg_color = virtual_screen.fg_color;
|
||||
|
@ -892,7 +891,7 @@ grub_gfxterm_putchar (struct grub_term_output *term,
|
|||
virtual_screen.text_buffer + virtual_screen.columns
|
||||
* virtual_screen.rows; i++)
|
||||
{
|
||||
grub_free (p[i].code.combining);
|
||||
grub_unicode_destroy_glyph (&p[i].code);
|
||||
p[i].code.base = 0;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue