From eae60b6a3d7672446e0a6bf468184d4f553e978e Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Sat, 21 Jan 2023 13:12:48 +0200 Subject: [PATCH] infineat: Remove batterystyle Setting local style is more efficient --- src/displayapp/screens/WatchFaceInfineat.cpp | 18 +++++++----------- src/displayapp/screens/WatchFaceInfineat.h | 2 -- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp index 7266b328..6291e24f 100644 --- a/src/displayapp/screens/WatchFaceInfineat.cpp +++ b/src/displayapp/screens/WatchFaceInfineat.cpp @@ -48,8 +48,6 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app, } // Side Cover - lineBattery = lv_line_create(lv_scr_act(), nullptr); - static constexpr lv_point_t linePoints[nLines][2] = {{{30, 25}, {68, -8}}, {{26, 167}, {43, 216}}, {{27, 40}, {27, 196}}, @@ -76,13 +74,13 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app, lv_img_set_src(logoPine, "F:/images/pine_small.bin"); lv_obj_set_pos(logoPine, 15, 106); - lv_style_init(&lineBatteryStyle); - lv_style_set_line_width(&lineBatteryStyle, LV_STATE_DEFAULT, 24); - lv_style_set_line_color(&lineBatteryStyle, - LV_STATE_DEFAULT, - lv_color_hex(infineatColors.orange[settingsController.GetInfineatColorIndex() * nLines + 4])); - lv_style_set_line_opa(&lineBatteryStyle, LV_STATE_DEFAULT, 190); - lv_obj_add_style(lineBattery, LV_LINE_PART_MAIN, &lineBatteryStyle); + lineBattery = lv_line_create(lv_scr_act(), nullptr); + lv_obj_set_style_local_line_width(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 24); + lv_obj_set_style_local_line_color(lineBattery, + LV_LINE_PART_MAIN, + LV_STATE_DEFAULT, + lv_color_hex(infineatColors.orange[settingsController.GetInfineatColorIndex() * nLines + 4])); + lv_obj_set_style_local_line_opa(lineBattery, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 190); lineBatteryPoints[0] = {27, 105}; lineBatteryPoints[1] = {27, 106}; lv_line_set_points(lineBattery, lineBatteryPoints, 2); @@ -241,8 +239,6 @@ WatchFaceInfineat::WatchFaceInfineat(DisplayApp* app, WatchFaceInfineat::~WatchFaceInfineat() { lv_task_del(taskRefresh); - lv_style_reset(&lineBatteryStyle); - if (font_bebas != nullptr) { lv_font_free(font_bebas); } diff --git a/src/displayapp/screens/WatchFaceInfineat.h b/src/displayapp/screens/WatchFaceInfineat.h index bf2d3cc4..dfa0b38b 100644 --- a/src/displayapp/screens/WatchFaceInfineat.h +++ b/src/displayapp/screens/WatchFaceInfineat.h @@ -63,8 +63,6 @@ namespace Pinetime { // Lines making up the side cover lv_obj_t* lineBattery; - lv_style_t lineBatteryStyle; - lv_point_t lineBatteryPoints[2]; lv_obj_t* logoPine;