diff options
author | Tao Bao | 2017-08-30 17:23:34 -0500 |
---|---|---|
committer | Tao Bao | 2017-08-30 17:32:41 -0500 |
commit | 79127102e40fde2669db7136f40f77ab6727c386 (patch) | |
tree | 6d9ce633308f73f16cfeca8ee9dc220ba20a86aa | |
parent | 11f68b6b691425eb001a073ff56d8b448a564d8a (diff) | |
download | platform-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
-rw-r--r-- | wear_ui.cpp | 40 | ||||
-rw-r--r-- | wear_ui.h | 8 |
2 files changed, 8 insertions, 40 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 | ||
57 | int WearRecoveryUI::GetProgressBaseline() const { | 55 | int 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 | ||
180 | bool 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 | |||
194 | void WearRecoveryUI::SetStage(int current, int max) { | 166 | void WearRecoveryUI::SetStage(int current, int max) { |
195 | } | 167 | } |
196 | 168 | ||
@@ -25,8 +25,6 @@ class WearRecoveryUI : public ScreenRecoveryUI { | |||
25 | public: | 25 | public: |
26 | WearRecoveryUI(); | 26 | WearRecoveryUI(); |
27 | 27 | ||
28 | bool Init(const std::string& locale) override; | ||
29 | |||
30 | void SetStage(int current, int max) override; | 28 | void SetStage(int current, int max) override; |
31 | 29 | ||
32 | // printing messages | 30 | // printing messages |
@@ -55,14 +53,12 @@ class WearRecoveryUI : public ScreenRecoveryUI { | |||
55 | void PrintV(const char*, bool, va_list) override; | 53 | void PrintV(const char*, bool, va_list) override; |
56 | 54 | ||
57 | private: | 55 | private: |
58 | GRSurface* backgroundIcon[5]; | ||
59 | |||
60 | int menu_start, menu_end; | ||
61 | |||
62 | void draw_background_locked() override; | 56 | void draw_background_locked() override; |
63 | void draw_screen_locked() override; | 57 | void draw_screen_locked() override; |
64 | 58 | ||
65 | void PutChar(char); | 59 | void PutChar(char); |
60 | |||
61 | int menu_start, menu_end; | ||
66 | }; | 62 | }; |
67 | 63 | ||
68 | #endif // RECOVERY_WEAR_UI_H | 64 | #endif // RECOVERY_WEAR_UI_H |