mirror of
https://git.savannah.gnu.org/git/grub.git
synced 2026-10-26 09:10:53 +00:00
Agglomerate more mallocs to speed-up gfxterm.
This commit is contained in:
1 parent
22b06e9685
commit
85002bf34a
15 files changed
+254
-187
No files matched your search
@@ -42,7 +42,6 @@ grub_font_draw_string (const char *str, grub_font_t font,
|
||||
int left_x, int baseline_y)
|
||||
{
|
||||
int x;
|
||||
struct grub_font_glyph *glyph;
|
||||
grub_uint32_t *logical;
|
||||
grub_ssize_t logical_len, visual_len;
|
||||
struct grub_unicode_glyph *visual, *ptr;
|
||||
@@ -60,18 +59,18 @@ grub_font_draw_string (const char *str, grub_font_t font,
|
||||
for (ptr = visual, x = left_x; ptr < visual + visual_len; ptr++)
|
||||
{
|
||||
grub_err_t err;
|
||||
struct grub_font_glyph *glyph;
|
||||
glyph = grub_font_construct_glyph (font, ptr);
|
||||
if (!glyph)
|
||||
return grub_errno;
|
||||
err = grub_font_draw_glyph (glyph, color, x, baseline_y);
|
||||
x += glyph->device_width;
|
||||
grub_free (glyph);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
for (ptr = visual; ptr < visual + visual_len; ptr++)
|
||||
grub_free (ptr->combining);
|
||||
grub_unicode_destroy_glyph (ptr);
|
||||
grub_free (visual);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
@@ -104,7 +103,7 @@ grub_font_get_string_width (grub_font_t font, const char *str)
|
||||
&glyph);
|
||||
width += grub_font_get_constructed_device_width (font, &glyph);
|
||||
|
||||
grub_free (glyph.combining);
|
||||
grub_unicode_destroy_glyph (&glyph);
|
||||
}
|
||||
grub_free (logical);
|
||||
|
||||
|
||||
Reference in new issue
Block a user