1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

run formatter

This commit is contained in:
Gabor Kiss-Vamosi 2020-03-24 10:13:52 +01:00
parent a8b49faf6b
commit bb0c5a968c
30 changed files with 438 additions and 400 deletions

View File

@ -23,4 +23,12 @@
--suffix=none
--preserve-date
--formatted
--exclude=lv_conf_internal.h
--exclude=lv_conf_internal.h
--exclude=../src/lv_font/lv_font_roboto_12.c
--exclude=../src/lv_font/lv_font_roboto_12_subpx.c
--exclude=../src/lv_font/lv_font_roboto_16.c
--exclude=../src/lv_font/lv_font_roboto_22.c
--exclude=../src/lv_font/lv_font_roboto_28.c
--exclude=../src/lv_font/lv_font_roboto_28_compressed.c
--exclude=../src/lv_font/lv_font_unscii_8.c

View File

@ -399,9 +399,9 @@ lv_res_t lv_obj_del(lv_obj_t * obj)
bool act_scr_del = false;
lv_obj_t * par = lv_obj_get_parent(obj);
if(par == NULL) {
disp = lv_obj_get_disp(obj);
if(!disp) return LV_RES_INV; /*Shouldn't happen*/
if(disp->act_scr == obj) act_scr_del = true;
disp = lv_obj_get_disp(obj);
if(!disp) return LV_RES_INV; /*Shouldn't happen*/
if(disp->act_scr == obj) act_scr_del = true;
}
@ -1290,9 +1290,10 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_property_t prop)
lv_obj_invalidate(obj);
if(prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_INHERIT_MASK))
/*Send style change signals*/
refresh_children_style(obj);
} else {
/*Send style change signals*/
refresh_children_style(obj);
}
else {
lv_obj_invalidate(obj);
}
}
@ -3040,7 +3041,7 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t part, lv_draw_label_dsc_
}
#if LV_USE_BIDI
draw_dsc->bidi_dir = lv_obj_get_base_dir(obj);
draw_dsc->bidi_dir = lv_obj_get_base_dir(obj);
#endif
}
@ -3110,10 +3111,10 @@ lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part)
{
lv_coord_t s = 0;
lv_coord_t sh_width = lv_obj_get_style_shadow_width(obj, part);
if(sh_width) {
lv_opa_t sh_opa = lv_obj_get_style_shadow_opa(obj, part);
if(sh_opa > LV_OPA_MIN) {
lv_coord_t sh_width = lv_obj_get_style_shadow_width(obj, part);
if(sh_width) {
lv_opa_t sh_opa = lv_obj_get_style_shadow_opa(obj, part);
if(sh_opa > LV_OPA_MIN) {
sh_width = sh_width / 2; /*THe blur adds only half width*/
sh_width++;
sh_width += lv_obj_get_style_shadow_spread(obj, part);
@ -3124,10 +3125,10 @@ lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part)
}
}
const char * value_str = lv_obj_get_style_value_str(obj, part);
if(value_str) {
lv_opa_t value_opa = lv_obj_get_style_value_opa(obj, part);
if(value_opa > LV_OPA_MIN) {
const char * value_str = lv_obj_get_style_value_str(obj, part);
if(value_str) {
lv_opa_t value_opa = lv_obj_get_style_value_opa(obj, part);
if(value_opa > LV_OPA_MIN) {
lv_style_int_t letter_space = lv_obj_get_style_value_letter_space(obj, part);
lv_style_int_t line_space = lv_obj_get_style_value_letter_space(obj, part);
const lv_font_t * font = lv_obj_get_style_value_font(obj, part);
@ -3159,10 +3160,10 @@ lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part)
}
}
lv_style_int_t outline_width = lv_obj_get_style_outline_width(obj, part);
if(outline_width) {
lv_opa_t outline_opa = lv_obj_get_style_outline_opa(obj, part);
if(outline_opa > LV_OPA_MIN) {
lv_style_int_t outline_width = lv_obj_get_style_outline_width(obj, part);
if(outline_width) {
lv_opa_t outline_opa = lv_obj_get_style_outline_opa(obj, part);
if(outline_opa > LV_OPA_MIN) {
lv_style_int_t outline_pad = lv_obj_get_style_outline_pad(obj, part);
s = LV_MATH_MAX(s, outline_pad + outline_width);
}

View File

@ -584,7 +584,8 @@ void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t type, lv_style_property
* For example: `lv_obj_style_get_trasition_path()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline void _lv_obj_set_style_local_func_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_style_prop_cb_t value)
static inline void _lv_obj_set_style_local_func_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop,
lv_style_prop_cb_t value)
{
lv_style_fptr_dptr_t fd;
fd.fptr = value;
@ -603,7 +604,8 @@ static inline void _lv_obj_set_style_local_func_ptr(lv_obj_t * obj, uint8_t type
* For example: `lv_obj_style_get_text_font()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline void _lv_obj_set_style_local_data_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, const void * value)
static inline void _lv_obj_set_style_local_data_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop,
const void * value)
{
lv_style_fptr_dptr_t fd;
fd.fptr = NULL;
@ -1089,7 +1091,8 @@ lv_style_fptr_dptr_t _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, l
* For example: `lv_obj_style_get_trasition_path()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline lv_style_prop_cb_t _lv_obj_get_style_func_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop)
static inline lv_style_prop_cb_t _lv_obj_get_style_func_ptr(const lv_obj_t * obj, uint8_t part,
lv_style_property_t prop)
{
lv_style_fptr_dptr_t fd;
fd = _lv_obj_get_style_ptr(obj, part, prop);

View File

@ -101,22 +101,22 @@ extern "C" {
}
#define _OBJ_SET_STYLE_scalar(prop_name, func_name, value_type, style_type) \
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
{ \
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
{ \
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
#define _OBJ_SET_STYLE_nonscalar(prop_name, func_name, value_type, style_type) \
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
{ \
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
{ \
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), value); \
}
#define _OBJ_SET_STYLE_func_ptr(prop_name, func_name, value_type, style_type) \
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
{ \
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), FUNC_PTR_CAST(value)); \
} \
static inline void lv_style_set_##func_name (lv_style_t * style, lv_state_t state, value_type value) \
{ \
_lv_style_set##style_type (style, LV_STYLE_##prop_name | (state << LV_STYLE_STATE_POS), FUNC_PTR_CAST(value)); \
} \
#define _LV_OBJ_STYLE_SET_GET_DECLARE(prop_name, func_name, value_type, style_type, scalar) \
_OBJ_GET_STYLE_##scalar(prop_name, func_name, value_type, style_type) \
@ -217,7 +217,8 @@ _LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_6, transition_prop_6, lv_style_int
#if LV_USE_ANIMATION
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, lv_anim_path_cb_t, _func_ptr, func_ptr)
#else
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path,lv_style_prop_cb_t, _func_ptr, func_ptr) /*For compatibility*/
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, lv_style_prop_cb_t, _func_ptr,
func_ptr) /*For compatibility*/
#endif
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int, scalar)
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int, scalar)

View File

@ -218,7 +218,7 @@ typedef void(*lv_style_prop_cb_t)(void);
typedef union {
lv_style_prop_cb_t fptr;
const void * dptr;
}lv_style_fptr_dptr_t;
} lv_style_fptr_dptr_t;
typedef struct {
@ -512,8 +512,8 @@ static inline int16_t _lv_style_get_data_ptr(const lv_style_t * style, lv_style_
fd_res.fptr = NULL;
lv_res_t r = _lv_style_get_ptr(style, prop, &fd_res);
void** res2 = (void**)res;
*res2 = (void*)fd_res.dptr;
void ** res2 = (void **)res;
*res2 = (void *)fd_res.dptr;
return r;
}
@ -587,7 +587,8 @@ void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t pro
* @param value the value to set
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline void lv_style_list_set_local_func_ptr(lv_style_list_t * list, lv_style_property_t prop, lv_style_prop_cb_t value)
static inline void lv_style_list_set_local_func_ptr(lv_style_list_t * list, lv_style_property_t prop,
lv_style_prop_cb_t value)
{
lv_style_fptr_dptr_t fd;
fd.dptr = NULL;
@ -603,7 +604,8 @@ static inline void lv_style_list_set_local_func_ptr(lv_style_list_t * list, lv_s
* @param value the value to set
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline void lv_style_list_set_local_data_ptr(lv_style_list_t * list, lv_style_property_t prop, const void * value)
static inline void lv_style_list_set_local_data_ptr(lv_style_list_t * list, lv_style_property_t prop,
const void * value)
{
lv_style_fptr_dptr_t fd;
fd.fptr = NULL;

View File

@ -65,9 +65,9 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co
#define FILL_NORMAL_MASK_PX(out_x, color) \
if(*mask_tmp_x) { \
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_tmp[out_x] = color; \
else if(disp_buf_tmp[out_x].full == color.full) disp_buf_tmp[out_x] = color; \
else disp_buf_tmp[out_x] = lv_color_mix(color, disp_buf_tmp[out_x], *mask_tmp_x); \
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_tmp[out_x] = color; \
else if(disp_buf_tmp[out_x].full == color.full) disp_buf_tmp[out_x] = color; \
else disp_buf_tmp[out_x] = lv_color_mix(color, disp_buf_tmp[out_x], *mask_tmp_x); \
} \
mask_tmp_x++;
@ -75,18 +75,18 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co
#define FILL_NORMAL_MASK_PX_SCR_TRANSP(out_x, color) \
if(*mask_tmp_x) { \
if(*mask_tmp_x != last_mask || last_dest_color.full != disp_buf_tmp[out_x].full) { \
if(disp->driver.screen_transp) { \
lv_color_mix_with_alpha(disp_buf_tmp[x], disp_buf_tmp[out_x].ch.alpha, \
color, *mask_tmp_x, &last_res_color, &last_res_color.ch.alpha); \
} \
else \
{ \
if(*mask_tmp_x == LV_OPA_COVER) last_res_color = color; \
else if(disp_buf_tmp[out_x].full == color.full) last_res_color = color; \
else last_res_color = lv_color_mix(color, disp_buf_tmp[out_x], *mask_tmp_x); \
last_mask = *mask_tmp_x; \
last_dest_color.full = disp_buf_tmp[out_x].full; \
} \
if(disp->driver.screen_transp) { \
lv_color_mix_with_alpha(disp_buf_tmp[x], disp_buf_tmp[out_x].ch.alpha, \
color, *mask_tmp_x, &last_res_color, &last_res_color.ch.alpha); \
} \
else \
{ \
if(*mask_tmp_x == LV_OPA_COVER) last_res_color = color; \
else if(disp_buf_tmp[out_x].full == color.full) last_res_color = color; \
else last_res_color = lv_color_mix(color, disp_buf_tmp[out_x], *mask_tmp_x); \
last_mask = *mask_tmp_x; \
last_dest_color.full = disp_buf_tmp[out_x].full; \
} \
} \
disp_buf_tmp[out_x] = last_res_color; \
} \
@ -379,30 +379,31 @@ static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, con
#else
for(x = draw_area->x1; x <= draw_area->x2 && ((lv_uintptr_t)mask_tmp_x & 0x3); x++) {
#if LV_COLOR_SCREEN_TRANSP
FILL_NORMAL_MASK_PX_SCR_TRANSP(x, color)
FILL_NORMAL_MASK_PX_SCR_TRANSP(x, color)
#else
FILL_NORMAL_MASK_PX(x, color)
#endif
}
uint32_t * mask32 = (uint32_t *) mask_tmp_x;
for(; x <= x_end4; x+= 4) {
for(; x <= x_end4; x += 4) {
if(*mask32) {
if((*mask32) == 0xFFFFFFFF) {
disp_buf_tmp[x] = color;
disp_buf_tmp[x + 1] = color;
disp_buf_tmp[x + 2] = color;
disp_buf_tmp[x + 3] = color;
} else {
}
else {
mask_tmp_x = (const lv_opa_t *)mask32;
#if LV_COLOR_SCREEN_TRANSP
FILL_NORMAL_MASK_PX_SCR_TRANSP(x, color)
FILL_NORMAL_MASK_PX_SCR_TRANSP(x + 1 , color)
FILL_NORMAL_MASK_PX_SCR_TRANSP(x + 1, color)
FILL_NORMAL_MASK_PX_SCR_TRANSP(x + 2, color)
FILL_NORMAL_MASK_PX_SCR_TRANSP(x + 3, color)
#else
FILL_NORMAL_MASK_PX(x, color)
FILL_NORMAL_MASK_PX(x + 1 , color)
FILL_NORMAL_MASK_PX(x + 1, color)
FILL_NORMAL_MASK_PX(x + 2, color)
FILL_NORMAL_MASK_PX(x + 3, color)
#endif
@ -414,7 +415,7 @@ static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, con
mask_tmp_x = (const lv_opa_t *)mask32;
for(; x <= draw_area->x2 ; x++) {
#if LV_COLOR_SCREEN_TRANSP
FILL_NORMAL_MASK_PX_SCR_TRANSP(x, color)
FILL_NORMAL_MASK_PX_SCR_TRANSP(x, color)
#else
FILL_NORMAL_MASK_PX(x, color)
#endif
@ -431,12 +432,13 @@ static void fill_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, con
const lv_opa_t * mask_tmp_x = &mask_tmp[draw_area->x1];
for(x = draw_area->x1; x <= draw_area->x2; x++) {
if(*mask_tmp_x) {
if(*mask_tmp_x != last_mask) opa_tmp = *mask_tmp_x == LV_OPA_COVER ? opa : (uint32_t)((uint32_t)(*mask_tmp_x) * opa) >> 8;
if(*mask_tmp_x != last_mask) opa_tmp = *mask_tmp_x == LV_OPA_COVER ? opa : (uint32_t)((uint32_t)(
*mask_tmp_x) * opa) >> 8;
if(*mask_tmp_x != last_mask || last_dest_color.full != disp_buf_tmp[x].full) {
#if LV_COLOR_SCREEN_TRANSP
if(disp->driver.screen_transp) {
lv_color_mix_with_alpha(disp_buf_tmp[x], disp_buf_tmp[x].ch.alpha, color, opa_tmp, &last_res_color,
&last_res_color.ch.alpha);
&last_res_color.ch.alpha);
}
else
#endif
@ -682,14 +684,14 @@ static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
for(y = draw_area->y1; y <= draw_area->y2; y++) {
for(x = draw_area->x1; x <= draw_area->x2; x++) {
if(mask_tmp[x]) {
#if LV_COLOR_SCREEN_TRANSP
#if LV_COLOR_SCREEN_TRANSP
if(disp->driver.screen_transp) {
lv_color_mix_with_alpha(disp_buf_tmp[x], disp_buf_tmp[x].ch.alpha, map_buf_tmp[x], mask_tmp[x], &res_color,
&opa_composed);
res_color.ch.alpha = opa_composed;
}
else
#endif
#endif
{
if(mask_tmp[x] > LV_OPA_MAX) res_color = map_buf_tmp[x];
else res_color = lv_color_mix(map_buf_tmp[x], disp_buf_tmp[x], mask_tmp[x]);
@ -709,13 +711,13 @@ static void map_normal(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
for(x = draw_area->x1; x <= draw_area->x2; x++) {
if(mask_tmp[x]) {
lv_opa_t opa_tmp = mask_tmp[x] >= LV_OPA_MAX ? opa : ((opa * mask_tmp[x]) >> 8);
#if LV_COLOR_SCREEN_TRANSP
#if LV_COLOR_SCREEN_TRANSP
if(disp->driver.screen_transp) {
lv_color_mix_with_alpha(disp_buf_tmp[x], disp_buf_tmp[x].ch.alpha, map_buf_tmp[x], opa_tmp, &disp_buf_tmp[x],
&disp_buf_tmp[x].ch.alpha);
}
else
#endif
#endif
{
disp_buf_tmp[x] = lv_color_mix(map_buf_tmp[x], disp_buf_tmp[x], opa_tmp);
}

View File

@ -390,7 +390,7 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
/*Prepare the `mask_buf`if there are other masks*/
if(other_mask_cnt) {
lv_memset_ff(mask_buf,mask_buf_size);
lv_memset_ff(mask_buf, mask_buf_size);
}
lv_coord_t draw_area_h = lv_area_get_height(&draw_area);
@ -405,26 +405,26 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
for(y = 0; y < draw_area_h; y++) {
map_px = map_buf_tmp;
for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) {
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
mask_buf[px_i] = px_opa;
if(px_opa < LV_OPA_MIN) {
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
mask_buf[px_i] = px_opa;
if(px_opa < LV_OPA_MIN) {
#if LV_COLOR_DEPTH == 32
map2[px_i].ch.alpha = 0xFF;
map2[px_i].ch.alpha = 0xFF;
#endif
continue;
}
continue;
}
#if LV_COLOR_DEPTH == 8
c.full = map_px[0];
#elif LV_COLOR_DEPTH == 16
c.full = map_px[0] + (map_px[1] << 8);
#elif LV_COLOR_DEPTH == 32
c.full = *((uint32_t *)map_px);
#endif
#if LV_COLOR_DEPTH == 8
c.full = map_px[0];
#elif LV_COLOR_DEPTH == 16
c.full = map_px[0] + (map_px[1] << 8);
#elif LV_COLOR_DEPTH == 32
c.full = *((uint32_t *)map_px);
#endif
map2[px_i].full = c.full;
}
map_buf_tmp += map_w * px_size_byte;
map_buf_tmp += map_w * px_size_byte;
if(px_i + lv_area_get_width(&draw_area) < mask_buf_size) {
blend_area.y2 ++;
}
@ -449,134 +449,133 @@ static void lv_draw_map(const lv_area_t * map_area, const lv_area_t * clip_area,
/*Most complicated case: transform or other mask or chroma keyed*/
else {
lv_img_transform_dsc_t trans_dsc;
lv_memset_00(&trans_dsc, sizeof(lv_img_transform_dsc_t));
if(transform) {
lv_img_cf_t cf = LV_IMG_CF_TRUE_COLOR;
if(alpha_byte) cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
else if(chroma_key) cf = LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED;
lv_img_transform_dsc_t trans_dsc;
lv_memset_00(&trans_dsc, sizeof(lv_img_transform_dsc_t));
if(transform) {
lv_img_cf_t cf = LV_IMG_CF_TRUE_COLOR;
if(alpha_byte) cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
else if(chroma_key) cf = LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED;
trans_dsc.cfg.angle = draw_dsc->angle;
trans_dsc.cfg.zoom = draw_dsc->zoom;
trans_dsc.cfg.src = map_p;
trans_dsc.cfg.src_w = map_w;
trans_dsc.cfg.src_h = map_h;
trans_dsc.cfg.cf = cf;
trans_dsc.cfg.pivot_x = draw_dsc->pivot.x;
trans_dsc.cfg.pivot_y = draw_dsc->pivot.y;
trans_dsc.cfg.color = draw_dsc->recolor;
trans_dsc.cfg.antialias = draw_dsc->antialias;
trans_dsc.cfg.angle = draw_dsc->angle;
trans_dsc.cfg.zoom = draw_dsc->zoom;
trans_dsc.cfg.src = map_p;
trans_dsc.cfg.src_w = map_w;
trans_dsc.cfg.src_h = map_h;
trans_dsc.cfg.cf = cf;
trans_dsc.cfg.pivot_x = draw_dsc->pivot.x;
trans_dsc.cfg.pivot_y = draw_dsc->pivot.y;
trans_dsc.cfg.color = draw_dsc->recolor;
trans_dsc.cfg.antialias = draw_dsc->antialias;
lv_img_buf_transform_init(&trans_dsc);
}
lv_img_buf_transform_init(&trans_dsc);
}
uint16_t recolor_premult[3] = {0};
lv_opa_t recolor_opa_inv = 255 - draw_dsc->recolor_opa;
if(draw_dsc->recolor_opa != 0) {
lv_color_premult(draw_dsc->recolor, draw_dsc->recolor_opa, recolor_premult);
}
uint16_t recolor_premult[3] = {0};
lv_opa_t recolor_opa_inv = 255 - draw_dsc->recolor_opa;
if(draw_dsc->recolor_opa != 0) {
lv_color_premult(draw_dsc->recolor, draw_dsc->recolor_opa, recolor_premult);
}
lv_draw_mask_res_t mask_res;
mask_res = (alpha_byte || chroma_key || draw_dsc->angle) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
int32_t x;
int32_t y;
for(y = 0; y < draw_area_h; y++) {
map_px = map_buf_tmp;
uint32_t px_i_start = px_i;
lv_draw_mask_res_t mask_res;
mask_res = (alpha_byte || chroma_key || draw_dsc->angle) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
int32_t x;
int32_t y;
for(y = 0; y < draw_area_h; y++) {
map_px = map_buf_tmp;
uint32_t px_i_start = px_i;
for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) {
for(x = 0; x < draw_area_w; x++, map_px += px_size_byte, px_i++) {
if(transform == false)
{
if(alpha_byte) {
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
mask_buf[px_i] = px_opa;
if(px_opa < LV_OPA_MIN) {
#if LV_COLOR_DEPTH == 32
map2[px_i].ch.alpha = 0xFF;
#endif
continue;
}
}
else {
mask_buf[px_i] = LV_OPA_COVER;
}
if(transform == false) {
if(alpha_byte) {
lv_opa_t px_opa = map_px[LV_IMG_PX_SIZE_ALPHA_BYTE - 1];
mask_buf[px_i] = px_opa;
if(px_opa < LV_OPA_MIN) {
#if LV_COLOR_DEPTH == 32
map2[px_i].ch.alpha = 0xFF;
#endif
continue;
}
}
else {
mask_buf[px_i] = LV_OPA_COVER;
}
#if LV_COLOR_DEPTH == 8
c.full = map_px[0];
#elif LV_COLOR_DEPTH == 16
c.full = map_px[0] + (map_px[1] << 8);
#elif LV_COLOR_DEPTH == 32
c.full = *((uint32_t *)map_px);
#endif
if(chroma_key) {
if(c.full == chroma_keyed_color.full) {
mask_buf[px_i] = LV_OPA_TRANSP;
continue;
}
}
}
else {
/*Rotate*/
bool ret;
int32_t rot_x = x + (disp_area->x1 + draw_area.x1) - map_area->x1;
int32_t rot_y = y + (disp_area->y1 + draw_area.y1) - map_area->y1;
ret = lv_img_buf_transform(&trans_dsc, rot_x, rot_y);
if(ret == false) {
mask_buf[px_i] = LV_OPA_TRANSP;
continue;
}
else {
mask_buf[px_i] = trans_dsc.res.opa;
c.full = trans_dsc.res.color.full;
}
}
#if LV_COLOR_DEPTH == 8
c.full = map_px[0];
#elif LV_COLOR_DEPTH == 16
c.full = map_px[0] + (map_px[1] << 8);
#elif LV_COLOR_DEPTH == 32
c.full = *((uint32_t *)map_px);
#endif
if(chroma_key) {
if(c.full == chroma_keyed_color.full) {
mask_buf[px_i] = LV_OPA_TRANSP;
continue;
}
}
}
else {
/*Rotate*/
bool ret;
int32_t rot_x = x + (disp_area->x1 + draw_area.x1) - map_area->x1;
int32_t rot_y = y + (disp_area->y1 + draw_area.y1) - map_area->y1;
ret = lv_img_buf_transform(&trans_dsc, rot_x, rot_y);
if(ret == false) {
mask_buf[px_i] = LV_OPA_TRANSP;
continue;
}
else {
mask_buf[px_i] = trans_dsc.res.opa;
c.full = trans_dsc.res.color.full;
}
}
if(draw_dsc->recolor_opa != 0) {
c = lv_color_mix_premult(recolor_premult, c, recolor_opa_inv);
}
if(draw_dsc->recolor_opa != 0) {
c = lv_color_mix_premult(recolor_premult, c, recolor_opa_inv);
}
map2[px_i].full = c.full;
}
map2[px_i].full = c.full;
}
/*Apply the masks if any*/
if(other_mask_cnt) {
lv_draw_mask_res_t mask_res_sub;
mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + vdb->area.x1, y + draw_area.y1 + vdb->area.y1,
lv_area_get_width(&draw_area));
if(mask_res_sub == LV_DRAW_MASK_RES_FULL_TRANSP) {
lv_memset_00(mask_buf + px_i_start, lv_area_get_width(&draw_area));
mask_res = LV_DRAW_MASK_RES_CHANGED;
}
else if(mask_res_sub == LV_DRAW_MASK_RES_CHANGED) {
mask_res = LV_DRAW_MASK_RES_CHANGED;
}
}
/*Apply the masks if any*/
if(other_mask_cnt) {
lv_draw_mask_res_t mask_res_sub;
mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + vdb->area.x1, y + draw_area.y1 + vdb->area.y1,
lv_area_get_width(&draw_area));
if(mask_res_sub == LV_DRAW_MASK_RES_FULL_TRANSP) {
lv_memset_00(mask_buf + px_i_start, lv_area_get_width(&draw_area));
mask_res = LV_DRAW_MASK_RES_CHANGED;
}
else if(mask_res_sub == LV_DRAW_MASK_RES_CHANGED) {
mask_res = LV_DRAW_MASK_RES_CHANGED;
}
}
map_buf_tmp += map_w * px_size_byte;
if(px_i + lv_area_get_width(&draw_area) < mask_buf_size) {
blend_area.y2 ++;
}
else {
lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
map_buf_tmp += map_w * px_size_byte;
if(px_i + lv_area_get_width(&draw_area) < mask_buf_size) {
blend_area.y2 ++;
}
else {
lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
blend_area.y1 = blend_area.y2 + 1;
blend_area.y2 = blend_area.y1;
blend_area.y1 = blend_area.y2 + 1;
blend_area.y2 = blend_area.y1;
px_i = 0;
mask_res = (alpha_byte || chroma_key || draw_dsc->angle) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
px_i = 0;
mask_res = (alpha_byte || chroma_key || draw_dsc->angle) ? LV_DRAW_MASK_RES_CHANGED : LV_DRAW_MASK_RES_FULL_COVER;
/*Prepare the `mask_buf`if there are other masks*/
if(other_mask_cnt) {
lv_memset_ff(mask_buf, mask_buf_size);
}
}
}
/*Flush the last part*/
if(blend_area.y1 != blend_area.y2) {
blend_area.y2--;
lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
}
/*Prepare the `mask_buf`if there are other masks*/
if(other_mask_cnt) {
lv_memset_ff(mask_buf, mask_buf_size);
}
}
}
/*Flush the last part*/
if(blend_area.y1 != blend_area.y2) {
blend_area.y2--;
lv_blend_map(clip_area, &blend_area, map2, mask_buf, mask_res, draw_dsc->opa, draw_dsc->blend_mode);
}
}
lv_mem_buf_release(mask_buf);

View File

@ -52,7 +52,8 @@ static const uint8_t bpp2_opa_table[4] = {0, 85, 170, 255}; /*Opacity mapping w
static const uint8_t bpp4_opa_table[16] = {0, 17, 34, 51, /*Opacity mapping with bpp = 4*/
68, 85, 102, 119,
136, 153, 170, 187,
204, 221, 238, 255};
204, 221, 238, 255
};
static const uint8_t bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
@ -68,7 +69,8 @@ static const uint8_t bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207,
208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223,
224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255
};
/*clang-format on*/
/**********************
@ -518,42 +520,42 @@ static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
uint32_t col_bit_max = 8 - bpp;
uint32_t col_bit_row_ofs = (box_w + col_start- col_end) * bpp;
uint32_t col_bit_row_ofs = (box_w + col_start - col_end) * bpp;
for(row = row_start ; row < row_end; row++) {
int32_t mask_p_start = mask_p;
bitmask = bitmask_init >> col_bit;
for(col = col_start; col < col_end; col++) {
/*Load the pixel's opacity into the mask*/
letter_px = (*map_p & bitmask) >> (col_bit_max - col_bit);
if(letter_px) {
mask_buf[mask_p] = bpp_opa_table_p[letter_px];
}
else {
mask_buf[mask_p] = 0;
}
for(col = col_start; col < col_end; col++) {
/*Load the pixel's opacity into the mask*/
letter_px = (*map_p & bitmask) >> (col_bit_max - col_bit);
if(letter_px) {
mask_buf[mask_p] = bpp_opa_table_p[letter_px];
}
else {
mask_buf[mask_p] = 0;
}
/*Go to the next column*/
if(col_bit < col_bit_max) {
col_bit += bpp;
bitmask = bitmask >> bpp;
}
else {
col_bit = 0;
bitmask = bitmask_init;
map_p++;
}
/*Go to the next column*/
if(col_bit < col_bit_max) {
col_bit += bpp;
bitmask = bitmask >> bpp;
}
else {
col_bit = 0;
bitmask = bitmask_init;
map_p++;
}
/*Next mask byte*/
mask_p++;
}
/*Next mask byte*/
mask_p++;
}
/*Apply masks if any*/
if(other_mask_cnt) {
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf + mask_p_start, fill_area.x1, fill_area.y2,
lv_area_get_width(&fill_area));
lv_area_get_width(&fill_area));
if(mask_res == LV_DRAW_MASK_RES_FULL_TRANSP) {
lv_memset_00(mask_buf + mask_p_start, lv_area_get_width(&fill_area));
}
@ -564,8 +566,8 @@ static void draw_letter_normal(lv_coord_t pos_x, lv_coord_t pos_y, lv_font_glyph
}
else {
lv_blend_fill(clip_area, &fill_area,
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
LV_BLEND_MODE_NORMAL);
color, mask_buf, LV_DRAW_MASK_RES_CHANGED, LV_OPA_COVER,
LV_BLEND_MODE_NORMAL);
fill_area.y1 = fill_area.y2 + 1;
fill_area.y2 = fill_area.y1;

View File

@ -651,7 +651,7 @@ static lv_draw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x,
if(k >= len) {
return LV_DRAW_MASK_RES_FULL_TRANSP;
}
if(k >= 0) lv_memset_00(&mask_buf[0],k);
if(k >= 0) lv_memset_00(&mask_buf[0], k);
}
else {
@ -979,7 +979,7 @@ static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t ab
return LV_DRAW_MASK_RES_FULL_TRANSP;
}
if(kr <= len) {
lv_memset_00(&mask_buf[kr],len - kr);
lv_memset_00(&mask_buf[kr], len - kr);
}
}
else {

View File

@ -19,7 +19,7 @@
*********************/
#define SHADOW_UPSACALE_SHIFT 6
#define SHADOW_ENHANCE 1
#define SPLIT_LIMIT 50
#define SPLIT_LIMIT 50
/**********************
* TYPEDEFS

View File

@ -379,15 +379,26 @@ static inline void decompress_line(uint8_t * out, lv_coord_t w)
*/
static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len)
{
uint8_t bit_mask;
switch(len) {
case 1: bit_mask = 0x1; break;
case 2: bit_mask = 0x3; break;
case 3: bit_mask = 0x7; break;
case 4: bit_mask = 0xF; break;
case 8: bit_mask = 0xFF; break;
default: bit_mask = (uint16_t)((uint16_t) 1 << len) - 1;
}
uint8_t bit_mask;
switch(len) {
case 1:
bit_mask = 0x1;
break;
case 2:
bit_mask = 0x3;
break;
case 3:
bit_mask = 0x7;
break;
case 4:
bit_mask = 0xF;
break;
case 8:
bit_mask = 0xFF;
break;
default:
bit_mask = (uint16_t)((uint16_t) 1 << len) - 1;
}
uint32_t byte_pos = bit_pos >> 3;
bit_pos = bit_pos & 0x7;

View File

@ -447,14 +447,14 @@ static inline lv_color_t lv_color_mix(lv_color_t c1, lv_color_t c2, uint8_t mix)
static inline void lv_color_premult(lv_color_t c, uint8_t mix, uint16_t * out)
{
#if LV_COLOR_DEPTH != 1
out[0] = (uint16_t) LV_COLOR_GET_R(c) * mix;
out[1] = (uint16_t) LV_COLOR_GET_G(c) * mix;
out[2] = (uint16_t) LV_COLOR_GET_B(c) * mix;
out[0] = (uint16_t) LV_COLOR_GET_R(c) * mix;
out[1] = (uint16_t) LV_COLOR_GET_G(c) * mix;
out[2] = (uint16_t) LV_COLOR_GET_B(c) * mix;
#else
/*Pre-multiplication can't be used with 1 bpp*/
out[0] = LV_COLOR_GET_R(c);
out[1] = LV_COLOR_GET_G(c);
out[2] = LV_COLOR_GET_B(c);
/*Pre-multiplication can't be used with 1 bpp*/
out[0] = LV_COLOR_GET_R(c);
out[1] = LV_COLOR_GET_G(c);
out[2] = LV_COLOR_GET_B(c);
#endif
}
@ -468,7 +468,7 @@ static inline void lv_color_premult(lv_color_t c, uint8_t mix, uint16_t * out)
* @return the mixed color
* @note 255 won't give clearly `c1`.
*/
static inline lv_color_t lv_color_mix_premult(uint16_t * premult_c1 , lv_color_t c2, uint8_t mix)
static inline lv_color_t lv_color_mix_premult(uint16_t * premult_c1, lv_color_t c2, uint8_t mix)
{
lv_color_t ret;
#if LV_COLOR_DEPTH != 1

View File

@ -85,7 +85,7 @@ void lv_log_add(lv_log_level_t level, const char * file, int line, const char *
}
static const char * lvl_prefix[] = {"Trace", "Info", "Warn", "Error", "User"};
printf("%s: %s \t(%s #%d %s())\n", lvl_prefix[level], buf, &file[p], line ,func);
printf("%s: %s \t(%s #%d %s())\n", lvl_prefix[level], buf, &file[p], line, func);
#else
if(custom_print_cb) custom_print_cb(level, file, line, func, buf);
#endif

View File

@ -57,9 +57,9 @@ typedef struct {
#endif /* LV_ENABLE_GC */
#ifdef LV_ARCH_64
#define ALIGN_MASK 0x7
#define ALIGN_MASK 0x7
#else
#define ALIGN_MASK 0x3
#define ALIGN_MASK 0x3
#endif
/**********************
@ -519,59 +519,59 @@ void lv_mem_buf_free_all(void)
*/
void * lv_memcpy(void * dst, const void * src, size_t len)
{
uint8_t * d8 = dst;
const uint8_t * s8 = src;
uint8_t * d8 = dst;
const uint8_t * s8 = src;
lv_uintptr_t d_align = (lv_uintptr_t)d8 & ALIGN_MASK;
lv_uintptr_t s_align = (lv_uintptr_t)s8 & ALIGN_MASK;
lv_uintptr_t d_align = (lv_uintptr_t)d8 & ALIGN_MASK;
lv_uintptr_t s_align = (lv_uintptr_t)s8 & ALIGN_MASK;
/*Byte copy for unaligned memories*/
if(s_align != d_align) {
while(len > 32) {
REPEAT8(COPY8);
/*Byte copy for unaligned memories*/
if(s_align != d_align) {
while(len > 32) {
REPEAT8(COPY8);
REPEAT8(COPY8);
REPEAT8(COPY8);
len -= 32;
}
while(len) {
COPY8
len--;
}
return dst;
}
REPEAT8(COPY8);
len -= 32;
}
while(len) {
COPY8
len--;
}
return dst;
}
/*Make the memories aligned*/
if(d_align) {
d_align = ALIGN_MASK + 1 - d_align;
/*Make the memories aligned*/
if(d_align) {
d_align = ALIGN_MASK + 1 - d_align;
while(d_align && len) {
COPY8;
d_align--;
len--;
}
}
}
uint32_t * d32 = (uint32_t*)d8;
const uint32_t * s32 = (uint32_t*)s8;
while(len > 32) {
REPEAT8(COPY32)
len -= 32;
}
uint32_t * d32 = (uint32_t *)d8;
const uint32_t * s32 = (uint32_t *)s8;
while(len > 32) {
REPEAT8(COPY32)
len -= 32;
}
while(len > 4) {
COPY32;
len -= 4;
}
while(len > 4) {
COPY32;
len -= 4;
}
d8 = (uint8_t *)d32;
s8 = (const uint8_t *)s32;
while(len) {
COPY8
len--;
}
d8 = (uint8_t *)d32;
s8 = (const uint8_t *)s32;
while(len) {
COPY8
len--;
}
return dst;
return dst;
}
@ -585,11 +585,11 @@ void * lv_memcpy(void * dst, const void * src, size_t len)
void lv_memset(void * dst, uint8_t v, size_t len)
{
uint8_t * d8 = (uint8_t *) dst;
uint8_t * d8 = (uint8_t *) dst;
uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK;
uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK;
/*Make the address aligned*/
/*Make the address aligned*/
if(d_align) {
d_align = ALIGN_MASK + 1 - d_align;
while(d_align && len) {
@ -600,34 +600,34 @@ void lv_memset(void * dst, uint8_t v, size_t len)
}
}
uint32_t v32 = v + (v << 8) + (v << 16) + (v << 24);
uint32_t v32 = v + (v << 8) + (v << 16) + (v << 24);
uint32_t * d32 = (uint32_t*)d8;
uint32_t * d32 = (uint32_t *)d8;
while(len > 32) {
SET32(v32);
SET32(v32);
SET32(v32);
SET32(v32);
SET32(v32);
SET32(v32);
SET32(v32);
SET32(v32);
len -= 32;
}
while(len > 32) {
SET32(v32);
SET32(v32);
SET32(v32);
SET32(v32);
SET32(v32);
SET32(v32);
SET32(v32);
SET32(v32);
len -= 32;
}
while(len > 4) {
SET32(v32);
len -= 4;
}
while(len > 4) {
SET32(v32);
len -= 4;
}
d8 = (uint8_t *)d32;
while(len) {
*d8 = v;
d8++;
len--;
}
d8 = (uint8_t *)d32;
while(len) {
*d8 = v;
d8++;
len--;
}
}
/**
@ -638,7 +638,7 @@ void lv_memset(void * dst, uint8_t v, size_t len)
*/
void lv_memset_00(void * dst, size_t len)
{
uint8_t * d8 = (uint8_t*) dst;
uint8_t * d8 = (uint8_t *) dst;
uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK;
@ -653,31 +653,31 @@ void lv_memset_00(void * dst, size_t len)
}
}
uint32_t * d32 = (uint32_t*)d8;
while(len > 32) {
SET32(0);
SET32(0);
SET32(0);
SET32(0);
SET32(0);
SET32(0);
SET32(0);
SET32(0);
len -= 32;
}
uint32_t * d32 = (uint32_t *)d8;
while(len > 32) {
SET32(0);
SET32(0);
SET32(0);
SET32(0);
SET32(0);
SET32(0);
SET32(0);
SET32(0);
len -= 32;
}
while(len > 4) {
SET32(0);
len -= 4;
}
while(len > 4) {
SET32(0);
len -= 4;
}
d8 = (uint8_t *)d32;
while(len) {
*d8 = 0;
d8++;
len--;
}
d8 = (uint8_t *)d32;
while(len) {
*d8 = 0;
d8++;
len--;
}
}
/**
@ -688,7 +688,7 @@ void lv_memset_00(void * dst, size_t len)
*/
void lv_memset_ff(void * dst, size_t len)
{
uint8_t * d8 = (uint8_t*) dst;
uint8_t * d8 = (uint8_t *) dst;
uintptr_t d_align = (lv_uintptr_t) d8 & ALIGN_MASK;
@ -703,31 +703,31 @@ void lv_memset_ff(void * dst, size_t len)
}
}
uint32_t * d32 = (uint32_t*)d8;
while(len > 32) {
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
len -= 32;
}
uint32_t * d32 = (uint32_t *)d8;
while(len > 32) {
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
SET32(0xFFFFFFFF);
len -= 32;
}
while(len > 4) {
SET32(0xFFFFFFFF);
len -= 4;
}
while(len > 4) {
SET32(0xFFFFFFFF);
len -= 4;
}
d8 = (uint8_t *)d32;
while(len) {
*d8 = 0xFF;
d8++;
len--;
}
d8 = (uint8_t *)d32;
while(len) {
*d8 = 0xFF;
d8++;
len--;
}
}

View File

@ -760,7 +760,8 @@ static void tabview_init(void)
lv_style_init(&tabview_btns_bg);
lv_style_set_bg_opa(&tabview_btns_bg, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&tabview_btns_bg, LV_STATE_DEFAULT, COLOR_BG);
lv_style_set_border_color(&tabview_btns_bg, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0xe4eaf0) : lv_color_hex(0x3b3e42));
lv_style_set_border_color(&tabview_btns_bg, LV_STATE_DEFAULT,
IS_LIGHT ? lv_color_hex(0xe4eaf0) : lv_color_hex(0x3b3e42));
lv_style_set_border_width(&tabview_btns_bg, LV_STATE_DEFAULT, LV_DPI / 30 > 0 ? LV_DPI / 30 : 1);
lv_style_set_border_side(&tabview_btns_bg, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM);
lv_style_set_text_color(&tabview_btns_bg, LV_STATE_DEFAULT, COLOR_SCR_TEXT);

View File

@ -28,7 +28,7 @@ extern "C" {
typedef enum {
LV_THEME_MATERIAL_PALETTE_LIGHT,
LV_THEME_MATERIAL_PALETTE_DARK,
}lv_theme_material_palette_t;
} lv_theme_material_palette_t;
/**********************

View File

@ -382,7 +382,8 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
lv_coord_t right_bg = lv_obj_get_style_pad_right(arc, LV_ARC_PART_BG);
lv_coord_t top_bg = lv_obj_get_style_pad_top(arc, LV_ARC_PART_BG);
lv_coord_t bottom_bg = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_BG);
lv_coord_t r = (LV_MATH_MIN(lv_obj_get_width(arc) - left_bg - right_bg, lv_obj_get_height(arc) - top_bg - bottom_bg)) / 2;
lv_coord_t r = (LV_MATH_MIN(lv_obj_get_width(arc) - left_bg - right_bg,
lv_obj_get_height(arc) - top_bg - bottom_bg)) / 2;
lv_coord_t x = arc->coords.x1 + r + left_bg;
lv_coord_t y = arc->coords.y1 + r + top_bg;
@ -400,7 +401,7 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area
lv_coord_t right_indic = lv_obj_get_style_pad_right(arc, LV_ARC_PART_INDIC);
lv_coord_t top_indic = lv_obj_get_style_pad_top(arc, LV_ARC_PART_INDIC);
lv_coord_t bottom_indic = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_INDIC);
r-= LV_MATH_MAX4(left_indic, right_indic, top_indic, bottom_indic);
r -= LV_MATH_MAX4(left_indic, right_indic, top_indic, bottom_indic);
lv_draw_arc(x, y, r, ext->arc_angle_start, ext->arc_angle_end, clip_area, &arc_dsc);
}

View File

@ -485,8 +485,9 @@ static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area)
lv_coord_t anim_cur_value_end_x =
(int32_t)((int32_t)anim_length * (ext->cur_value_anim.anim_end - ext->min_value)) / range;
anim_cur_value_x = anim_cur_value_start_x + (((anim_cur_value_end_x - anim_cur_value_start_x) * ext->cur_value_anim.anim_state) /
LV_BAR_ANIM_STATE_END);
anim_cur_value_x = anim_cur_value_start_x + (((anim_cur_value_end_x - anim_cur_value_start_x) *
ext->cur_value_anim.anim_state) /
LV_BAR_ANIM_STATE_END);
}
else
#endif

View File

@ -233,7 +233,8 @@ void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
/* Set the button's area.
* If inner padding is zero then use the prev. button x2 as x1 to avoid rounding
* errors*/
if(btn_i != 0 && inner == 0 && ((act_x == left && base_dir != LV_BIDI_DIR_RTL) || (act_x + act_unit_w == max_w - right && base_dir == LV_BIDI_DIR_RTL))) {
if(btn_i != 0 && inner == 0 && ((act_x == left && base_dir != LV_BIDI_DIR_RTL) ||
(act_x + act_unit_w == max_w - right && base_dir == LV_BIDI_DIR_RTL))) {
lv_area_set(&ext->button_areas[btn_i], ext->button_areas[btn_i - 1].x2, act_y, act_x + act_unit_w,
act_y + btn_h);
}

View File

@ -136,8 +136,8 @@ lv_obj_t * lv_dropdown_create(lv_obj_t * par, const lv_obj_t * copy)
lv_dropdown_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
if(copy_ext->static_txt == 0)
lv_dropdown_set_options(ddlist, lv_dropdown_get_options(copy));
else
lv_dropdown_set_static_options(ddlist, lv_dropdown_get_options(copy));
else
lv_dropdown_set_static_options(ddlist, lv_dropdown_get_options(copy));
ext->option_cnt = copy_ext->option_cnt;
ext->sel_opt_id = copy_ext->sel_opt_id;
ext->sel_opt_id_orig = copy_ext->sel_opt_id;
@ -219,7 +219,7 @@ void lv_dropdown_set_options(lv_obj_t * ddlist, const char * options)
ext->option_cnt++; /*Last option has no `\n`*/
ext->sel_opt_id = 0;
ext->sel_opt_id_orig = 0;
/*Allocate space for the new text*/
size_t len = strlen(options) + 1;
if(ext->options != NULL && ext->static_txt == 0) {
@ -297,11 +297,11 @@ void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint16_t pos
/*Allocate space for the new option*/
size_t old_len = (ext->options == NULL) ? 0 : strlen(ext->options);
size_t ins_len = strlen(option);
size_t new_len = ins_len + old_len + 2; /* +2 for terminating NULL and possible \n */
ext->options = lv_mem_realloc(ext->options, new_len + 1);
LV_ASSERT_MEM(ext->options);
if(ext->options == NULL) return;
size_t ins_len = strlen(option);
size_t new_len = ins_len + old_len + 2; /* +2 for terminating NULL and possible \n */
ext->options = lv_mem_realloc(ext->options, new_len + 1);
LV_ASSERT_MEM(ext->options);
if(ext->options == NULL) return;
ext->options[old_len] = 0;
@ -325,7 +325,7 @@ void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint16_t pos
char * ins_buf = lv_mem_buf_get(ins_len + 2); /* + 2 for terminating NULL and possible \n */
LV_ASSERT_MEM(ins_buf);
if(ins_buf == NULL) return;
strcpy(ins_buf, option);
strcpy(ins_buf, option);
if(pos < ext->option_cnt)
strcat(ins_buf, "\n");
lv_txt_ins(ext->options, insert_pos, ins_buf);
@ -592,13 +592,13 @@ bool lv_dropdown_get_show_selected(lv_obj_t * ddlist)
* @param ddlist pointer to a drop down list
* @return open/close animation time [ms]
*/
uint16_t lv_dropdown_get_anim_time(const lv_obj_t * ddlist)
uint16_t lv_dropdown_get_anim_time(const lv_obj_t * ddlist)
{
LV_ASSERT_OBJ(ddlist, LV_OBJX_NAME);
LV_ASSERT_OBJ(ddlist, LV_OBJX_NAME);
lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist);
lv_dropdown_ext_t * ext = lv_obj_get_ext_attr(ddlist);
return ext->anim_time;
return ext->anim_time;
}
/*=====================
@ -937,7 +937,7 @@ static lv_res_t lv_dropdown_signal(lv_obj_t * ddlist, lv_signal_t sign, void * p
lv_mem_free(ext->options);
ext->options = NULL;
}
/*`lv_obj_clean_style_list` is not required because these styles are only copied to the page
* so they can have transitions or other object related things. */
lv_style_list_reset(&ext->style_page);

View File

@ -33,7 +33,7 @@ extern "C" {
* DEFINES
*********************/
#define LV_DROPDOWN_POS_LAST 0xFFFF
/**********************
* TYPEDEFS
**********************/
@ -127,7 +127,7 @@ void lv_dropdown_set_static_options(lv_obj_t * ddlist, const char * options);
* @param pos the insert position, indexed from 0, LV_DROPDOWN_POS_LAST = end of string
*/
void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint16_t pos);
/**
* Set the selected option
* @param ddlist pointer to drop down list object

View File

@ -1,7 +1,7 @@
/**
* @file lv_gauge.c
*
*/
/**
* @file lv_gauge.c
*
*/
/*********************
* INCLUDES

View File

@ -146,7 +146,7 @@ void lv_imgbtn_set_src(lv_obj_t * imgbtn, lv_btn_state_t state, const void * src
* to a file)
*/
void lv_imgbtn_set_src_tiled(lv_obj_t * imgbtn, lv_btn_state_t state, const void * src_left, const void * src_mid,
const void * src_right)
const void * src_right)
{
LV_ASSERT_OBJ(imgbtn, LV_OBJX_NAME);
@ -293,7 +293,8 @@ static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * cli
lv_obj_init_draw_img_dsc(imgbtn, LV_IMGBTN_PART_MAIN, &img_dsc);
lv_draw_img(&imgbtn->coords, clip_area, src, &img_dsc);
}
} else {
}
else {
#if LV_IMGBTN_TILED
const void * src = ext->img_src_left[state];
if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) {

View File

@ -43,7 +43,7 @@ typedef struct {
const void * img_src_right[_LV_BTN_STATE_LAST]; /*Store right side images to each state*/
#endif
lv_img_cf_t act_cf; /*Color format of the currently active image*/
uint8_t tiled :1; /*1: the middle src will be repeated to fill the user defined width*/
uint8_t tiled : 1; /*1: the middle src will be repeated to fill the user defined width*/
} lv_imgbtn_ext_t;
/*Parts of the image button*/
@ -94,7 +94,7 @@ void lv_imgbtn_set_src(lv_obj_t * imgbtn, lv_btn_state_t state, const void * src
* to a file)
*/
void lv_imgbtn_set_src_tiled(lv_obj_t * imgbtn, lv_btn_state_t state, const void * src_left, const void * src_mid,
const void * src_right);
const void * src_right);
#endif

View File

@ -298,17 +298,17 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
lv_area_t mask_area;
mask_area.x1 = x_ofs - r_in;
mask_area.x2 = x_ofs + r_in-1;
mask_area.x2 = x_ofs + r_in - 1;
mask_area.y1 = y_ofs - r_in;
mask_area.y2 = y_ofs + r_in-1;
mask_area.y2 = y_ofs + r_in - 1;
lv_draw_mask_radius_param_t mask_in_param;
lv_draw_mask_radius_init(&mask_in_param, &mask_area, LV_RADIUS_CIRCLE, true);
int16_t mask_in_id = lv_draw_mask_add(&mask_in_param, 0);
mask_area.x1 = x_ofs - r_out;
mask_area.x2 = x_ofs + r_out-1;
mask_area.x2 = x_ofs + r_out - 1;
mask_area.y1 = y_ofs - r_out;
mask_area.y2 = y_ofs + r_out-1;
mask_area.y2 = y_ofs + r_out - 1;
lv_draw_mask_radius_param_t mask_out_param;
lv_draw_mask_radius_init(&mask_out_param, &mask_area, LV_RADIUS_CIRCLE, false);
int16_t mask_out_id = lv_draw_mask_add(&mask_out_param, 0);
@ -327,11 +327,11 @@ void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uin
/*Interpolate sine and cos*/
int32_t sin_low = lv_trigo_sin(angle_low + angle_ofs);
int32_t sin_high = lv_trigo_sin(angle_high + angle_ofs);
int32_t sin_mid = (sin_low * (256 - angle_rem) + sin_high * angle_rem) >> 8;
int32_t sin_mid = (sin_low * (256 - angle_rem) + sin_high * angle_rem) >> 8;
int32_t cos_low = lv_trigo_sin(angle_low + 90 + angle_ofs);
int32_t cos_high = lv_trigo_sin(angle_high + 90 + angle_ofs);
int32_t cos_mid = (cos_low * (256 - angle_rem) + cos_high * angle_rem) >> 8;
int32_t cos_mid = (cos_low * (256 - angle_rem) + cos_high * angle_rem) >> 8;
/*Use the interpolated values to get x and y coordinates*/
int32_t y_out = (int32_t)((int32_t)sin_mid * r_out_extra) >> (LV_TRIGO_SHIFT - 8);

View File

@ -986,7 +986,8 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
#if LV_USE_GROUP
if(lv_obj_get_group(page)) {
lv_group_focus_obj(page);
} else
}
else
#endif
{
res = lv_signal_send(page, LV_SIGNAL_FOCUS, NULL);

View File

@ -764,7 +764,7 @@ static lv_res_t release_handler(lv_obj_t * roller)
lv_obj_t * label = get_label(roller);
if(label == NULL) return LV_RES_OK;
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER || lv_indev_get_type(indev) == LV_INDEV_TYPE_BUTTON) {
/*Search the clicked option (For KEYPAD and ENCODER the new value should be already set)*/
uint16_t new_opt = 0;

View File

@ -273,10 +273,12 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
lv_coord_t dist_left, dist_right;
if(hor) {
if((base_dir != LV_BIDI_DIR_RTL && p.x > ext->right_knob_area.x2) || (base_dir == LV_BIDI_DIR_RTL && p.x < ext->right_knob_area.x1)) {
if((base_dir != LV_BIDI_DIR_RTL && p.x > ext->right_knob_area.x2) || (base_dir == LV_BIDI_DIR_RTL &&
p.x < ext->right_knob_area.x1)) {
ext->value_to_set = &ext->bar.cur_value;
}
else if((base_dir != LV_BIDI_DIR_RTL && p.x < ext->left_knob_area.x1) || (base_dir == LV_BIDI_DIR_RTL && p.x > ext->left_knob_area.x2)) {
else if((base_dir != LV_BIDI_DIR_RTL && p.x < ext->left_knob_area.x1) || (base_dir == LV_BIDI_DIR_RTL &&
p.x > ext->left_knob_area.x2)) {
ext->value_to_set = &ext->bar.start_value;
}
else {

View File

@ -219,7 +219,8 @@ static lv_design_res_t lv_switch_design(lv_obj_t * sw, const lv_area_t * clip_ar
if(base_dir != LV_BIDI_DIR_RTL) {
knob_area.x1 = ext->bar.indic_area.x2 - ((act_indic_w * knob_size) / max_indic_w);
knob_area.x2 = knob_area.x1 + knob_size;
} else {
}
else {
knob_area.x2 = ext->bar.indic_area.x1 + ((act_indic_w * knob_size) / max_indic_w);
knob_area.x1 = knob_area.x2 - knob_size;
}

View File

@ -350,7 +350,7 @@ void lv_table_set_cell_crop(lv_obj_t * table, uint16_t row, uint16_t col, bool c
LV_ASSERT_OBJ(table, LV_OBJX_NAME);
lv_table_ext_t * ext = lv_obj_get_ext_attr(table);
if( col >= ext->col_cnt) {
if(col >= ext->col_cnt) {
LV_LOG_WARN("lv_table_set_cell_crop: invalid column");
return;
}