Move gfxmenu color handling to video, so that gfxterm can use it
too. * grub-core/gfxmenu/named_colors.c: Move to ... * grub-core/video/colors.c: ... here. Rename grub_gui_get_named_color to grub_video_get_named_color. * grub-core/gfxmenu/gui_string_util.c (my_isxdigit): Move to ... * grub-core/video/colors.c (my_isxdigit): ... here. * grub-core/gfxmenu/gui_string_util.c (parse_hex_color_component): Move to ... * grub-core/video/colors.c (parse_hex_color_component): ... here. * grub-core/gfxmenu/gui_string_util.c (grub_gui_parse_color): Move to ... * grub-core/video/colors.c (grub_video_parse_color): ... here. * include/grub/gui.h (grub_gui_color_t): Move to ... * include/grub/video.h (grub_video_rgba_color_t): ... here. * include/grub/gui.h (grub_gui_color_rgb): Move to ... * include/grub/video.h (grub_video_rgba_color_rgb): ... here. * include/grub/gui.h (grub_gui_map_color): Move to ... * include/grub/video.h (grub_video_map_rgba_color): ... here. * include/grub/gui_string_util.h (grub_gui_get_named_color): Move to ... * include/grub/video.h (grub_video_get_named_color): ... here. * include/grub/gui_string_util.h (grub_gui_parse_color): Move to ... * include/grub/video.h (grub_video_parse_color): ... here. * grub-core/Makefile.core.def (kernel) [videoinkernel]: Add video/colors.c. (gfxmenu): Remove gfxmenu/named_colors.c. (video_colors) [videomodules]: New module, containing video/colors.c.
This commit is contained in:
parent
5367ecd305
commit
52832c554c
13 changed files with 240 additions and 198 deletions
|
@ -40,10 +40,10 @@ struct grub_gui_progress_bar
|
|||
int show_text;
|
||||
char *template;
|
||||
grub_font_t font;
|
||||
grub_gui_color_t text_color;
|
||||
grub_gui_color_t border_color;
|
||||
grub_gui_color_t bg_color;
|
||||
grub_gui_color_t fg_color;
|
||||
grub_video_rgba_color_t text_color;
|
||||
grub_video_rgba_color_t border_color;
|
||||
grub_video_rgba_color_t bg_color;
|
||||
grub_video_rgba_color_t fg_color;
|
||||
|
||||
char *theme_dir;
|
||||
int need_to_recreate_pixmaps;
|
||||
|
@ -109,7 +109,7 @@ draw_filled_rect_bar (grub_gui_progress_bar_t self)
|
|||
f.height = self->bounds.height - 2;
|
||||
|
||||
/* Border. */
|
||||
grub_video_fill_rect (grub_gui_map_color (self->border_color),
|
||||
grub_video_fill_rect (grub_video_map_rgba_color (self->border_color),
|
||||
f.x - 1, f.y - 1,
|
||||
f.width + 2, f.height + 2);
|
||||
|
||||
|
@ -117,12 +117,12 @@ draw_filled_rect_bar (grub_gui_progress_bar_t self)
|
|||
int barwidth = (f.width
|
||||
* (self->value - self->start)
|
||||
/ (self->end - self->start));
|
||||
grub_video_fill_rect (grub_gui_map_color (self->bg_color),
|
||||
grub_video_fill_rect (grub_video_map_rgba_color (self->bg_color),
|
||||
f.x + barwidth, f.y,
|
||||
f.width - barwidth, f.height);
|
||||
|
||||
/* Bar foreground. */
|
||||
grub_video_fill_rect (grub_gui_map_color (self->fg_color),
|
||||
grub_video_fill_rect (grub_video_map_rgba_color (self->fg_color),
|
||||
f.x, f.y,
|
||||
barwidth, f.height);
|
||||
}
|
||||
|
@ -161,7 +161,8 @@ draw_text (grub_gui_progress_bar_t self)
|
|||
if (self->template)
|
||||
{
|
||||
grub_font_t font = self->font;
|
||||
grub_video_color_t text_color = grub_gui_map_color (self->text_color);
|
||||
grub_video_color_t text_color =
|
||||
grub_video_map_rgba_color (self->text_color);
|
||||
int width = self->bounds.width;
|
||||
int height = self->bounds.height;
|
||||
char *text;
|
||||
|
@ -298,19 +299,19 @@ progress_bar_set_property (void *vself, const char *name, const char *value)
|
|||
}
|
||||
else if (grub_strcmp (name, "text_color") == 0)
|
||||
{
|
||||
grub_gui_parse_color (value, &self->text_color);
|
||||
grub_video_parse_color (value, &self->text_color);
|
||||
}
|
||||
else if (grub_strcmp (name, "border_color") == 0)
|
||||
{
|
||||
grub_gui_parse_color (value, &self->border_color);
|
||||
grub_video_parse_color (value, &self->border_color);
|
||||
}
|
||||
else if (grub_strcmp (name, "bg_color") == 0)
|
||||
{
|
||||
grub_gui_parse_color (value, &self->bg_color);
|
||||
grub_video_parse_color (value, &self->bg_color);
|
||||
}
|
||||
else if (grub_strcmp (name, "fg_color") == 0)
|
||||
{
|
||||
grub_gui_parse_color (value, &self->fg_color);
|
||||
grub_video_parse_color (value, &self->fg_color);
|
||||
}
|
||||
else if (grub_strcmp (name, "bar_style") == 0)
|
||||
{
|
||||
|
@ -379,9 +380,9 @@ grub_gui_progress_bar_new (void)
|
|||
self->progress.component.ops = &progress_bar_ops;
|
||||
self->visible = 1;
|
||||
self->font = grub_font_get ("Unknown Regular 16");
|
||||
grub_gui_color_t black = { .red = 0, .green = 0, .blue = 0, .alpha = 255 };
|
||||
grub_gui_color_t gray = { .red = 128, .green = 128, .blue = 128, .alpha = 255 };
|
||||
grub_gui_color_t lightgray = { .red = 200, .green = 200, .blue = 200, .alpha = 255 };
|
||||
grub_video_rgba_color_t black = { .red = 0, .green = 0, .blue = 0, .alpha = 255 };
|
||||
grub_video_rgba_color_t gray = { .red = 128, .green = 128, .blue = 128, .alpha = 255 };
|
||||
grub_video_rgba_color_t lightgray = { .red = 200, .green = 200, .blue = 200, .alpha = 255 };
|
||||
self->text_color = black;
|
||||
self->border_color = black;
|
||||
self->bg_color = gray;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue