From 41c461d1f676d7e63a9bc7bc3edc380550e417f3 Mon Sep 17 00:00:00 2001 From: Riku Isokoski Date: Wed, 18 May 2022 23:16:00 +0300 Subject: [PATCH] Move linePoints to a member variable --- src/displayapp/widgets/Counter.cpp | 7 ++++--- src/displayapp/widgets/Counter.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/displayapp/widgets/Counter.cpp b/src/displayapp/widgets/Counter.cpp index 08c48044..7c8bf7b1 100644 --- a/src/displayapp/widgets/Counter.cpp +++ b/src/displayapp/widgets/Counter.cpp @@ -89,17 +89,18 @@ void Counter::Create() { lv_label_set_text_static(downLabel, "-"); lv_obj_align(downLabel, nullptr, LV_ALIGN_CENTER, 0, 0); - static lv_point_t line_points[] = {{0, 0}, {width, 0}}; + linePoints[0] = {0, 0}; + linePoints[1] = {width, 0}; lv_obj_t* upperLine = lv_line_create(counterContainer, nullptr); - lv_line_set_points(upperLine, line_points, 2); + lv_line_set_points(upperLine, linePoints, 2); lv_obj_set_style_local_line_width(upperLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 1); lv_obj_set_style_local_line_color(upperLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); lv_obj_set_style_local_line_opa(upperLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20); lv_obj_align(upperLine, upBtn, LV_ALIGN_OUT_BOTTOM_MID, 0, 0); lv_obj_t* lowerLine = lv_line_create(counterContainer, nullptr); - lv_line_set_points(lowerLine, line_points, 2); + lv_line_set_points(lowerLine, linePoints, 2); lv_obj_set_style_local_line_width(lowerLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, 1); lv_obj_set_style_local_line_color(lowerLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_WHITE); lv_obj_set_style_local_line_opa(lowerLine, LV_LINE_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_20); diff --git a/src/displayapp/widgets/Counter.h b/src/displayapp/widgets/Counter.h index a25635e2..bc907c2a 100644 --- a/src/displayapp/widgets/Counter.h +++ b/src/displayapp/widgets/Counter.h @@ -30,6 +30,7 @@ namespace Pinetime { lv_obj_t* upBtn; lv_obj_t* downBtn; lv_obj_t* number; + lv_point_t linePoints[2]; int value = 0; int min; int max;