From f84fbd01bf11c4ff167e8e64fdc3b8c174595dd7 Mon Sep 17 00:00:00 2001 From: Malte Langermann <54738901+gagarinlg@users.noreply.github.com> Date: Sun, 26 Mar 2023 10:16:28 +0200 Subject: [PATCH] chore(ui): improve static text and window base speed (#88) --- radio/src/thirdparty/libopenui/src/static.cpp | 7 +++++-- radio/src/thirdparty/libopenui/src/window.h | 7 ++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/radio/src/thirdparty/libopenui/src/static.cpp b/radio/src/thirdparty/libopenui/src/static.cpp index ddad3d980..da6bd8e99 100644 --- a/radio/src/thirdparty/libopenui/src/static.cpp +++ b/radio/src/thirdparty/libopenui/src/static.cpp @@ -25,8 +25,7 @@ StaticText::StaticText(Window* parent, const rect_t& rect, std::string txt, Window(parent, rect, windowFlags, textFlags, lv_label_create), text(std::move(txt)) { - lv_label_set_text(lvobj, text.c_str()); - lv_obj_set_height(lvobj, LV_SIZE_CONTENT); + lv_obj_enable_style_refresh(false); lv_obj_clear_flag(lvobj, LV_OBJ_FLAG_CLICK_FOCUSABLE); lv_obj_set_style_text_font(lvobj, getFont(textFlags), LV_PART_MAIN); @@ -43,6 +42,10 @@ StaticText::StaticText(Window* parent, const rect_t& rect, std::string txt, } lv_obj_set_style_grid_cell_x_align(lvobj, LV_GRID_ALIGN_STRETCH, 0); + lv_label_set_text(lvobj, text.c_str()); + lv_obj_set_height(lvobj, LV_SIZE_CONTENT); + lv_obj_enable_style_refresh(true); + lv_obj_refresh_style(lvobj, LV_PART_ANY, LV_STYLE_PROP_ANY); } #if defined(DEBUG_WINDOWS) diff --git a/radio/src/thirdparty/libopenui/src/window.h b/radio/src/thirdparty/libopenui/src/window.h index cf08e83e8..605d7d51d 100644 --- a/radio/src/thirdparty/libopenui/src/window.h +++ b/radio/src/thirdparty/libopenui/src/window.h @@ -119,17 +119,17 @@ class Window void setRect(rect_t value) { rect = value; + lv_obj_enable_style_refresh(false); lv_obj_set_pos(lvobj, rect.x, rect.y); lv_obj_set_width(lvobj, rect.w); + lv_obj_enable_style_refresh(true); lv_obj_set_height(lvobj, rect.h); - invalidate(); } void setWidth(coord_t value) { rect.w = value; lv_obj_set_width(lvobj, rect.w); - invalidate(); } void setWindowCentered() @@ -143,21 +143,18 @@ class Window { rect.h = value; if (lvobj != nullptr) lv_obj_set_height(lvobj, rect.h); - invalidate(); } void setLeft(coord_t x) { rect.x = x; lv_obj_set_pos(lvobj, rect.x, rect.y); - invalidate(); } void setTop(coord_t y) { rect.y = y; lv_obj_set_pos(lvobj, rect.x, rect.y); - invalidate(); } coord_t left() const