|
|
f96e0b |
From d2d36cebce2ae1c1ded7debadaf509044554c319 Mon Sep 17 00:00:00 2001
|
|
|
f96e0b |
From: Vladimir 'phcoder' Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
Date: Sat, 4 May 2013 22:23:23 +0200
|
|
|
f96e0b |
Subject: [PATCH 425/482] Agglomerate more mallocs to speed-up gfxterm.
|
|
|
f96e0b |
|
|
|
f96e0b |
---
|
|
|
f96e0b |
ChangeLog | 4 +
|
|
|
f96e0b |
grub-core/font/font.c | 91 +++++++++++------
|
|
|
f96e0b |
grub-core/gfxmenu/font.c | 7 +-
|
|
|
f96e0b |
grub-core/gfxmenu/gui_list.c | 1 +
|
|
|
f96e0b |
grub-core/gfxmenu/gui_progress_bar.c | 3 +
|
|
|
f96e0b |
grub-core/kern/term.c | 1 -
|
|
|
f96e0b |
grub-core/normal/charset.c | 193 +++++++++++++++++------------------
|
|
|
f96e0b |
grub-core/normal/menu_entry.c | 2 +-
|
|
|
f96e0b |
grub-core/normal/menu_text.c | 8 +-
|
|
|
f96e0b |
grub-core/normal/term.c | 18 ++--
|
|
|
f96e0b |
grub-core/term/gfxterm.c | 19 ++--
|
|
|
f96e0b |
grub-core/tests/video_checksum.c | 10 +-
|
|
|
f96e0b |
grub-core/video/fb/fbblit.c | 6 --
|
|
|
f96e0b |
include/grub/emu/export.h | 2 +
|
|
|
f96e0b |
include/grub/unicode.h | 76 ++++++++++----
|
|
|
f96e0b |
15 files changed, 254 insertions(+), 187 deletions(-)
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/ChangeLog b/ChangeLog
|
|
|
f96e0b |
index 963792e..57bce50 100644
|
|
|
f96e0b |
--- a/ChangeLog
|
|
|
f96e0b |
+++ b/ChangeLog
|
|
|
f96e0b |
@@ -1,5 +1,9 @@
|
|
|
f96e0b |
2013-05-04 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
|
|
|
f96e0b |
+ Agglomerate more mallocs to speed-up gfxterm.
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+2013-05-04 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
+
|
|
|
f96e0b |
Speed-up gfxterm by slightly agglomerating mallocs.
|
|
|
f96e0b |
|
|
|
f96e0b |
2013-05-04 Vladimir Serbinenko <phcoder@gmail.com>
|
|
|
f96e0b |
diff --git a/grub-core/font/font.c b/grub-core/font/font.c
|
|
|
f96e0b |
index 4758f6c..50b1799 100644
|
|
|
f96e0b |
--- a/grub-core/font/font.c
|
|
|
f96e0b |
+++ b/grub-core/font/font.c
|
|
|
f96e0b |
@@ -1064,6 +1064,7 @@ grub_font_get_glyph_with_fallback (grub_font_t font, grub_uint32_t code)
|
|
|
f96e0b |
return best_glyph;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
+#if 0
|
|
|
f96e0b |
static struct grub_font_glyph *
|
|
|
f96e0b |
grub_font_dup_glyph (struct grub_font_glyph *glyph)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
@@ -1075,6 +1076,7 @@ grub_font_dup_glyph (struct grub_font_glyph *glyph)
|
|
|
f96e0b |
+ (glyph->width * glyph->height + 7) / 8);
|
|
|
f96e0b |
return ret;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
+#endif
|
|
|
f96e0b |
|
|
|
f96e0b |
/* FIXME: suboptimal. */
|
|
|
f96e0b |
static void
|
|
|
f96e0b |
@@ -1202,6 +1204,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
|
|
|
f96e0b |
signed above_leftx, above_lefty;
|
|
|
f96e0b |
signed below_rightx, below_righty;
|
|
|
f96e0b |
signed min_devwidth = 0;
|
|
|
f96e0b |
+ const struct grub_unicode_combining *comb;
|
|
|
f96e0b |
|
|
|
f96e0b |
if (glyph)
|
|
|
f96e0b |
glyph->device_width = main_glyph->device_width;
|
|
|
f96e0b |
@@ -1222,6 +1225,8 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
|
|
|
f96e0b |
below_rightx = ctx.bounds.x + ctx.bounds.width;
|
|
|
f96e0b |
below_righty = ctx.bounds.y;
|
|
|
f96e0b |
|
|
|
f96e0b |
+ comb = grub_unicode_get_comb (glyph_id);
|
|
|
f96e0b |
+
|
|
|
f96e0b |
for (i = 0; i < glyph_id->ncomb; i++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_int16_t space = 0;
|
|
|
f96e0b |
@@ -1232,10 +1237,10 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
targetx = (ctx.bounds.width - combining_glyphs[i]->width) / 2 + ctx.bounds.x;
|
|
|
f96e0b |
/* CGJ is to avoid diacritics reordering. */
|
|
|
f96e0b |
- if (glyph_id->combining[i].code
|
|
|
f96e0b |
+ if (comb[i].code
|
|
|
f96e0b |
== GRUB_UNICODE_COMBINING_GRAPHEME_JOINER)
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
- switch (glyph_id->combining[i].type)
|
|
|
f96e0b |
+ switch (comb[i].type)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
case GRUB_UNICODE_COMB_OVERLAY:
|
|
|
f96e0b |
do_blit (combining_glyphs[i],
|
|
|
f96e0b |
@@ -1361,7 +1366,7 @@ blit_comb (const struct grub_unicode_glyph *glyph_id,
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
|
|
|
f96e0b |
case GRUB_UNICODE_COMB_MN:
|
|
|
f96e0b |
- switch (glyph_id->combining[i].code)
|
|
|
f96e0b |
+ switch (comb[i].code)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
case GRUB_UNICODE_THAANA_ABAFILI:
|
|
|
f96e0b |
case GRUB_UNICODE_THAANA_AABAAFILI:
|
|
|
f96e0b |
@@ -1410,17 +1415,14 @@ static struct grub_font_glyph *
|
|
|
f96e0b |
grub_font_construct_dry_run (grub_font_t hinted_font,
|
|
|
f96e0b |
const struct grub_unicode_glyph *glyph_id,
|
|
|
f96e0b |
struct grub_video_signed_rect *bounds,
|
|
|
f96e0b |
- struct grub_font_glyph ***combining_glyphs_out,
|
|
|
f96e0b |
+ struct grub_font_glyph **combining_glyphs,
|
|
|
f96e0b |
int *device_width)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
struct grub_font_glyph *main_glyph = NULL;
|
|
|
f96e0b |
- struct grub_font_glyph **combining_glyphs;
|
|
|
f96e0b |
grub_uint32_t desired_attributes = 0;
|
|
|
f96e0b |
unsigned i;
|
|
|
f96e0b |
grub_uint32_t base = glyph_id->base;
|
|
|
f96e0b |
-
|
|
|
f96e0b |
- if (combining_glyphs_out)
|
|
|
f96e0b |
- *combining_glyphs_out = NULL;
|
|
|
f96e0b |
+ const struct grub_unicode_combining *comb;
|
|
|
f96e0b |
|
|
|
f96e0b |
if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED)
|
|
|
f96e0b |
desired_attributes |= GRUB_FONT_CODE_RIGHT_JOINED;
|
|
|
f96e0b |
@@ -1428,11 +1430,12 @@ grub_font_construct_dry_run (grub_font_t hinted_font,
|
|
|
f96e0b |
if (glyph_id->attributes & GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED)
|
|
|
f96e0b |
desired_attributes |= GRUB_FONT_CODE_LEFT_JOINED;
|
|
|
f96e0b |
|
|
|
f96e0b |
+ comb = grub_unicode_get_comb (glyph_id);
|
|
|
f96e0b |
|
|
|
f96e0b |
if (base == 'i' || base == 'j')
|
|
|
f96e0b |
{
|
|
|
f96e0b |
for (i = 0; i < glyph_id->ncomb; i++)
|
|
|
f96e0b |
- if (glyph_id->combining[i].type == GRUB_UNICODE_STACK_ABOVE)
|
|
|
f96e0b |
+ if (comb[i].type == GRUB_UNICODE_STACK_ABOVE)
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
if (i < glyph_id->ncomb && base == 'i')
|
|
|
f96e0b |
base = GRUB_UNICODE_DOTLESS_LOWERCASE_I;
|
|
|
f96e0b |
@@ -1461,8 +1464,6 @@ grub_font_construct_dry_run (grub_font_t hinted_font,
|
|
|
f96e0b |
if (!glyph_id->ncomb && !glyph_id->attributes)
|
|
|
f96e0b |
return main_glyph;
|
|
|
f96e0b |
|
|
|
f96e0b |
- combining_glyphs = grub_malloc (sizeof (combining_glyphs[0])
|
|
|
f96e0b |
- * glyph_id->ncomb);
|
|
|
f96e0b |
if (glyph_id->ncomb && !combining_glyphs)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_errno = GRUB_ERR_NONE;
|
|
|
f96e0b |
@@ -1472,18 +1473,33 @@ grub_font_construct_dry_run (grub_font_t hinted_font,
|
|
|
f96e0b |
for (i = 0; i < glyph_id->ncomb; i++)
|
|
|
f96e0b |
combining_glyphs[i]
|
|
|
f96e0b |
= grub_font_get_glyph_with_fallback (main_glyph->font,
|
|
|
f96e0b |
- glyph_id->combining[i].code);
|
|
|
f96e0b |
+ comb[i].code);
|
|
|
f96e0b |
|
|
|
f96e0b |
blit_comb (glyph_id, NULL, bounds, main_glyph, combining_glyphs,
|
|
|
f96e0b |
device_width);
|
|
|
f96e0b |
- if (combining_glyphs_out)
|
|
|
f96e0b |
- *combining_glyphs_out = combining_glyphs;
|
|
|
f96e0b |
- else
|
|
|
f96e0b |
- grub_free (combining_glyphs);
|
|
|
f96e0b |
|
|
|
f96e0b |
return main_glyph;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
+static struct grub_font_glyph **render_combining_glyphs = 0;
|
|
|
f96e0b |
+static grub_size_t render_max_comb_glyphs = 0;
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+static void
|
|
|
f96e0b |
+ensure_comb_space (const struct grub_unicode_glyph *glyph_id)
|
|
|
f96e0b |
+{
|
|
|
f96e0b |
+ if (glyph_id->ncomb <= render_max_comb_glyphs)
|
|
|
f96e0b |
+ return;
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ render_max_comb_glyphs = 2 * glyph_id->ncomb;
|
|
|
f96e0b |
+ if (render_max_comb_glyphs < 8)
|
|
|
f96e0b |
+ render_max_comb_glyphs = 8;
|
|
|
f96e0b |
+ grub_free (render_combining_glyphs);
|
|
|
f96e0b |
+ render_combining_glyphs = grub_malloc (render_max_comb_glyphs
|
|
|
f96e0b |
+ * sizeof (render_combining_glyphs[0]));
|
|
|
f96e0b |
+ if (!render_combining_glyphs)
|
|
|
f96e0b |
+ grub_errno = 0;
|
|
|
f96e0b |
+}
|
|
|
f96e0b |
+
|
|
|
f96e0b |
int
|
|
|
f96e0b |
grub_font_get_constructed_device_width (grub_font_t hinted_font,
|
|
|
f96e0b |
const struct grub_unicode_glyph
|
|
|
f96e0b |
@@ -1491,8 +1507,11 @@ grub_font_get_constructed_device_width (grub_font_t hinted_font,
|
|
|
f96e0b |
{
|
|
|
f96e0b |
int ret;
|
|
|
f96e0b |
struct grub_font_glyph *main_glyph;
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ ensure_comb_space (glyph_id);
|
|
|
f96e0b |
+
|
|
|
f96e0b |
main_glyph = grub_font_construct_dry_run (hinted_font, glyph_id, NULL,
|
|
|
f96e0b |
- NULL, &ret;;
|
|
|
f96e0b |
+ render_combining_glyphs, &ret;;
|
|
|
f96e0b |
if (!main_glyph)
|
|
|
f96e0b |
return unknown_glyph->device_width;
|
|
|
f96e0b |
return ret;
|
|
|
f96e0b |
@@ -1504,26 +1523,42 @@ grub_font_construct_glyph (grub_font_t hinted_font,
|
|
|
f96e0b |
{
|
|
|
f96e0b |
struct grub_font_glyph *main_glyph;
|
|
|
f96e0b |
struct grub_video_signed_rect bounds;
|
|
|
f96e0b |
- struct grub_font_glyph *glyph;
|
|
|
f96e0b |
- struct grub_font_glyph **combining_glyphs;
|
|
|
f96e0b |
+ static struct grub_font_glyph *glyph = 0;
|
|
|
f96e0b |
+ static grub_size_t max_glyph_size = 0;
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ ensure_comb_space (glyph_id);
|
|
|
f96e0b |
|
|
|
f96e0b |
main_glyph = grub_font_construct_dry_run (hinted_font, glyph_id,
|
|
|
f96e0b |
- &bounds, &combining_glyphs, NULL);
|
|
|
f96e0b |
+ &bounds, render_combining_glyphs,
|
|
|
f96e0b |
+ NULL);
|
|
|
f96e0b |
|
|
|
f96e0b |
if (!main_glyph)
|
|
|
f96e0b |
- return grub_font_dup_glyph (unknown_glyph);
|
|
|
f96e0b |
+ return unknown_glyph;
|
|
|
f96e0b |
|
|
|
f96e0b |
- if (!combining_glyphs)
|
|
|
f96e0b |
- return grub_font_dup_glyph (main_glyph);
|
|
|
f96e0b |
+ if (!render_combining_glyphs && glyph_id->ncomb)
|
|
|
f96e0b |
+ return main_glyph;
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ if (!glyph_id->ncomb && !glyph_id->attributes)
|
|
|
f96e0b |
+ return main_glyph;
|
|
|
f96e0b |
|
|
|
f96e0b |
- glyph =
|
|
|
f96e0b |
- grub_zalloc (sizeof (*glyph) + (bounds.width * bounds.height + 7) / 8);
|
|
|
f96e0b |
+ if (max_glyph_size < sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT)
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ grub_free (glyph);
|
|
|
f96e0b |
+ max_glyph_size = (sizeof (*glyph) + (bounds.width * bounds.height + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT) * 2;
|
|
|
f96e0b |
+ if (max_glyph_size < 8)
|
|
|
f96e0b |
+ max_glyph_size = 8;
|
|
|
f96e0b |
+ glyph = grub_malloc (max_glyph_size);
|
|
|
f96e0b |
+ }
|
|
|
f96e0b |
if (!glyph)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_errno = GRUB_ERR_NONE;
|
|
|
f96e0b |
- return grub_font_dup_glyph (main_glyph);
|
|
|
f96e0b |
+ return main_glyph;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
+ grub_memset (glyph, 0, sizeof (*glyph)
|
|
|
f96e0b |
+ + (bounds.width * bounds.height
|
|
|
f96e0b |
+ + GRUB_CHAR_BIT - 1) / GRUB_CHAR_BIT);
|
|
|
f96e0b |
+
|
|
|
f96e0b |
glyph->font = main_glyph->font;
|
|
|
f96e0b |
glyph->width = bounds.width;
|
|
|
f96e0b |
glyph->height = bounds.height;
|
|
|
f96e0b |
@@ -1542,9 +1577,7 @@ grub_font_construct_glyph (grub_font_t hinted_font,
|
|
|
f96e0b |
(glyph->height + glyph->offset_y)
|
|
|
f96e0b |
- (main_glyph->height + main_glyph->offset_y));
|
|
|
f96e0b |
|
|
|
f96e0b |
- blit_comb (glyph_id, glyph, NULL, main_glyph, combining_glyphs, NULL);
|
|
|
f96e0b |
-
|
|
|
f96e0b |
- grub_free (combining_glyphs);
|
|
|
f96e0b |
+ blit_comb (glyph_id, glyph, NULL, main_glyph, render_combining_glyphs, NULL);
|
|
|
f96e0b |
|
|
|
f96e0b |
return glyph;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
diff --git a/grub-core/gfxmenu/font.c b/grub-core/gfxmenu/font.c
|
|
|
f96e0b |
index 9c6e2d4..64d5267 100644
|
|
|
f96e0b |
--- a/grub-core/gfxmenu/font.c
|
|
|
f96e0b |
+++ b/grub-core/gfxmenu/font.c
|
|
|
f96e0b |
@@ -42,7 +42,6 @@ grub_font_draw_string (const char *str, grub_font_t font,
|
|
|
f96e0b |
int left_x, int baseline_y)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
int x;
|
|
|
f96e0b |
- struct grub_font_glyph *glyph;
|
|
|
f96e0b |
grub_uint32_t *logical;
|
|
|
f96e0b |
grub_ssize_t logical_len, visual_len;
|
|
|
f96e0b |
struct grub_unicode_glyph *visual, *ptr;
|
|
|
f96e0b |
@@ -60,18 +59,18 @@ grub_font_draw_string (const char *str, grub_font_t font,
|
|
|
f96e0b |
for (ptr = visual, x = left_x; ptr < visual + visual_len; ptr++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_err_t err;
|
|
|
f96e0b |
+ struct grub_font_glyph *glyph;
|
|
|
f96e0b |
glyph = grub_font_construct_glyph (font, ptr);
|
|
|
f96e0b |
if (!glyph)
|
|
|
f96e0b |
return grub_errno;
|
|
|
f96e0b |
err = grub_font_draw_glyph (glyph, color, x, baseline_y);
|
|
|
f96e0b |
x += glyph->device_width;
|
|
|
f96e0b |
- grub_free (glyph);
|
|
|
f96e0b |
if (err)
|
|
|
f96e0b |
return err;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
for (ptr = visual; ptr < visual + visual_len; ptr++)
|
|
|
f96e0b |
- grub_free (ptr->combining);
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (ptr);
|
|
|
f96e0b |
grub_free (visual);
|
|
|
f96e0b |
|
|
|
f96e0b |
return GRUB_ERR_NONE;
|
|
|
f96e0b |
@@ -104,7 +103,7 @@ grub_font_get_string_width (grub_font_t font, const char *str)
|
|
|
f96e0b |
&glyph);
|
|
|
f96e0b |
width += grub_font_get_constructed_device_width (font, &glyph);
|
|
|
f96e0b |
|
|
|
f96e0b |
- grub_free (glyph.combining);
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (&glyph);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
grub_free (logical);
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/grub-core/gfxmenu/gui_list.c b/grub-core/gfxmenu/gui_list.c
|
|
|
f96e0b |
index 1a2a16d..3d227ee 100644
|
|
|
f96e0b |
--- a/grub-core/gfxmenu/gui_list.c
|
|
|
f96e0b |
+++ b/grub-core/gfxmenu/gui_list.c
|
|
|
f96e0b |
@@ -87,6 +87,7 @@ list_destroy (void *vself)
|
|
|
f96e0b |
self->scrollbar_thumb->destroy (self->scrollbar_thumb);
|
|
|
f96e0b |
if (self->scrollbar_frame)
|
|
|
f96e0b |
self->scrollbar_frame->destroy (self->scrollbar_frame);
|
|
|
f96e0b |
+ grub_free (self->scrollbar_thumb_pattern);
|
|
|
f96e0b |
grub_free (self);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/grub-core/gfxmenu/gui_progress_bar.c b/grub-core/gfxmenu/gui_progress_bar.c
|
|
|
f96e0b |
index cb70930..b29efc0 100644
|
|
|
f96e0b |
--- a/grub-core/gfxmenu/gui_progress_bar.c
|
|
|
f96e0b |
+++ b/grub-core/gfxmenu/gui_progress_bar.c
|
|
|
f96e0b |
@@ -59,6 +59,9 @@ static void
|
|
|
f96e0b |
progress_bar_destroy (void *vself)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_gui_progress_bar_t self = vself;
|
|
|
f96e0b |
+ grub_free (self->theme_dir);
|
|
|
f96e0b |
+ grub_free (self->template);
|
|
|
f96e0b |
+ grub_free (self->id);
|
|
|
f96e0b |
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
|
|
f96e0b |
grub_free (self);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
diff --git a/grub-core/kern/term.c b/grub-core/kern/term.c
|
|
|
f96e0b |
index 66c5971..6eca68b 100644
|
|
|
f96e0b |
--- a/grub-core/kern/term.c
|
|
|
f96e0b |
+++ b/grub-core/kern/term.c
|
|
|
f96e0b |
@@ -46,7 +46,6 @@ grub_putcode_dumb (grub_uint32_t code,
|
|
|
f96e0b |
.variant = 0,
|
|
|
f96e0b |
.attributes = 0,
|
|
|
f96e0b |
.ncomb = 0,
|
|
|
f96e0b |
- .combining = 0,
|
|
|
f96e0b |
.estimated_width = 1
|
|
|
f96e0b |
};
|
|
|
f96e0b |
|
|
|
f96e0b |
diff --git a/grub-core/normal/charset.c b/grub-core/normal/charset.c
|
|
|
f96e0b |
index ab3101b..f4268ec 100644
|
|
|
f96e0b |
--- a/grub-core/normal/charset.c
|
|
|
f96e0b |
+++ b/grub-core/normal/charset.c
|
|
|
f96e0b |
@@ -435,7 +435,6 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen,
|
|
|
f96e0b |
out->attributes = 0;
|
|
|
f96e0b |
out->ncomb = 0;
|
|
|
f96e0b |
out->estimated_width = 1;
|
|
|
f96e0b |
- out->combining = NULL;
|
|
|
f96e0b |
return 1;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -473,25 +472,42 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen,
|
|
|
f96e0b |
|| comb_type == GRUB_UNICODE_COMB_ME
|
|
|
f96e0b |
|| comb_type == GRUB_UNICODE_COMB_MN)
|
|
|
f96e0b |
last_comb_pointer = out->ncomb;
|
|
|
f96e0b |
- n = grub_realloc (out->combining,
|
|
|
f96e0b |
- sizeof (n[0]) * (out->ncomb + 1));
|
|
|
f96e0b |
- if (!n)
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ if (out->ncomb + 1 <= (int) ARRAY_SIZE (out->combining_inline))
|
|
|
f96e0b |
+ n = out->combining_inline;
|
|
|
f96e0b |
+ else if (out->ncomb > (int) ARRAY_SIZE (out->combining_inline))
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- grub_errno = GRUB_ERR_NONE;
|
|
|
f96e0b |
- continue;
|
|
|
f96e0b |
+ n = grub_realloc (out->combining_ptr,
|
|
|
f96e0b |
+ sizeof (n[0]) * (out->ncomb + 1));
|
|
|
f96e0b |
+ if (!n)
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ grub_errno = GRUB_ERR_NONE;
|
|
|
f96e0b |
+ continue;
|
|
|
f96e0b |
+ }
|
|
|
f96e0b |
+ out->combining_ptr = n;
|
|
|
f96e0b |
+ }
|
|
|
f96e0b |
+ else
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ n = grub_malloc (sizeof (n[0]) * (out->ncomb + 1));
|
|
|
f96e0b |
+ if (!n)
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ grub_errno = GRUB_ERR_NONE;
|
|
|
f96e0b |
+ continue;
|
|
|
f96e0b |
+ }
|
|
|
f96e0b |
+ grub_memcpy (n, out->combining_inline,
|
|
|
f96e0b |
+ sizeof (out->combining_inline));
|
|
|
f96e0b |
+ out->combining_ptr = n;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- out->combining = n;
|
|
|
f96e0b |
|
|
|
f96e0b |
for (j = last_comb_pointer; j < out->ncomb; j++)
|
|
|
f96e0b |
- if (is_type_after (out->combining[j].type, comb_type))
|
|
|
f96e0b |
+ if (is_type_after (n[j].type, comb_type))
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
- grub_memmove (out->combining + j + 1,
|
|
|
f96e0b |
- out->combining + j,
|
|
|
f96e0b |
+ grub_memmove (n + j + 1,
|
|
|
f96e0b |
+ n + j,
|
|
|
f96e0b |
(out->ncomb - j)
|
|
|
f96e0b |
- * sizeof (out->combining[0]));
|
|
|
f96e0b |
- out->combining = n;
|
|
|
f96e0b |
- out->combining[j].code = *ptr;
|
|
|
f96e0b |
- out->combining[j].type = comb_type;
|
|
|
f96e0b |
+ * sizeof (n[0]));
|
|
|
f96e0b |
+ n[j].code = *ptr;
|
|
|
f96e0b |
+ n[j].type = comb_type;
|
|
|
f96e0b |
out->ncomb++;
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
@@ -503,7 +519,6 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen,
|
|
|
f96e0b |
out->attributes = 0;
|
|
|
f96e0b |
out->ncomb = 0;
|
|
|
f96e0b |
out->estimated_width = 1;
|
|
|
f96e0b |
- out->combining = NULL;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
return ptr - in;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
@@ -511,7 +526,7 @@ grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen,
|
|
|
f96e0b |
static grub_ssize_t
|
|
|
f96e0b |
bidi_line_wrap (struct grub_unicode_glyph *visual_out,
|
|
|
f96e0b |
struct grub_unicode_glyph *visual,
|
|
|
f96e0b |
- grub_size_t visual_len, unsigned *levels,
|
|
|
f96e0b |
+ grub_size_t visual_len,
|
|
|
f96e0b |
grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual, void *getcharwidth_arg),
|
|
|
f96e0b |
void *getcharwidth_arg,
|
|
|
f96e0b |
grub_size_t maxwidth, grub_size_t startwidth,
|
|
|
f96e0b |
@@ -531,7 +546,7 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out,
|
|
|
f96e0b |
void revert (unsigned start, unsigned end)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
struct grub_unicode_glyph t;
|
|
|
f96e0b |
- unsigned i, tl;
|
|
|
f96e0b |
+ unsigned i;
|
|
|
f96e0b |
int a, b;
|
|
|
f96e0b |
if (pos)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
@@ -549,9 +564,6 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out,
|
|
|
f96e0b |
pos[visual[start + i].orig_pos].x = a + b - pos[visual[start + i].orig_pos].x;
|
|
|
f96e0b |
pos[visual[end - i].orig_pos].x = a + b - pos[visual[end - i].orig_pos].x;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- tl = levels[start + i];
|
|
|
f96e0b |
- levels[start + i] = levels[end - i];
|
|
|
f96e0b |
- levels[end - i] = tl;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -611,10 +623,10 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out,
|
|
|
f96e0b |
unsigned i;
|
|
|
f96e0b |
for (i = line_start; i < k; i++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- if (levels[i] > max_level)
|
|
|
f96e0b |
- max_level = levels[i];
|
|
|
f96e0b |
- if (levels[i] < min_odd_level && (levels[i] & 1))
|
|
|
f96e0b |
- min_odd_level = levels[i];
|
|
|
f96e0b |
+ if (visual[i].bidi_level > max_level)
|
|
|
f96e0b |
+ max_level = visual[i].bidi_level;
|
|
|
f96e0b |
+ if (visual[i].bidi_level < min_odd_level && (visual[i].bidi_level & 1))
|
|
|
f96e0b |
+ min_odd_level = visual[i].bidi_level;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -627,9 +639,11 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out,
|
|
|
f96e0b |
unsigned i;
|
|
|
f96e0b |
for (i = line_start; i < k; i++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- if (i != line_start && levels[i] >= j && levels[i-1] < j)
|
|
|
f96e0b |
+ if (i != line_start && visual[i].bidi_level >= j
|
|
|
f96e0b |
+ && visual[i-1].bidi_level < j)
|
|
|
f96e0b |
in = i;
|
|
|
f96e0b |
- if (levels[i] >= j && (i + 1 == k || levels[i+1] < j))
|
|
|
f96e0b |
+ if (visual[i].bidi_level >= j && (i + 1 == k
|
|
|
f96e0b |
+ || visual[i+1].bidi_level < j))
|
|
|
f96e0b |
revert (in, i);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
}
|
|
|
f96e0b |
@@ -639,10 +653,10 @@ bidi_line_wrap (struct grub_unicode_glyph *visual_out,
|
|
|
f96e0b |
unsigned i;
|
|
|
f96e0b |
for (i = line_start; i < k; i++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- if (is_mirrored (visual[i].base) && levels[i])
|
|
|
f96e0b |
+ if (is_mirrored (visual[i].base) && visual[i].bidi_level)
|
|
|
f96e0b |
visual[i].attributes |= GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR;
|
|
|
f96e0b |
if ((visual[i].attributes & GRUB_UNICODE_GLYPH_ATTRIBUTES_JOIN)
|
|
|
f96e0b |
- && levels[i])
|
|
|
f96e0b |
+ && visual[i].bidi_level)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
int left, right;
|
|
|
f96e0b |
left = visual[i].attributes
|
|
|
f96e0b |
@@ -763,8 +777,6 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
|
|
f96e0b |
{
|
|
|
f96e0b |
enum grub_bidi_type type = GRUB_BIDI_TYPE_L;
|
|
|
f96e0b |
enum override_status {OVERRIDE_NEUTRAL = 0, OVERRIDE_R, OVERRIDE_L};
|
|
|
f96e0b |
- unsigned *levels;
|
|
|
f96e0b |
- enum grub_bidi_type *resolved_types;
|
|
|
f96e0b |
unsigned base_level;
|
|
|
f96e0b |
enum override_status cur_override;
|
|
|
f96e0b |
unsigned i;
|
|
|
f96e0b |
@@ -808,24 +820,9 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
|
|
f96e0b |
cur_override = stack_override[stack_depth];
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
- levels = grub_malloc (sizeof (levels[0]) * logical_len);
|
|
|
f96e0b |
- if (!levels)
|
|
|
f96e0b |
- return -1;
|
|
|
f96e0b |
-
|
|
|
f96e0b |
- resolved_types = grub_malloc (sizeof (resolved_types[0]) * logical_len);
|
|
|
f96e0b |
- if (!resolved_types)
|
|
|
f96e0b |
- {
|
|
|
f96e0b |
- grub_free (levels);
|
|
|
f96e0b |
- return -1;
|
|
|
f96e0b |
- }
|
|
|
f96e0b |
-
|
|
|
f96e0b |
visual = grub_malloc (sizeof (visual[0]) * logical_len);
|
|
|
f96e0b |
if (!visual)
|
|
|
f96e0b |
- {
|
|
|
f96e0b |
- grub_free (resolved_types);
|
|
|
f96e0b |
- grub_free (levels);
|
|
|
f96e0b |
- return -1;
|
|
|
f96e0b |
- }
|
|
|
f96e0b |
+ return -1;
|
|
|
f96e0b |
|
|
|
f96e0b |
for (i = 0; i < logical_len; i++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
@@ -930,13 +927,13 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
|
|
f96e0b |
join_state = JOIN_DEFAULT;
|
|
|
f96e0b |
zwj_propagate_to_previous = 1;
|
|
|
f96e0b |
|
|
|
f96e0b |
- levels[visual_len] = cur_level;
|
|
|
f96e0b |
+ visual[visual_len].bidi_level = cur_level;
|
|
|
f96e0b |
if (cur_override != OVERRIDE_NEUTRAL)
|
|
|
f96e0b |
- resolved_types[visual_len] =
|
|
|
f96e0b |
+ visual[visual_len].bidi_type =
|
|
|
f96e0b |
(cur_override == OVERRIDE_L) ? GRUB_BIDI_TYPE_L
|
|
|
f96e0b |
: GRUB_BIDI_TYPE_R;
|
|
|
f96e0b |
else
|
|
|
f96e0b |
- resolved_types[visual_len] = type;
|
|
|
f96e0b |
+ visual[visual_len].bidi_type = type;
|
|
|
f96e0b |
visual_len++;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
}
|
|
|
f96e0b |
@@ -951,16 +948,16 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
|
|
f96e0b |
unsigned prev_level, next_level, cur_run_level;
|
|
|
f96e0b |
unsigned last_type, last_strong_type;
|
|
|
f96e0b |
for (run_end = run_start; run_end < visual_len &&
|
|
|
f96e0b |
- levels[run_end] == levels[run_start]; run_end++);
|
|
|
f96e0b |
+ visual[run_end].bidi_level == visual[run_start].bidi_level; run_end++);
|
|
|
f96e0b |
if (run_start == 0)
|
|
|
f96e0b |
prev_level = base_level;
|
|
|
f96e0b |
else
|
|
|
f96e0b |
- prev_level = levels[run_start - 1];
|
|
|
f96e0b |
+ prev_level = visual[run_start - 1].bidi_level;
|
|
|
f96e0b |
if (run_end == visual_len)
|
|
|
f96e0b |
next_level = base_level;
|
|
|
f96e0b |
else
|
|
|
f96e0b |
- next_level = levels[run_end];
|
|
|
f96e0b |
- cur_run_level = levels[run_start];
|
|
|
f96e0b |
+ next_level = visual[run_end].bidi_level;
|
|
|
f96e0b |
+ cur_run_level = visual[run_start].bidi_level;
|
|
|
f96e0b |
if (prev_level & 1)
|
|
|
f96e0b |
last_type = GRUB_BIDI_TYPE_R;
|
|
|
f96e0b |
else
|
|
|
f96e0b |
@@ -968,48 +965,48 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
|
|
f96e0b |
last_strong_type = last_type;
|
|
|
f96e0b |
for (i = run_start; i < run_end; i++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- switch (resolved_types[i])
|
|
|
f96e0b |
+ switch (visual[i].bidi_type)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
case GRUB_BIDI_TYPE_NSM:
|
|
|
f96e0b |
- resolved_types[i] = last_type;
|
|
|
f96e0b |
+ visual[i].bidi_type = last_type;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
case GRUB_BIDI_TYPE_EN:
|
|
|
f96e0b |
if (last_strong_type == GRUB_BIDI_TYPE_AL)
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_AN;
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_AN;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
case GRUB_BIDI_TYPE_L:
|
|
|
f96e0b |
case GRUB_BIDI_TYPE_R:
|
|
|
f96e0b |
- last_strong_type = resolved_types[i];
|
|
|
f96e0b |
+ last_strong_type = visual[i].bidi_type;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
case GRUB_BIDI_TYPE_ES:
|
|
|
f96e0b |
if (last_type == GRUB_BIDI_TYPE_EN
|
|
|
f96e0b |
&& i + 1 < run_end
|
|
|
f96e0b |
- && resolved_types[i + 1] == GRUB_BIDI_TYPE_EN)
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_EN;
|
|
|
f96e0b |
+ && visual[i + 1].bidi_type == GRUB_BIDI_TYPE_EN)
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_EN;
|
|
|
f96e0b |
else
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_ON;
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_ON;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
case GRUB_BIDI_TYPE_ET:
|
|
|
f96e0b |
{
|
|
|
f96e0b |
unsigned j;
|
|
|
f96e0b |
if (last_type == GRUB_BIDI_TYPE_EN)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_EN;
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_EN;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
for (j = i; j < run_end
|
|
|
f96e0b |
- && resolved_types[j] == GRUB_BIDI_TYPE_ET; j++);
|
|
|
f96e0b |
- if (j != run_end && resolved_types[j] == GRUB_BIDI_TYPE_EN)
|
|
|
f96e0b |
+ && visual[j].bidi_type == GRUB_BIDI_TYPE_ET; j++);
|
|
|
f96e0b |
+ if (j != run_end && visual[j].bidi_type == GRUB_BIDI_TYPE_EN)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
for (; i < run_end
|
|
|
f96e0b |
- && resolved_types[i] == GRUB_BIDI_TYPE_ET; i++)
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_EN;
|
|
|
f96e0b |
+ && visual[i].bidi_type == GRUB_BIDI_TYPE_ET; i++)
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_EN;
|
|
|
f96e0b |
i--;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
for (; i < run_end
|
|
|
f96e0b |
- && resolved_types[i] == GRUB_BIDI_TYPE_ET; i++)
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_ON;
|
|
|
f96e0b |
+ && visual[i].bidi_type == GRUB_BIDI_TYPE_ET; i++)
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_ON;
|
|
|
f96e0b |
i--;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
@@ -1017,33 +1014,33 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
|
|
f96e0b |
case GRUB_BIDI_TYPE_CS:
|
|
|
f96e0b |
if (last_type == GRUB_BIDI_TYPE_EN
|
|
|
f96e0b |
&& i + 1 < run_end
|
|
|
f96e0b |
- && resolved_types[i + 1] == GRUB_BIDI_TYPE_EN)
|
|
|
f96e0b |
+ && visual[i + 1].bidi_type == GRUB_BIDI_TYPE_EN)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_EN;
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_EN;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
if (last_type == GRUB_BIDI_TYPE_AN
|
|
|
f96e0b |
&& i + 1 < run_end
|
|
|
f96e0b |
- && (resolved_types[i + 1] == GRUB_BIDI_TYPE_AN
|
|
|
f96e0b |
- || (resolved_types[i + 1] == GRUB_BIDI_TYPE_EN
|
|
|
f96e0b |
+ && (visual[i + 1].bidi_type == GRUB_BIDI_TYPE_AN
|
|
|
f96e0b |
+ || (visual[i + 1].bidi_type == GRUB_BIDI_TYPE_EN
|
|
|
f96e0b |
&& last_strong_type == GRUB_BIDI_TYPE_AL)))
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_EN;
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_EN;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_ON;
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_ON;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
case GRUB_BIDI_TYPE_AL:
|
|
|
f96e0b |
- last_strong_type = resolved_types[i];
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_R;
|
|
|
f96e0b |
+ last_strong_type = visual[i].bidi_type;
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_R;
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
default: /* Make GCC happy. */
|
|
|
f96e0b |
break;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- last_type = resolved_types[i];
|
|
|
f96e0b |
- if (resolved_types[i] == GRUB_BIDI_TYPE_EN
|
|
|
f96e0b |
+ last_type = visual[i].bidi_type;
|
|
|
f96e0b |
+ if (visual[i].bidi_type == GRUB_BIDI_TYPE_EN
|
|
|
f96e0b |
&& last_strong_type == GRUB_BIDI_TYPE_L)
|
|
|
f96e0b |
- resolved_types[i] = GRUB_BIDI_TYPE_L;
|
|
|
f96e0b |
+ visual[i].bidi_type = GRUB_BIDI_TYPE_L;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
if (prev_level & 1)
|
|
|
f96e0b |
last_type = GRUB_BIDI_TYPE_R;
|
|
|
f96e0b |
@@ -1054,13 +1051,13 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
|
|
f96e0b |
unsigned j;
|
|
|
f96e0b |
unsigned next_type;
|
|
|
f96e0b |
for (j = i; j < run_end &&
|
|
|
f96e0b |
- (resolved_types[j] == GRUB_BIDI_TYPE_B
|
|
|
f96e0b |
- || resolved_types[j] == GRUB_BIDI_TYPE_S
|
|
|
f96e0b |
- || resolved_types[j] == GRUB_BIDI_TYPE_WS
|
|
|
f96e0b |
- || resolved_types[j] == GRUB_BIDI_TYPE_ON); j++);
|
|
|
f96e0b |
+ (visual[j].bidi_type == GRUB_BIDI_TYPE_B
|
|
|
f96e0b |
+ || visual[j].bidi_type == GRUB_BIDI_TYPE_S
|
|
|
f96e0b |
+ || visual[j].bidi_type == GRUB_BIDI_TYPE_WS
|
|
|
f96e0b |
+ || visual[j].bidi_type == GRUB_BIDI_TYPE_ON); j++);
|
|
|
f96e0b |
if (j == i)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- if (resolved_types[i] == GRUB_BIDI_TYPE_L)
|
|
|
f96e0b |
+ if (visual[i].bidi_type == GRUB_BIDI_TYPE_L)
|
|
|
f96e0b |
last_type = GRUB_BIDI_TYPE_L;
|
|
|
f96e0b |
else
|
|
|
f96e0b |
last_type = GRUB_BIDI_TYPE_R;
|
|
|
f96e0b |
@@ -1071,39 +1068,39 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
|
|
f96e0b |
next_type = (next_level & 1) ? GRUB_BIDI_TYPE_R : GRUB_BIDI_TYPE_L;
|
|
|
f96e0b |
else
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- if (resolved_types[j] == GRUB_BIDI_TYPE_L)
|
|
|
f96e0b |
+ if (visual[j].bidi_type == GRUB_BIDI_TYPE_L)
|
|
|
f96e0b |
next_type = GRUB_BIDI_TYPE_L;
|
|
|
f96e0b |
else
|
|
|
f96e0b |
next_type = GRUB_BIDI_TYPE_R;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
if (next_type == last_type)
|
|
|
f96e0b |
for (; i < j; i++)
|
|
|
f96e0b |
- resolved_types[i] = last_type;
|
|
|
f96e0b |
+ visual[i].bidi_type = last_type;
|
|
|
f96e0b |
else
|
|
|
f96e0b |
for (; i < j; i++)
|
|
|
f96e0b |
- resolved_types[i] = (cur_run_level & 1) ? GRUB_BIDI_TYPE_R
|
|
|
f96e0b |
+ visual[i].bidi_type = (cur_run_level & 1) ? GRUB_BIDI_TYPE_R
|
|
|
f96e0b |
: GRUB_BIDI_TYPE_L;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
for (i = 0; i < visual_len; i++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- if (!(levels[i] & 1) && resolved_types[i] == GRUB_BIDI_TYPE_R)
|
|
|
f96e0b |
+ if (!(visual[i].bidi_level & 1) && visual[i].bidi_type == GRUB_BIDI_TYPE_R)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- levels[i]++;
|
|
|
f96e0b |
+ visual[i].bidi_level++;
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- if (!(levels[i] & 1) && (resolved_types[i] == GRUB_BIDI_TYPE_AN
|
|
|
f96e0b |
- || resolved_types[i] == GRUB_BIDI_TYPE_EN))
|
|
|
f96e0b |
+ if (!(visual[i].bidi_level & 1) && (visual[i].bidi_type == GRUB_BIDI_TYPE_AN
|
|
|
f96e0b |
+ || visual[i].bidi_type == GRUB_BIDI_TYPE_EN))
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- levels[i] += 2;
|
|
|
f96e0b |
+ visual[i].bidi_level += 2;
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- if ((levels[i] & 1) && (resolved_types[i] == GRUB_BIDI_TYPE_L
|
|
|
f96e0b |
- || resolved_types[i] == GRUB_BIDI_TYPE_AN
|
|
|
f96e0b |
- || resolved_types[i] == GRUB_BIDI_TYPE_EN))
|
|
|
f96e0b |
+ if ((visual[i].bidi_level & 1) && (visual[i].bidi_type == GRUB_BIDI_TYPE_L
|
|
|
f96e0b |
+ || visual[i].bidi_type == GRUB_BIDI_TYPE_AN
|
|
|
f96e0b |
+ || visual[i].bidi_type == GRUB_BIDI_TYPE_EN))
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- levels[i]++;
|
|
|
f96e0b |
+ visual[i].bidi_level++;
|
|
|
f96e0b |
continue;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
}
|
|
|
f96e0b |
@@ -1111,16 +1108,14 @@ grub_bidi_line_logical_to_visual (const grub_uint32_t *logical,
|
|
|
f96e0b |
else
|
|
|
f96e0b |
{
|
|
|
f96e0b |
for (i = 0; i < visual_len; i++)
|
|
|
f96e0b |
- levels[i] = 0;
|
|
|
f96e0b |
+ visual[i].bidi_level = 0;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- grub_free (resolved_types);
|
|
|
f96e0b |
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_ssize_t ret;
|
|
|
f96e0b |
- ret = bidi_line_wrap (visual_out, visual, visual_len, levels,
|
|
|
f96e0b |
+ ret = bidi_line_wrap (visual_out, visual, visual_len,
|
|
|
f96e0b |
getcharwidth, getcharwidth_arg, maxwidth, startwidth, contchar,
|
|
|
f96e0b |
pos, primitive_wrap, log_end);
|
|
|
f96e0b |
- grub_free (levels);
|
|
|
f96e0b |
grub_free (visual);
|
|
|
f96e0b |
return ret;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
diff --git a/grub-core/normal/menu_entry.c b/grub-core/normal/menu_entry.c
|
|
|
f96e0b |
index 3cc0c01..fae258a 100644
|
|
|
f96e0b |
--- a/grub-core/normal/menu_entry.c
|
|
|
f96e0b |
+++ b/grub-core/normal/menu_entry.c
|
|
|
f96e0b |
@@ -624,7 +624,7 @@ backward_char (struct screen *screen, int update)
|
|
|
f96e0b |
linep->buf + screen->column)
|
|
|
f96e0b |
- linep->buf;
|
|
|
f96e0b |
|
|
|
f96e0b |
- grub_free (glyph.combining);
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (&glyph);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
else if (screen->line > 0)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
diff --git a/grub-core/normal/menu_text.c b/grub-core/normal/menu_text.c
|
|
|
f96e0b |
index d7e5641..36f8e73 100644
|
|
|
f96e0b |
--- a/grub-core/normal/menu_text.c
|
|
|
f96e0b |
+++ b/grub-core/normal/menu_text.c
|
|
|
f96e0b |
@@ -56,10 +56,10 @@ grub_getstringwidth (grub_uint32_t * str, const grub_uint32_t * last_position,
|
|
|
f96e0b |
while (str < last_position)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
struct grub_unicode_glyph glyph;
|
|
|
f96e0b |
- glyph.combining = 0;
|
|
|
f96e0b |
+ glyph.ncomb = 0;
|
|
|
f96e0b |
str += grub_unicode_aglomerate_comb (str, last_position - str, &glyph);
|
|
|
f96e0b |
width += grub_term_getcharwidth (term, &glyph);
|
|
|
f96e0b |
- grub_free (glyph.combining);
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (&glyph);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
return width;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
@@ -259,7 +259,8 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
|
|
|
f96e0b |
len - i, &glyph);
|
|
|
f96e0b |
|
|
|
f96e0b |
width = grub_term_getcharwidth (term, &glyph);
|
|
|
f96e0b |
- grub_free (glyph.combining);
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (&glyph);
|
|
|
f96e0b |
|
|
|
f96e0b |
if (x + width <= (int) (GRUB_TERM_LEFT_BORDER_X
|
|
|
f96e0b |
+ grub_term_border_width (term)
|
|
|
f96e0b |
@@ -284,7 +285,6 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
|
|
|
f96e0b |
.variant = 0,
|
|
|
f96e0b |
.attributes = 0,
|
|
|
f96e0b |
.ncomb = 0,
|
|
|
f96e0b |
- .combining = 0,
|
|
|
f96e0b |
.estimated_width = 1
|
|
|
f96e0b |
};
|
|
|
f96e0b |
x += grub_term_getcharwidth (term, &pseudo_glyph);
|
|
|
f96e0b |
diff --git a/grub-core/normal/term.c b/grub-core/normal/term.c
|
|
|
f96e0b |
index 820156f..83b3bce 100644
|
|
|
f96e0b |
--- a/grub-core/normal/term.c
|
|
|
f96e0b |
+++ b/grub-core/normal/term.c
|
|
|
f96e0b |
@@ -29,7 +29,7 @@
|
|
|
f96e0b |
struct term_state
|
|
|
f96e0b |
{
|
|
|
f96e0b |
struct term_state *next;
|
|
|
f96e0b |
- const struct grub_unicode_glyph *backlog_glyphs;
|
|
|
f96e0b |
+ struct grub_unicode_glyph *backlog_glyphs;
|
|
|
f96e0b |
const grub_uint32_t *backlog_ucs4;
|
|
|
f96e0b |
int backlog_fixed_tab;
|
|
|
f96e0b |
grub_size_t backlog_len;
|
|
|
f96e0b |
@@ -228,7 +228,6 @@ grub_puts_terminal (const char *str, struct grub_term_output *term)
|
|
|
f96e0b |
.variant = 0,
|
|
|
f96e0b |
.attributes = 0,
|
|
|
f96e0b |
.ncomb = 0,
|
|
|
f96e0b |
- .combining = 0,
|
|
|
f96e0b |
.estimated_width = 1,
|
|
|
f96e0b |
.base = *str
|
|
|
f96e0b |
};
|
|
|
f96e0b |
@@ -422,7 +421,6 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term,
|
|
|
f96e0b |
.variant = 0,
|
|
|
f96e0b |
.attributes = 0,
|
|
|
f96e0b |
.ncomb = 0,
|
|
|
f96e0b |
- .combining = 0,
|
|
|
f96e0b |
.estimated_width = 1
|
|
|
f96e0b |
};
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -475,7 +473,7 @@ putglyph (const struct grub_unicode_glyph *c, struct grub_term_output *term,
|
|
|
f96e0b |
}
|
|
|
f96e0b |
}
|
|
|
f96e0b |
else
|
|
|
f96e0b |
- code = c->combining[i].code;
|
|
|
f96e0b |
+ code = grub_unicode_get_comb (c) [i].code;
|
|
|
f96e0b |
|
|
|
f96e0b |
grub_ucs4_to_utf8 (&code, 1, u8, sizeof (u8));
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -506,7 +504,6 @@ putcode_real (grub_uint32_t code, struct grub_term_output *term, int fixed_tab)
|
|
|
f96e0b |
.variant = 0,
|
|
|
f96e0b |
.attributes = 0,
|
|
|
f96e0b |
.ncomb = 0,
|
|
|
f96e0b |
- .combining = 0,
|
|
|
f96e0b |
.estimated_width = 1
|
|
|
f96e0b |
};
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -534,7 +531,6 @@ get_maxwidth (struct grub_term_output *term,
|
|
|
f96e0b |
.variant = 0,
|
|
|
f96e0b |
.attributes = 0,
|
|
|
f96e0b |
.ncomb = 0,
|
|
|
f96e0b |
- .combining = 0
|
|
|
f96e0b |
};
|
|
|
f96e0b |
return (grub_term_width (term)
|
|
|
f96e0b |
- grub_term_getcharwidth (term, &space_glyph)
|
|
|
f96e0b |
@@ -615,7 +611,6 @@ print_ucs4_terminal (const grub_uint32_t * str,
|
|
|
f96e0b |
.variant = 0,
|
|
|
f96e0b |
.attributes = 0,
|
|
|
f96e0b |
.ncomb = 0,
|
|
|
f96e0b |
- .combining = 0
|
|
|
f96e0b |
};
|
|
|
f96e0b |
c.base = *ptr;
|
|
|
f96e0b |
if (pos)
|
|
|
f96e0b |
@@ -779,14 +774,14 @@ find_term_state (struct grub_term_output *term)
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
static int
|
|
|
f96e0b |
-put_glyphs_terminal (const struct grub_unicode_glyph *visual,
|
|
|
f96e0b |
+put_glyphs_terminal (struct grub_unicode_glyph *visual,
|
|
|
f96e0b |
grub_ssize_t visual_len,
|
|
|
f96e0b |
int margin_left, int margin_right,
|
|
|
f96e0b |
struct grub_term_output *term,
|
|
|
f96e0b |
struct term_state *state, int fixed_tab,
|
|
|
f96e0b |
grub_uint32_t contchar)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- const struct grub_unicode_glyph *visual_ptr;
|
|
|
f96e0b |
+ struct grub_unicode_glyph *visual_ptr;
|
|
|
f96e0b |
int since_last_nl = 1;
|
|
|
f96e0b |
for (visual_ptr = visual; visual_ptr < visual + visual_len; visual_ptr++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
@@ -813,7 +808,7 @@ put_glyphs_terminal (const struct grub_unicode_glyph *visual,
|
|
|
f96e0b |
grub_term_gotoxy (term, margin_left,
|
|
|
f96e0b |
grub_term_getxy (term) & 0xff);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- grub_free (visual_ptr->combining);
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (visual_ptr);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
if (contchar && since_last_nl)
|
|
|
f96e0b |
fill_margin (term, margin_right);
|
|
|
f96e0b |
@@ -953,7 +948,7 @@ print_ucs4_real (const grub_uint32_t * str,
|
|
|
f96e0b |
if (visual_len_show && visual[visual_len_show - 1].base != '\n')
|
|
|
f96e0b |
ret++;
|
|
|
f96e0b |
for (vptr = visual; vptr < visual + visual_len; vptr++)
|
|
|
f96e0b |
- grub_free (vptr->combining);
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (vptr);
|
|
|
f96e0b |
grub_free (visual);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
else
|
|
|
f96e0b |
@@ -1030,7 +1025,6 @@ grub_xnputs (const char *str, grub_size_t msg_len)
|
|
|
f96e0b |
.variant = 0,
|
|
|
f96e0b |
.attributes = 0,
|
|
|
f96e0b |
.ncomb = 0,
|
|
|
f96e0b |
- .combining = 0,
|
|
|
f96e0b |
.estimated_width = 1,
|
|
|
f96e0b |
.base = *str
|
|
|
f96e0b |
};
|
|
|
f96e0b |
diff --git a/grub-core/term/gfxterm.c b/grub-core/term/gfxterm.c
|
|
|
f96e0b |
index 0cb4037..0e5bcd9 100644
|
|
|
f96e0b |
--- a/grub-core/term/gfxterm.c
|
|
|
f96e0b |
+++ b/grub-core/term/gfxterm.c
|
|
|
f96e0b |
@@ -175,7 +175,7 @@ set_term_color (grub_uint8_t term_color)
|
|
|
f96e0b |
static void
|
|
|
f96e0b |
clear_char (struct grub_colored_char *c)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- grub_free (c->code.combining);
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (&c->code);
|
|
|
f96e0b |
grub_unicode_set_glyph_from_code (&c->code, ' ');
|
|
|
f96e0b |
c->fg_color = virtual_screen.fg_color;
|
|
|
f96e0b |
c->bg_color = virtual_screen.bg_color;
|
|
|
f96e0b |
@@ -191,7 +191,7 @@ grub_virtual_screen_free (void)
|
|
|
f96e0b |
for (i = 0;
|
|
|
f96e0b |
i < virtual_screen.columns * virtual_screen.rows;
|
|
|
f96e0b |
i++)
|
|
|
f96e0b |
- grub_free (virtual_screen.text_buffer[i].code.combining);
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (&virtual_screen.text_buffer[i].code);
|
|
|
f96e0b |
grub_free (virtual_screen.text_buffer);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -267,7 +267,7 @@ grub_virtual_screen_setup (unsigned int x, unsigned int y,
|
|
|
f96e0b |
/* Clear out text buffer. */
|
|
|
f96e0b |
for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- virtual_screen.text_buffer[i].code.combining = 0;
|
|
|
f96e0b |
+ virtual_screen.text_buffer[i].code.ncomb = 0;
|
|
|
f96e0b |
clear_char (&(virtual_screen.text_buffer[i]));
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -408,8 +408,8 @@ grub_gfxterm_term_fini (struct grub_term_output *term __attribute__ ((unused)))
|
|
|
f96e0b |
|
|
|
f96e0b |
for (i = 0; i < virtual_screen.columns * virtual_screen.rows; i++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- grub_free (virtual_screen.text_buffer[i].code.combining);
|
|
|
f96e0b |
- virtual_screen.text_buffer[i].code.combining = 0;
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (&virtual_screen.text_buffer[i].code);
|
|
|
f96e0b |
+ virtual_screen.text_buffer[i].code.ncomb = 0;
|
|
|
f96e0b |
virtual_screen.text_buffer[i].code.base = 0;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -651,7 +651,6 @@ paint_char (unsigned cx, unsigned cy)
|
|
|
f96e0b |
/* Mark character to be drawn. */
|
|
|
f96e0b |
dirty_region_add (virtual_screen.offset_x + x, virtual_screen.offset_y + y,
|
|
|
f96e0b |
width, height);
|
|
|
f96e0b |
- grub_free (glyph);
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
static inline void
|
|
|
f96e0b |
@@ -804,8 +803,8 @@ scroll_up (void)
|
|
|
f96e0b |
|
|
|
f96e0b |
/* Clear first line in text buffer. */
|
|
|
f96e0b |
for (i = 0; i < virtual_screen.columns; i++)
|
|
|
f96e0b |
- grub_free (virtual_screen.text_buffer[i].code.combining);
|
|
|
f96e0b |
-
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (&virtual_screen.text_buffer[i].code);
|
|
|
f96e0b |
+
|
|
|
f96e0b |
/* Scroll text buffer with one line to up. */
|
|
|
f96e0b |
grub_memmove (virtual_screen.text_buffer,
|
|
|
f96e0b |
virtual_screen.text_buffer + virtual_screen.columns,
|
|
|
f96e0b |
@@ -877,7 +876,7 @@ grub_gfxterm_putchar (struct grub_term_output *term,
|
|
|
f96e0b |
p = (virtual_screen.text_buffer +
|
|
|
f96e0b |
virtual_screen.cursor_x +
|
|
|
f96e0b |
virtual_screen.cursor_y * virtual_screen.columns);
|
|
|
f96e0b |
- grub_free (p->code.combining);
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (&p->code);
|
|
|
f96e0b |
grub_unicode_set_glyph (&p->code, c);
|
|
|
f96e0b |
grub_errno = GRUB_ERR_NONE;
|
|
|
f96e0b |
p->fg_color = virtual_screen.fg_color;
|
|
|
f96e0b |
@@ -892,7 +891,7 @@ grub_gfxterm_putchar (struct grub_term_output *term,
|
|
|
f96e0b |
virtual_screen.text_buffer + virtual_screen.columns
|
|
|
f96e0b |
* virtual_screen.rows; i++)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- grub_free (p[i].code.combining);
|
|
|
f96e0b |
+ grub_unicode_destroy_glyph (&p[i].code);
|
|
|
f96e0b |
p[i].code.base = 0;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
}
|
|
|
f96e0b |
diff --git a/grub-core/tests/video_checksum.c b/grub-core/tests/video_checksum.c
|
|
|
f96e0b |
index 68c61ff..ec9d33a 100644
|
|
|
f96e0b |
--- a/grub-core/tests/video_checksum.c
|
|
|
f96e0b |
+++ b/grub-core/tests/video_checksum.c
|
|
|
f96e0b |
@@ -478,6 +478,11 @@ int genfd = -1;
|
|
|
f96e0b |
|
|
|
f96e0b |
#include <grub/time.h>
|
|
|
f96e0b |
|
|
|
f96e0b |
+#if defined (GRUB_MACHINE_EMU) && defined (COLLECT_TIME_STATISTICS)
|
|
|
f96e0b |
+#include <sys/times.h>
|
|
|
f96e0b |
+#include <unistd.h>
|
|
|
f96e0b |
+#endif
|
|
|
f96e0b |
+
|
|
|
f96e0b |
static void
|
|
|
f96e0b |
write_time (void)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
@@ -486,9 +491,12 @@ write_time (void)
|
|
|
f96e0b |
static grub_uint64_t prev;
|
|
|
f96e0b |
grub_uint64_t cur;
|
|
|
f96e0b |
static int tmrfd = -1;
|
|
|
f96e0b |
+ struct tms tm;
|
|
|
f96e0b |
if (tmrfd < 0)
|
|
|
f96e0b |
tmrfd = open ("time.txt", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
|
|
|
f96e0b |
- cur = grub_get_time_ms ();
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ times (&tm;;
|
|
|
f96e0b |
+ cur = (tm.tms_utime * 1000ULL) / sysconf(_SC_CLK_TCK);
|
|
|
f96e0b |
grub_snprintf (buf, sizeof (buf), "%s_%dx%dx%s:%d: %" PRIuGRUB_UINT64_T " ms\n",
|
|
|
f96e0b |
basename,
|
|
|
f96e0b |
capt_mode_info.width,
|
|
|
f96e0b |
diff --git a/grub-core/video/fb/fbblit.c b/grub-core/video/fb/fbblit.c
|
|
|
f96e0b |
index c206ac8..789507e 100644
|
|
|
f96e0b |
--- a/grub-core/video/fb/fbblit.c
|
|
|
f96e0b |
+++ b/grub-core/video/fb/fbblit.c
|
|
|
f96e0b |
@@ -1085,15 +1085,9 @@ grub_video_fbblit_replace_index_RGBX8888 (struct grub_video_fbblit_info *dst,
|
|
|
f96e0b |
{
|
|
|
f96e0b |
color = *srcptr++;
|
|
|
f96e0b |
|
|
|
f96e0b |
-#ifdef GRUB_CPU_WORDS_BIGENDIAN
|
|
|
f96e0b |
- sb = (color >> 0) & 0xFF;
|
|
|
f96e0b |
- sg = (color >> 8) & 0xFF;
|
|
|
f96e0b |
- sr = (color >> 16) & 0xFF;
|
|
|
f96e0b |
-#else
|
|
|
f96e0b |
sr = (color >> 0) & 0xFF;
|
|
|
f96e0b |
sg = (color >> 8) & 0xFF;
|
|
|
f96e0b |
sb = (color >> 16) & 0xFF;
|
|
|
f96e0b |
-#endif
|
|
|
f96e0b |
|
|
|
f96e0b |
color = grub_video_fb_map_rgb(sr, sg, sb);
|
|
|
f96e0b |
*dstptr++ = color & 0xFF;
|
|
|
f96e0b |
diff --git a/include/grub/emu/export.h b/include/grub/emu/export.h
|
|
|
f96e0b |
index 7f9e4e1..4da9c47 100644
|
|
|
f96e0b |
--- a/include/grub/emu/export.h
|
|
|
f96e0b |
+++ b/include/grub/emu/export.h
|
|
|
f96e0b |
@@ -5,3 +5,5 @@ void EXPORT_FUNC (write) (void);
|
|
|
f96e0b |
void EXPORT_FUNC (ioctl) (void);
|
|
|
f96e0b |
void EXPORT_FUNC (__errno_location) (void);
|
|
|
f96e0b |
void EXPORT_FUNC (strerror) (void);
|
|
|
f96e0b |
+void EXPORT_FUNC (sysconf) (void);
|
|
|
f96e0b |
+void EXPORT_FUNC (times) (void);
|
|
|
f96e0b |
diff --git a/include/grub/unicode.h b/include/grub/unicode.h
|
|
|
f96e0b |
index 3d79c4c..d38ddbf 100644
|
|
|
f96e0b |
--- a/include/grub/unicode.h
|
|
|
f96e0b |
+++ b/include/grub/unicode.h
|
|
|
f96e0b |
@@ -132,21 +132,33 @@ enum grub_comb_type
|
|
|
f96e0b |
GRUB_UNICODE_COMB_MN = 255,
|
|
|
f96e0b |
};
|
|
|
f96e0b |
|
|
|
f96e0b |
+struct grub_unicode_combining
|
|
|
f96e0b |
+{
|
|
|
f96e0b |
+ grub_uint32_t code:21;
|
|
|
f96e0b |
+ enum grub_comb_type type:8;
|
|
|
f96e0b |
+};
|
|
|
f96e0b |
/* This structure describes a glyph as opposed to character. */
|
|
|
f96e0b |
struct grub_unicode_glyph
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- grub_uint32_t base;
|
|
|
f96e0b |
- grub_uint16_t variant:9;
|
|
|
f96e0b |
- grub_uint8_t attributes:5;
|
|
|
f96e0b |
- grub_size_t ncomb;
|
|
|
f96e0b |
- grub_size_t orig_pos;
|
|
|
f96e0b |
- struct grub_unicode_combining {
|
|
|
f96e0b |
- grub_uint32_t code;
|
|
|
f96e0b |
- enum grub_comb_type type;
|
|
|
f96e0b |
- } *combining;
|
|
|
f96e0b |
+ grub_uint32_t base:23; /* minimum: 21 */
|
|
|
f96e0b |
+ grub_uint16_t variant:9; /* minimum: 9 */
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ grub_uint8_t attributes:5; /* minimum: 5 */
|
|
|
f96e0b |
+ grub_uint8_t bidi_level:6; /* minimum: 6 */
|
|
|
f96e0b |
+ enum grub_bidi_type bidi_type:5; /* minimum: :5 */
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ unsigned ncomb:8;
|
|
|
f96e0b |
/* Hint by unicode subsystem how wide this character usually is.
|
|
|
f96e0b |
Real width is determined by font. Set only in UTF-8 stream. */
|
|
|
f96e0b |
- int estimated_width;
|
|
|
f96e0b |
+ int estimated_width:8;
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+ grub_size_t orig_pos;
|
|
|
f96e0b |
+ union
|
|
|
f96e0b |
+ {
|
|
|
f96e0b |
+ struct grub_unicode_combining combining_inline[sizeof (void *)
|
|
|
f96e0b |
+ / sizeof (struct grub_unicode_combining)];
|
|
|
f96e0b |
+ struct grub_unicode_combining *combining_ptr;
|
|
|
f96e0b |
+ };
|
|
|
f96e0b |
};
|
|
|
f96e0b |
|
|
|
f96e0b |
#define GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR 0x1
|
|
|
f96e0b |
@@ -253,6 +265,24 @@ grub_size_t
|
|
|
f96e0b |
grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen,
|
|
|
f96e0b |
struct grub_unicode_glyph *out);
|
|
|
f96e0b |
|
|
|
f96e0b |
+static inline const struct grub_unicode_combining *
|
|
|
f96e0b |
+grub_unicode_get_comb (const struct grub_unicode_glyph *in)
|
|
|
f96e0b |
+{
|
|
|
f96e0b |
+ if (in->ncomb == 0)
|
|
|
f96e0b |
+ return NULL;
|
|
|
f96e0b |
+ if (in->ncomb > ARRAY_SIZE (in->combining_inline))
|
|
|
f96e0b |
+ return in->combining_ptr;
|
|
|
f96e0b |
+ return in->combining_inline;
|
|
|
f96e0b |
+}
|
|
|
f96e0b |
+
|
|
|
f96e0b |
+static inline void
|
|
|
f96e0b |
+grub_unicode_destroy_glyph (struct grub_unicode_glyph *glyph)
|
|
|
f96e0b |
+{
|
|
|
f96e0b |
+ if (glyph->ncomb > ARRAY_SIZE (glyph->combining_inline))
|
|
|
f96e0b |
+ grub_free (glyph->combining_ptr);
|
|
|
f96e0b |
+ glyph->ncomb = 0;
|
|
|
f96e0b |
+}
|
|
|
f96e0b |
+
|
|
|
f96e0b |
static inline struct grub_unicode_glyph *
|
|
|
f96e0b |
grub_unicode_glyph_dup (const struct grub_unicode_glyph *in)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
@@ -260,17 +290,20 @@ grub_unicode_glyph_dup (const struct grub_unicode_glyph *in)
|
|
|
f96e0b |
if (!out)
|
|
|
f96e0b |
return NULL;
|
|
|
f96e0b |
grub_memcpy (out, in, sizeof (*in));
|
|
|
f96e0b |
- if (in->combining)
|
|
|
f96e0b |
+ if (in->ncomb > ARRAY_SIZE (out->combining_inline))
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- out->combining = grub_malloc (in->ncomb * sizeof (out->combining[0]));
|
|
|
f96e0b |
- if (!out->combining)
|
|
|
f96e0b |
+ out->combining_ptr = grub_malloc (in->ncomb * sizeof (out->combining_ptr[0]));
|
|
|
f96e0b |
+ if (!out->combining_ptr)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_free (out);
|
|
|
f96e0b |
return NULL;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
- grub_memcpy (out->combining, in->combining,
|
|
|
f96e0b |
- in->ncomb * sizeof (out->combining[0]));
|
|
|
f96e0b |
+ grub_memcpy (out->combining_ptr, in->combining_ptr,
|
|
|
f96e0b |
+ in->ncomb * sizeof (out->combining_ptr[0]));
|
|
|
f96e0b |
}
|
|
|
f96e0b |
+ else
|
|
|
f96e0b |
+ grub_memcpy (&out->combining_inline, &in->combining_inline,
|
|
|
f96e0b |
+ sizeof (out->combining_inline));
|
|
|
f96e0b |
return out;
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
@@ -279,14 +312,17 @@ grub_unicode_set_glyph (struct grub_unicode_glyph *out,
|
|
|
f96e0b |
const struct grub_unicode_glyph *in)
|
|
|
f96e0b |
{
|
|
|
f96e0b |
grub_memcpy (out, in, sizeof (*in));
|
|
|
f96e0b |
- if (in->combining)
|
|
|
f96e0b |
+ if (in->ncomb > ARRAY_SIZE (out->combining_inline))
|
|
|
f96e0b |
{
|
|
|
f96e0b |
- out->combining = grub_malloc (in->ncomb * sizeof (out->combining[0]));
|
|
|
f96e0b |
- if (!out->combining)
|
|
|
f96e0b |
+ out->combining_ptr = grub_malloc (in->ncomb * sizeof (out->combining_ptr[0]));
|
|
|
f96e0b |
+ if (!out->combining_ptr)
|
|
|
f96e0b |
return;
|
|
|
f96e0b |
- grub_memcpy (out->combining, in->combining,
|
|
|
f96e0b |
- in->ncomb * sizeof (out->combining[0]));
|
|
|
f96e0b |
+ grub_memcpy (out->combining_ptr, in->combining_ptr,
|
|
|
f96e0b |
+ in->ncomb * sizeof (out->combining_ptr[0]));
|
|
|
f96e0b |
}
|
|
|
f96e0b |
+ else
|
|
|
f96e0b |
+ grub_memcpy (&out->combining_inline, &in->combining_inline,
|
|
|
f96e0b |
+ sizeof (out->combining_inline));
|
|
|
f96e0b |
}
|
|
|
f96e0b |
|
|
|
f96e0b |
static inline struct grub_unicode_glyph *
|
|
|
f96e0b |
--
|
|
|
f96e0b |
1.8.2.1
|
|
|
f96e0b |
|