From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1UQFHj-0002T9-V3 for mharc-grub-devel@gnu.org; Thu, 11 Apr 2013 07:03:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:55566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQFHf-0002Sy-KB for grub-devel@gnu.org; Thu, 11 Apr 2013 07:03:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UQFHe-0005m1-3M for grub-devel@gnu.org; Thu, 11 Apr 2013 07:03:15 -0400 Received: from collab.rosalab.ru ([217.199.216.181]:44318) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UQFHd-0005ll-M0 for grub-devel@gnu.org; Thu, 11 Apr 2013 07:03:14 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by collab.rosalab.ru (Postfix) with ESMTP id 09E9029C33D for ; Thu, 11 Apr 2013 15:03:13 +0400 (MSK) X-Virus-Scanned: amavisd-new at rosalab.ru Received: from collab.rosalab.ru ([127.0.0.1]) by localhost (collab.rosalab.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EIIfXIZRWLvy for ; Thu, 11 Apr 2013 15:03:07 +0400 (MSK) Received: from icedphoenix.localnet (unknown [10.168.1.56]) by collab.rosalab.ru (Postfix) with ESMTPSA id C983729C33C for ; Thu, 11 Apr 2013 15:03:07 +0400 (MSK) From: Vladimir Testov To: grub-devel@gnu.org Subject: [PATCH] [3/11] [gfxmenu/list] some code cleaning Date: Thu, 11 Apr 2013 15:03:07 +0400 Message-ID: <1996048.qASZFuLNxs@icedphoenix> User-Agent: KMail/4.9.5 (Linux/3.5.0-26-generic; KDE/4.9.5; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart7547541.uPQRTetmiI" Content-Transfer-Encoding: 7Bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 217.199.216.181 X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Apr 2013 11:03:18 -0000 This is a multi-part message in MIME format. --nextPart7547541.uPQRTetmiI Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" reduce number of calculations, make the code more clear -- With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru --nextPart7547541.uPQRTetmiI Content-Disposition: attachment; filename="grub-2.00-list-some-cleaning.patch" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="grub-2.00-list-some-cleaning.patch" diff -Naur grub-new3/grub-core/gfxmenu/gui_list.c grub-new4/grub-core/gfxmenu/gui_list.c --- grub-new3/grub-core/gfxmenu/gui_list.c 2013-03-26 17:12:24.522409216 +0400 +++ grub-new4/grub-core/gfxmenu/gui_list.c 2013-03-26 18:03:19.746373903 +0400 @@ -269,6 +269,19 @@ sviewport.width = cwidth + sel_leftpad - string_left_offset; sviewport.height = item_height; + grub_font_t font, item_font, selected_item_font; + grub_video_color_t color, item_color, selected_item_color; + item_font = self->item_font; + if (self->selected_item_font) + selected_item_font = self->selected_item_font; + else + selected_item_font = item_font; + item_color = grub_video_map_rgba_color (self->item_color); + if (self->selected_item_color_set) + selected_item_color = grub_video_map_rgba_color (self->selected_item_color); + else + selected_item_color = item_color; + for (visible_index = 0, menu_index = self->first_shown_index; visible_index < num_shown_items && menu_index < self->view->menu->size; visible_index++, menu_index++) @@ -280,6 +293,13 @@ { selbox->draw (selbox, 0, item_top - sel_toppad); + font = selected_item_font; + color = selected_item_color; + } + else + { + font = item_font; + color = item_color; } icon = get_item_icon (self, menu_index); @@ -291,20 +311,12 @@ const char *item_title = grub_menu_get_entry (self->view->menu, menu_index)->title; - grub_font_t font = - (is_selected && self->selected_item_font - ? self->selected_item_font - : self->item_font); - grub_video_rgba_color_t text_color = - ((is_selected && self->selected_item_color_set) - ? self->selected_item_color - : self->item_color); sviewport.y = item_top; if (self->list_version == 0) { grub_font_draw_string (item_title, font, - grub_video_map_rgba_color (text_color), + color, string_left_offset, (item_top + string_top_offset)); } @@ -313,7 +325,7 @@ grub_gui_set_viewport (&sviewport, &svpsave); grub_font_draw_string (item_title, font, - grub_video_map_rgba_color (text_color), + color, 0, string_top_offset); grub_gui_restore_viewport (&svpsave); --nextPart7547541.uPQRTetmiI--