feat(obj style): remove obj->style_lista nd use array of lv_obj_style_t in lv_obj_t

This commit is contained in:
Gabor Kiss-Vamosi
2021-03-19 09:38:52 +01:00
parent d62c8b2114
commit a9e826d3c5
8 changed files with 111 additions and 118 deletions

View File

@@ -1087,11 +1087,11 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
if(cmp_res == _LV_STYLE_STATE_CMP_SAME) return; if(cmp_res == _LV_STYLE_STATE_CMP_SAME) return;
trans_set_t * ts = lv_mem_buf_get(sizeof(trans_set_t) * STYLE_TRANSITION_MAX); trans_set_t * ts = lv_mem_buf_get(sizeof(trans_set_t) * STYLE_TRANSITION_MAX);
lv_memset_00(ts, sizeof(sizeof(trans_set_t) * 64)); lv_memset_00(ts, sizeof(trans_set_t) * STYLE_TRANSITION_MAX);
uint32_t tsi = 0; uint32_t tsi = 0;
uint32_t i; uint32_t i;
for(i = 0; i < obj->style_list.style_cnt && tsi < STYLE_TRANSITION_MAX; i++) { for(i = 0; i < obj->style_cnt && tsi < STYLE_TRANSITION_MAX; i++) {
lv_obj_style_t * obj_style = &obj->style_list.styles[i]; lv_obj_style_t * obj_style = &obj->styles[i];
if(obj_style->state & (~new_state)) continue; /*Skip unrelated styles*/ if(obj_style->state & (~new_state)) continue; /*Skip unrelated styles*/
if(obj_style->is_trans) continue; if(obj_style->is_trans) continue;

View File

@@ -239,7 +239,7 @@ typedef struct _lv_obj_t{
const lv_obj_class_t * class_p; const lv_obj_class_t * class_p;
struct _lv_obj_t * parent; struct _lv_obj_t * parent;
lv_obj_spec_attr_t * spec_attr; lv_obj_spec_attr_t * spec_attr;
lv_obj_style_list_t style_list; lv_obj_style_t * styles;
lv_area_t coords; lv_area_t coords;
lv_coord_t x_set; lv_coord_t x_set;
lv_coord_t y_set; lv_coord_t y_set;
@@ -247,7 +247,9 @@ typedef struct _lv_obj_t{
lv_coord_t h_set; lv_coord_t h_set;
lv_obj_flag_t flags; lv_obj_flag_t flags;
lv_state_t state; lv_state_t state;
uint8_t layout_inv:1; uint8_t layout_inv :1;
uint8_t skip_trans :1;
uint8_t style_cnt :6;
}lv_obj_t; }lv_obj_t;

View File

@@ -83,27 +83,27 @@ void lv_obj_add_style(struct _lv_obj_t * obj, uint32_t part, uint32_t state, lv_
uint32_t i; uint32_t i;
/*Go after the transition and local styles*/ /*Go after the transition and local styles*/
for(i = 0; i < obj->style_list.style_cnt; i++) { for(i = 0; i < obj->style_cnt; i++) {
if(obj->style_list.styles[i].is_trans) continue; if(obj->styles[i].is_trans) continue;
if(obj->style_list.styles[i].is_local) continue; if(obj->styles[i].is_local) continue;
break; break;
} }
/*Now `i` is at the first normal style. Insert the new style before this*/ /*Now `i` is at the first normal style. Insert the new style before this*/
/*Allocate space for the new style and shift the rest of the style to the end*/ /*Allocate space for the new style and shift the rest of the style to the end*/
obj->style_list.style_cnt++; obj->style_cnt++;
obj->style_list.styles = lv_mem_realloc(obj->style_list.styles, obj->style_list.style_cnt * sizeof(lv_obj_style_t)); obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t));
uint32_t j; uint32_t j;
for(j = obj->style_list.style_cnt - 1; j > i ; j--) { for(j = obj->style_cnt - 1; j > i ; j--) {
obj->style_list.styles[j] = obj->style_list.styles[j - 1]; obj->styles[j] = obj->styles[j - 1];
} }
lv_memset_00(&obj->style_list.styles[i], sizeof(lv_obj_style_t)); lv_memset_00(&obj->styles[i], sizeof(lv_obj_style_t));
obj->style_list.styles[i].style = style; obj->styles[i].style = style;
obj->style_list.styles[i].part = part; obj->styles[i].part = part;
obj->style_list.styles[i].state = state; obj->styles[i].state = state;
lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL); lv_obj_refresh_style(obj, part, LV_STYLE_PROP_ALL);
} }
@@ -112,33 +112,33 @@ void lv_obj_remove_style(lv_obj_t * obj, uint32_t part, uint32_t state, lv_style
{ {
uint32_t i = 0; uint32_t i = 0;
bool deleted = false; bool deleted = false;
while(i < obj->style_list.style_cnt) { while(i < obj->style_cnt) {
if((state != LV_STATE_ANY && obj->style_list.styles[i].state != state) || if((state != LV_STATE_ANY && obj->styles[i].state != state) ||
(part != LV_PART_ANY && obj->style_list.styles[i].part != part) || (part != LV_PART_ANY && obj->styles[i].part != part) ||
(style != NULL && style != obj->style_list.styles[i].style)) (style != NULL && style != obj->styles[i].style))
{ {
i++; i++;
continue; continue;
} }
if(obj->style_list.styles[i].is_trans) { if(obj->styles[i].is_trans) {
trans_del(obj, part, LV_STYLE_PROP_ALL, NULL); trans_del(obj, part, LV_STYLE_PROP_ALL, NULL);
} }
if(obj->style_list.styles[i].is_local || obj->style_list.styles[i].is_trans) { if(obj->styles[i].is_local || obj->styles[i].is_trans) {
lv_style_reset(obj->style_list.styles[i].style); lv_style_reset(obj->styles[i].style);
lv_mem_free(obj->style_list.styles[i].style); lv_mem_free(obj->styles[i].style);
obj->style_list.styles[i].style = NULL; obj->styles[i].style = NULL;
} }
/*Shift the styles after `i` by one*/ /*Shift the styles after `i` by one*/
uint32_t j; uint32_t j;
for(j = i; j < (uint32_t)obj->style_list.style_cnt - 1 ; j++) { for(j = i; j < (uint32_t)obj->style_cnt - 1 ; j++) {
obj->style_list.styles[j] = obj->style_list.styles[j + 1]; obj->styles[j] = obj->styles[j + 1];
} }
obj->style_list.style_cnt--; obj->style_cnt--;
obj->style_list.styles = lv_mem_realloc(obj->style_list.styles, obj->style_list.style_cnt * sizeof(lv_obj_style_t)); obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t));
deleted = true; deleted = true;
/*The style from the current `i` index is removed, so `i` points to the next style. /*The style from the current `i` index is removed, so `i` points to the next style.
@@ -233,18 +233,18 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, uint32_t part, uint32_t stat
uint32_t i; uint32_t i;
/*Find the style*/ /*Find the style*/
for(i = 0; i < obj->style_list.style_cnt; i++) { for(i = 0; i < obj->style_cnt; i++) {
if(obj->style_list.styles[i].is_local && if(obj->styles[i].is_local &&
obj->style_list.styles[i].state == state && obj->styles[i].state == state &&
obj->style_list.styles[i].part == part) { obj->styles[i].part == part) {
break; break;
} }
} }
/*The style is not found*/ /*The style is not found*/
if(i == obj->style_list.style_cnt) return false; if(i == obj->style_cnt) return false;
return lv_style_remove_prop(obj->style_list.styles[i].style, prop); return lv_style_remove_prop(obj->styles[i].style, prop);
} }
void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, uint8_t part, lv_state_t prev_state, void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, uint8_t part, lv_state_t prev_state,
@@ -253,12 +253,12 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, uint8
trans_t * tr; trans_t * tr;
/*Get the previous and current values*/ /*Get the previous and current values*/
obj->style_list.skip_trans = 1; obj->skip_trans = 1;
obj->state = prev_state; obj->state = prev_state;
lv_style_value_t v1 = lv_obj_get_style_prop(obj, part, prop); lv_style_value_t v1 = lv_obj_get_style_prop(obj, part, prop);
obj->state = new_state; obj->state = new_state;
lv_style_value_t v2 = lv_obj_get_style_prop(obj, part, prop); lv_style_value_t v2 = lv_obj_get_style_prop(obj, part, prop);
obj->style_list.skip_trans = 0; obj->skip_trans = 0;
if(v1.ptr == v2.ptr && v1.num == v2.num && v1.color.full == v2.color.full) return; if(v1.ptr == v2.ptr && v1.num == v2.num && v1.color.full == v2.color.full) return;
obj->state = prev_state; obj->state = prev_state;
@@ -305,19 +305,18 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_style_prop_t prop, uint8
_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2) _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2)
{ {
lv_obj_style_list_t * list = &obj->style_list;
_lv_style_state_cmp_t res = _LV_STYLE_STATE_CMP_SAME; _lv_style_state_cmp_t res = _LV_STYLE_STATE_CMP_SAME;
/*Are there any new styles for the new state?*/ /*Are there any new styles for the new state?*/
uint32_t i; uint32_t i;
for(i = 0; i < list->style_cnt; i++) { for(i = 0; i < obj->style_cnt; i++) {
if(list->styles[i].is_trans) continue; if(obj->styles[i].is_trans) continue;
/*The style is valid for a stat but not the other*/ /*The style is valid for a stat but not the other*/
bool valid1 = list->styles[i].state & (~state1) ? false : true; bool valid1 = obj->styles[i].state & (~state1) ? false : true;
bool valid2 = list->styles[i].state & (~state2) ? false : true; bool valid2 = obj->styles[i].state & (~state2) ? false : true;
if(valid1 != valid2) { if(valid1 != valid2) {
lv_style_t * style = list->styles[i].style; lv_style_t * style = obj->styles[i].style;
lv_style_value_t v; lv_style_value_t v;
/*If there is layout difference on the main part, return immediately. There is no more serious difference*/ /*If there is layout difference on the main part, return immediately. There is no more serious difference*/
_lv_style_state_cmp_t res_tmp = res; _lv_style_state_cmp_t res_tmp = res;
@@ -329,7 +328,7 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta
else if(lv_style_get_prop(style, LV_STYLE_PAD_ROW, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT; else if(lv_style_get_prop(style, LV_STYLE_PAD_ROW, &v)) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
if(res_tmp == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) { if(res_tmp == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) {
if(list->styles[i].part == LV_PART_MAIN) return _LV_STYLE_STATE_CMP_DIFF_LAYOUT; if(obj->styles[i].part == LV_PART_MAIN) return _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
else { else {
res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
continue; continue;
@@ -406,32 +405,32 @@ void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay)
static lv_style_t * get_local_style(lv_obj_t * obj, uint32_t part, uint32_t state) static lv_style_t * get_local_style(lv_obj_t * obj, uint32_t part, uint32_t state)
{ {
uint32_t i; uint32_t i;
for(i = 0; i < obj->style_list.style_cnt; i++) { for(i = 0; i < obj->style_cnt; i++) {
if(obj->style_list.styles[i].is_local && if(obj->styles[i].is_local &&
obj->style_list.styles[i].part == part && obj->styles[i].part == part &&
obj->style_list.styles[i].state == state) obj->styles[i].state == state)
{ {
return obj->style_list.styles[i].style; return obj->styles[i].style;
} }
} }
obj->style_list.style_cnt++; obj->style_cnt++;
obj->style_list.styles = lv_mem_realloc(obj->style_list.styles, obj->style_list.style_cnt * sizeof(lv_obj_style_t)); obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t));
for(i = obj->style_list.style_cnt - 1; i > 0 ; i--) { for(i = obj->style_cnt - 1; i > 0 ; i--) {
/*Copy only normal styles (not local and transition). /*Copy only normal styles (not local and transition).
*The new local style will be added as the last local style*/ *The new local style will be added as the last local style*/
if(obj->style_list.styles[i - 1].is_local || obj->style_list.styles[i - 1].is_trans) break; if(obj->styles[i - 1].is_local || obj->styles[i - 1].is_trans) break;
obj->style_list.styles[i] = obj->style_list.styles[i - 1]; obj->styles[i] = obj->styles[i - 1];
} }
lv_memset_00(&obj->style_list.styles[i], sizeof(lv_obj_style_t)); lv_memset_00(&obj->styles[i], sizeof(lv_obj_style_t));
obj->style_list.styles[i].style = lv_mem_alloc(sizeof(lv_style_t)); obj->styles[i].style = lv_mem_alloc(sizeof(lv_style_t));
lv_style_init(obj->style_list.styles[i].style); lv_style_init(obj->styles[i].style);
obj->style_list.styles[i].is_local = 1; obj->styles[i].is_local = 1;
obj->style_list.styles[i].part = part; obj->styles[i].part = part;
obj->style_list.styles[i].state = state; obj->styles[i].state = state;
return obj->style_list.styles[i].style; return obj->styles[i].style;
} }
/** /**
@@ -445,26 +444,26 @@ static lv_style_t * get_local_style(lv_obj_t * obj, uint32_t part, uint32_t stat
static lv_obj_style_t * get_trans_style(lv_obj_t * obj, uint32_t part) static lv_obj_style_t * get_trans_style(lv_obj_t * obj, uint32_t part)
{ {
uint32_t i; uint32_t i;
for(i = 0; i < obj->style_list.style_cnt; i++) { for(i = 0; i < obj->style_cnt; i++) {
if(obj->style_list.styles[i].is_trans && obj->style_list.styles[i].part == part) break; if(obj->styles[i].is_trans && obj->styles[i].part == part) break;
} }
/*Already have a transition style for it*/ /*Already have a transition style for it*/
if(i != obj->style_list.style_cnt) return &obj->style_list.styles[i]; if(i != obj->style_cnt) return &obj->styles[i];
obj->style_list.style_cnt++; obj->style_cnt++;
obj->style_list.styles = lv_mem_realloc(obj->style_list.styles, obj->style_list.style_cnt * sizeof(lv_obj_style_t)); obj->styles = lv_mem_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t));
for(i = obj->style_list.style_cnt - 1; i > 0 ; i--) { for(i = obj->style_cnt - 1; i > 0 ; i--) {
obj->style_list.styles[i] = obj->style_list.styles[i - 1]; obj->styles[i] = obj->styles[i - 1];
} }
lv_memset_00(&obj->style_list.styles[0], sizeof(lv_obj_style_t)); lv_memset_00(&obj->styles[0], sizeof(lv_obj_style_t));
obj->style_list.styles[0].style = lv_mem_alloc(sizeof(lv_style_t)); obj->styles[0].style = lv_mem_alloc(sizeof(lv_style_t));
lv_style_init(obj->style_list.styles[0].style); lv_style_init(obj->styles[0].style);
obj->style_list.styles[0].is_trans = 1; obj->styles[0].is_trans = 1;
obj->style_list.styles[0].part = part; obj->styles[0].part = part;
return &obj->style_list.styles[0]; return &obj->styles[0];
} }
@@ -475,11 +474,11 @@ static bool get_prop_core(const lv_obj_t * obj, uint8_t part, lv_style_prop_t pr
lv_state_t state = obj->state; lv_state_t state = obj->state;
lv_state_t state_inv = ~state; lv_state_t state_inv = ~state;
lv_style_value_t value_tmp; lv_style_value_t value_tmp;
bool skip_trans = obj->style_list.skip_trans; bool skip_trans = obj->skip_trans;
uint32_t i; uint32_t i;
bool found; bool found;
for(i = 0; i < obj->style_list.style_cnt; i++) { for(i = 0; i < obj->style_cnt; i++) {
lv_obj_style_t * obj_style = &obj->style_list.styles[i]; lv_obj_style_t * obj_style = &obj->styles[i];
if(obj_style->is_trans == false) break; if(obj_style->is_trans == false) break;
if(skip_trans) continue; if(skip_trans) continue;
if(obj_style->part != part) continue; if(obj_style->part != part) continue;
@@ -491,8 +490,8 @@ static bool get_prop_core(const lv_obj_t * obj, uint8_t part, lv_style_prop_t pr
} }
} }
for(; i < obj->style_list.style_cnt; i++) { for(; i < obj->style_cnt; i++) {
lv_obj_style_t * obj_style = &obj->style_list.styles[i]; lv_obj_style_t * obj_style = &obj->styles[i];
if(obj_style->part != part) continue; if(obj_style->part != part) continue;
if((obj_style->style->has_group & group) == 0) continue; if((obj_style->style->has_group & group) == 0) continue;
@@ -538,16 +537,14 @@ static lv_style_value_t apply_color_filter(const lv_obj_t * obj, uint32_t part,
/** /**
* Refresh the style of all children of an object. (Called recursively) * Refresh the style of all children of an object. (Called recursively)
* @param style refresh objects only with this style_list. * @param style refresh objects only with this
* @param obj pointer to an object * @param obj pointer to an object
*/ */
static void report_style_change_core(void * style, lv_obj_t * obj) static void report_style_change_core(void * style, lv_obj_t * obj)
{ {
lv_obj_style_list_t * list = &obj->style_list;
uint32_t i; uint32_t i;
for(i = 0; i < list->style_cnt; i++) { for(i = 0; i < obj->style_cnt; i++) {
if(style == NULL || list->styles[i].style == style) { if(style == NULL || obj->styles[i].style == style) {
lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ALL); lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ALL);
break; break;
} }
@@ -601,9 +598,9 @@ static bool trans_del(lv_obj_t * obj, uint8_t part, lv_style_prop_t prop, trans_
/*Remove the transitioned property from trans. style /*Remove the transitioned property from trans. style
*to allow changing it by normal styles*/ *to allow changing it by normal styles*/
uint32_t i; uint32_t i;
for(i = 0; i < obj->style_list.style_cnt; i++) { for(i = 0; i < obj->style_cnt; i++) {
if(obj->style_list.styles[i].is_trans && (part == LV_PART_ANY || obj->style_list.styles[i].part == part)) { if(obj->styles[i].is_trans && (part == LV_PART_ANY || obj->styles[i].part == part)) {
lv_style_remove_prop(obj->style_list.styles[i].style, tr->prop); lv_style_remove_prop(obj->styles[i].style, tr->prop);
lv_anim_del(tr, NULL); lv_anim_del(tr, NULL);
_lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr); _lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
lv_mem_free(tr); lv_mem_free(tr);
@@ -620,11 +617,11 @@ static bool trans_del(lv_obj_t * obj, uint8_t part, lv_style_prop_t prop, trans_
static void trans_anim_cb(void * _tr, int32_t v) static void trans_anim_cb(void * _tr, int32_t v)
{ {
trans_t * tr = _tr; trans_t * tr = _tr;
lv_obj_style_list_t * list = &tr->obj->style_list; lv_obj_t * obj = tr->obj;
uint32_t i; uint32_t i;
for(i = 0; i < list->style_cnt; i++) { for(i = 0; i < obj->style_cnt; i++) {
if(list->styles[i].is_trans == 0 || list->styles[i].part != tr->part) continue; if(obj->styles[i].is_trans == 0 || obj->styles[i].part != tr->part) continue;
lv_style_value_t value_final; lv_style_value_t value_final;
switch (tr->prop) { switch (tr->prop) {
@@ -666,12 +663,12 @@ static void trans_anim_cb(void * _tr, int32_t v)
lv_style_value_t old_value; lv_style_value_t old_value;
bool refr = true; bool refr = true;
if(lv_style_get_prop(list->styles[i].style, tr->prop, &old_value)) { if(lv_style_get_prop(obj->styles[i].style, tr->prop, &old_value)) {
if(value_final.ptr == old_value.ptr && value_final.color.full == old_value.color.full && value_final.num == old_value.num) { if(value_final.ptr == old_value.ptr && value_final.color.full == old_value.color.full && value_final.num == old_value.num) {
refr = false; refr = false;
} }
} }
lv_style_set_prop(list->styles[i].style, tr->prop, value_final); lv_style_set_prop(obj->styles[i].style, tr->prop, value_final);
if (refr) lv_obj_refresh_style(tr->obj, tr->part, tr->prop); if (refr) lv_obj_refresh_style(tr->obj, tr->part, tr->prop);
break; break;
@@ -719,15 +716,15 @@ static void trans_anim_ready_cb(lv_anim_t * a)
if(!running) { if(!running) {
uint32_t i; uint32_t i;
for(i = 0; i < obj->style_list.style_cnt; i++) { for(i = 0; i < obj->style_cnt; i++) {
if(obj->style_list.styles[i].is_trans && obj->style_list.styles[i].part == tr->part) { if(obj->styles[i].is_trans && obj->styles[i].part == tr->part) {
_lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr); _lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
lv_mem_free(tr); lv_mem_free(tr);
lv_obj_style_t * obj_style = &obj->style_list.styles[i]; lv_obj_style_t * obj_style = &obj->styles[i];
lv_style_remove_prop(obj_style->style, prop); lv_style_remove_prop(obj_style->style, prop);
if(lv_style_is_empty(obj->style_list.styles[i].style)) { if(lv_style_is_empty(obj->styles[i].style)) {
lv_obj_remove_style(obj, obj_style->part, obj_style->state, obj_style->style); lv_obj_remove_style(obj, obj_style->part, obj_style->state, obj_style->style);
//trans_del(obj, obj_style->part, prop, NULL); //trans_del(obj, obj_style->part, prop, NULL);

View File

@@ -41,12 +41,6 @@ typedef struct {
uint8_t is_trans :1; uint8_t is_trans :1;
}lv_obj_style_t; }lv_obj_style_t;
typedef struct {
lv_obj_style_t * styles;
uint8_t style_cnt;
uint8_t skip_trans :1;
}lv_obj_style_list_t;
/********************** /**********************
* GLOBAL PROTOTYPES * GLOBAL PROTOTYPES
**********************/ **********************/

View File

@@ -646,7 +646,7 @@ static void draw_main(lv_obj_t * obj)
if(btnm->btn_cnt == 0) return; if(btnm->btn_cnt == 0) return;
const lv_area_t * clip_area = lv_event_get_param(); const lv_area_t * clip_area = lv_event_get_param();
obj->style_list.skip_trans = 1; obj->skip_trans = 1;
lv_area_t area_obj; lv_area_t area_obj;
lv_obj_get_coords(obj, &area_obj); lv_obj_get_coords(obj, &area_obj);
@@ -666,13 +666,13 @@ static void draw_main(lv_obj_t * obj)
lv_state_t state_ori = obj->state; lv_state_t state_ori = obj->state;
obj->state = LV_STATE_DEFAULT; obj->state = LV_STATE_DEFAULT;
obj->style_list.skip_trans = 1; obj->skip_trans = 1;
lv_draw_rect_dsc_init(&draw_rect_dsc_def); lv_draw_rect_dsc_init(&draw_rect_dsc_def);
lv_draw_label_dsc_init(&draw_label_dsc_def); lv_draw_label_dsc_init(&draw_label_dsc_def);
lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &draw_rect_dsc_def); lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &draw_rect_dsc_def);
lv_obj_init_draw_label_dsc(obj, LV_PART_ITEMS, &draw_label_dsc_def); lv_obj_init_draw_label_dsc(obj, LV_PART_ITEMS, &draw_label_dsc_def);
draw_label_dsc_act.flag |= recolor_flag; draw_label_dsc_act.flag |= recolor_flag;
obj->style_list.skip_trans = 0; obj->skip_trans = 0;
obj->state = state_ori; obj->state = state_ori;
lv_coord_t ptop = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); lv_coord_t ptop = lv_obj_get_style_pad_top(obj, LV_PART_MAIN);
@@ -726,14 +726,14 @@ static void draw_main(lv_obj_t * obj)
/*In other cases get the styles directly without caching them*/ /*In other cases get the styles directly without caching them*/
else { else {
obj->state = btn_state; obj->state = btn_state;
obj->style_list.skip_trans = 1; obj->skip_trans = 1;
lv_draw_rect_dsc_init(&draw_rect_dsc_act); lv_draw_rect_dsc_init(&draw_rect_dsc_act);
lv_draw_label_dsc_init(&draw_label_dsc_act); lv_draw_label_dsc_init(&draw_label_dsc_act);
lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &draw_rect_dsc_act); lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &draw_rect_dsc_act);
lv_obj_init_draw_label_dsc(obj, LV_PART_ITEMS, &draw_label_dsc_act); lv_obj_init_draw_label_dsc(obj, LV_PART_ITEMS, &draw_label_dsc_act);
draw_label_dsc_act.flag = recolor_flag; draw_label_dsc_act.flag = recolor_flag;
obj->state = state_ori; obj->state = state_ori;
obj->style_list.skip_trans = 0; obj->skip_trans = 0;
} }
dsc.draw_area = &btn_area; dsc.draw_area = &btn_area;
@@ -783,7 +783,7 @@ static void draw_main(lv_obj_t * obj)
lv_event_send(obj,LV_EVENT_DRAW_PART_END, &dsc); lv_event_send(obj,LV_EVENT_DRAW_PART_END, &dsc);
} }
obj->style_list.skip_trans = 0; obj->skip_trans = 0;
#if LV_USE_ARABIC_PERSIAN_CHARS #if LV_USE_ARABIC_PERSIAN_CHARS
lv_mem_buf_release(txt_ap); lv_mem_buf_release(txt_ap);
#endif #endif

View File

@@ -732,7 +732,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area)
lv_state_t state_ori = obj->state; lv_state_t state_ori = obj->state;
obj->state = LV_STATE_DEFAULT; obj->state = LV_STATE_DEFAULT;
obj->style_list.skip_trans = 1; obj->skip_trans = 1;
lv_draw_line_dsc_t line_dsc_default; lv_draw_line_dsc_t line_dsc_default;
lv_draw_line_dsc_init(&line_dsc_default); lv_draw_line_dsc_init(&line_dsc_default);
lv_obj_init_draw_line_dsc(obj, LV_PART_ITEMS, &line_dsc_default); lv_obj_init_draw_line_dsc(obj, LV_PART_ITEMS, &line_dsc_default);
@@ -747,7 +747,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area)
lv_coord_t point_size_pr = lv_obj_get_style_size(obj, LV_PART_ITEMS); lv_coord_t point_size_pr = lv_obj_get_style_size(obj, LV_PART_ITEMS);
obj->state = state_ori; obj->state = state_ori;
obj->style_list.skip_trans = 0; obj->skip_trans = 0;
lv_coord_t point_size_act; lv_coord_t point_size_act;

View File

@@ -874,7 +874,7 @@ static void draw_box(lv_obj_t * dropdown_obj, const lv_area_t * clip_area, uint1
if(state != list_obj->state) { if(state != list_obj->state) {
list_obj->state = state; list_obj->state = state;
list_obj->style_list.skip_trans = 1; list_obj->skip_trans = 1;
} }
/*Draw a rectangle under the selected item*/ /*Draw a rectangle under the selected item*/
@@ -899,7 +899,7 @@ static void draw_box(lv_obj_t * dropdown_obj, const lv_area_t * clip_area, uint1
lv_draw_rect(&rect_area, clip_area, &sel_rect); lv_draw_rect(&rect_area, clip_area, &sel_rect);
list_obj->state = state_ori; list_obj->state = state_ori;
list_obj->style_list.skip_trans = 0; list_obj->skip_trans = 0;
} }
static void draw_box_label(lv_obj_t * dropdown_obj, const lv_area_t * clip_area, uint16_t id, lv_state_t state) static void draw_box_label(lv_obj_t * dropdown_obj, const lv_area_t * clip_area, uint16_t id, lv_state_t state)
@@ -912,7 +912,7 @@ static void draw_box_label(lv_obj_t * dropdown_obj, const lv_area_t * clip_area,
if(state != list_obj->state) { if(state != list_obj->state) {
list_obj->state = state; list_obj->state = state;
list_obj->style_list.skip_trans = 1; list_obj->skip_trans = 1;
} }
lv_draw_label_dsc_t label_dsc; lv_draw_label_dsc_t label_dsc;
@@ -941,7 +941,7 @@ static void draw_box_label(lv_obj_t * dropdown_obj, const lv_area_t * clip_area,
lv_draw_label(&label->coords, &mask_sel, &label_dsc, lv_label_get_text(label), NULL); lv_draw_label(&label->coords, &mask_sel, &label_dsc, lv_label_get_text(label), NULL);
} }
list_obj->state = state_orig; list_obj->state = state_orig;
list_obj->style_list.skip_trans = 0; list_obj->skip_trans = 0;
} }
/** /**

View File

@@ -556,7 +556,7 @@ static void draw_main(lv_obj_t * obj)
lv_state_t state_ori = obj->state; lv_state_t state_ori = obj->state;
obj->state = LV_STATE_DEFAULT; obj->state = LV_STATE_DEFAULT;
obj->style_list.skip_trans = 1; obj->skip_trans = 1;
lv_draw_rect_dsc_t rect_dsc_def; lv_draw_rect_dsc_t rect_dsc_def;
lv_draw_rect_dsc_t rect_dsc_act; /*Passed to the event to modify it*/ lv_draw_rect_dsc_t rect_dsc_act; /*Passed to the event to modify it*/
lv_draw_rect_dsc_init(&rect_dsc_def); lv_draw_rect_dsc_init(&rect_dsc_def);
@@ -567,7 +567,7 @@ static void draw_main(lv_obj_t * obj)
lv_draw_label_dsc_init(&label_dsc_def); lv_draw_label_dsc_init(&label_dsc_def);
lv_obj_init_draw_label_dsc(obj, LV_PART_ITEMS, &label_dsc_def); lv_obj_init_draw_label_dsc(obj, LV_PART_ITEMS, &label_dsc_def);
obj->state = state_ori; obj->state = state_ori;
obj->style_list.skip_trans = 0; obj->skip_trans = 0;
uint16_t col; uint16_t col;
uint16_t row; uint16_t row;
@@ -664,13 +664,13 @@ static void draw_main(lv_obj_t * obj)
/*In other cases get the styles directly without caching them*/ /*In other cases get the styles directly without caching them*/
else { else {
obj->state = cell_state; obj->state = cell_state;
obj->style_list.skip_trans = 1; obj->skip_trans = 1;
lv_draw_rect_dsc_init(&rect_dsc_act); lv_draw_rect_dsc_init(&rect_dsc_act);
lv_draw_label_dsc_init(&label_dsc_act); lv_draw_label_dsc_init(&label_dsc_act);
lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &rect_dsc_act); lv_obj_init_draw_rect_dsc(obj, LV_PART_ITEMS, &rect_dsc_act);
lv_obj_init_draw_label_dsc(obj, LV_PART_ITEMS, &label_dsc_act); lv_obj_init_draw_label_dsc(obj, LV_PART_ITEMS, &label_dsc_act);
obj->state = state_ori; obj->state = state_ori;
obj->style_list.skip_trans = 0; obj->skip_trans = 0;
} }
dsc.draw_area = &cell_area_border; dsc.draw_area = &cell_area_border;