small optimization

Gains around 10% when building tabs
This commit is contained in:
Raphael Coeffic
2022-06-11 15:13:11 +02:00
committed by Raphael Coeffic
parent 7dc960a514
commit 70b8b3d186
2 changed files with 6 additions and 2 deletions
+3
View File
@@ -37,6 +37,7 @@ FormField::FormField(Window* parent, const rect_t& rect,
}
}
lv_obj_enable_style_refresh(false);
lv_style_init(&bg_style);
lv_style_set_bg_color(&bg_style, makeLvColor(COLOR_THEME_PRIMARY2));
lv_style_set_bg_opa(&bg_style, LV_OPA_COVER);
@@ -49,6 +50,8 @@ FormField::FormField(Window* parent, const rect_t& rect,
lv_style_init(&edit_style);
lv_style_set_bg_color(&edit_style, makeLvColor(COLOR_THEME_EDIT));
lv_obj_add_style(lvobj, &edit_style, LV_PART_MAIN | LV_STATE_EDITED);
lv_obj_enable_style_refresh(true);
lv_obj_refresh_style(lvobj, LV_PART_ANY, LV_STYLE_PROP_ANY);
}
#if defined(HARDWARE_KEYS)
+3 -2
View File
@@ -451,8 +451,9 @@ class Window
virtual void addChild(Window * window, bool front = false)
{
if (lv_obj_get_parent(window->lvobj) != nullptr) {
lv_obj_set_parent(window->lvobj, this->lvobj);
auto lv_parent = lv_obj_get_parent(window->lvobj);
if (lv_parent && (lv_parent != lvobj)) {
lv_obj_set_parent(window->lvobj, lvobj);
// not used anywhere!
if (front)
lv_obj_move_to_index(window->lvobj, 0);