mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
run code formatter
This commit is contained in:
parent
e7364f321d
commit
037d3d9090
@ -1442,10 +1442,10 @@ void _lv_obj_disable_style_caching(lv_obj_t * obj, bool dis)
|
||||
list->ignore_cache = dis;
|
||||
}
|
||||
for(part = _LV_OBJ_PART_REAL_FIRST; part < 0xFF; part++) {
|
||||
lv_style_list_t * list = lv_obj_get_style_list(obj, part);
|
||||
if(list == NULL) break;
|
||||
list->ignore_cache = dis;
|
||||
}
|
||||
lv_style_list_t * list = lv_obj_get_style_list(obj, part);
|
||||
if(list == NULL) break;
|
||||
list->ignore_cache = dis;
|
||||
}
|
||||
}
|
||||
|
||||
/*-----------------
|
||||
@ -2512,61 +2512,61 @@ lv_style_int_t _lv_obj_get_style_int(const lv_obj_t * obj, uint8_t part, lv_styl
|
||||
while(parent) {
|
||||
lv_style_list_t * list = lv_obj_get_style_list(parent, part);
|
||||
if(!list->ignore_cache && list->style_cnt > 0) {
|
||||
if(!list->valid_cache) update_style_cache((lv_obj_t*)parent, part, prop & (~LV_STYLE_STATE_MASK));
|
||||
if(!list->valid_cache) update_style_cache((lv_obj_t *)parent, part, prop & (~LV_STYLE_STATE_MASK));
|
||||
|
||||
bool def = false;
|
||||
switch(prop & (~LV_STYLE_STATE_MASK)) {
|
||||
case LV_STYLE_BG_GRAD_DIR:
|
||||
if(list->bg_grad_dir_none) def = true;
|
||||
break;
|
||||
case LV_STYLE_CLIP_CORNER:
|
||||
if(list->clip_corner_off) def = true;
|
||||
break;
|
||||
case LV_STYLE_TEXT_LETTER_SPACE:
|
||||
case LV_STYLE_TEXT_LINE_SPACE:
|
||||
if(list->text_space_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_TRANSFORM_ANGLE:
|
||||
case LV_STYLE_TRANSFORM_WIDTH:
|
||||
case LV_STYLE_TRANSFORM_HEIGHT:
|
||||
case LV_STYLE_TRANSFORM_ZOOM:
|
||||
if(list->transform_all_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_BORDER_WIDTH:
|
||||
if(list->border_width_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_BORDER_SIDE:
|
||||
if(list->border_side_full) def = true;
|
||||
break;
|
||||
case LV_STYLE_BORDER_POST:
|
||||
if(list->border_post_off) def = true;
|
||||
break;
|
||||
case LV_STYLE_OUTLINE_WIDTH:
|
||||
if(list->outline_width_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_RADIUS:
|
||||
if(list->radius_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_SHADOW_WIDTH:
|
||||
if(list->shadow_width_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_PAD_TOP:
|
||||
case LV_STYLE_PAD_BOTTOM:
|
||||
case LV_STYLE_PAD_LEFT:
|
||||
case LV_STYLE_PAD_RIGHT:
|
||||
if(list->pad_all_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_BG_BLEND_MODE:
|
||||
case LV_STYLE_BORDER_BLEND_MODE:
|
||||
case LV_STYLE_IMAGE_BLEND_MODE:
|
||||
case LV_STYLE_LINE_BLEND_MODE:
|
||||
case LV_STYLE_OUTLINE_BLEND_MODE:
|
||||
case LV_STYLE_PATTERN_BLEND_MODE:
|
||||
case LV_STYLE_SHADOW_BLEND_MODE:
|
||||
case LV_STYLE_TEXT_BLEND_MODE:
|
||||
case LV_STYLE_VALUE_BLEND_MODE:
|
||||
if(list->blend_mode_all_normal) def = true;
|
||||
break;
|
||||
case LV_STYLE_BG_GRAD_DIR:
|
||||
if(list->bg_grad_dir_none) def = true;
|
||||
break;
|
||||
case LV_STYLE_CLIP_CORNER:
|
||||
if(list->clip_corner_off) def = true;
|
||||
break;
|
||||
case LV_STYLE_TEXT_LETTER_SPACE:
|
||||
case LV_STYLE_TEXT_LINE_SPACE:
|
||||
if(list->text_space_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_TRANSFORM_ANGLE:
|
||||
case LV_STYLE_TRANSFORM_WIDTH:
|
||||
case LV_STYLE_TRANSFORM_HEIGHT:
|
||||
case LV_STYLE_TRANSFORM_ZOOM:
|
||||
if(list->transform_all_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_BORDER_WIDTH:
|
||||
if(list->border_width_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_BORDER_SIDE:
|
||||
if(list->border_side_full) def = true;
|
||||
break;
|
||||
case LV_STYLE_BORDER_POST:
|
||||
if(list->border_post_off) def = true;
|
||||
break;
|
||||
case LV_STYLE_OUTLINE_WIDTH:
|
||||
if(list->outline_width_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_RADIUS:
|
||||
if(list->radius_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_SHADOW_WIDTH:
|
||||
if(list->shadow_width_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_PAD_TOP:
|
||||
case LV_STYLE_PAD_BOTTOM:
|
||||
case LV_STYLE_PAD_LEFT:
|
||||
case LV_STYLE_PAD_RIGHT:
|
||||
if(list->pad_all_zero) def = true;
|
||||
break;
|
||||
case LV_STYLE_BG_BLEND_MODE:
|
||||
case LV_STYLE_BORDER_BLEND_MODE:
|
||||
case LV_STYLE_IMAGE_BLEND_MODE:
|
||||
case LV_STYLE_LINE_BLEND_MODE:
|
||||
case LV_STYLE_OUTLINE_BLEND_MODE:
|
||||
case LV_STYLE_PATTERN_BLEND_MODE:
|
||||
case LV_STYLE_SHADOW_BLEND_MODE:
|
||||
case LV_STYLE_TEXT_BLEND_MODE:
|
||||
case LV_STYLE_VALUE_BLEND_MODE:
|
||||
if(list->blend_mode_all_normal) def = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(def) {
|
||||
@ -2694,19 +2694,19 @@ lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prop
|
||||
lv_style_list_t * list = lv_obj_get_style_list(parent, part);
|
||||
|
||||
if(!list->ignore_cache && list->style_cnt > 0) {
|
||||
if(!list->valid_cache) update_style_cache((lv_obj_t*)parent, part, prop & (~LV_STYLE_STATE_MASK));
|
||||
if(!list->valid_cache) update_style_cache((lv_obj_t *)parent, part, prop & (~LV_STYLE_STATE_MASK));
|
||||
bool def = false;
|
||||
switch(prop & (~LV_STYLE_STATE_MASK)) {
|
||||
case LV_STYLE_OPA_SCALE:
|
||||
if(list->opa_scale_cover) def = true;
|
||||
break;
|
||||
case LV_STYLE_BG_OPA:
|
||||
if(list->bg_opa_cover) return LV_OPA_COVER; /*Special case, not the default value is used*/
|
||||
if(list->bg_opa_transp) def = true;
|
||||
break;
|
||||
case LV_STYLE_IMAGE_RECOLOR_OPA:
|
||||
if(list->img_recolor_opa_transp) def = true;
|
||||
break;
|
||||
case LV_STYLE_OPA_SCALE:
|
||||
if(list->opa_scale_cover) def = true;
|
||||
break;
|
||||
case LV_STYLE_BG_OPA:
|
||||
if(list->bg_opa_cover) return LV_OPA_COVER; /*Special case, not the default value is used*/
|
||||
if(list->bg_opa_transp) def = true;
|
||||
break;
|
||||
case LV_STYLE_IMAGE_RECOLOR_OPA:
|
||||
if(list->img_recolor_opa_transp) def = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(def) {
|
||||
@ -2773,18 +2773,18 @@ const void * _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_
|
||||
lv_style_list_t * list = lv_obj_get_style_list(parent, part);
|
||||
|
||||
if(!list->ignore_cache && list->style_cnt > 0) {
|
||||
if(!list->valid_cache) update_style_cache((lv_obj_t*)parent, part, prop & (~LV_STYLE_STATE_MASK));
|
||||
if(!list->valid_cache) update_style_cache((lv_obj_t *)parent, part, prop & (~LV_STYLE_STATE_MASK));
|
||||
bool def = false;
|
||||
switch(prop & (~LV_STYLE_STATE_MASK)) {
|
||||
case LV_STYLE_VALUE_STR:
|
||||
if(list->value_txt_str) def = true;
|
||||
break;
|
||||
case LV_STYLE_PATTERN_IMAGE:
|
||||
if(list->pattern_img_null) def = true;
|
||||
break;
|
||||
case LV_STYLE_TEXT_FONT:
|
||||
if(list->text_font_normal) def = true;
|
||||
break;
|
||||
case LV_STYLE_VALUE_STR:
|
||||
if(list->value_txt_str) def = true;
|
||||
break;
|
||||
case LV_STYLE_PATTERN_IMAGE:
|
||||
if(list->pattern_img_null) def = true;
|
||||
break;
|
||||
case LV_STYLE_TEXT_FONT:
|
||||
if(list->text_font_normal) def = true;
|
||||
break;
|
||||
}
|
||||
|
||||
if(def) {
|
||||
@ -4472,44 +4472,44 @@ static bool style_prop_is_cacheble(lv_style_property_t prop)
|
||||
{
|
||||
|
||||
switch(prop) {
|
||||
case LV_STYLE_PROP_ALL:
|
||||
case LV_STYLE_BG_GRAD_DIR:
|
||||
case LV_STYLE_CLIP_CORNER:
|
||||
case LV_STYLE_TEXT_LETTER_SPACE:
|
||||
case LV_STYLE_TEXT_LINE_SPACE:
|
||||
case LV_STYLE_TEXT_FONT:
|
||||
case LV_STYLE_TRANSFORM_ANGLE:
|
||||
case LV_STYLE_TRANSFORM_WIDTH:
|
||||
case LV_STYLE_TRANSFORM_HEIGHT:
|
||||
case LV_STYLE_TRANSFORM_ZOOM:
|
||||
case LV_STYLE_BORDER_WIDTH:
|
||||
case LV_STYLE_OUTLINE_WIDTH:
|
||||
case LV_STYLE_RADIUS:
|
||||
case LV_STYLE_SHADOW_WIDTH:
|
||||
case LV_STYLE_OPA_SCALE:
|
||||
case LV_STYLE_BG_OPA:
|
||||
case LV_STYLE_BORDER_SIDE:
|
||||
case LV_STYLE_BORDER_POST:
|
||||
case LV_STYLE_IMAGE_RECOLOR_OPA:
|
||||
case LV_STYLE_VALUE_STR:
|
||||
case LV_STYLE_PATTERN_IMAGE:
|
||||
case LV_STYLE_PAD_TOP:
|
||||
case LV_STYLE_PAD_BOTTOM:
|
||||
case LV_STYLE_PAD_LEFT:
|
||||
case LV_STYLE_PAD_RIGHT:
|
||||
case LV_STYLE_BG_BLEND_MODE:
|
||||
case LV_STYLE_BORDER_BLEND_MODE:
|
||||
case LV_STYLE_IMAGE_BLEND_MODE:
|
||||
case LV_STYLE_LINE_BLEND_MODE:
|
||||
case LV_STYLE_OUTLINE_BLEND_MODE:
|
||||
case LV_STYLE_PATTERN_BLEND_MODE:
|
||||
case LV_STYLE_SHADOW_BLEND_MODE:
|
||||
case LV_STYLE_TEXT_BLEND_MODE:
|
||||
case LV_STYLE_VALUE_BLEND_MODE:
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
case LV_STYLE_PROP_ALL:
|
||||
case LV_STYLE_BG_GRAD_DIR:
|
||||
case LV_STYLE_CLIP_CORNER:
|
||||
case LV_STYLE_TEXT_LETTER_SPACE:
|
||||
case LV_STYLE_TEXT_LINE_SPACE:
|
||||
case LV_STYLE_TEXT_FONT:
|
||||
case LV_STYLE_TRANSFORM_ANGLE:
|
||||
case LV_STYLE_TRANSFORM_WIDTH:
|
||||
case LV_STYLE_TRANSFORM_HEIGHT:
|
||||
case LV_STYLE_TRANSFORM_ZOOM:
|
||||
case LV_STYLE_BORDER_WIDTH:
|
||||
case LV_STYLE_OUTLINE_WIDTH:
|
||||
case LV_STYLE_RADIUS:
|
||||
case LV_STYLE_SHADOW_WIDTH:
|
||||
case LV_STYLE_OPA_SCALE:
|
||||
case LV_STYLE_BG_OPA:
|
||||
case LV_STYLE_BORDER_SIDE:
|
||||
case LV_STYLE_BORDER_POST:
|
||||
case LV_STYLE_IMAGE_RECOLOR_OPA:
|
||||
case LV_STYLE_VALUE_STR:
|
||||
case LV_STYLE_PATTERN_IMAGE:
|
||||
case LV_STYLE_PAD_TOP:
|
||||
case LV_STYLE_PAD_BOTTOM:
|
||||
case LV_STYLE_PAD_LEFT:
|
||||
case LV_STYLE_PAD_RIGHT:
|
||||
case LV_STYLE_BG_BLEND_MODE:
|
||||
case LV_STYLE_BORDER_BLEND_MODE:
|
||||
case LV_STYLE_IMAGE_BLEND_MODE:
|
||||
case LV_STYLE_LINE_BLEND_MODE:
|
||||
case LV_STYLE_OUTLINE_BLEND_MODE:
|
||||
case LV_STYLE_PATTERN_BLEND_MODE:
|
||||
case LV_STYLE_SHADOW_BLEND_MODE:
|
||||
case LV_STYLE_TEXT_BLEND_MODE:
|
||||
case LV_STYLE_VALUE_BLEND_MODE:
|
||||
return true;
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -4564,32 +4564,29 @@ static void update_style_cache(lv_obj_t * obj, uint8_t part, uint16_t prop)
|
||||
if(lv_obj_get_style_transform_angle(obj, part) != 0 ||
|
||||
lv_obj_get_style_transform_width(obj, part) != 0 ||
|
||||
lv_obj_get_style_transform_height(obj, part) != 0 ||
|
||||
lv_obj_get_style_transform_zoom(obj, part) != LV_IMG_ZOOM_NONE)
|
||||
{
|
||||
lv_obj_get_style_transform_zoom(obj, part) != LV_IMG_ZOOM_NONE) {
|
||||
list->transform_all_zero = 0;
|
||||
}
|
||||
|
||||
list->pad_all_zero = 1;
|
||||
if(lv_obj_get_style_pad_top(obj, part) != 0 ||
|
||||
lv_obj_get_style_pad_bottom(obj, part) != 0 ||
|
||||
lv_obj_get_style_pad_left(obj, part) != 0 ||
|
||||
lv_obj_get_style_pad_right(obj, part) != 0)
|
||||
{
|
||||
lv_obj_get_style_pad_bottom(obj, part) != 0 ||
|
||||
lv_obj_get_style_pad_left(obj, part) != 0 ||
|
||||
lv_obj_get_style_pad_right(obj, part) != 0) {
|
||||
list->pad_all_zero = 0;
|
||||
}
|
||||
|
||||
list->blend_mode_all_normal = 1;
|
||||
#if LV_USE_BLEND_MODES
|
||||
if(lv_obj_get_style_bg_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_border_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_pattern_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_outline_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_value_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_text_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_line_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_image_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_shadow_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL)
|
||||
{
|
||||
lv_obj_get_style_border_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_pattern_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_outline_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_value_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_text_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_line_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_image_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL ||
|
||||
lv_obj_get_style_shadow_blend_mode(obj, part) != LV_BLEND_MODE_NORMAL) {
|
||||
list->blend_mode_all_normal = 0;
|
||||
}
|
||||
#endif
|
||||
@ -4619,7 +4616,7 @@ static void update_style_cache_children(lv_obj_t * obj)
|
||||
|
||||
list->text_space_zero = 1;
|
||||
if(lv_obj_get_style_text_letter_space(obj, part) != 0 ||
|
||||
lv_obj_get_style_text_line_space(obj, part) != 0) {
|
||||
lv_obj_get_style_text_line_space(obj, part) != 0) {
|
||||
list->text_space_zero = 0;
|
||||
}
|
||||
|
||||
@ -4647,7 +4644,8 @@ static void invalidate_style_cache(lv_obj_t * obj, uint8_t part, lv_style_proper
|
||||
lv_style_list_t * list = lv_obj_get_style_list(obj, part);
|
||||
if(list == NULL) return;
|
||||
list->valid_cache = 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
|
||||
for(part = 0; part < _LV_OBJ_PART_REAL_FIRST; part++) {
|
||||
lv_style_list_t * list = lv_obj_get_style_list(obj, part);
|
||||
@ -4655,10 +4653,10 @@ static void invalidate_style_cache(lv_obj_t * obj, uint8_t part, lv_style_proper
|
||||
list->valid_cache = 0;
|
||||
}
|
||||
for(part = _LV_OBJ_PART_REAL_FIRST; part < 0xFF; part++) {
|
||||
lv_style_list_t * list = lv_obj_get_style_list(obj, part);
|
||||
if(list == NULL) break;
|
||||
list->valid_cache = 0;
|
||||
}
|
||||
lv_style_list_t * list = lv_obj_get_style_list(obj, part);
|
||||
if(list == NULL) break;
|
||||
list->valid_cache = 0;
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_t * child = lv_obj_get_child(obj, NULL);
|
||||
|
@ -221,37 +221,37 @@ typedef struct {
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
uint32_t sentinel;
|
||||
#endif
|
||||
uint32_t style_cnt :6;
|
||||
uint32_t has_local :1;
|
||||
uint32_t has_trans :1;
|
||||
uint32_t skip_trans :1; /*1: Temporally skip the transition style if any*/
|
||||
uint32_t ignore_trans :1; /*1: Mark that this style list shouldn't receive transitions at all*/
|
||||
uint32_t valid_cache :1; /*1: The cache is valid and can be used*/
|
||||
uint32_t ignore_cache :1; /*1: Ignore cache while getting value of properties*/
|
||||
uint32_t style_cnt : 6;
|
||||
uint32_t has_local : 1;
|
||||
uint32_t has_trans : 1;
|
||||
uint32_t skip_trans : 1; /*1: Temporally skip the transition style if any*/
|
||||
uint32_t ignore_trans : 1; /*1: Mark that this style list shouldn't receive transitions at all*/
|
||||
uint32_t valid_cache : 1; /*1: The cache is valid and can be used*/
|
||||
uint32_t ignore_cache : 1; /*1: Ignore cache while getting value of properties*/
|
||||
|
||||
uint32_t radius_zero :1;
|
||||
uint32_t opa_scale_cover :1;
|
||||
uint32_t clip_corner_off :1;
|
||||
uint32_t transform_all_zero :1;
|
||||
uint32_t pad_all_zero :1;
|
||||
uint32_t blend_mode_all_normal :1;
|
||||
uint32_t bg_opa_transp :1;
|
||||
uint32_t bg_opa_cover :1;
|
||||
uint32_t bg_grad_dir_none :1;
|
||||
uint32_t radius_zero : 1;
|
||||
uint32_t opa_scale_cover : 1;
|
||||
uint32_t clip_corner_off : 1;
|
||||
uint32_t transform_all_zero : 1;
|
||||
uint32_t pad_all_zero : 1;
|
||||
uint32_t blend_mode_all_normal : 1;
|
||||
uint32_t bg_opa_transp : 1;
|
||||
uint32_t bg_opa_cover : 1;
|
||||
uint32_t bg_grad_dir_none : 1;
|
||||
|
||||
uint32_t border_width_zero :1;
|
||||
uint32_t border_side_full :1;
|
||||
uint32_t border_post_off :1;
|
||||
uint32_t border_width_zero : 1;
|
||||
uint32_t border_side_full : 1;
|
||||
uint32_t border_post_off : 1;
|
||||
|
||||
uint32_t outline_width_zero :1;
|
||||
uint32_t pattern_img_null :1;
|
||||
uint32_t shadow_width_zero :1;
|
||||
uint32_t value_txt_str :1;
|
||||
uint32_t img_recolor_opa_transp :1;
|
||||
uint32_t outline_width_zero : 1;
|
||||
uint32_t pattern_img_null : 1;
|
||||
uint32_t shadow_width_zero : 1;
|
||||
uint32_t value_txt_str : 1;
|
||||
uint32_t img_recolor_opa_transp : 1;
|
||||
|
||||
uint32_t text_space_zero :1;
|
||||
uint32_t text_decor_none :1;
|
||||
uint32_t text_font_normal :1;
|
||||
uint32_t text_space_zero : 1;
|
||||
uint32_t text_decor_none : 1;
|
||||
uint32_t text_font_normal : 1;
|
||||
} lv_style_list_t;
|
||||
|
||||
/**********************
|
||||
|
@ -41,7 +41,7 @@ typedef struct {
|
||||
lv_style_int_t border_side;
|
||||
lv_opa_t border_opa;
|
||||
lv_blend_mode_t border_blend_mode;
|
||||
uint8_t border_post :1; /*There is a border it will be drawn later. */
|
||||
uint8_t border_post : 1; /*There is a border it will be drawn later. */
|
||||
|
||||
/*Outline*/
|
||||
lv_color_t outline_color;
|
||||
|
@ -102,7 +102,7 @@ lv_font_t * lv_font_load(const char * font_name)
|
||||
|
||||
if(!success) {
|
||||
LV_LOG_WARN("Error loading font file: %s\n", font_name);
|
||||
/*
|
||||
/*
|
||||
* When `lvgl_load_font` fails it can leak some pointers.
|
||||
* All non-null pointers can be assumed as allocated and
|
||||
* `lv_font_free` should free them correctly.
|
||||
|
@ -165,11 +165,13 @@ void lv_arc_set_start_angle(lv_obj_t * arc, uint16_t start)
|
||||
}
|
||||
/*Only a smaller incremental move*/
|
||||
else if(ext->arc_angle_start > ext->arc_angle_end && start > ext->arc_angle_end) {
|
||||
inv_arc_area(arc, LV_MATH_MIN(ext->arc_angle_start, start), LV_MATH_MAX(ext->arc_angle_start, start), LV_ARC_PART_INDIC);
|
||||
inv_arc_area(arc, LV_MATH_MIN(ext->arc_angle_start, start), LV_MATH_MAX(ext->arc_angle_start, start),
|
||||
LV_ARC_PART_INDIC);
|
||||
}
|
||||
/*Only a smaller incremental move*/
|
||||
else if(ext->arc_angle_start < ext->arc_angle_end && start < ext->arc_angle_end) {
|
||||
inv_arc_area(arc, LV_MATH_MIN(ext->arc_angle_start, start), LV_MATH_MAX(ext->arc_angle_start, start), LV_ARC_PART_INDIC);
|
||||
inv_arc_area(arc, LV_MATH_MIN(ext->arc_angle_start, start), LV_MATH_MAX(ext->arc_angle_start, start),
|
||||
LV_ARC_PART_INDIC);
|
||||
}
|
||||
/*Crossing the start angle makes the whole arc change*/
|
||||
else {
|
||||
@ -351,14 +353,14 @@ void lv_arc_set_type(lv_obj_t * arc, lv_arc_type_t type)
|
||||
{
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t *ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
lv_arc_ext_t * ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
int16_t val = ext->cur_value;
|
||||
|
||||
ext->type = type;
|
||||
ext->cur_value = -1; /** Force set_value handling*/
|
||||
|
||||
int16_t bg_midpoint, bg_end = ext->bg_angle_end;
|
||||
if (ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360;
|
||||
if(ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360;
|
||||
|
||||
switch(ext->type) {
|
||||
case LV_ARC_TYPE_SYMMETRIC:
|
||||
@ -396,7 +398,7 @@ void lv_arc_set_value(lv_obj_t * arc, int16_t value)
|
||||
ext->cur_value = new_value;
|
||||
|
||||
int16_t bg_midpoint, range_midpoint, bg_end = ext->bg_angle_end;
|
||||
if (ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360;
|
||||
if(ext->bg_angle_end < ext->bg_angle_start) bg_end = ext->bg_angle_end + 360;
|
||||
|
||||
int16_t angle;
|
||||
switch(ext->type) {
|
||||
@ -404,11 +406,12 @@ void lv_arc_set_value(lv_obj_t * arc, int16_t value)
|
||||
bg_midpoint = (ext->bg_angle_start + bg_end) / 2;
|
||||
range_midpoint = (int32_t)(ext->min_value + ext->max_value) / 2;
|
||||
|
||||
if (ext->cur_value < range_midpoint) {
|
||||
if(ext->cur_value < range_midpoint) {
|
||||
angle = _lv_map(ext->cur_value, ext->min_value, range_midpoint, ext->bg_angle_start, bg_midpoint);
|
||||
lv_arc_set_start_angle(arc, angle);
|
||||
lv_arc_set_end_angle(arc, bg_midpoint);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
angle = _lv_map(ext->cur_value, range_midpoint, ext->max_value, bg_midpoint, bg_end);
|
||||
lv_arc_set_start_angle(arc, bg_midpoint);
|
||||
lv_arc_set_end_angle(arc, angle);
|
||||
@ -433,7 +436,7 @@ void lv_arc_set_value(lv_obj_t * arc, int16_t value)
|
||||
*/
|
||||
void lv_arc_set_range(lv_obj_t * arc, int16_t min, int16_t max)
|
||||
{
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t * ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
if(ext->min_value == min && ext->max_value == max) return;
|
||||
@ -461,7 +464,7 @@ void lv_arc_set_chg_rate(lv_obj_t * arc, uint16_t rate)
|
||||
{
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t *ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
lv_arc_ext_t * ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
ext->chg_rate = rate;
|
||||
}
|
||||
|
||||
@ -549,7 +552,7 @@ int16_t lv_arc_get_min_value(const lv_obj_t * arc)
|
||||
{
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t *ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
lv_arc_ext_t * ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
return ext->min_value;
|
||||
}
|
||||
|
||||
@ -562,7 +565,7 @@ int16_t lv_arc_get_max_value(const lv_obj_t * arc)
|
||||
{
|
||||
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
|
||||
|
||||
lv_arc_ext_t *ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
lv_arc_ext_t * ext = (lv_arc_ext_t *)lv_obj_get_ext_attr(arc);
|
||||
return ext->max_value;
|
||||
}
|
||||
|
||||
@ -640,7 +643,8 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
||||
lv_draw_line_dsc_init(&arc_dsc);
|
||||
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_BG, &arc_dsc);
|
||||
|
||||
lv_draw_arc(center.x, center.y, arc_r, ext->bg_angle_start + ext->rotation_angle, ext->bg_angle_end + ext->rotation_angle, clip_area,
|
||||
lv_draw_arc(center.x, center.y, arc_r, ext->bg_angle_start + ext->rotation_angle,
|
||||
ext->bg_angle_end + ext->rotation_angle, clip_area,
|
||||
&arc_dsc);
|
||||
}
|
||||
|
||||
@ -656,7 +660,8 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
|
||||
lv_draw_line_dsc_init(&arc_dsc);
|
||||
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_INDIC, &arc_dsc);
|
||||
|
||||
lv_draw_arc(center.x, center.y, indic_r, ext->arc_angle_start + ext->rotation_angle, ext->arc_angle_end + ext->rotation_angle, clip_area,
|
||||
lv_draw_arc(center.x, center.y, indic_r, ext->arc_angle_start + ext->rotation_angle,
|
||||
ext->arc_angle_end + ext->rotation_angle, clip_area,
|
||||
&arc_dsc);
|
||||
}
|
||||
|
||||
@ -738,7 +743,7 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
||||
/*Calculate the angle of the pressed point*/
|
||||
int16_t angle;
|
||||
int16_t bg_end = ext->bg_angle_end;
|
||||
if (ext->bg_angle_end < ext->bg_angle_start) {
|
||||
if(ext->bg_angle_end < ext->bg_angle_start) {
|
||||
bg_end = ext->bg_angle_end + 360;
|
||||
}
|
||||
|
||||
@ -752,9 +757,10 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
||||
uint32_t delta_tick = lv_tick_elaps(ext->last_tick);
|
||||
int16_t delta_angle_max = (ext->chg_rate * delta_tick) / 1000;
|
||||
|
||||
if (delta_angle > delta_angle_max) {
|
||||
if(delta_angle > delta_angle_max) {
|
||||
delta_angle = delta_angle_max;
|
||||
} else if (delta_angle < -delta_angle_max) {
|
||||
}
|
||||
else if(delta_angle < -delta_angle_max) {
|
||||
delta_angle = -delta_angle_max;
|
||||
}
|
||||
|
||||
@ -807,7 +813,7 @@ static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
|
||||
lv_arc_set_value(arc, lv_arc_get_value(arc) - 1);
|
||||
}
|
||||
|
||||
if (old_value != ext->cur_value) {
|
||||
if(old_value != ext->cur_value) {
|
||||
res = lv_event_send(arc, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
if(res != LV_RES_OK) return res;
|
||||
}
|
||||
@ -1005,9 +1011,11 @@ static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t
|
||||
uint16_t angle = ext->rotation_angle;
|
||||
if(ext->type == LV_ARC_TYPE_NORMAL) {
|
||||
angle += ext->arc_angle_end;
|
||||
} else if(ext->type == LV_ARC_TYPE_REVERSE) {
|
||||
}
|
||||
else if(ext->type == LV_ARC_TYPE_REVERSE) {
|
||||
angle += ext->arc_angle_start;
|
||||
} else if(ext->type == LV_ARC_TYPE_SYMMETRIC) {
|
||||
}
|
||||
else if(ext->type == LV_ARC_TYPE_SYMMETRIC) {
|
||||
int32_t range_midpoint = (int32_t)(ext->min_value + ext->max_value) / 2;
|
||||
if(ext->cur_value < range_midpoint) angle += ext->arc_angle_start;
|
||||
else angle += ext->arc_angle_end;
|
||||
|
@ -48,8 +48,8 @@ typedef struct {
|
||||
int16_t cur_value; /*Current value of the arc*/
|
||||
int16_t min_value; /*Minimum value of the arc*/
|
||||
int16_t max_value; /*Maximum value of the arc*/
|
||||
uint16_t dragging :1;
|
||||
uint16_t type :2;
|
||||
uint16_t dragging : 1;
|
||||
uint16_t type : 2;
|
||||
uint16_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/
|
||||
uint32_t last_tick; /*Last dragging event timestamp of the arc*/
|
||||
int16_t last_angle; /*Last dragging angle of the arc*/
|
||||
|
@ -904,8 +904,7 @@ static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * pa
|
||||
lv_indev_reset_long_press(param); /*Start the log press time again on the new button*/
|
||||
if(btn_pr != LV_BTNMATRIX_BTN_NONE &&
|
||||
button_is_inactive(ext->ctrl_bits[btn_pr]) == false &&
|
||||
button_is_hidden(ext->ctrl_bits[btn_pr]) == false)
|
||||
{
|
||||
button_is_hidden(ext->ctrl_bits[btn_pr]) == false) {
|
||||
invalidate_button_area(btnm, btn_pr);
|
||||
/* Send VALUE_CHANGED for the newly pressed button */
|
||||
if(button_is_click_trig(ext->ctrl_bits[btn_pr]) == false) {
|
||||
|
@ -687,7 +687,8 @@ static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area
|
||||
if(zommed_coords.y1 > img->coords.y1) zommed_coords.y1 -= ext->h;
|
||||
|
||||
lv_area_t clip_real;
|
||||
_lv_img_buf_get_transformed_area(&clip_real, lv_obj_get_width(img), lv_obj_get_height(img), angle_final, zoom_final, &ext->pivot);
|
||||
_lv_img_buf_get_transformed_area(&clip_real, lv_obj_get_width(img), lv_obj_get_height(img), angle_final, zoom_final,
|
||||
&ext->pivot);
|
||||
clip_real.x1 += img->coords.x1;
|
||||
clip_real.x2 += img->coords.x1;
|
||||
clip_real.y1 += img->coords.y1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user