From: Robert Millan <rmh@aybabtu.com>
To: grub-devel@gnu.org
Subject: gfxterm / grub_virtual_screen_setcolorstate()
Date: Mon, 24 Dec 2007 02:35:30 +0100 [thread overview]
Message-ID: <20071224013530.GA22710@thorin> (raw)
In-Reply-To: <20071224012818.GA22510@thorin>
[-- Attachment #1: Type: text/plain, Size: 975 bytes --]
On Mon, Dec 24, 2007 at 02:28:18AM +0100, Robert Millan wrote:
>
> New patch. Corrects a minor mistake when filling the last colum in the
> menu. Also, it doesn't change the colors on gfxterm since some reasjustments
> were needed for that, and there's also a bug that makes it impossible to
> change colors on the fly with gfxterm/vbe (I'll write more on that later).
This patch (relative to previous one) basicaly makes it work with a big
ugly kludge (see "| 0xff000000" line). The problem seems to be that alpha
channel is set to 0 for all return values of grub_video_map_color() after
gfxterm initialization. I checked the few places in the code where those
variables are zeroed, but to no avail. I assume the problem is just they
haven't been initialised, but I just have no idea where they're supposed to.
Any clues?
--
Robert Millan
<GPLv2> I know my rights; I want my phone call!
<DRM> What use is a phone call, if you are unable to speak?
(as seen on /.)
[-- Attachment #2: gfxterm.diff --]
[-- Type: text/x-diff, Size: 4482 bytes --]
diff -ur grub2.color/term/gfxterm.c grub2.gfxterm/term/gfxterm.c
--- grub2.color/term/gfxterm.c 2007-12-24 02:21:30.000000000 +0100
+++ grub2.gfxterm/term/gfxterm.c 2007-12-24 02:07:31.000000000 +0100
@@ -38,10 +38,13 @@
#define DEFAULT_BORDER_WIDTH 10
-#define DEFAULT_FG_COLOR 0x0a
-#define DEFAULT_BG_COLOR 0x00
#define DEFAULT_CURSOR_COLOR 0x0f
+static grub_uint8_t grub_gfxterm_cur_color = 0x7;
+static grub_uint8_t grub_gfxterm_standard_color = 0x7;
+static grub_uint8_t grub_gfxterm_normal_color = 0x7;
+static grub_uint8_t grub_gfxterm_highlight_color = 0x70;
+
struct grub_dirty_region
{
int top_left_x;
@@ -90,8 +93,6 @@
int cursor_state;
/* Color settings. */
- grub_video_color_t fg_color_setting;
- grub_video_color_t bg_color_setting;
grub_video_color_t fg_color;
grub_video_color_t bg_color;
grub_video_color_t cursor_color;
@@ -175,10 +176,8 @@
we can only have those after mode is initialized. */
grub_video_set_active_render_target (text_layer);
- virtual_screen.fg_color_setting = grub_video_map_color (DEFAULT_FG_COLOR);
- virtual_screen.bg_color_setting = grub_video_map_color (DEFAULT_BG_COLOR);
- virtual_screen.fg_color = virtual_screen.fg_color_setting;
- virtual_screen.bg_color = virtual_screen.bg_color_setting;
+ virtual_screen.fg_color = grub_video_map_color (grub_gfxterm_cur_color & 0x0f);
+ virtual_screen.bg_color = grub_video_map_color (grub_gfxterm_cur_color >> 4);
virtual_screen.cursor_color = grub_video_map_color (DEFAULT_CURSOR_COLOR);
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
@@ -805,15 +804,12 @@
static void
grub_gfxterm_cls (void)
{
- grub_video_color_t color;
-
/* Clear virtual screen. */
grub_virtual_screen_cls ();
/* Clear text layer. */
grub_video_set_active_render_target (text_layer);
- color = virtual_screen.bg_color_setting;
- grub_video_fill_rect (color, 0, 0, mode_info.width, mode_info.height);
+ grub_video_fill_rect (virtual_screen.bg_color, 0, 0, mode_info.width, mode_info.height);
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
/* Mark virtual screen to be redrawn. */
@@ -823,20 +819,39 @@
static void
grub_virtual_screen_setcolorstate (grub_term_color_state state)
{
- switch (state)
- {
+ grub_video_color_t tmp;
+
+ switch (state) {
case GRUB_TERM_COLOR_STANDARD:
+ grub_gfxterm_cur_color = grub_gfxterm_standard_color;
+ break;
case GRUB_TERM_COLOR_NORMAL:
- virtual_screen.fg_color = virtual_screen.fg_color_setting;
- virtual_screen.bg_color = virtual_screen.bg_color_setting;
+ grub_gfxterm_cur_color = grub_gfxterm_normal_color;
break;
case GRUB_TERM_COLOR_HIGHLIGHT:
- virtual_screen.fg_color = virtual_screen.bg_color_setting;
- virtual_screen.bg_color = virtual_screen.fg_color_setting;
+ grub_gfxterm_cur_color = grub_gfxterm_highlight_color;
break;
default:
break;
- }
+ }
+
+ virtual_screen.fg_color = grub_video_map_color (grub_gfxterm_cur_color & 0x0f) | 0xff000000;
+ virtual_screen.bg_color = grub_video_map_color (grub_gfxterm_cur_color >> 4);
+}
+
+static void
+grub_virtual_screen_setcolor (grub_uint8_t normal_color,
+ grub_uint8_t highlight_color)
+{
+ grub_gfxterm_normal_color = normal_color;
+ grub_gfxterm_highlight_color = highlight_color;
+}
+
+static void
+grub_virtual_screen_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color)
+{
+ *normal_color = grub_gfxterm_normal_color;
+ *highlight_color = grub_gfxterm_highlight_color;
}
static void
@@ -874,6 +889,8 @@
.gotoxy = grub_gfxterm_gotoxy,
.cls = grub_gfxterm_cls,
.setcolorstate = grub_virtual_screen_setcolorstate,
+ .setcolor = grub_virtual_screen_setcolor,
+ .getcolor = grub_virtual_screen_getcolor,
.setcursor = grub_gfxterm_setcursor,
.refresh = grub_gfxterm_refresh,
.flags = 0,
diff -ur grub2.color/video/i386/pc/vbe.c grub2.gfxterm/video/i386/pc/vbe.c
--- grub2.color/video/i386/pc/vbe.c 2007-07-22 01:32:32.000000000 +0200
+++ grub2.gfxterm/video/i386/pc/vbe.c 2007-12-24 02:29:48.000000000 +0100
@@ -722,6 +722,8 @@
value |= blue << render_target->mode_info.blue_field_pos;
value |= alpha << render_target->mode_info.reserved_field_pos;
+ grub_printf ("alpha=%x, bits=%x\n", alpha, render_target->mode_info.reserved_field_pos);
+
return value;
}
next prev parent reply other threads:[~2007-12-24 1:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-12-23 21:09 [PATCH] colored menu Robert Millan
2007-12-24 1:28 ` Robert Millan
2007-12-24 1:35 ` Robert Millan [this message]
2007-12-29 23:50 ` gfxterm / grub_virtual_screen_setcolorstate() Vesa Jääskeläinen
2008-01-23 12:23 ` Marco Gerards
2008-01-23 13:07 ` Robert Millan
2007-12-24 19:46 ` [PATCH] colored menu Yoshinori K. Okuji
2007-12-25 9:26 ` Robert Millan
2007-12-25 10:27 ` Yoshinori K. Okuji
2007-12-25 11:16 ` Robert Millan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20071224013530.GA22710@thorin \
--to=rmh@aybabtu.com \
--cc=grub-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.