Detach optional parts of gfxterm and integrate in with coreboot init.

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2013-05-31 00:42:33 +02:00
parent 6570b2050e
commit fc4c4fddf6
26 changed files with 410 additions and 317 deletions

View file

@ -59,8 +59,25 @@ grub_err_t EXPORT_FUNC (grub_video_bitmap_destroy) (struct grub_video_bitmap *bi
grub_err_t EXPORT_FUNC (grub_video_bitmap_load) (struct grub_video_bitmap **bitmap,
const char *filename);
unsigned int EXPORT_FUNC (grub_video_bitmap_get_width) (struct grub_video_bitmap *bitmap);
unsigned int EXPORT_FUNC (grub_video_bitmap_get_height) (struct grub_video_bitmap *bitmap);
/* Return bitmap width. */
static inline unsigned int
grub_video_bitmap_get_width (struct grub_video_bitmap *bitmap)
{
if (!bitmap)
return 0;
return bitmap->mode_info.width;
}
/* Return bitmap height. */
static inline unsigned int
grub_video_bitmap_get_height (struct grub_video_bitmap *bitmap)
{
if (!bitmap)
return 0;
return bitmap->mode_info.height;
}
void EXPORT_FUNC (grub_video_bitmap_get_mode_info) (struct grub_video_bitmap *bitmap,
struct grub_video_mode_info *mode_info);

30
include/grub/color.h Normal file
View file

@ -0,0 +1,30 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_VIDEO_COLOR_HEADER
#define GRUB_VIDEO_COLOR_HEADER 1
#include <grub/video.h>
int grub_video_get_named_color (const char *name,
grub_video_rgba_color_t *color);
grub_err_t grub_video_parse_color (const char *s,
grub_video_rgba_color_t *color);
#endif

View file

@ -31,8 +31,15 @@ struct grub_video_fbblit_info
grub_uint8_t *data;
};
void *grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y);
/* Don't use for 1-bit bitmaps, addressing needs to be done at the bit level
and it doesn't make sense, in general, to ask for a pointer
to a particular pixel's data. */
static inline void *
grub_video_fb_get_video_ptr (struct grub_video_fbblit_info *source,
unsigned int x, unsigned int y)
{
return source->data + y * source->mode_info->pitch + x * source->mode_info->bytes_per_pixel;
}
/* Advance pointer by VAL bytes. If there is no unaligned access available,
VAL has to be divisible by size of pointed type.

View file

@ -31,13 +31,21 @@ EXPORT_FUNC (grub_gfxterm_set_window) (struct grub_video_render_target *target,
int double_repaint,
grub_font_t font, int border_width);
typedef void (*grub_gfxterm_repaint_callback_t)(int x, int y,
int width, int height);
void grub_gfxterm_set_repaint_callback (grub_gfxterm_repaint_callback_t func);
void EXPORT_FUNC (grub_gfxterm_schedule_repaint) (void);
extern void (*EXPORT_VAR (grub_gfxterm_decorator_hook)) (void);
struct grub_gfxterm_background
{
struct grub_video_bitmap *bitmap;
int blend_text_bg;
grub_video_rgba_color_t default_bg_color;
};
extern struct grub_gfxterm_background EXPORT_VAR (grub_gfxterm_background);
void EXPORT_FUNC (grub_gfxterm_video_update_color) (void);
void
EXPORT_FUNC (grub_gfxterm_get_dimensions) (unsigned *width, unsigned *height);
#endif /* ! GRUB_GFXTERM_HEADER */

View file

@ -22,4 +22,11 @@
void grub_vga_text_init (void);
void grub_vga_text_fini (void);
void grub_video_coreboot_fb_init (void);
void grub_video_coreboot_fb_early_init (void);
void grub_video_coreboot_fb_late_init (void);
void grub_video_coreboot_fb_fini (void);
extern struct grub_linuxbios_table_framebuffer *grub_video_coreboot_fbtable;
#endif /* ! GRUB_MACHINE_CONSOLE_HEADER */

View file

@ -531,12 +531,6 @@ 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);
#ifndef GRUB_MACHINE_EMU
extern void grub_font_init (void);
extern void grub_font_fini (void);