aboutsummaryrefslogtreecommitdiffstats
path: root/screen_ui.cpp
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2015-03-24 15:21:48 -0700
committerElliott Hughes <enh@google.com>2015-03-24 15:21:48 -0700
commit01a4d08010d1c26cc2cb37ca62b624829a7e1506 (patch)
tree954ddbce66798d137c74bc773b56775900c43b11 /screen_ui.cpp
parent47733eafdc37203d59a8a0a17ccfb936d2920e31 (diff)
downloadbootable_recovery-01a4d08010d1c26cc2cb37ca62b624829a7e1506.tar.gz
bootable_recovery-01a4d08010d1c26cc2cb37ca62b624829a7e1506.tar.bz2
bootable_recovery-01a4d08010d1c26cc2cb37ca62b624829a7e1506.zip
Fix recovery image text rendering.
Previously most devices would lose the character before a line wrap. The log's text rendering was starting at offset 4 but none of the arithmetic was taking this into account. It just happened to work on the Nexus 9's 1536-pixel wide display (1536/18=85.3) but not on a device such as the Nexus 5 (1080/18=60). The only active part of this change is the change from 4 to 0 in the gr_text call. The rest is just a few bits of trivial cleanup while I was working out what was going on. Change-Id: I9279ae323c77bc8b6ea87dc0fe009aaaec6bfa0e
Diffstat (limited to 'screen_ui.cpp')
-rw-r--r--screen_ui.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/screen_ui.cpp b/screen_ui.cpp
index 5e3a24f..edc41ab 100644
--- a/screen_ui.cpp
+++ b/screen_ui.cpp
@@ -246,12 +246,11 @@ void ScreenRecoveryUI::draw_screen_locked()
// 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);
+ gr_text(0, ty, text[row], 0);
--row;
if (row < 0) row = text_rows-1;
}
@@ -480,8 +479,7 @@ void ScreenRecoveryUI::Print(const char *fmt, ...)
// This can get called before ui_init(), so be careful.
pthread_mutex_lock(&updateMutex);
if (text_rows > 0 && text_cols > 0) {
- char *ptr;
- for (ptr = buf; *ptr != '\0'; ++ptr) {
+ for (char* ptr = buf; *ptr != '\0'; ++ptr) {
if (*ptr == '\n' || text_col >= text_cols) {
text[text_row][text_col] = '\0';
text_col = 0;
@@ -521,10 +519,9 @@ void ScreenRecoveryUI::StartMenu(const char* const * headers, const char* const
}
int ScreenRecoveryUI::SelectMenu(int sel) {
- int old_sel;
pthread_mutex_lock(&updateMutex);
if (show_menu > 0) {
- old_sel = menu_sel;
+ int old_sel = menu_sel;
menu_sel = sel;
// Wrap at top and bottom.
@@ -539,7 +536,6 @@ int ScreenRecoveryUI::SelectMenu(int sel) {
}
void ScreenRecoveryUI::EndMenu() {
- int i;
pthread_mutex_lock(&updateMutex);
if (show_menu > 0 && text_rows > 0 && text_cols > 0) {
show_menu = 0;