Author: Riku Isokoski <riksu9000@gmail.com>
infineat: Remove batterystyle Setting local style is more efficient
src/displayapp/screens/WatchFaceInfineat.cpp | 18 +++++++----------- src/displayapp/screens/WatchFaceInfineat.h | 2 --
diff --git a/src/displayapp/screens/WatchFaceInfineat.cpp b/src/displayapp/screens/WatchFaceInfineat.cpp index 7266b3285e001190e5778dde3fec457f186c5cf6..6291e24f36ab9ab5e66cc4ff2155895541385973 100644 --- a/src/displayapp/screens/WatchFaceInfineat.cpp +++ b/src/displayapp/screens/WatchFaceInfineat.cpp @@ -48,8 +48,6 @@ font_bebas = lv_font_load("F:/fonts/bebas.bin"); } // 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 @@ logoPine = lv_img_create(lv_scr_act(), nullptr); 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); @@ -240,8 +238,6 @@ } 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 bf2d3cc41e11b99ebf656b09c8caae0cdd2067bc..dfa0b38b97153e44c04f4af9d5f9f884493a494f 100644 --- a/src/displayapp/screens/WatchFaceInfineat.h +++ b/src/displayapp/screens/WatchFaceInfineat.h @@ -63,8 +63,6 @@ // Lines making up the side cover lv_obj_t* lineBattery; - lv_style_t lineBatteryStyle; - lv_point_t lineBatteryPoints[2]; lv_obj_t* logoPine;