2008-01-01 Vesa Jaaskelainen <chaac@nic.fi>

* include/grub/video.h: Added grub_video_unmap_color and
        grub_video_get_active_render_target.
        (grub_video_adapter): Added unmap_color and get_active_render_target.

        * video/video.c: Added grub_video_unmap_color and
        grub_video_get_active_render_target.
        (grub_video_get_info): Changed method to accept NULL pointer as an
        argument to allow detection of active video adapter.

        * video/i386/pc/vbe.c: Renamed grub_video_vbe_unmap_color as
        grub_video_vbe_unmap_color_int.
        Added grub_video_vbe_unmap_color and
        grub_video_vbe_get_active_render_target.
        (grub_video_vbe_adapter): Added unmap_color and
        get_active_render_target.

        * video/i386/pc/vbeblit.c: Replaced grub_video_vbe_unmap_color usage
        with grub_video_vbe_unmap_color_int.

        * term/gfxterm.c (DEFAULT_STANDARD_COLOR): Added.
        (DEFAULT_NORMAL_COLOR): Likewise.
        (DEFAULT_HIGHLIGHT_COLOR) Likewise.
        (DEFAULT_FG_COLOR): Removed.
        (DEFAULT_BG_COLOR): Likewise.
        (DEFAULT_CURSOR_COLOR): Changed value.
        (grub_virtual_screen): Added standard_color_setting,
        normal_color_setting, highlight_color_setting and term_color.
        (grub_virtual_screen): Removed fg_color_setting and bg_color_setting.
        (bitmap_width): Added.
        (bitmap_height): Likewise.
        (bitmap): Likewise.
        (set_term_color): Likewise.
        (grub_virtual_screen_setup): Changed to use new terminal coloring
        settings.
        (grub_gfxterm_init): Added init for bitmap.
        (grub_gfxterm_fini): Added destroy for bitmap.
        (redraw_screen_rect): Updated to use background bitmap and new
        terminal coloring.
        (scroll_up): Added optimization for case when there is no bitmap.
        (grub_gfxterm_cls): Fixed to use correct background color.
        (grub_virtual_screen_setcolorstate): Changed to use new terminal
        coloring.
        (grub_virtual_screen_setcolor): Likewise.
        (grub_virtual_screen_getcolor): Added.
        (grub_gfxterm_background_image_cmd): Likewise.
        (grub_video_term): Added setcolor and getcolor.
        (MOD_INIT): Added registration of background_image command.
        (MOD_TERM): Added unregistration for background_image command.
This commit is contained in:
chaac 2008-01-01 12:02:07 +00:00
parent df26671616
commit dbfdce36f1
7 changed files with 380 additions and 42 deletions

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007 Free Software Foundation, Inc.
* Copyright (C) 2005,2006,2007,2008 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
@ -754,11 +754,25 @@ grub_video_vbe_map_rgba (grub_uint8_t red, grub_uint8_t green,
}
}
grub_err_t grub_video_vbe_unmap_color (grub_video_color_t color,
grub_uint8_t *red, grub_uint8_t *green,
grub_uint8_t *blue, grub_uint8_t *alpha)
{
struct grub_video_i386_vbeblit_info target_info;
target_info.mode_info = &render_target->mode_info;
target_info.data = render_target->data;
grub_video_vbe_unmap_color_int (&target_info, color, red, green, blue, alpha);
return GRUB_ERR_NONE;
}
void
grub_video_vbe_unmap_color (struct grub_video_i386_vbeblit_info * source,
grub_video_color_t color,
grub_uint8_t *red, grub_uint8_t *green,
grub_uint8_t *blue, grub_uint8_t *alpha)
grub_video_vbe_unmap_color_int (struct grub_video_i386_vbeblit_info * source,
grub_video_color_t color,
grub_uint8_t *red, grub_uint8_t *green,
grub_uint8_t *blue, grub_uint8_t *alpha)
{
struct grub_video_mode_info *mode_info;
mode_info = source->mode_info;
@ -1510,6 +1524,14 @@ grub_video_vbe_set_active_render_target (struct grub_video_render_target *target
return GRUB_ERR_NONE;
}
static grub_err_t
grub_video_vbe_get_active_render_target (struct grub_video_render_target **target)
{
*target = render_target;
return GRUB_ERR_NONE;
}
static struct grub_video_adapter grub_video_vbe_adapter =
{
.name = "VESA BIOS Extension Video Driver",
@ -1525,6 +1547,7 @@ static struct grub_video_adapter grub_video_vbe_adapter =
.map_color = grub_video_vbe_map_color,
.map_rgb = grub_video_vbe_map_rgb,
.map_rgba = grub_video_vbe_map_rgba,
.unmap_color = grub_video_vbe_unmap_color,
.fill_rect = grub_video_vbe_fill_rect,
.blit_glyph = grub_video_vbe_blit_glyph,
.blit_bitmap = grub_video_vbe_blit_bitmap,
@ -1534,6 +1557,7 @@ static struct grub_video_adapter grub_video_vbe_adapter =
.create_render_target = grub_video_vbe_create_render_target,
.delete_render_target = grub_video_vbe_delete_render_target,
.set_active_render_target = grub_video_vbe_set_active_render_target,
.get_active_render_target = grub_video_vbe_get_active_render_target,
.next = 0
};

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
* Copyright (C) 2006,2007,2008 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
@ -281,7 +281,7 @@ grub_video_i386_vbeblit_index_R8G8B8A8 (struct grub_video_i386_vbeblit_info *dst
continue;
}
grub_video_vbe_unmap_color (dst, *dstptr, &dr, &dg, &db, &da);
grub_video_vbe_unmap_color_int (dst, *dstptr, &dr, &dg, &db, &da);
dr = (dr * (255 - a) + sr * a) / 255;
dg = (dg * (255 - a) + sg * a) / 255;
@ -481,7 +481,7 @@ grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
grub_video_color_t dst_color;
src_color = get_pixel (src, i + offset_x, j + offset_y);
grub_video_vbe_unmap_color (src, src_color, &src_red, &src_green,
grub_video_vbe_unmap_color_int (src, src_color, &src_red, &src_green,
&src_blue, &src_alpha);
if (src_alpha == 0)
@ -497,7 +497,7 @@ grub_video_i386_vbeblit_blend (struct grub_video_i386_vbeblit_info *dst,
dst_color = get_pixel (dst, x + i, y + j);
grub_video_vbe_unmap_color (dst, dst_color, &dst_red,
grub_video_vbe_unmap_color_int (dst, dst_color, &dst_red,
&dst_green, &dst_blue, &dst_alpha);
dst_red = (((src_red * src_alpha)
@ -539,7 +539,7 @@ grub_video_i386_vbeblit_replace (struct grub_video_i386_vbeblit_info *dst,
for (i = 0; i < width; i++)
{
src_color = get_pixel (src, i + offset_x, j + offset_y);
grub_video_vbe_unmap_color (src, src_color, &src_red, &src_green,
grub_video_vbe_unmap_color_int (src, src_color, &src_red, &src_green,
&src_blue, &src_alpha);
dst_color = grub_video_vbe_map_rgba (src_red, src_green,

View file

@ -1,6 +1,6 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
* Copyright (C) 2006,2007,2008 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
@ -134,6 +134,13 @@ grub_video_get_info (struct grub_video_mode_info *mode_info)
if (! grub_video_adapter_active)
return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
/* If mode_info is NULL just report that video adapter is active. */
if (! mode_info)
{
grub_errno = GRUB_ERR_NONE;
return grub_errno;
}
return grub_video_adapter_active->get_info (mode_info);
}
@ -260,6 +267,22 @@ grub_video_map_rgba (grub_uint8_t red, grub_uint8_t green, grub_uint8_t blue,
return grub_video_adapter_active->map_rgba (red, green, blue, alpha);
}
/* Unmap video color back to RGBA components. */
grub_err_t
grub_video_unmap_color (grub_video_color_t color, grub_uint8_t *red,
grub_uint8_t *green, grub_uint8_t *blue,
grub_uint8_t *alpha)
{
if (! grub_video_adapter_active)
return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
return grub_video_adapter_active->unmap_color (color,
red,
green,
blue,
alpha);
}
/* Fill rectangle using specified color. */
grub_err_t
grub_video_fill_rect (grub_video_color_t color, int x, int y,
@ -366,6 +389,16 @@ grub_video_set_active_render_target (struct grub_video_render_target *target)
return grub_video_adapter_active->set_active_render_target (target);
}
/* Get active render target. */
grub_err_t
grub_video_get_active_render_target (struct grub_video_render_target **target)
{
if (! grub_video_adapter_active)
return grub_error (GRUB_ERR_BAD_DEVICE, "No video mode activated");
return grub_video_adapter_active->get_active_render_target (target);
}
/* Initialize Video API module. */
GRUB_MOD_INIT(video_video)
{