small optimization
Gains around 10% when building tabs
This commit is contained in:
committed by
Raphael Coeffic
parent
7dc960a514
commit
70b8b3d186
+3
@@ -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_init(&bg_style);
|
||||||
lv_style_set_bg_color(&bg_style, makeLvColor(COLOR_THEME_PRIMARY2));
|
lv_style_set_bg_color(&bg_style, makeLvColor(COLOR_THEME_PRIMARY2));
|
||||||
lv_style_set_bg_opa(&bg_style, LV_OPA_COVER);
|
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_init(&edit_style);
|
||||||
lv_style_set_bg_color(&edit_style, makeLvColor(COLOR_THEME_EDIT));
|
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_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)
|
#if defined(HARDWARE_KEYS)
|
||||||
|
|||||||
+3
-2
@@ -451,8 +451,9 @@ class Window
|
|||||||
|
|
||||||
virtual void addChild(Window * window, bool front = false)
|
virtual void addChild(Window * window, bool front = false)
|
||||||
{
|
{
|
||||||
if (lv_obj_get_parent(window->lvobj) != nullptr) {
|
auto lv_parent = lv_obj_get_parent(window->lvobj);
|
||||||
lv_obj_set_parent(window->lvobj, this->lvobj);
|
if (lv_parent && (lv_parent != lvobj)) {
|
||||||
|
lv_obj_set_parent(window->lvobj, lvobj);
|
||||||
// not used anywhere!
|
// not used anywhere!
|
||||||
if (front)
|
if (front)
|
||||||
lv_obj_move_to_index(window->lvobj, 0);
|
lv_obj_move_to_index(window->lvobj, 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user