mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
optimize size of the style
This commit is contained in:
parent
093a6652cf
commit
aed63d9cbd
@ -134,7 +134,7 @@ void lv_obj_remove_style(lv_obj_t * obj, uint32_t part, uint32_t state, lv_style
|
||||
|
||||
/*Shift the styles after `i` by one*/
|
||||
uint32_t j;
|
||||
for(j = i; j > obj->style_list.style_cnt - 2 ; j--) {
|
||||
for(j = i; j < obj->style_list.style_cnt - 1 ; j++) {
|
||||
obj->style_list.styles[j] = obj->style_list.styles[j + 1];
|
||||
}
|
||||
|
||||
@ -416,6 +416,7 @@ lv_obj_style_t * _get_trans_style(lv_obj_t * obj, uint32_t part)
|
||||
_lv_memset_00(&obj->style_list.styles[0], sizeof(lv_obj_style_t));
|
||||
obj->style_list.styles[0].style = lv_mem_alloc(sizeof(lv_style_t));
|
||||
lv_style_init(obj->style_list.styles[0].style);
|
||||
obj->style_list.styles[0].style->dont_index = 1;
|
||||
obj->style_list.styles[0].is_trans = 1;
|
||||
obj->style_list.styles[0].part = part;
|
||||
return &obj->style_list.styles[0];
|
||||
@ -542,63 +543,63 @@ void _lv_obj_create_style_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)
|
||||
{
|
||||
return _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
lv_obj_style_list_t * list = &obj->style_list;
|
||||
_lv_style_state_cmp_t res = _LV_STYLE_STATE_CMP_SAME;
|
||||
|
||||
/*Are there any new styles for the new state?*/
|
||||
uint32_t i;
|
||||
for(i = 0; i < list->style_cnt; i++) {
|
||||
if(list->styles[i].is_trans) continue;
|
||||
|
||||
/*The style is valid for a stat but not the other*/
|
||||
bool valid1 = list->styles[i].state & (~state1) ? false : true;
|
||||
bool valid2 = list->styles[i].state & (~state2) ? false : true;
|
||||
if(valid1 != valid2) {
|
||||
lv_style_t * style = list->styles[i].style;
|
||||
|
||||
/*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;
|
||||
if(style->has_pad_bottom) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->has_pad_top) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->has_pad_left) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->has_pad_right) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->ext && style->ext->has_margin_bottom) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->ext && style->ext->has_margin_top) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->ext && style->ext->has_margin_left) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
else if(style->ext && style->ext->has_margin_right) 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;
|
||||
else {
|
||||
res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/*Check for draw pad changes*/
|
||||
if(style->ext && style->ext->has_transform_width) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_transform_height) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_transform_angle) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_transform_zoom) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_outline_opa) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_outline_pad) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_shadow_width) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_shadow_opa) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_shadow_ofs_x) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_shadow_ofs_y) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_shadow_spread) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_line_width) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_content_src) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_content_ofs_x) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_content_ofs_y) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else if(style->ext && style->ext->has_content_align) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
else {
|
||||
if(res != _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) res = _LV_STYLE_STATE_CMP_DIFF_REDRAW;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
// lv_obj_style_list_t * list = &obj->style_list;
|
||||
// _lv_style_state_cmp_t res = _LV_STYLE_STATE_CMP_SAME;
|
||||
//
|
||||
// /*Are there any new styles for the new state?*/
|
||||
// uint32_t i;
|
||||
// for(i = 0; i < list->style_cnt; i++) {
|
||||
// if(list->styles[i].is_trans) continue;
|
||||
//
|
||||
// /*The style is valid for a stat but not the other*/
|
||||
// bool valid1 = list->styles[i].state & (~state1) ? false : true;
|
||||
// bool valid2 = list->styles[i].state & (~state2) ? false : true;
|
||||
// if(valid1 != valid2) {
|
||||
// lv_style_t * style = list->styles[i].style;
|
||||
//
|
||||
// /*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;
|
||||
// if(style->has_pad_bottom) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
// else if(style->has_pad_top) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
// else if(style->has_pad_left) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
// else if(style->has_pad_right) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
// else if(style->ext && style->ext->has_margin_bottom) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
// else if(style->ext && style->ext->has_margin_top) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
// else if(style->ext && style->ext->has_margin_left) res_tmp = _LV_STYLE_STATE_CMP_DIFF_LAYOUT;
|
||||
// else if(style->ext && style->ext->has_margin_right) 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;
|
||||
// else {
|
||||
// res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /*Check for draw pad changes*/
|
||||
// if(style->ext && style->ext->has_transform_width) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_transform_height) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_transform_angle) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_transform_zoom) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_outline_opa) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_outline_pad) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_shadow_width) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_shadow_opa) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_shadow_ofs_x) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_shadow_ofs_y) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_shadow_spread) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_line_width) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_content_src) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_content_ofs_x) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_content_ofs_y) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else if(style->ext && style->ext->has_content_align) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD;
|
||||
// else {
|
||||
// if(res != _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) res = _LV_STYLE_STATE_CMP_DIFF_REDRAW;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return res;
|
||||
}
|
||||
|
||||
/**********************
|
||||
@ -770,6 +771,8 @@ static void trans_anim_start_cb(lv_anim_t * a)
|
||||
static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
{
|
||||
lv_style_trans_t * tr = a->var;
|
||||
lv_obj_t * obj = tr->obj;
|
||||
lv_style_prop_t prop = tr->prop;
|
||||
|
||||
/* Remove the transitioned property from trans. style
|
||||
* if there no more transitions for this property
|
||||
@ -785,15 +788,24 @@ static void trans_anim_ready_cb(lv_anim_t * a)
|
||||
|
||||
if(!running) {
|
||||
uint32_t i;
|
||||
for(i = 0; i < tr->obj->style_list.style_cnt; i++) {
|
||||
if(tr->obj->style_list.styles[i].is_trans && tr->obj->style_list.styles[i].part == tr->part) {
|
||||
lv_style_remove_prop(tr->obj->style_list.styles[i].style, tr->prop);
|
||||
for(i = 0; i < obj->style_list.style_cnt; i++) {
|
||||
if(obj->style_list.styles[i].is_trans && obj->style_list.styles[i].part == tr->part) {
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
lv_mem_free(tr);
|
||||
|
||||
lv_obj_style_t * obj_style = &obj->style_list.styles[i];
|
||||
lv_style_remove_prop(obj_style->style, prop);
|
||||
|
||||
if(lv_style_is_empty(obj->style_list.styles[i].style)) {
|
||||
lv_style_t * style = obj_style->style;
|
||||
lv_obj_remove_style(obj, obj_style->part, obj_style->state, obj_style->style);
|
||||
lv_style_reset(style);
|
||||
lv_mem_free(style);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_lv_ll_remove(&LV_GC_ROOT(_lv_obj_style_trans_ll), tr);
|
||||
lv_mem_free(tr);
|
||||
}
|
||||
|
||||
static void fade_anim_cb(lv_obj_t * obj, lv_anim_value_t v)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -177,9 +177,13 @@ struct _lv_style_transiton_t;
|
||||
typedef struct {
|
||||
lv_color_filter_cb_t color_filter_cb;
|
||||
const struct _lv_style_transiton_t * transition;
|
||||
const char * content_text;
|
||||
const char * content_src;
|
||||
const lv_font_t * text_font;
|
||||
|
||||
lv_color_t bg_color;
|
||||
lv_color_t bg_grad_color;
|
||||
lv_color_t border_color;
|
||||
lv_color_t text_color;
|
||||
lv_color_t outline_color;
|
||||
lv_color_t shadow_color;
|
||||
lv_color_t img_recolor;
|
||||
@ -187,110 +191,121 @@ typedef struct {
|
||||
|
||||
lv_opa_t opa;
|
||||
lv_opa_t color_filter_opa;
|
||||
lv_opa_t bg_opa;
|
||||
lv_opa_t bg_main_stop;
|
||||
lv_opa_t bg_grad_stop;
|
||||
lv_opa_t border_opa;
|
||||
lv_opa_t outline_opa;
|
||||
lv_opa_t img_opa;
|
||||
lv_opa_t img_recolor_opa;
|
||||
lv_opa_t text_opa;
|
||||
lv_opa_t shadow_opa;
|
||||
lv_opa_t line_opa;
|
||||
|
||||
int8_t transform_width;
|
||||
int8_t transform_height;
|
||||
int8_t transform_width;
|
||||
int8_t transform_height;
|
||||
int8_t pad_top;
|
||||
int8_t pad_bottom;
|
||||
int8_t pad_left;
|
||||
int8_t pad_right;
|
||||
int8_t margin_top;
|
||||
int8_t margin_bottom;
|
||||
int8_t margin_left;
|
||||
int8_t margin_right;
|
||||
int8_t outline_width;
|
||||
int8_t outline_pad;
|
||||
int8_t border_width;
|
||||
uint8_t outline_width;
|
||||
uint8_t outline_pad;
|
||||
int8_t shadow_width;
|
||||
int8_t shadow_ofs_x;
|
||||
int8_t shadow_ofs_y;
|
||||
int8_t shadow_spread;
|
||||
int8_t bg_main_stop;
|
||||
int8_t bg_grad_stop;
|
||||
int8_t text_letter_space;
|
||||
int8_t text_line_space;
|
||||
int8_t line_width;
|
||||
int8_t line_dash_width;
|
||||
int8_t line_dash_gap;
|
||||
uint8_t line_width;
|
||||
uint8_t line_dash_width;
|
||||
uint8_t line_dash_gap;
|
||||
int8_t content_ofs_x;
|
||||
int8_t content_ofs_y;
|
||||
|
||||
uint32_t clip_corner :1;
|
||||
uint32_t transform_zoom :14;
|
||||
uint32_t transform_angle :14;
|
||||
uint32_t bg_grad_dir :3;
|
||||
|
||||
uint32_t radius:12;
|
||||
uint32_t content_align :5;
|
||||
uint32_t border_side :5;
|
||||
uint32_t bg_blend_mode :2;
|
||||
uint32_t border_blend_mode :2;
|
||||
uint32_t outline_blend_mode :2;
|
||||
uint32_t shadow_blend_mode :2;
|
||||
uint32_t text_decor :2;
|
||||
|
||||
|
||||
uint32_t transform_zoom :14;
|
||||
uint32_t transform_angle :14;
|
||||
uint32_t text_blend_mode :2;
|
||||
uint32_t img_blend_mode :2;
|
||||
uint32_t line_blend_mode :2;
|
||||
uint32_t line_rounded:1;
|
||||
uint32_t content_align :5;
|
||||
uint32_t img_blend_mode :2;
|
||||
|
||||
uint32_t has_clip_corner :1;
|
||||
uint32_t has_transform_width :1;
|
||||
uint32_t has_transform_height :1;
|
||||
uint32_t has_transform_zoom :1;
|
||||
uint32_t has_transform_angle :1;
|
||||
uint32_t has_opa :1;
|
||||
uint32_t has_color_filter_cb :1;
|
||||
uint32_t has_color_filter_opa :1;
|
||||
|
||||
uint32_t has_margin_top :1;
|
||||
uint32_t has_margin_bottom :1;
|
||||
uint32_t has_margin_left :1;
|
||||
uint32_t has_margin_right :1;
|
||||
|
||||
uint32_t has_bg_grad_color :1;
|
||||
uint32_t has_bg_grad_dir :1;
|
||||
uint32_t has_bg_blend_mode :1;
|
||||
uint32_t has_bg_main_stop :1;
|
||||
uint32_t has_bg_grad_stop :1;
|
||||
uint32_t has_bg_img_src :1;
|
||||
uint32_t has_bg_img_mosaic :1;
|
||||
|
||||
uint32_t has_border_blend_mode :1;
|
||||
|
||||
uint32_t has_outline_width :1;
|
||||
uint32_t has_outline_color :1;
|
||||
uint32_t has_outline_opa :1;
|
||||
uint32_t has_outline_pad :1;
|
||||
uint32_t has_outline_blend_mode :1;
|
||||
|
||||
uint32_t has_shadow_width :1;
|
||||
uint32_t has_shadow_ofs_x :1;
|
||||
uint32_t has_shadow_ofs_y :1;
|
||||
uint32_t has_shadow_spread :1;
|
||||
uint32_t has_shadow_blend_mode :1;
|
||||
uint32_t has_shadow_color :1;
|
||||
uint32_t has_shadow_opa :1;
|
||||
|
||||
uint32_t has_text_letter_space :1;
|
||||
uint32_t has_text_line_space :1;
|
||||
uint32_t has_text_decor :1;
|
||||
uint32_t has_text_blend_mode :1;
|
||||
|
||||
uint32_t has_img_blend_mode :1;
|
||||
uint32_t has_img_recolor :1;
|
||||
uint32_t has_img_recolor_opa :1;
|
||||
|
||||
uint32_t has_line_width :1;
|
||||
uint32_t has_line_blend_mode :1;
|
||||
uint32_t has_line_dash_width :1;
|
||||
uint32_t has_line_dash_gap :1;
|
||||
uint32_t has_line_rounded :1;
|
||||
uint32_t has_line_color :1;
|
||||
uint32_t has_line_opa :1;
|
||||
|
||||
uint32_t has_content_src :1;
|
||||
uint32_t has_content_align :1;
|
||||
uint32_t has_content_ofs_x :1;
|
||||
uint32_t has_content_ofs_y :1;
|
||||
|
||||
uint32_t has_transition :1;
|
||||
struct{
|
||||
uint32_t color_filter_cb:1;
|
||||
uint32_t transition:1;
|
||||
uint32_t content_src:1;
|
||||
uint32_t bg_color:1;
|
||||
uint32_t bg_grad_color:1;
|
||||
uint32_t border_color:1;
|
||||
uint32_t text_color:1;
|
||||
uint32_t outline_color:1;
|
||||
uint32_t shadow_color:1;
|
||||
uint32_t img_recolor:1;
|
||||
uint32_t line_color:1;
|
||||
uint32_t opa:1;
|
||||
uint32_t color_filter_opa:1;
|
||||
uint32_t bg_opa:1;
|
||||
uint32_t bg_main_stop:1;
|
||||
uint32_t bg_grad_stop:1;
|
||||
uint32_t border_opa:1;
|
||||
uint32_t outline_opa:1;
|
||||
uint32_t img_opa:1;
|
||||
uint32_t img_recolor_opa:1;
|
||||
uint32_t text_font:1;
|
||||
uint32_t text_opa:1;
|
||||
uint32_t shadow_opa:1;
|
||||
uint32_t line_opa:1;
|
||||
uint32_t radius:1;
|
||||
uint32_t transform_width:1;
|
||||
uint32_t transform_height:1;
|
||||
uint32_t pad_top:1;
|
||||
uint32_t pad_bottom:1;
|
||||
uint32_t pad_left:1;
|
||||
uint32_t pad_right:1;
|
||||
uint32_t margin_top:1;
|
||||
uint32_t margin_bottom:1;
|
||||
uint32_t margin_left:1;
|
||||
uint32_t margin_right:1;
|
||||
uint32_t border_width:1;
|
||||
uint32_t outline_width:1;
|
||||
uint32_t outline_pad:1;
|
||||
uint32_t shadow_width:1;
|
||||
uint32_t shadow_ofs_x:1;
|
||||
uint32_t shadow_ofs_y:1;
|
||||
uint32_t shadow_spread:1;
|
||||
uint32_t text_letter_space:1;
|
||||
uint32_t text_line_space:1;
|
||||
uint32_t line_width:1;
|
||||
uint32_t line_dash_width:1;
|
||||
uint32_t line_dash_gap:1;
|
||||
uint32_t content_ofs_x:1;
|
||||
uint32_t content_ofs_y:1;
|
||||
uint32_t transform_zoom:1;
|
||||
uint32_t transform_angle:1;
|
||||
uint32_t bg_blend_mode:1;
|
||||
uint32_t border_blend_mode:1;
|
||||
uint32_t outline_blend_mode:1;
|
||||
uint32_t shadow_blend_mode:1;
|
||||
uint32_t text_decor:1;
|
||||
uint32_t text_blend_mode:1;
|
||||
uint32_t img_blend_mode:1;
|
||||
uint32_t line_blend_mode:1;
|
||||
uint32_t content_align:1;
|
||||
uint32_t border_side:1;
|
||||
}has;
|
||||
}lv_style_ext_t;
|
||||
|
||||
|
||||
@ -313,41 +328,61 @@ LV_CLASS_DECLARE_START(lv_style, lv_base);
|
||||
|
||||
#define _lv_style_data \
|
||||
_lv_base_data \
|
||||
_LV_STYLE_SENTINEL \
|
||||
lv_style_ext_t * ext; \
|
||||
const lv_font_t * text_font; \
|
||||
lv_opa_t bg_opa; \
|
||||
lv_opa_t border_opa; \
|
||||
lv_opa_t text_opa; \
|
||||
lv_opa_t img_opa; \
|
||||
int8_t pad_top; \
|
||||
int8_t pad_bottom; \
|
||||
int8_t pad_left; \
|
||||
int8_t pad_right; \
|
||||
lv_color_t bg_color; \
|
||||
lv_color_t border_color; \
|
||||
lv_color_t text_color; \
|
||||
uint32_t radius :16; \
|
||||
uint32_t border_width :8; \
|
||||
uint32_t border_side:4; \
|
||||
uint32_t border_post:1; \
|
||||
\
|
||||
uint16_t has_text_font :1; \
|
||||
uint16_t has_bg_opa :1; \
|
||||
uint16_t has_border_opa :1; \
|
||||
uint16_t has_text_opa :1; \
|
||||
uint16_t has_img_opa :1; \
|
||||
uint16_t has_pad_top :1; \
|
||||
uint16_t has_pad_bottom :1; \
|
||||
uint16_t has_pad_left :1; \
|
||||
uint16_t has_pad_right :1; \
|
||||
uint16_t has_bg_color :1; \
|
||||
uint16_t has_border_color :1; \
|
||||
uint16_t has_text_color :1; \
|
||||
uint16_t has_radius :1; \
|
||||
uint16_t has_border_width :1; \
|
||||
uint16_t has_border_side :1; \
|
||||
uint16_t has_border_post :1;
|
||||
_LV_STYLE_SENTINEL \
|
||||
/*32*/ \
|
||||
uint32_t radius :5; \
|
||||
uint32_t transform_width :5; \
|
||||
uint32_t transform_height :5; \
|
||||
uint32_t opa :5; \
|
||||
uint32_t color_filter_cb :4; \
|
||||
uint32_t transition :4; \
|
||||
uint32_t bg_color :4; \
|
||||
\
|
||||
uint32_t color_filter_opa :5; \
|
||||
uint32_t bg_opa :5; \
|
||||
uint32_t border_opa:5; \
|
||||
uint32_t img_opa:5; \
|
||||
uint32_t bg_grad_color :4; \
|
||||
uint32_t border_color:4; \
|
||||
uint32_t border_width:4; \
|
||||
\
|
||||
uint32_t pad_top:5; \
|
||||
uint32_t pad_bottom:5; \
|
||||
uint32_t pad_left:5; \
|
||||
uint32_t pad_right:5; \
|
||||
uint32_t text_color:4; \
|
||||
uint32_t text_font :4; \
|
||||
uint32_t line_color :4; \
|
||||
\
|
||||
uint32_t margin_top:5; \
|
||||
uint32_t margin_bottom:5; \
|
||||
uint32_t margin_left:5; \
|
||||
uint32_t margin_right:5; \
|
||||
uint32_t outline_color:4; \
|
||||
uint32_t shadow_color:4; \
|
||||
uint32_t line_rounded:1; \
|
||||
uint32_t border_post:1; \
|
||||
uint32_t clip_corner:1; \
|
||||
uint32_t has_line_rounded:1; \
|
||||
uint32_t has_clip_corner:1; \
|
||||
\
|
||||
uint32_t text_opa:5; \
|
||||
uint32_t line_width :5; \
|
||||
uint32_t line_opa :5; \
|
||||
uint32_t outline_width:5; \
|
||||
uint32_t outline_pad:5; \
|
||||
uint32_t outline_opa:5; \
|
||||
uint32_t bg_grad_dir:2; \
|
||||
\
|
||||
uint32_t shadow_width:5; \
|
||||
uint32_t shadow_ofs_y:5; \
|
||||
uint32_t shadow_ofs_x:5; \
|
||||
uint32_t shadow_spread:5; \
|
||||
uint32_t shadow_opa:4; \
|
||||
uint32_t has_bg_grad_dir:1; \
|
||||
uint32_t has_border_post:1; \
|
||||
uint32_t dont_index:1; \
|
||||
|
||||
#define _lv_style_class_dsc \
|
||||
_lv_base_class_dsc \
|
||||
@ -704,6 +739,8 @@ bool lv_debug_check_style(const lv_style_t * style);
|
||||
*/
|
||||
bool lv_debug_check_style_list(const void * list);
|
||||
|
||||
bool lv_style_is_empty(const lv_style_t * style);
|
||||
|
||||
/*************************
|
||||
* GLOBAL VARIABLES
|
||||
*************************/
|
||||
|
@ -230,7 +230,6 @@ static void basic_init(void)
|
||||
lv_style_set_border_width(&styles->card, BORDER_WIDTH);
|
||||
lv_style_set_border_post(&styles->card, true);
|
||||
lv_style_set_text_color(&styles->card, CARD_TEXT_COLOR);
|
||||
lv_style_set_img_recolor(&styles->card, CARD_TEXT_COLOR);
|
||||
lv_style_set_pad_all(&styles->card, PAD_DEF);
|
||||
|
||||
style_init_reset(&styles->focus_border);
|
||||
@ -255,7 +254,6 @@ static void basic_init(void)
|
||||
lv_style_set_border_color(&styles->btn, CARD_BORDER_COLOR);
|
||||
lv_style_set_border_width(&styles->btn, BORDER_WIDTH);
|
||||
lv_style_set_text_color(&styles->btn, CARD_TEXT_COLOR);
|
||||
lv_style_set_img_recolor(&styles->btn, CARD_TEXT_COLOR);
|
||||
lv_style_set_pad_hor(&styles->btn, LV_DPX(40));
|
||||
lv_style_set_pad_ver(&styles->btn, LV_DPX(15));
|
||||
|
||||
@ -264,7 +262,6 @@ static void basic_init(void)
|
||||
lv_style_set_border_width(&styles->btn_color, 0);
|
||||
lv_style_set_bg_color(&styles->btn_color, BTN_COLOR);
|
||||
lv_style_set_text_color(&styles->btn_color, LV_COLOR_WHITE);
|
||||
lv_style_set_img_recolor(&styles->btn_color, LV_COLOR_WHITE);
|
||||
|
||||
style_init_reset(&styles->btn_color_checked);
|
||||
lv_style_set_bg_color(&styles->btn_color_checked, BTN_CHK_PR_COLOR);
|
||||
@ -645,7 +642,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
||||
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->pressed);
|
||||
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->transition_normal);
|
||||
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_PRESSED, &styles->grow);
|
||||
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_BORN, &styles->grow);
|
||||
// lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_BORN, &styles->grow);
|
||||
lv_obj_add_style(obj, LV_PART_MAIN, LV_STATE_CHECKED, &styles->btn_color_checked);
|
||||
}
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user