From 80cb93f8e1e2ecd64d9f9d51bf5cd119a528d62d Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Wed, 16 May 2018 23:19:22 +0200 Subject: [PATCH] don't invalidate hidden objects --- lv_core/lv_obj.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lv_core/lv_obj.c b/lv_core/lv_obj.c index a0bbbf9ae..806fb3003 100644 --- a/lv_core/lv_obj.c +++ b/lv_core/lv_obj.c @@ -343,11 +343,14 @@ void lv_obj_clean(lv_obj_t *obj) */ void lv_obj_invalidate(lv_obj_t * obj) { + if(lv_obj_get_hidden(obj)) return; + /*Invalidate the object only if it belongs to the 'act_scr'*/ lv_obj_t * obj_scr = lv_obj_get_screen(obj); if(obj_scr == lv_scr_act() || obj_scr == lv_layer_top() || - obj_scr == lv_layer_sys()) { + obj_scr == lv_layer_sys()) + { /*Truncate recursively to the parents*/ lv_area_t area_trunc; lv_obj_t * par = lv_obj_get_parent(obj); @@ -363,7 +366,8 @@ void lv_obj_invalidate(lv_obj_t * obj) /*Check through all parents*/ while(par != NULL) { union_ok = lv_area_union(&area_trunc, &area_trunc, &par->coords); - if(union_ok == false) break; /*If no common parts with parent break;*/ + if(union_ok == false) break; /*If no common parts with parent break;*/ + if(lv_obj_get_hidden(par)) return; /*If the parent is hidden then the child is hidden and won't be drawn*/ par = lv_obj_get_parent(par); } @@ -750,12 +754,15 @@ void lv_obj_report_style_mod(lv_style_t * style) */ void lv_obj_set_hidden(lv_obj_t * obj, bool en) { + if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */ + obj->hidden = en == false ? 0 : 1; - + + if(!obj->hidden) lv_obj_invalidate(obj); /*Invalidate when not hidden (hidden objects are ignored) */ + lv_obj_t * par = lv_obj_get_parent(obj); par->signal_func(par, LV_SIGNAL_CHILD_CHG, obj); - lv_obj_invalidate(obj); } /**