From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1J6cEN-0004Yb-Cd for mharc-grub-devel@gnu.org; Sun, 23 Dec 2007 20:35:47 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1J6cEK-0004YK-Kn for grub-devel@gnu.org; Sun, 23 Dec 2007 20:35:44 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1J6cEJ-0004Y0-4j for grub-devel@gnu.org; Sun, 23 Dec 2007 20:35:43 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1J6cEI-0004Xx-WC for grub-devel@gnu.org; Sun, 23 Dec 2007 20:35:43 -0500 Received: from aybabtu.com ([69.60.117.155]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1J6cEI-0006eF-IU for grub-devel@gnu.org; Sun, 23 Dec 2007 20:35:42 -0500 Received: from [192.168.10.6] (helo=thorin) by aybabtu.com with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1J6cEG-00036F-UU for grub-devel@gnu.org; Mon, 24 Dec 2007 02:35:41 +0100 Received: from rmh by thorin with local (Exim 4.63) (envelope-from ) id 1J6cE6-0005wo-OR for grub-devel@gnu.org; Mon, 24 Dec 2007 02:35:30 +0100 Date: Mon, 24 Dec 2007 02:35:30 +0100 From: Robert Millan To: grub-devel@gnu.org Message-ID: <20071224013530.GA22710@thorin> References: <20071223210936.GA27776@thorin> <20071224012818.GA22510@thorin> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="RnlQjJ0d97Da+TV1" Content-Disposition: inline In-Reply-To: <20071224012818.GA22510@thorin> Organization: free as in freedom X-Message-Flag: Worried about Outlook viruses? Switch to Thunderbird! www.mozilla.com/thunderbird X-Debbugs-No-Ack: true User-Agent: Mutt/1.5.13 (2006-08-11) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. Subject: gfxterm / grub_virtual_screen_setcolorstate() X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Dec 2007 01:35:44 -0000 --RnlQjJ0d97Da+TV1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 I know my rights; I want my phone call! What use is a phone call, if you are unable to speak? (as seen on /.) --RnlQjJ0d97Da+TV1 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="gfxterm.diff" 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; } --RnlQjJ0d97Da+TV1--