infineat: Remove batterystyle

Setting local style is more efficient
This commit is contained in:
Riku Isokoski 2023-01-21 13:12:48 +02:00
parent a7a1dcbf23
commit eae60b6a3d
2 changed files with 7 additions and 13 deletions

View file

@ -48,8 +48,6 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app,
} }
// Side Cover // Side Cover
lineBattery = lv_line_create(lv_scr_act(), nullptr);
static constexpr lv_point_t linePoints[nLines][2] = {{{30, 25}, {68, -8}}, static constexpr lv_point_t linePoints[nLines][2] = {{{30, 25}, {68, -8}},
{{26, 167}, {43, 216}}, {{26, 167}, {43, 216}},
{{27, 40}, {27, 196}}, {{27, 40}, {27, 196}},
@ -76,13 +74,13 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app,
lv_img_set_src(logoPine, "F:/images/pine_small.bin"); lv_img_set_src(logoPine, "F:/images/pine_small.bin");
lv_obj_set_pos(logoPine, 15, 106); lv_obj_set_pos(logoPine, 15, 106);
lv_style_init(&lineBatteryStyle); lineBattery = lv_line_create(lv_scr_act(), nullptr);
lv_style_set_line_width(&lineBatteryStyle, LV_STATE_DEFAULT, 24); lv_obj_set_style_local_line_width(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 24);
lv_style_set_line_color(&lineBatteryStyle, lv_obj_set_style_local_line_color(lineBattery,
LV_STATE_DEFAULT, LV_LINE_PART_MAIN,
lv_color_hex(infineatColors.orange[settingsController.GetInfineatColorIndex() * nLines + 4])); LV_STATE_DEFAULT,
lv_style_set_line_opa(&lineBatteryStyle, LV_STATE_DEFAULT, 190); lv_color_hex(infineatColors.orange[settingsController.GetInfineatColorIndex() * nLines + 4]));
lv_obj_add_style(lineBattery, LV_LINE_PART_MAIN, &lineBatteryStyle); lv_obj_set_style_local_line_opa(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 190);
lineBatteryPoints[0] = {27, 105}; lineBatteryPoints[0] = {27, 105};
lineBatteryPoints[1] = {27, 106}; lineBatteryPoints[1] = {27, 106};
lv_line_set_points(lineBattery, lineBatteryPoints, 2); lv_line_set_points(lineBattery, lineBatteryPoints, 2);
@ -241,8 +239,6 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app,
WatchFaceInfineat::~WatchFaceInfineat() { WatchFaceInfineat::~WatchFaceInfineat() {
lv_task_del(taskRefresh); lv_task_del(taskRefresh);
lv_style_reset(&lineBatteryStyle);
if (font_bebas != nullptr) { if (font_bebas != nullptr) {
lv_font_free(font_bebas); lv_font_free(font_bebas);
} }

View file

@ -63,8 +63,6 @@ namespace Pinetime {
// Lines making up the side cover // Lines making up the side cover
lv_obj_t* lineBattery; lv_obj_t* lineBattery;
lv_style_t lineBatteryStyle;
lv_point_t lineBatteryPoints[2]; lv_point_t lineBatteryPoints[2];
lv_obj_t* logoPine; lv_obj_t* logoPine;