aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Song2017-06-23 16:33:46 -0500
committerTao Bao2017-06-23 18:51:00 -0500
commit9d4839c60fc51068ba8a389545b2751a7c5a14b0 (patch)
tree3388cd81f4ed24b2ea2d6908c5d853e1f773ce92 /vr_ui.cpp
parenteef231567cc9f8d8ce030c5975262872d031f7ca (diff)
downloadplatform-bootable-recovery-9d4839c60fc51068ba8a389545b2751a7c5a14b0.tar.gz
platform-bootable-recovery-9d4839c60fc51068ba8a389545b2751a7c5a14b0.tar.xz
platform-bootable-recovery-9d4839c60fc51068ba8a389545b2751a7c5a14b0.zip
Restructure vr_ui
Get rid of pixel offset variables, and use makefile variables in BoardConfigs. Bug: 37779982 Test: Verified vr ui has same behavior. Change-Id: Ifbf44e27d7101aedbe3c0e6db4b8181d56efadfd (cherry picked from commit 81a8e4cab2a20fd1b1a4716563d4d2586bd1e1de)
Diffstat (limited to 'vr_ui.cpp')
-rw-r--r--vr_ui.cpp31
1 files changed, 5 insertions, 26 deletions
diff --git a/vr_ui.cpp b/vr_ui.cpp
index b2c65e3a..8b8261e3 100644
--- a/vr_ui.cpp
+++ b/vr_ui.cpp
@@ -18,39 +18,18 @@
18 18
19#include <minui/minui.h> 19#include <minui/minui.h>
20 20
21VrRecoveryUI::VrRecoveryUI() : 21VrRecoveryUI::VrRecoveryUI() : kStereoOffset(RECOVERY_UI_VR_STEREO_OFFSET) {}
22 x_offset(400),
23 y_offset(400),
24 stereo_offset(100) {
25}
26 22
27bool VrRecoveryUI::InitTextParams() { 23bool VrRecoveryUI::InitTextParams() {
28 if (gr_init() < 0) { 24 if (!ScreenRecoveryUI::InitTextParams()) return false;
29 return false;
30 }
31
32 gr_font_size(gr_sys_font(), &char_width_, &char_height_);
33 int mid_divide = gr_fb_width() / 2; 25 int mid_divide = gr_fb_width() / 2;
34 text_rows_ = (gr_fb_height() - 2 * y_offset) / char_height_; 26 text_cols_ = (mid_divide - kMarginWidth - kStereoOffset) / char_width_;
35 text_cols_ = (mid_divide - x_offset - stereo_offset) / char_width_;
36 log_bottom_offset_ = gr_fb_height() - 2 * y_offset;
37 return true; 27 return true;
38} 28}
39 29
40void VrRecoveryUI::DrawHorizontalRule(int* y) {
41 SetColor(MENU);
42 *y += 4;
43 gr_fill(0, *y + y_offset, gr_fb_width(), *y + y_offset + 2);
44 *y += 4;
45}
46
47void VrRecoveryUI::DrawHighlightBar(int x, int y, int width, int height) const {
48 gr_fill(x, y + y_offset, x + width, y + y_offset + height);
49}
50
51void VrRecoveryUI::DrawTextLine(int x, int* y, const char* line, bool bold) const { 30void VrRecoveryUI::DrawTextLine(int x, int* y, const char* line, bool bold) const {
52 int mid_divide = gr_fb_width() / 2; 31 int mid_divide = gr_fb_width() / 2;
53 gr_text(gr_sys_font(), x + x_offset + stereo_offset, *y + y_offset, line, bold); 32 gr_text(gr_sys_font(), x + kStereoOffset, *y, line, bold);
54 gr_text(gr_sys_font(), x + x_offset - stereo_offset + mid_divide, *y + y_offset, line, bold); 33 gr_text(gr_sys_font(), x - kStereoOffset + mid_divide, *y, line, bold);
55 *y += char_height_ + 4; 34 *y += char_height_ + 4;
56} 35}