summaryrefslogtreecommitdiffstats
path: root/screen_ui.cpp
diff options
context:
space:
mode:
authorLuke Song <songwalker@google.com>2017-06-17 02:20:39 +0200
committerandroid-build-merger <android-build-merger@google.com>2017-06-17 02:20:39 +0200
commite003fbaa2e3bd0779d81488efa2b076112dc8d9f (patch)
tree107bcb564994dfcf8df5e9191740847df93ff731 /screen_ui.cpp
parentMerge "Add OWNERS in bootable/recovery" am: ffd8505f4d am: 9f20e861b6 (diff)
parentMerge "Introduce VR recovery ui" am: 5efe2bca22 (diff)
downloadandroid_bootable_recovery-e003fbaa2e3bd0779d81488efa2b076112dc8d9f.tar
android_bootable_recovery-e003fbaa2e3bd0779d81488efa2b076112dc8d9f.tar.gz
android_bootable_recovery-e003fbaa2e3bd0779d81488efa2b076112dc8d9f.tar.bz2
android_bootable_recovery-e003fbaa2e3bd0779d81488efa2b076112dc8d9f.tar.lz
android_bootable_recovery-e003fbaa2e3bd0779d81488efa2b076112dc8d9f.tar.xz
android_bootable_recovery-e003fbaa2e3bd0779d81488efa2b076112dc8d9f.tar.zst
android_bootable_recovery-e003fbaa2e3bd0779d81488efa2b076112dc8d9f.zip
Diffstat (limited to 'screen_ui.cpp')
-rw-r--r--screen_ui.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index bb2772dd8..61ef5911f 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -256,6 +256,10 @@ void ScreenRecoveryUI::DrawHorizontalRule(int* y) {
*y += 4;
}
+void ScreenRecoveryUI::DrawHighlightBar(int x, int y, int width, int height) const {
+ gr_fill(x, y, x + width, y + height);
+}
+
void ScreenRecoveryUI::DrawTextLine(int x, int* y, const char* line, bool bold) const {
gr_text(gr_sys_font(), x, *y, line, bold);
*y += char_height_ + 4;
@@ -310,15 +314,14 @@ void ScreenRecoveryUI::draw_screen_locked() {
if (i == menu_sel) {
// Draw the highlight bar.
SetColor(IsLongPress() ? MENU_SEL_BG_ACTIVE : MENU_SEL_BG);
- gr_fill(0, y - 2, gr_fb_width(), y + char_height_ + 2);
+ DrawHighlightBar(0, y - 2, gr_fb_width(), char_height_ + 4);
// Bold white text for the selected item.
SetColor(MENU_SEL_FG);
- gr_text(gr_sys_font(), 4, y, menu_[i], true);
+ DrawTextLine(TEXT_INDENT, &y, menu_[i], true);
SetColor(MENU);
} else {
- gr_text(gr_sys_font(), 4, y, menu_[i], false);
+ DrawTextLine(TEXT_INDENT, &y, menu_[i], false);
}
- y += char_height_ + 4;
}
DrawHorizontalRule(&y);
}
@@ -329,10 +332,11 @@ void ScreenRecoveryUI::draw_screen_locked() {
SetColor(LOG);
int row = (text_top_ + text_rows_ - 1) % text_rows_;
size_t count = 0;
- for (int ty = gr_fb_height() - char_height_;
+ for (int ty = gr_fb_height() - char_height_ - log_bottom_offset_;
ty >= y && count < text_rows_;
ty -= char_height_, ++count) {
- gr_text(gr_sys_font(), 0, ty, text_[row], false);
+ int temp_y = ty;
+ DrawTextLine(0, &temp_y, text_[row], false);
--row;
if (row < 0) row = text_rows_ - 1;
}
@@ -453,6 +457,7 @@ bool ScreenRecoveryUI::InitTextParams() {
gr_font_size(gr_sys_font(), &char_width_, &char_height_);
text_rows_ = gr_fb_height() / char_height_;
text_cols_ = gr_fb_width() / char_width_;
+ log_bottom_offset_ = 0;
return true;
}