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:
Colin Watson 2010-12-10 16:45:58 +00:00
parent 5367ecd305
commit 52832c554c
13 changed files with 240 additions and 198 deletions

View file

@ -87,11 +87,11 @@ struct grub_gfxmenu_view
grub_font_t title_font;
grub_font_t message_font;
char *terminal_font_name;
grub_gui_color_t title_color;
grub_gui_color_t message_color;
grub_gui_color_t message_bg_color;
grub_video_rgba_color_t title_color;
grub_video_rgba_color_t message_color;
grub_video_rgba_color_t message_bg_color;
struct grub_video_bitmap *desktop_image;
grub_gui_color_t desktop_color;
grub_video_rgba_color_t desktop_color;
grub_gfxmenu_box_t terminal_box;
char *title_text;
char *progress_message_text;

View file

@ -31,16 +31,6 @@
status changes. */
#define GRUB_GFXMENU_TIMEOUT_COMPONENT_ID "__timeout__"
/* A representation of a color. Unlike grub_video_color_t, this
representation is independent of any video mode specifics. */
typedef struct grub_gui_color
{
grub_uint8_t red;
grub_uint8_t green;
grub_uint8_t blue;
grub_uint8_t alpha;
} grub_gui_color_t;
typedef struct grub_gui_component *grub_gui_component_t;
typedef struct grub_gui_container *grub_gui_container_t;
typedef struct grub_gui_list *grub_gui_list_t;
@ -242,23 +232,6 @@ grub_gui_set_viewport (const grub_video_rect_t *r, grub_video_rect_t *old)
r->height);
}
static __inline grub_gui_color_t
grub_gui_color_rgb (int r, int g, int b)
{
grub_gui_color_t c;
c.red = r;
c.green = g;
c.blue = b;
c.alpha = 255;
return c;
}
static __inline grub_video_color_t
grub_gui_map_color (grub_gui_color_t c)
{
return grub_video_map_rgba (c.red, c.green, c.blue, c.alpha);
}
static inline int
grub_video_have_common_points (const grub_video_rect_t *a,
const grub_video_rect_t *b)

View file

@ -30,8 +30,4 @@ char *grub_resolve_relative_path (const char *base, const char *path);
char *grub_get_dirname (const char *file_path);
int grub_gui_get_named_color (const char *name, grub_gui_color_t *color);
grub_err_t grub_gui_parse_color (const char *s, grub_gui_color_t *color);
#endif /* GRUB_GUI_STRING_UTIL_HEADER */

View file

@ -27,6 +27,15 @@
specific coding format. */
typedef grub_uint32_t grub_video_color_t;
/* Video color in hardware independent format. */
typedef struct grub_video_rgba_color
{
grub_uint8_t red;
grub_uint8_t green;
grub_uint8_t blue;
grub_uint8_t alpha;
} grub_video_rgba_color_t;
/* This structure is driver specific and should not be accessed directly by
outside code. */
struct grub_video_render_target;
@ -428,4 +437,27 @@ grub_video_check_mode_flag (grub_video_mode_type_t flags,
grub_video_driver_id_t EXPORT_FUNC (grub_video_get_driver_id) (void);
static __inline grub_video_rgba_color_t
grub_video_rgba_color_rgb (int r, int g, int b)
{
grub_video_rgba_color_t c;
c.red = r;
c.green = g;
c.blue = b;
c.alpha = 255;
return c;
}
static __inline grub_video_color_t
grub_video_map_rgba_color (grub_video_rgba_color_t c)
{
return grub_video_map_rgba (c.red, c.green, c.blue, c.alpha);
}
int EXPORT_FUNC (grub_video_get_named_color) (const char *name,
grub_video_rgba_color_t *color);
grub_err_t EXPORT_FUNC (grub_video_parse_color) (const char *s,
grub_video_rgba_color_t *color);
#endif /* ! GRUB_VIDEO_HEADER */