summaryrefslogtreecommitdiffstats
path: root/screen_ui.cpp
diff options
context:
space:
mode:
authorDoug Zongker <dougz@android.com>2013-03-07 00:01:11 +0100
committerDoug Zongker <dougz@android.com>2013-03-07 22:34:24 +0100
commit6fd59ac07d91eb373f4269a40e688aa82a6ccc6e (patch)
tree64807edcb65fd2abd80c19c79cad6986f99ca396 /screen_ui.cpp
parentrecovery: change font for menus to be an image (diff)
downloadandroid_bootable_recovery-6fd59ac07d91eb373f4269a40e688aa82a6ccc6e.tar
android_bootable_recovery-6fd59ac07d91eb373f4269a40e688aa82a6ccc6e.tar.gz
android_bootable_recovery-6fd59ac07d91eb373f4269a40e688aa82a6ccc6e.tar.bz2
android_bootable_recovery-6fd59ac07d91eb373f4269a40e688aa82a6ccc6e.tar.lz
android_bootable_recovery-6fd59ac07d91eb373f4269a40e688aa82a6ccc6e.tar.xz
android_bootable_recovery-6fd59ac07d91eb373f4269a40e688aa82a6ccc6e.tar.zst
android_bootable_recovery-6fd59ac07d91eb373f4269a40e688aa82a6ccc6e.zip
Diffstat (limited to '')
-rw-r--r--screen_ui.cpp48
1 files changed, 31 insertions, 17 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 12af082cc..222de00ee 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -192,11 +192,9 @@ void ScreenRecoveryUI::draw_progress_locked()
}
}
-void ScreenRecoveryUI::draw_text_line(int row, const char* t) {
- if (t[0] != '\0') {
- gr_text(0, (row+1)*char_height-1, t);
- }
-}
+#define C_HEADER 247,0,6
+#define C_MENU 0,106,157
+#define C_LOG 249,194,0
// Redraw everything on the screen. Does not flip pages.
// Should only be called with updateMutex locked.
@@ -209,30 +207,46 @@ void ScreenRecoveryUI::draw_screen_locked()
gr_color(0, 0, 0, 160);
gr_fill(0, 0, gr_fb_width(), gr_fb_height());
+ int y = 0;
int i = 0;
if (show_menu) {
- gr_color(64, 96, 255, 255);
- gr_fill(0, (menu_top+menu_sel) * char_height,
- gr_fb_width(), (menu_top+menu_sel+1)*char_height+1);
+ gr_color(C_HEADER, 255);
for (; i < menu_top + menu_items; ++i) {
+ if (i == menu_top) gr_color(C_MENU, 255);
+
if (i == menu_top + menu_sel) {
+ // draw the highlight bar
+ gr_fill(0, y-2, gr_fb_width(), y+char_height+2);
+ // white text of selected item
gr_color(255, 255, 255, 255);
- draw_text_line(i, menu[i]);
- gr_color(64, 96, 255, 255);
+ if (menu[i][0]) gr_text(4, y, menu[i], 1);
+ gr_color(C_MENU, 255);
} else {
- draw_text_line(i, menu[i]);
+ if (menu[i][0]) gr_text(4, y, menu[i], i < menu_top);
}
+ y += char_height+4;
}
- gr_fill(0, i*char_height+char_height/2-1,
- gr_fb_width(), i*char_height+char_height/2+1);
+ gr_color(C_MENU, 255);
+ y += 4;
+ gr_fill(0, y, gr_fb_width(), y+2);
+ y += 4;
++i;
}
- gr_color(255, 255, 0, 255);
-
- for (; i < text_rows; ++i) {
- draw_text_line(i, text[(i+text_top) % text_rows]);
+ gr_color(C_LOG, 255);
+
+ // display from the bottom up, until we hit the top of the
+ // screen, the bottom of the menu, or we've displayed the
+ // entire text buffer.
+ int ty;
+ int row = (text_top+text_rows-1) % text_rows;
+ for (int ty = gr_fb_height() - char_height, count = 0;
+ ty > y+2 && count < text_rows;
+ ty -= char_height, ++count) {
+ gr_text(4, ty, text[row], 0);
+ --row;
+ if (row < 0) row = text_rows-1;
}
}
}