Fix handling of wide characters in gfxterm.

* grub-core/term/gfxterm.c (grub_colored_char): Remove width and index.
	(clear_char): Likewise.
	(paint_char): Skip code == NULL chars.
	(grub_gfxterm_putchar): Set code = NULL on "shadowed" positions.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2012-01-12 22:16:07 +01:00
parent e70cb72f73
commit 3049237440
2 changed files with 12 additions and 16 deletions

View file

@ -1,3 +1,12 @@
2012-01-12 Vladimir Serbinenko <phcoder@gmail.com>
Fix handling of wide characters in gfxterm.
* grub-core/term/gfxterm.c (grub_colored_char): Remove width and index.
(clear_char): Likewise.
(paint_char): Skip code == NULL chars.
(grub_gfxterm_putchar): Set code = NULL on "shadowed" positions.
2012-01-12 Vladimir Serbinenko <phcoder@gmail.com> 2012-01-12 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/charset.c: Move comment to right place. * grub-core/normal/charset.c: Move comment to right place.

View file

@ -54,12 +54,6 @@ struct grub_colored_char
/* Color values. */ /* Color values. */
grub_video_color_t fg_color; grub_video_color_t fg_color;
grub_video_color_t bg_color; grub_video_color_t bg_color;
/* The width of this character minus one. */
unsigned char width;
/* The column index of this character. */
unsigned char index;
}; };
struct grub_virtual_screen struct grub_virtual_screen
@ -187,8 +181,6 @@ clear_char (struct grub_colored_char *c)
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
c->fg_color = virtual_screen.fg_color; c->fg_color = virtual_screen.fg_color;
c->bg_color = virtual_screen.bg_color; c->bg_color = virtual_screen.bg_color;
c->width = 0;
c->index = 0;
} }
static void static void
@ -621,7 +613,8 @@ paint_char (unsigned cx, unsigned cy)
p = (virtual_screen.text_buffer p = (virtual_screen.text_buffer
+ cx + (cy * virtual_screen.columns)); + cx + (cy * virtual_screen.columns));
p -= p->index; if (!p->code)
return;
/* Get glyph for character. */ /* Get glyph for character. */
glyph = grub_font_construct_glyph (virtual_screen.font, p->code); glyph = grub_font_construct_glyph (virtual_screen.font, p->code);
@ -885,8 +878,6 @@ grub_gfxterm_putchar (struct grub_term_output *term,
grub_errno = GRUB_ERR_NONE; grub_errno = GRUB_ERR_NONE;
p->fg_color = virtual_screen.fg_color; p->fg_color = virtual_screen.fg_color;
p->bg_color = virtual_screen.bg_color; p->bg_color = virtual_screen.bg_color;
p->width = char_width - 1;
p->index = 0;
/* If we have large glyph, add fixup info. */ /* If we have large glyph, add fixup info. */
if (char_width > 1) if (char_width > 1)
@ -898,11 +889,7 @@ grub_gfxterm_putchar (struct grub_term_output *term,
* virtual_screen.rows; i++) * virtual_screen.rows; i++)
{ {
grub_free (p[i].code); grub_free (p[i].code);
p[i].code = grub_unicode_glyph_from_code (' '); p[i].code = NULL;
if (!p[i].code)
grub_errno = GRUB_ERR_NONE;
p[i].width = char_width - 1;
p[i].index = i;
} }
} }