Handle double redraw

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-06-21 02:08:19 +02:00
parent de24ab9b0d
commit a29051ec7f

View file

@ -38,15 +38,8 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
unsigned int width;
unsigned int height;
int i;
grub_font_t sansbig;
grub_font_t sans;
grub_font_t sanssmall;
grub_font_t fixed;
struct grub_font_glyph *glyph;
struct grub_video_render_target *text_layer;
grub_video_color_t palette[16];
const char *str;
int texty;
err = grub_video_set_mode ("auto", GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
if (err)
@ -54,21 +47,22 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
grub_video_get_viewport (&x, &y, &width, &height);
{
const char *str;
int texty;
grub_font_t sansbig;
grub_font_t sans;
grub_font_t sanssmall;
grub_font_t fixed;
struct grub_font_glyph *glyph;
grub_video_create_render_target (&text_layer, width, height,
GRUB_VIDEO_MODE_TYPE_RGB
| GRUB_VIDEO_MODE_TYPE_ALPHA);
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
color = grub_video_map_rgb (0, 0, 0);
grub_video_fill_rect (color, 0, 0, width, height);
color = grub_video_map_rgb (255, 0, 0);
grub_video_fill_rect (color, 0, 0, 100, 100);
grub_video_set_active_render_target (text_layer);
color = grub_video_map_rgb (0, 255, 255);
grub_video_fill_rect (color, 100, 100, 100, 100);
sansbig = grub_font_get ("Unknown Regular 16");
sans = grub_font_get ("Unknown Regular 16");
sanssmall = grub_font_get ("Unknown Regular 16");
@ -79,13 +73,6 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
glyph = grub_font_get_glyph (fixed, '*');
grub_font_draw_glyph (glyph, color, 200 ,0);
grub_video_set_viewport (x + 150, y + 150,
width - 150 * 2, height - 150 * 2);
color = grub_video_map_rgb (77, 33, 77);
grub_video_fill_rect (color, 0, 0, width, height);
grub_video_set_active_render_target (text_layer);
color = grub_video_map_rgb (255, 255, 255);
texty = 32;
@ -147,9 +134,28 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
palette[i] = color;
grub_font_draw_glyph (glyph, color, 16 + i * 16, 220);
}
}
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
for (i = 0; i < 2; i++)
{
color = grub_video_map_rgb (0, 0, 0);
grub_video_fill_rect (color, 0, 0, width, height);
color = grub_video_map_rgb (255, 0, 0);
grub_video_fill_rect (color, 0, 0, 100, 100);
color = grub_video_map_rgb (0, 255, 255);
grub_video_fill_rect (color, 100, 100, 100, 100);
grub_video_set_viewport (x + 150, y + 150,
width - 150 * 2, height - 150 * 2);
color = grub_video_map_rgb (77, 33, 77);
grub_video_fill_rect (color, 0, 0, width, height);
grub_video_swap_buffers ();
}
for (i = 0; i < 5; i++)
{
color = grub_video_map_rgb (i, 33, 77);