Loading charger/charger.c +17 −1 Original line number Diff line number Diff line Loading @@ -658,6 +658,20 @@ static void android_green(void) gr_color(0xa4, 0xc6, 0x39, 255); } static void draw_capacity(struct charger *charger) { char cap_str[64]; int x, y; int str_len_px; snprintf(cap_str, sizeof(cap_str), "%d%%", charger->batt_anim->capacity); str_len_px = gr_measure(cap_str); x = (gr_fb_width() - str_len_px) / 2; y = (gr_fb_height() + char_height) / 2; android_green(); gr_text(x, y, cap_str, 0); } /* returns the last y-offset of where the surface ends */ static int draw_surface_centered(struct charger *charger, gr_surface surface) { Loading Loading @@ -710,8 +724,10 @@ static void redraw_screen(struct charger *charger) /* try to display *something* */ if (batt_anim->capacity < 0 || batt_anim->num_frames == 0) draw_unknown(charger); else else { draw_battery(charger); draw_capacity(charger); } gr_flip(); } Loading Loading
charger/charger.c +17 −1 Original line number Diff line number Diff line Loading @@ -658,6 +658,20 @@ static void android_green(void) gr_color(0xa4, 0xc6, 0x39, 255); } static void draw_capacity(struct charger *charger) { char cap_str[64]; int x, y; int str_len_px; snprintf(cap_str, sizeof(cap_str), "%d%%", charger->batt_anim->capacity); str_len_px = gr_measure(cap_str); x = (gr_fb_width() - str_len_px) / 2; y = (gr_fb_height() + char_height) / 2; android_green(); gr_text(x, y, cap_str, 0); } /* returns the last y-offset of where the surface ends */ static int draw_surface_centered(struct charger *charger, gr_surface surface) { Loading Loading @@ -710,8 +724,10 @@ static void redraw_screen(struct charger *charger) /* try to display *something* */ if (batt_anim->capacity < 0 || batt_anim->num_frames == 0) draw_unknown(charger); else else { draw_battery(charger); draw_capacity(charger); } gr_flip(); } Loading