aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuke Song2017-09-19 12:51:35 -0500
committerTao Bao2017-10-05 14:02:13 -0500
commit92eda4db6cf6aae9fb9954c2555742ad7d1cd96a (patch)
treeff3dae97202620c6a9a37f891b580ecf3fd6be7e /vr_ui.cpp
parent9baa19012a535fa158d00fe37f19b1fbae5381cf (diff)
downloadplatform-bootable-recovery-92eda4db6cf6aae9fb9954c2555742ad7d1cd96a.tar.gz
platform-bootable-recovery-92eda4db6cf6aae9fb9954c2555742ad7d1cd96a.tar.xz
platform-bootable-recovery-92eda4db6cf6aae9fb9954c2555742ad7d1cd96a.zip
vr_ui: drawing changes
Change drawing of horizontal bars. Implement image and background drawing. Bug: 65556996 Test: Viewed graphics test Change-Id: I68ddd997123607dbebf972af5a455ce8ef0c7075
Diffstat (limited to 'vr_ui.cpp')
-rw-r--r--vr_ui.cpp44
1 files changed, 37 insertions, 7 deletions
diff --git a/vr_ui.cpp b/vr_ui.cpp
index 12516726..07cc9da5 100644
--- a/vr_ui.cpp
+++ b/vr_ui.cpp
@@ -20,16 +20,46 @@
20 20
21VrRecoveryUI::VrRecoveryUI() : kStereoOffset(RECOVERY_UI_VR_STEREO_OFFSET) {} 21VrRecoveryUI::VrRecoveryUI() : kStereoOffset(RECOVERY_UI_VR_STEREO_OFFSET) {}
22 22
23bool VrRecoveryUI::InitTextParams() { 23int VrRecoveryUI::ScreenWidth() const {
24 if (!ScreenRecoveryUI::InitTextParams()) return false; 24 return gr_fb_width() / 2;
25 int mid_divide = gr_fb_width() / 2; 25}
26 text_cols_ = (mid_divide - kMarginWidth - kStereoOffset) / char_width_; 26
27 return true; 27int VrRecoveryUI::ScreenHeight() const {
28 return gr_fb_height();
29}
30
31void VrRecoveryUI::DrawSurface(GRSurface* surface, int sx, int sy, int w, int h, int dx,
32 int dy) const {
33 gr_blit(surface, sx, sy, w, h, dx + kStereoOffset, dy);
34 gr_blit(surface, sx, sy, w, h, dx - kStereoOffset + ScreenWidth(), dy);
35}
36
37void VrRecoveryUI::DrawTextIcon(int x, int y, GRSurface* surface) const {
38 gr_texticon(x + kStereoOffset, y, surface);
39 gr_texticon(x - kStereoOffset + ScreenWidth(), y, surface);
28} 40}
29 41
30int VrRecoveryUI::DrawTextLine(int x, int y, const char* line, bool bold) const { 42int VrRecoveryUI::DrawTextLine(int x, int y, const char* line, bool bold) const {
31 int mid_divide = gr_fb_width() / 2;
32 gr_text(gr_sys_font(), x + kStereoOffset, y, line, bold); 43 gr_text(gr_sys_font(), x + kStereoOffset, y, line, bold);
33 gr_text(gr_sys_font(), x - kStereoOffset + mid_divide, y, line, bold); 44 gr_text(gr_sys_font(), x - kStereoOffset + ScreenWidth(), y, line, bold);
34 return char_height_ + 4; 45 return char_height_ + 4;
35} 46}
47
48int VrRecoveryUI::DrawHorizontalRule(int y) const {
49 y += 4;
50 gr_fill(kMarginWidth + kStereoOffset, y, ScreenWidth() - kMarginWidth + kStereoOffset, y + 2);
51 gr_fill(ScreenWidth() + kMarginWidth - kStereoOffset, y,
52 gr_fb_width() - kMarginWidth - kStereoOffset, y + 2);
53 return y + 4;
54}
55
56void VrRecoveryUI::DrawHighlightBar(int x, int y, int width, int height) const {
57 gr_fill(kMarginWidth + kStereoOffset, y, ScreenWidth() - kMarginWidth + kStereoOffset, y + height);
58 gr_fill(ScreenWidth() + kMarginWidth - kStereoOffset, y,
59 gr_fb_width() - kMarginWidth - kStereoOffset, y + height);
60}
61
62void VrRecoveryUI::DrawFill(int x, int y, int w, int h) const {
63 gr_fill(x + kStereoOffset, y, w, h);
64 gr_fill(x - kStereoOffset + ScreenWidth(), y, w, h);
65}