aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao2017-08-30 17:23:34 -0500
committerTao Bao2017-08-30 17:32:41 -0500
commit79127102e40fde2669db7136f40f77ab6727c386 (patch)
tree6d9ce633308f73f16cfeca8ee9dc220ba20a86aa /wear_ui.cpp
parent11f68b6b691425eb001a073ff56d8b448a564d8a (diff)
downloadplatform-bootable-recovery-79127102e40fde2669db7136f40f77ab6727c386.tar.gz
platform-bootable-recovery-79127102e40fde2669db7136f40f77ab6727c386.tar.xz
platform-bootable-recovery-79127102e40fde2669db7136f40f77ab6727c386.zip
wear_ui: Remove backgroundIcon.
It's covered by the equivalent variable in ScreenRecoveryUI: GRSurface* error_icon; Also refactor WearRecoveryUI::draw_background_locked() to get it closer to ScreenRecoveryUI code. Test: Build a wearable target recovery; Run graphics test. Change-Id: I3a8d0e4dbf6fe170e4f3adde7eaf4a2043132a57
Diffstat (limited to 'wear_ui.cpp')
-rw-r--r--wear_ui.cpp40
1 files changed, 6 insertions, 34 deletions
diff --git a/wear_ui.cpp b/wear_ui.cpp
index 85c8f835..b9289d36 100644
--- a/wear_ui.cpp
+++ b/wear_ui.cpp
@@ -50,8 +50,6 @@ WearRecoveryUI::WearRecoveryUI()
50 loop_frames = 60; 50 loop_frames = 60;
51 51
52 touch_screen_allowed_ = true; 52 touch_screen_allowed_ = true;
53
54 for (size_t i = 0; i < 5; i++) backgroundIcon[i] = NULL;
55} 53}
56 54
57int WearRecoveryUI::GetProgressBaseline() const { 55int WearRecoveryUI::GetProgressBaseline() const {
@@ -67,24 +65,12 @@ void WearRecoveryUI::draw_background_locked() {
67 gr_fill(0, 0, gr_fb_width(), gr_fb_height()); 65 gr_fill(0, 0, gr_fb_width(), gr_fb_height());
68 66
69 if (currentIcon != NONE) { 67 if (currentIcon != NONE) {
70 GRSurface* surface; 68 GRSurface* frame = GetCurrentFrame();
71 if (currentIcon == INSTALLING_UPDATE || currentIcon == ERASING) { 69 int frame_width = gr_get_width(frame);
72 if (!intro_done) { 70 int frame_height = gr_get_height(frame);
73 surface = introFrames[current_frame]; 71 int frame_x = (gr_fb_width() - frame_width) / 2;
74 } else { 72 int frame_y = (gr_fb_height() - frame_height) / 2;
75 surface = loopFrames[current_frame]; 73 gr_blit(frame, 0, 0, frame_width, frame_height, frame_x, frame_y);
76 }
77 } else {
78 surface = backgroundIcon[currentIcon];
79 }
80
81 int width = gr_get_width(surface);
82 int height = gr_get_height(surface);
83
84 int x = (gr_fb_width() - width) / 2;
85 int y = (gr_fb_height() - height) / 2;
86
87 gr_blit(surface, 0, 0, width, height, x, y);
88 } 74 }
89} 75}
90 76
@@ -177,20 +163,6 @@ void WearRecoveryUI::update_progress_locked() {
177 gr_flip(); 163 gr_flip();
178} 164}
179 165
180bool WearRecoveryUI::Init(const std::string& locale) {
181 if (!ScreenRecoveryUI::Init(locale)) {
182 return false;
183 }
184
185 LoadBitmap("icon_error", &backgroundIcon[ERROR]);
186 backgroundIcon[NO_COMMAND] = backgroundIcon[ERROR];
187
188 // This leaves backgroundIcon[INSTALLING_UPDATE] and backgroundIcon[ERASING]
189 // as NULL which is fine since draw_background_locked() doesn't use them.
190
191 return true;
192}
193
194void WearRecoveryUI::SetStage(int current, int max) { 166void WearRecoveryUI::SetStage(int current, int max) {
195} 167}
196 168