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

solve conflicts

This commit is contained in:
Gabor Kiss-Vamosi 2020-01-01 16:01:31 +01:00
commit 96b0955e97
10 changed files with 468 additions and 472 deletions

View File

@ -2011,7 +2011,10 @@ lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj)
lv_style_dsc_t * lv_obj_get_style(const lv_obj_t * obj, uint8_t part) lv_style_dsc_t * lv_obj_get_style(const lv_obj_t * obj, uint8_t part)
{ {
if(part == LV_OBJ_PART_MAIN) return &obj->style_dsc;
void * p = ∂ void * p = ∂
lv_res_t res; lv_res_t res;
res = lv_signal_send((lv_obj_t*)obj, LV_SIGNAL_GET_STYLE, &p); res = lv_signal_send((lv_obj_t*)obj, LV_SIGNAL_GET_STYLE, &p);
@ -2070,6 +2073,11 @@ lv_style_value_t lv_obj_get_style_value(const lv_obj_t * obj, uint8_t part, lv_s
return dsc->cache.letter_space; return dsc->cache.letter_space;
} }
break; break;
case LV_STYLE_LINE_SPACE:
if(dsc->cache.line_space != LV_STYLE_CACHE_WIDTH_SKIPPED) {
return dsc->cache.line_space;
}
break;
case LV_STYLE_SHADOW_WIDTH: case LV_STYLE_SHADOW_WIDTH:
if(dsc->cache.shadow_width == 0) { if(dsc->cache.shadow_width == 0) {
return 0; return 0;
@ -2100,11 +2108,22 @@ lv_style_value_t lv_obj_get_style_value(const lv_obj_t * obj, uint8_t part, lv_s
return LV_BLEND_MODE_NORMAL; return LV_BLEND_MODE_NORMAL;
} }
break; break;
case LV_STYLE_SHADOW_BLEND_MODE:
if(dsc->cache.shadow_blend_mode == LV_STYLE_CACHE_BLEND_MODE_NORMAL) {
return LV_BLEND_MODE_NORMAL;
}
break;
case LV_STYLE_RADIUS: case LV_STYLE_RADIUS:
if(dsc->cache.radius != LV_STYLE_CACHE_RADIUS_SKIPPED) { if(dsc->cache.radius != LV_STYLE_CACHE_RADIUS_SKIPPED) {
return dsc->cache.radius == LV_STYLE_CACHE_RADIUS_CIRCLE ? LV_RADIUS_CIRCLE : dsc->cache.radius; return dsc->cache.radius == LV_STYLE_CACHE_RADIUS_CIRCLE ? LV_RADIUS_CIRCLE : dsc->cache.radius;
} }
break; break;
case LV_STYLE_CLIP_CORNER:
return dsc->cache.clip_corner;
break;
case LV_STYLE_BORDER_PART:
if(dsc->cache.border_part == LV_STYLE_CACHE_BORDER_PART_FULL) return LV_BORDER_SIDE_FULL;
break;
} }
} }
@ -2251,6 +2270,8 @@ lv_color_t lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_p
return LV_COLOR_BLACK; return LV_COLOR_BLACK;
case LV_STYLE_BORDER_COLOR: case LV_STYLE_BORDER_COLOR:
return LV_COLOR_BLACK; return LV_COLOR_BLACK;
case LV_STYLE_SHADOW_COLOR:
return LV_COLOR_GRAY;
} }
return LV_COLOR_WHITE; return LV_COLOR_WHITE;
@ -2373,6 +2394,14 @@ lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prope
void * lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop) void * lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop)
{ {
lv_style_dsc_t * dsc = lv_obj_get_style(obj, part);
if(dsc->cache.enabled) {
switch(prop & (~LV_STYLE_STATE_MASK)) {
case LV_STYLE_FONT:
if(dsc->cache.font == LV_STYLE_CACHE_FONT_DEFAULT) return LV_FONT_DEFAULT;
break;
}
}
uint8_t state; uint8_t state;
lv_style_property_t prop_ori = prop; lv_style_property_t prop_ori = prop;
@ -2898,6 +2927,17 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t part, lv_draw_rect_dsc_t
draw_dsc->overlay_opa = lv_obj_get_style_opa(obj, part, LV_STYLE_OVERLAY_OPA); draw_dsc->overlay_opa = lv_obj_get_style_opa(obj, part, LV_STYLE_OVERLAY_OPA);
draw_dsc->overlay_color = lv_obj_get_style_color(obj, part, LV_STYLE_OVERLAY_COLOR); draw_dsc->overlay_color = lv_obj_get_style_color(obj, part, LV_STYLE_OVERLAY_COLOR);
draw_dsc->shadow_width = lv_obj_get_style_value(obj, part, LV_STYLE_SHADOW_WIDTH);
if(draw_dsc->shadow_width) {
draw_dsc->shadow_opa = lv_obj_get_style_opa(obj, part, LV_STYLE_SHADOW_OPA);
if(draw_dsc->shadow_opa > LV_OPA_MIN) {
draw_dsc->shadow_ofs_x = lv_obj_get_style_value(obj, part, LV_STYLE_SHADOW_OFFSET_X);
draw_dsc->shadow_ofs_y = lv_obj_get_style_value(obj, part, LV_STYLE_SHADOW_OFFSET_Y);
draw_dsc->shadow_spread = lv_obj_get_style_value(obj, part, LV_STYLE_SHADOW_SPREAD);
draw_dsc->shadow_color = lv_obj_get_style_color(obj, part, LV_STYLE_SHADOW_COLOR);
}
}
if(opa_scale < LV_OPA_MAX) { if(opa_scale < LV_OPA_MAX) {
draw_dsc->bg_opa = (uint16_t)((uint16_t)draw_dsc->bg_opa * opa_scale) >> 8; draw_dsc->bg_opa = (uint16_t)((uint16_t)draw_dsc->bg_opa * opa_scale) >> 8;
draw_dsc->border_opa = (uint16_t)((uint16_t)draw_dsc->border_opa * opa_scale) >> 8; draw_dsc->border_opa = (uint16_t)((uint16_t)draw_dsc->border_opa * opa_scale) >> 8;
@ -2910,10 +2950,13 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t part, lv_draw_label_dsc_
{ {
draw_dsc->color = lv_obj_get_style_color(obj, part, LV_STYLE_TEXT_COLOR); draw_dsc->color = lv_obj_get_style_color(obj, part, LV_STYLE_TEXT_COLOR);
draw_dsc->letter_space = lv_obj_get_style_value(obj, part, LV_STYLE_LETTER_SPACE); draw_dsc->letter_space = lv_obj_get_style_value(obj, part, LV_STYLE_LETTER_SPACE);
draw_dsc->line_space = lv_obj_get_style_value(obj, part, LV_STYLE_LETTER_SPACE);
draw_dsc->opa = lv_obj_get_style_opa(obj, part, LV_STYLE_TEXT_OPA);
draw_dsc->font = lv_obj_get_style_ptr(obj, part, LV_STYLE_FONT); draw_dsc->font = lv_obj_get_style_ptr(obj, part, LV_STYLE_FONT);
lv_opa_t opa_scale = lv_obj_get_style_opa(obj, part, LV_STYLE_OPA_SCALE); lv_opa_t opa_scale = lv_obj_get_style_opa(obj, part, LV_STYLE_OPA_SCALE);
if(opa_scale < LV_OPA_MAX) { if(opa_scale < LV_OPA_MAX) {
draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8; draw_dsc->opa = (uint16_t)((uint16_t)draw_dsc->opa * opa_scale) >> 8;
} }
@ -3250,12 +3293,20 @@ static lv_res_t style_cache_update_core(lv_obj_t * obj, uint8_t part)
if(value == LV_BLEND_MODE_NORMAL) dsc->cache.image_blend_mode = LV_STYLE_CACHE_BLEND_MODE_NORMAL; if(value == LV_BLEND_MODE_NORMAL) dsc->cache.image_blend_mode = LV_STYLE_CACHE_BLEND_MODE_NORMAL;
else dsc->cache.image_blend_mode = LV_STYLE_CACHE_BLEND_MODE_SKIPPED; else dsc->cache.image_blend_mode = LV_STYLE_CACHE_BLEND_MODE_SKIPPED;
value = lv_obj_get_style_value(obj, part, LV_STYLE_SHADOW_BLEND_MODE);
if(value == LV_BLEND_MODE_NORMAL) dsc->cache.shadow_blend_mode = LV_STYLE_CACHE_BLEND_MODE_NORMAL;
else dsc->cache.shadow_blend_mode = LV_STYLE_CACHE_BLEND_MODE_SKIPPED;
value = lv_obj_get_style_value(obj, part, LV_STYLE_RADIUS); value = lv_obj_get_style_value(obj, part, LV_STYLE_RADIUS);
if(value == LV_RADIUS_CIRCLE) dsc->cache.radius = LV_STYLE_CACHE_RADIUS_CIRCLE; if(value == LV_RADIUS_CIRCLE) dsc->cache.radius = LV_STYLE_CACHE_RADIUS_CIRCLE;
else if(value < LV_STYLE_CACHE_RADIUS_SKIPPED) dsc->cache.radius = value; else if(value < LV_STYLE_CACHE_RADIUS_SKIPPED) dsc->cache.radius = value;
else dsc->cache.radius = LV_STYLE_CACHE_RADIUS_SKIPPED; else dsc->cache.radius = LV_STYLE_CACHE_RADIUS_SKIPPED;
value = lv_obj_get_style_value(obj, part, LV_STYLE_BORDER_PART);
if(value == LV_BORDER_SIDE_FULL) dsc->cache.border_part = LV_STYLE_CACHE_BORDER_PART_FULL;
else dsc->cache.border_part = LV_STYLE_CACHE_BORDER_PART_SKIPPED;
ptr = lv_obj_get_style_ptr(obj, part, LV_STYLE_FONT); ptr = lv_obj_get_style_ptr(obj, part, LV_STYLE_FONT);
if(ptr == LV_FONT_DEFAULT) dsc->cache.font = LV_STYLE_CACHE_FONT_DEFAULT; if(ptr == LV_FONT_DEFAULT) dsc->cache.font = LV_STYLE_CACHE_FONT_DEFAULT;
else dsc->cache.font = LV_STYLE_CACHE_FONT_SKIPPED; else dsc->cache.font = LV_STYLE_CACHE_FONT_SKIPPED;

View File

@ -523,12 +523,14 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
#if MASK_AREA_DEBUG #if MASK_AREA_DEBUG
static lv_color_t debug_color = LV_COLOR_RED; static lv_color_t debug_color = LV_COLOR_RED;
LV_STYLE_CREATE(style_debug, &lv_style_plain); lv_draw_rect_dsc_t draw_dsc;
style_debug.body.main_color = debug_color; lv_draw_rect_dsc_init(&draw_dsc);
style_debug.body.grad_color = debug_color; draw_dsc.bg_color.full = debug_color.full;
style_debug.body.border.width = 2; draw_dsc.bg_opa = LV_OPA_50;
style_debug.body.border.color.full = (debug_color.full + 0x13) * 9; draw_dsc.border_width = 2;
lv_draw_rect(&obj_ext_mask, &obj_ext_mask, &style_debug, LV_OPA_50); draw_dsc.border_color.full = (debug_color.full + 0x13) * 9;
lv_draw_rect(&obj_ext_mask, &obj_ext_mask, &draw_dsc);
debug_color.full *= 17; debug_color.full *= 17;
debug_color.full += 0xA1; debug_color.full += 0xA1;
#endif #endif

View File

@ -392,11 +392,11 @@ static inline int32_t get_property_index(const lv_style_t * style, lv_style_prop
lv_style_attr_t attr_act; lv_style_attr_t attr_act;
attr_act.full = style->map[i + 1]; attr_act.full = style->map[i + 1];
if(style->map[i] == id_to_find) { if(style->map[i] == id_to_find) {
/*If there the state has perfectly match return this property*/ /*If the state perfectly matches return this property*/
if(attr_act.bits.state == attr.bits.state) { if(attr_act.bits.state == attr.bits.state) {
return i; return i;
} }
/* Be sure the property not specifies other state the the requested. /* Be sure the property not specifies other state than the requested.
* E.g. For HOVER+PRESS, HOVER only is OK, but HOVER+FOCUS not*/ * E.g. For HOVER+PRESS, HOVER only is OK, but HOVER+FOCUS not*/
else if((attr_act.bits.state & (~attr.bits.state)) == 0) { else if((attr_act.bits.state & (~attr.bits.state)) == 0) {
/* Use this property if it describes better the requested state than the current candidate. /* Use this property if it describes better the requested state than the current candidate.

View File

@ -179,6 +179,10 @@ typedef int16_t lv_style_value_t;
#define LV_STYLE_CACHE_BLEND_MODE_NORMAL 0 #define LV_STYLE_CACHE_BLEND_MODE_NORMAL 0
#define LV_STYLE_CACHE_BLEND_MODE_SKIPPED 1 #define LV_STYLE_CACHE_BLEND_MODE_SKIPPED 1
#define LV_STYLE_CACHE_BORDER_PART_FULL 0
#define LV_STYLE_CACHE_BORDER_PART_SKIPPED 1
typedef struct { typedef struct {
/*32 bit*/ /*32 bit*/
uint32_t pad_left :6; uint32_t pad_left :6;
@ -188,7 +192,7 @@ typedef struct {
uint32_t pad_inner :6; uint32_t pad_inner :6;
uint32_t bg_grad_dir :2; uint32_t bg_grad_dir :2;
/*32 bit*/ /*31 bit*/
uint32_t border_width :3; uint32_t border_width :3;
uint32_t line_width :3; uint32_t line_width :3;
uint32_t letter_space :3; uint32_t letter_space :3;
@ -209,11 +213,13 @@ typedef struct {
uint32_t text_blend_mode :1; uint32_t text_blend_mode :1;
uint32_t line_blend_mode :1; uint32_t line_blend_mode :1;
uint32_t image_blend_mode :1; uint32_t image_blend_mode :1;
uint32_t shadow_blend_mode :1;
/*32 bit*/ /*32 bit*/
uint32_t radius :4; uint32_t radius :4;
uint32_t font :1; uint32_t font :1;
uint32_t clip_corner :1; uint32_t clip_corner :1;
uint32_t border_part :1;
uint32_t enabled :1; uint32_t enabled :1;

View File

@ -49,12 +49,13 @@ static void draw_img(const lv_area_t * coords, const lv_area_t * clip, lv_draw_r
void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc) void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
{ {
memset(dsc, 0x00, sizeof(lv_draw_rect_dsc_t)); memset(dsc, 0x00, sizeof(lv_draw_rect_dsc_t));
dsc->bg_opa = LV_OPA_COVER;
dsc->bg_grad_color_stop = 0xFF; dsc->bg_grad_color_stop = 0xFF;
dsc->bg_opa = LV_OPA_COVER;
dsc->border_opa = LV_OPA_COVER; dsc->border_opa = LV_OPA_COVER;
dsc->overlay_opa = LV_OPA_TRANSP; dsc->overlay_opa = LV_OPA_TRANSP;
dsc->pattern_font = LV_FONT_DEFAULT; dsc->pattern_font = LV_FONT_DEFAULT;
dsc->shadow_opa = LV_OPA_COVER;
dsc->border_part = LV_BORDER_SIDE_FULL;
} }
/** /**
@ -165,7 +166,7 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, lv_draw_re
if(rout > short_side >> 1) rout = short_side >> 1; if(rout > short_side >> 1) rout = short_side >> 1;
/*Most simple case: just a plain rectangle*/ /*Most simple case: just a plain rectangle*/
if(simple_mode && rout == 0 && dsc->bg_color.full == dsc->bg_grad_color.full) { if(simple_mode && rout == 0 && (dsc->bg_grad_dir == LV_GRAD_DIR_NONE)) {
lv_blend_fill(clip, &coords_bg, lv_blend_fill(clip, &coords_bg,
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
dsc->bg_blend_mode); dsc->bg_blend_mode);
@ -491,382 +492,380 @@ static lv_color_t grad_get(lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i)
static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc) static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, lv_draw_rect_dsc_t * dsc)
{ {
// /*Check whether the shadow is visible*/ /*Check whether the shadow is visible*/
// if(style->body.shadow.width == 0) return; if(dsc->shadow_width == 0) return;
//
// if(style->body.shadow.width == 1 && style->body.shadow.offset.x == 0 && if(dsc->shadow_width == 1 && dsc->shadow_ofs_x == 0 &&
// style->body.shadow.offset.y == 0 && style->body.shadow.spread <= 0) { dsc->shadow_ofs_y == 0 && dsc->shadow_spread <= 0) {
// return; return;
// } }
//
// lv_coord_t sw = style->body.shadow.width; lv_coord_t sw = dsc->shadow_width;
//
// lv_area_t sh_rect_area; lv_area_t sh_rect_area;
// sh_rect_area.x1 = coords->x1 + style->body.shadow.offset.x - style->body.shadow.spread; sh_rect_area.x1 = coords->x1 + dsc->shadow_ofs_x - dsc->shadow_spread;
// sh_rect_area.x2 = coords->x2 + style->body.shadow.offset.x + style->body.shadow.spread; sh_rect_area.x2 = coords->x2 + dsc->shadow_ofs_x + dsc->shadow_spread;
// sh_rect_area.y1 = coords->y1 + style->body.shadow.offset.y - style->body.shadow.spread; sh_rect_area.y1 = coords->y1 + dsc->shadow_ofs_y - dsc->shadow_spread;
// sh_rect_area.y2 = coords->y2 + style->body.shadow.offset.y + style->body.shadow.spread; sh_rect_area.y2 = coords->y2 + dsc->shadow_ofs_y + dsc->shadow_spread;
//
// lv_area_t sh_area; lv_area_t sh_area;
// sh_area.x1 = sh_rect_area.x1 - sw / 2 - 1; sh_area.x1 = sh_rect_area.x1 - sw / 2 - 1;
// sh_area.x2 = sh_rect_area.x2 + sw / 2 + 1; sh_area.x2 = sh_rect_area.x2 + sw / 2 + 1;
// sh_area.y1 = sh_rect_area.y1 - sw / 2 - 1; sh_area.y1 = sh_rect_area.y1 - sw / 2 - 1;
// sh_area.y2 = sh_rect_area.y2 + sw / 2 + 1; sh_area.y2 = sh_rect_area.y2 + sw / 2 + 1;
//
// lv_opa_t opa = style->body.shadow.opa; lv_opa_t opa = dsc->shadow_opa;
//
// if(opa_scale != LV_OPA_COVER) opa = (opa * opa_scale) >> 8; if(opa > LV_OPA_MAX) opa = LV_OPA_COVER;
//
// if(opa > LV_OPA_MAX) opa = LV_OPA_COVER; lv_disp_t * disp = lv_refr_get_disp_refreshing();
// lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
// lv_disp_t * disp = lv_refr_get_disp_refreshing();
// lv_disp_buf_t * vdb = lv_disp_get_buf(disp); /* Get clipped fill area which is the real draw area.
// * It is always the same or inside `fill_area` */
// /* Get clipped fill area which is the real draw area. lv_area_t draw_area;
// * It is always the same or inside `fill_area` */ bool is_common;
// lv_area_t draw_area; is_common = lv_area_intersect(&draw_area, &sh_area, clip);
// bool is_common; if(is_common == false) return;
// is_common = lv_area_intersect(&draw_area, &sh_area, clip);
// if(is_common == false) return; const lv_area_t * disp_area = &vdb->area;
//
// const lv_area_t * disp_area = &vdb->area; /* Now `draw_area` has absolute coordinates.
// * Make it relative to `disp_area` to simplify draw to `disp_buf`*/
// /* Now `draw_area` has absolute coordinates. draw_area.x1 -= disp_area->x1;
// * Make it relative to `disp_area` to simplify draw to `disp_buf`*/ draw_area.y1 -= disp_area->y1;
// draw_area.x1 -= disp_area->x1; draw_area.x2 -= disp_area->x1;
// draw_area.y1 -= disp_area->y1; draw_area.y2 -= disp_area->y1;
// draw_area.x2 -= disp_area->x1;
// draw_area.y2 -= disp_area->y1; /*Consider 1 px smaller bg to be sure the edge will be covered by the shadow*/
// lv_area_t bg_coords;
// /*Consider 1 px smaller bg to be sure the edge will be covered by the shadow*/ lv_area_copy(&bg_coords, coords);
// lv_area_t bg_coords; bg_coords.x1 += 1;
// lv_area_copy(&bg_coords, coords); bg_coords.y1 += 1;
// bg_coords.x1 += 1; bg_coords.x2 -= 1;
// bg_coords.y1 += 1; bg_coords.y2 -= 1;
// bg_coords.x2 -= 1;
// bg_coords.y2 -= 1; /*Get the real radius*/
// lv_coord_t r_bg = dsc->radius;
// /*Get the real radius*/ lv_coord_t short_side = LV_MATH_MIN(lv_area_get_width(&bg_coords), lv_area_get_height(&bg_coords));
// lv_coord_t r_bg = style->body.radius; if(r_bg > short_side >> 1) r_bg = short_side >> 1;
// lv_coord_t short_side = LV_MATH_MIN(lv_area_get_width(&bg_coords), lv_area_get_height(&bg_coords));
// if(r_bg > short_side >> 1) r_bg = short_side >> 1; lv_coord_t r_sh = dsc->radius;
// short_side = LV_MATH_MIN(lv_area_get_width(&sh_rect_area), lv_area_get_height(&sh_rect_area));
// lv_coord_t r_sh = style->body.radius; if(r_sh > short_side >> 1) r_sh = short_side >> 1;
// short_side = LV_MATH_MIN(lv_area_get_width(&sh_rect_area), lv_area_get_height(&sh_rect_area));
// if(r_sh > short_side >> 1) r_sh = short_side >> 1;
// lv_coord_t corner_size = sw + r_sh;
//
// lv_coord_t corner_size = sw + r_sh; lv_opa_t * sh_buf = lv_mem_buf_get(corner_size * corner_size);
// shadow_draw_corner_buf(&sh_rect_area, sh_buf, dsc->shadow_width, r_sh);
// lv_opa_t * sh_buf = lv_mem_buf_get(corner_size * corner_size);
// shadow_draw_corner_buf(&sh_rect_area, sh_buf, style->body.shadow.width, r_sh); bool simple_mode = true;
// if(lv_draw_mask_get_cnt() > 0) simple_mode = false;
// bool simple_mode = true; else if(dsc->shadow_ofs_x != 0 || dsc->shadow_ofs_y != 0) simple_mode = false;
// if(lv_draw_mask_get_cnt() > 0) simple_mode = false; else if(dsc->shadow_spread != 0) simple_mode = false;
// else if(style->body.shadow.offset.x != 0 || style->body.shadow.offset.y != 0) simple_mode = false;
// else if(style->body.shadow.spread != 0) simple_mode = false; lv_coord_t y_max;
//
// lv_coord_t y_max; /*Create a mask*/
// lv_draw_mask_res_t mask_res;
// /*Create a mask*/ lv_opa_t * mask_buf = lv_mem_buf_get(lv_area_get_width(&sh_rect_area));
// lv_draw_mask_res_t mask_res;
// lv_opa_t * mask_buf = lv_mem_buf_get(lv_area_get_width(&sh_rect_area)); lv_draw_mask_radius_param_t mask_rout_param;
// lv_draw_mask_radius_init(&mask_rout_param, &bg_coords, r_bg, true);
// lv_draw_mask_radius_param_t mask_rout_param;
// lv_draw_mask_radius_init(&mask_rout_param, &bg_coords, r_bg, true); int16_t mask_rout_id = LV_MASK_ID_INV;
// mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL);
// int16_t mask_rout_id = LV_MASK_ID_INV;
// mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL); lv_area_t a;
//
// lv_area_t a; /*Draw the top right corner*/
// a.x2 = sh_area.x2;
// /*Draw the top right corner*/ a.x1 = a.x2 - corner_size + 1;
// a.x2 = sh_area.x2; a.y1 = sh_area.y1;
// a.x1 = a.x2 - corner_size + 1; a.y2 = a.y1;
// a.y1 = sh_area.y1;
// a.y2 = a.y1; lv_coord_t first_px;
// first_px = 0;
// lv_coord_t first_px; if(disp_area->x1 > a.x1) {
// first_px = 0; first_px = disp_area->x1 - a.x1;
// if(disp_area->x1 > a.x1) { }
// first_px = disp_area->x1 - a.x1;
// } lv_coord_t hor_mid_dist = (sh_area.x1 + lv_area_get_width(&sh_area) / 2) - (a.x1 + first_px);
// if(hor_mid_dist > 0) {
// lv_coord_t hor_mid_dist = (sh_area.x1 + lv_area_get_width(&sh_area) / 2) - (a.x1 + first_px); first_px += hor_mid_dist;
// if(hor_mid_dist > 0) { }
// first_px += hor_mid_dist; a.x1 += first_px;
// }
// a.x1 += first_px; lv_coord_t ver_mid_dist = (a.y1 + corner_size) - (sh_area.y1 + lv_area_get_height(&sh_area) / 2);
// lv_coord_t ver_mid_corr = 0;
// lv_coord_t ver_mid_dist = (a.y1 + corner_size) - (sh_area.y1 + lv_area_get_height(&sh_area) / 2); if(ver_mid_dist <= 0) ver_mid_dist = 0;
// lv_coord_t ver_mid_corr = 0; else {
// if(ver_mid_dist <= 0) ver_mid_dist = 0; if(lv_area_get_height(&sh_area) & 0x1) ver_mid_corr = 1;
// else { }
// if(lv_area_get_height(&sh_area) & 0x1) ver_mid_corr = 1; lv_opa_t * sh_buf_tmp = sh_buf;
// }
// lv_opa_t * sh_buf_tmp = sh_buf; lv_coord_t y;
// for(y = 0; y < corner_size - ver_mid_dist + ver_mid_corr; y++) {
// lv_coord_t y; memcpy(mask_buf, sh_buf_tmp, corner_size);
// for(y = 0; y < corner_size - ver_mid_dist + ver_mid_corr; y++) { mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// memcpy(mask_buf, sh_buf_tmp, corner_size); if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
// mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED; lv_blend_fill(clip, &a,
// dsc->shadow_color, mask_buf + first_px, mask_res, opa, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a, a.y1++;
// style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode); a.y2++;
// a.y1++; sh_buf_tmp += corner_size;
// a.y2++; }
// sh_buf_tmp += corner_size;
// } /*Draw the bottom right corner*/
// a.y1 = sh_area.y2;
// /*Draw the bottom right corner*/ a.y2 = a.y1;
// a.y1 = sh_area.y2;
// a.y2 = a.y1; sh_buf_tmp = sh_buf ;
//
// sh_buf_tmp = sh_buf ; for(y = 0; y < corner_size - ver_mid_dist; y++) {
// memcpy(mask_buf, sh_buf_tmp, corner_size);
// for(y = 0; y < corner_size - ver_mid_dist; y++) { mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// memcpy(mask_buf, sh_buf_tmp, corner_size); if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
// mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED; lv_blend_fill(clip, &a,
// dsc->shadow_color, mask_buf + first_px, mask_res, opa, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a, a.y1--;
// style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode); a.y2--;
// a.y1--; sh_buf_tmp += corner_size;
// a.y2--; }
// sh_buf_tmp += corner_size;
// } /*Fill the right side*/
// a.y1 = sh_area.y1 + corner_size;
// /*Fill the right side*/ a.y2 = a.y1;
// a.y1 = sh_area.y1 + corner_size; sh_buf_tmp = sh_buf + corner_size * (corner_size - 1);
// a.y2 = a.y1;
// sh_buf_tmp = sh_buf + corner_size * (corner_size - 1); lv_coord_t x;
//
// lv_coord_t x; if(simple_mode) {
// /*Draw vertical lines*/
// if(simple_mode) { lv_area_t va;
// /*Draw vertical lines*/ va.x1 = a.x1;
// lv_area_t va; va.x2 = a.x1;
// va.x1 = a.x1; va.y1 = sh_area.y1 + corner_size;
// va.x2 = a.x1; va.y2 = sh_area.y2 - corner_size;
// va.y1 = sh_area.y1 + corner_size;
// va.y2 = sh_area.y2 - corner_size; if(va.y1 <= va.y2) {
// for(x = a.x1; x < a.x2; x++) {
// if(va.y1 <= va.y2) { if(x > coords->x2) {
// for(x = a.x1; x < a.x2; x++) { lv_opa_t opa_tmp = sh_buf_tmp[x - a.x1 + first_px];
// if(x > coords->x2) { if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
// lv_opa_t opa_tmp = sh_buf_tmp[x - a.x1 + first_px]; lv_blend_fill(clip, &va,
// if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8; dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &va, }
// style->body.shadow.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode); va.x1++;
// } va.x2++;
// va.x1++; }
// va.x2++; }
// } }
// } else {
// } for(y = corner_size; y < lv_area_get_height(&sh_area) - corner_size; y++) {
// else { memcpy(mask_buf, sh_buf_tmp, corner_size);
// for(y = corner_size; y < lv_area_get_height(&sh_area) - corner_size; y++) { mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// memcpy(mask_buf, sh_buf_tmp, corner_size); if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
// mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED; lv_blend_fill(clip, &a,
// dsc->shadow_color, mask_buf+first_px, mask_res, opa, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a, a.y1++;
// style->body.shadow.color, mask_buf+first_px, mask_res, opa, style->body.shadow.blend_mode); a.y2++;
// a.y1++; }
// a.y2++; }
// }
// } /*Invert the shadow corner buffer and draw the corners on the left*/
// sh_buf_tmp = sh_buf ;
// /*Invert the shadow corner buffer and draw the corners on the left*/ for(y = 0; y < corner_size; y++) {
// sh_buf_tmp = sh_buf ; for(x = 0; x < corner_size / 2; x++) {
// for(y = 0; y < corner_size; y++) { lv_opa_t tmp = sh_buf_tmp[x];
// for(x = 0; x < corner_size / 2; x++) { sh_buf_tmp[x] = sh_buf_tmp[corner_size - x - 1];
// lv_opa_t tmp = sh_buf_tmp[x]; sh_buf_tmp[corner_size - x - 1] = tmp;
// sh_buf_tmp[x] = sh_buf_tmp[corner_size - x - 1]; }
// sh_buf_tmp[corner_size - x - 1] = tmp; sh_buf_tmp += corner_size;
// } }
// sh_buf_tmp += corner_size;
// } /*Draw the top left corner*/
// a.x1 = sh_area.x1;
// /*Draw the top left corner*/ a.x2 = a.x1 + corner_size - 1;
// a.x1 = sh_area.x1; a.y1 = sh_area.y1;
// a.x2 = a.x1 + corner_size - 1; a.y2 = a.y1;
// a.y1 = sh_area.y1;
// a.y2 = a.y1; if(a.x2 > sh_area.x1 + lv_area_get_width(&sh_area)/2 - 1) {
// a.x2 = sh_area.x1 + lv_area_get_width(&sh_area)/2 -1 ;
// if(a.x2 > sh_area.x1 + lv_area_get_width(&sh_area)/2 - 1) { }
// a.x2 = sh_area.x1 + lv_area_get_width(&sh_area)/2 -1 ;
// } first_px = 0;
// if(disp_area->x1 >= a.x1) {
// first_px = 0; first_px = disp_area->x1 - a.x1;
// if(disp_area->x1 >= a.x1) { a.x1 += first_px;
// first_px = disp_area->x1 - a.x1; }
// a.x1 += first_px;
// } sh_buf_tmp = sh_buf ;
// for(y = 0; y < corner_size - ver_mid_dist + ver_mid_corr; y++) {
// sh_buf_tmp = sh_buf ; memcpy(mask_buf, sh_buf_tmp, corner_size);
// for(y = 0; y < corner_size - ver_mid_dist + ver_mid_corr; y++) { mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// memcpy(mask_buf, sh_buf_tmp, corner_size); if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
// mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED; lv_blend_fill(clip, &a,
// dsc->shadow_color, mask_buf + first_px, mask_res, opa, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a, a.y1++;
// style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode); a.y2++;
// a.y1++; sh_buf_tmp += corner_size;
// a.y2++; }
// sh_buf_tmp += corner_size;
// } /*Draw the bottom left corner*/
// a.y1 = sh_area.y2;
// /*Draw the bottom left corner*/ a.y2 = a.y1;
// a.y1 = sh_area.y2;
// a.y2 = a.y1; sh_buf_tmp = sh_buf ;
//
// sh_buf_tmp = sh_buf ; for(y = 0; y < corner_size - ver_mid_dist; y++) {
// memcpy(mask_buf, sh_buf_tmp, corner_size);
// for(y = 0; y < corner_size - ver_mid_dist; y++) { mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// memcpy(mask_buf, sh_buf_tmp, corner_size); if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
// mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED; lv_blend_fill(clip, &a,
// dsc->shadow_color, mask_buf + first_px, mask_res, opa, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a, a.y1--;
// style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode); a.y2--;
// a.y1--; sh_buf_tmp += corner_size;
// a.y2--; }
// sh_buf_tmp += corner_size;
// } /*Fill the left side*/
// a.y1 = sh_area.y1+corner_size;
// /*Fill the left side*/ a.y2 = a.y1;
// a.y1 = sh_area.y1+corner_size;
// a.y2 = a.y1; sh_buf_tmp = sh_buf + corner_size * (corner_size - 1);
//
// sh_buf_tmp = sh_buf + corner_size * (corner_size - 1); if(simple_mode) {
// /*Draw vertical lines*/
// if(simple_mode) { lv_area_t va;
// /*Draw vertical lines*/ va.x1 = a.x1;
// lv_area_t va; va.x2 = a.x1;
// va.x1 = a.x1; va.y1 = sh_area.y1 + corner_size;
// va.x2 = a.x1; va.y2 = sh_area.y2 - corner_size;
// va.y1 = sh_area.y1 + corner_size;
// va.y2 = sh_area.y2 - corner_size; if(va.y1 <= va.y2) {
// for(x = a.x1; x < coords->x1; x++) {
// if(va.y1 <= va.y2) { lv_opa_t opa_tmp = sh_buf_tmp[x - a.x1 + first_px];
// for(x = a.x1; x < coords->x1; x++) { if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
// lv_opa_t opa_tmp = sh_buf_tmp[x - a.x1 + first_px]; lv_blend_fill(clip, &va,
// if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8; dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &va, va.x1++;
// style->body.shadow.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode); va.x2++;
// va.x1++; }
// va.x2++; }
// } }
// } else {
// } for(y = corner_size; y < lv_area_get_height(&sh_area) - corner_size; y++) {
// else { memcpy(mask_buf, sh_buf_tmp, corner_size);
// for(y = corner_size; y < lv_area_get_height(&sh_area) - corner_size; y++) { mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// memcpy(mask_buf, sh_buf_tmp, corner_size); if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
// mask_res = lv_draw_mask_apply(mask_buf + first_px, a.x1, a.y1, lv_area_get_width(&a));
// if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED; lv_blend_fill(clip, &a,
// dsc->shadow_color, mask_buf + first_px, mask_res, opa, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a, a.y1++;
// style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode); a.y2++;
// a.y1++; }
// a.y2++; }
// }
// } /*Fill the top side*/
//
// /*Fill the top side*/ a.x1 = sh_area.x1 + corner_size;
// a.x2 = sh_area.x2 - corner_size;
// a.x1 = sh_area.x1 + corner_size; a.y1 = sh_area.y1;
// a.x2 = sh_area.x2 - corner_size; a.y2 = a.y1;
// a.y1 = sh_area.y1;
// a.y2 = a.y1;
// first_px = 0;
// if(disp_area->x1 > a.x1) {
// first_px = 0; first_px = disp_area->x1 - a.x1;
// if(disp_area->x1 > a.x1) { a.x1 += first_px;
// first_px = disp_area->x1 - a.x1; }
// a.x1 += first_px;
// } if(a.x1 <= a.x2) {
//
// if(a.x1 <= a.x2) { sh_buf_tmp = sh_buf + corner_size - 1;
//
// sh_buf_tmp = sh_buf + corner_size - 1; y_max = corner_size - ver_mid_dist;
// if(simple_mode) {
// y_max = corner_size - ver_mid_dist; y_max = sw / 2 + 1;
// if(simple_mode) { if(y_max > corner_size - ver_mid_dist) y_max = corner_size - ver_mid_dist;
// y_max = sw / 2 + 1; }
// if(y_max > corner_size - ver_mid_dist) y_max = corner_size - ver_mid_dist;
// } for(y = 0; y < y_max; y++) {
// if(simple_mode == false) {
// for(y = 0; y < y_max; y++) { memset(mask_buf, sh_buf_tmp[0], lv_area_get_width(&a));
// if(simple_mode == false) { mask_res = lv_draw_mask_apply(mask_buf, a.x1, a.y1, lv_area_get_width(&a));
// memset(mask_buf, sh_buf_tmp[0], lv_area_get_width(&a)); if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
// mask_res = lv_draw_mask_apply(mask_buf, a.x1, a.y1, lv_area_get_width(&a));
// if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED; lv_blend_fill(clip, &a,
// dsc->shadow_color, mask_buf, mask_res, opa, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a, } else {
// style->body.shadow.color, mask_buf, mask_res, opa, style->body.shadow.blend_mode);
// } else { lv_opa_t opa_tmp = sh_buf_tmp[0];
// if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
// lv_opa_t opa_tmp = sh_buf_tmp[0]; lv_blend_fill(clip, &a,
// if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8; dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a, }
// style->body.shadow.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode);
// } a.y1++;
// a.y2++;
// a.y1++; sh_buf_tmp += corner_size;
// a.y2++; }
// sh_buf_tmp += corner_size;
// } /*Fill the bottom side*/
// lv_coord_t y_min = simple_mode ? (corner_size - (sh_area.y2 - coords->y2)) : ver_mid_dist;
// /*Fill the bottom side*/ if(y_min < 0) y_min = 0;
// lv_coord_t y_min = simple_mode ? (corner_size - (sh_area.y2 - coords->y2)) : ver_mid_dist; sh_buf_tmp = sh_buf + corner_size * (corner_size - y_min - 1 ) + corner_size - 1;
// if(y_min < 0) y_min = 0;
// sh_buf_tmp = sh_buf + corner_size * (corner_size - y_min - 1 ) + corner_size - 1; a.y1 = sh_area.y2 - corner_size + 1 + y_min;
// a.y2 = a.y1;
// a.y1 = sh_area.y2 - corner_size + 1 + y_min;
// a.y2 = a.y1; for(y = y_min; y < corner_size; y++) {
// if(simple_mode == false) {
// for(y = y_min; y < corner_size; y++) { memset(mask_buf, sh_buf_tmp[0], lv_area_get_width(&a));
// if(simple_mode == false) { mask_res = lv_draw_mask_apply(mask_buf, a.x1, a.y1, lv_area_get_width(&a));
// memset(mask_buf, sh_buf_tmp[0], lv_area_get_width(&a)); if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
// mask_res = lv_draw_mask_apply(mask_buf, a.x1, a.y1, lv_area_get_width(&a)); lv_blend_fill(clip, &a,
// if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED; dsc->shadow_color, mask_buf, mask_res, opa, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a, } else {
// style->body.shadow.color, mask_buf, mask_res, opa, style->body.shadow.blend_mode); lv_opa_t opa_tmp = sh_buf_tmp[0];
// } else { if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
// lv_opa_t opa_tmp = sh_buf_tmp[0]; lv_blend_fill(clip, &a,
// if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8; dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a, }
// style->body.shadow.color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, style->body.shadow.blend_mode);
// } a.y1++;
// a.y2++;
// a.y1++; sh_buf_tmp -= corner_size;
// a.y2++; }
// sh_buf_tmp -= corner_size; }
// }
// } /*Finally fill the middle area*/
// if(simple_mode == false) {
// /*Finally fill the middle area*/ a.y1 = sh_area.y1 + corner_size;
// if(simple_mode == false) { a.y2 = a.y1;
// a.y1 = sh_area.y1 + corner_size; if(a.x1 <= a.x2) {
// a.y2 = a.y1; for(y = 0; y < lv_area_get_height(&sh_area) - corner_size * 2; y++) {
// if(a.x1 <= a.x2) { memset(mask_buf, 0xFF, lv_area_get_width(&a));
// for(y = 0; y < lv_area_get_height(&sh_area) - corner_size * 2; y++) { mask_res = lv_draw_mask_apply(mask_buf, a.x1, a.y1, lv_area_get_width(&a));
// memset(mask_buf, 0xFF, lv_area_get_width(&a)); lv_blend_fill(clip, &a,
// mask_res = lv_draw_mask_apply(mask_buf, a.x1, a.y1, lv_area_get_width(&a)); dsc->shadow_color, mask_buf, mask_res, opa, dsc->shadow_blend_mode);
// lv_blend_fill(clip, &a,
// style->body.shadow.color, mask_buf, mask_res, opa, style->body.shadow.blend_mode); a.y1++;
// a.y2++;
// a.y1++; }
// a.y2++; }
// } }
// }
// } lv_draw_mask_remove_id(mask_rout_id);
// lv_mem_buf_release(mask_buf);
// lv_draw_mask_remove_id(mask_rout_id); lv_mem_buf_release(sh_buf);
// lv_mem_buf_release(mask_buf);
// lv_mem_buf_release(sh_buf);
} }
static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf, lv_coord_t sw, lv_coord_t r) static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf, lv_coord_t sw, lv_coord_t r)
@ -945,7 +944,6 @@ static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf,
#endif #endif
lv_mem_buf_release(sh_ups_buf); lv_mem_buf_release(sh_ups_buf);
} }
static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, lv_opa_t * res_buf, uint16_t * sh_ups_buf) static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, lv_opa_t * res_buf, uint16_t * sh_ups_buf)

View File

@ -45,9 +45,11 @@ typedef struct {
/*Shadow*/ /*Shadow*/
lv_color_t shadow_color; lv_color_t shadow_color;
lv_style_value_t shadow_blur; lv_style_value_t shadow_width;
lv_style_value_t shadow_ofs_x; lv_style_value_t shadow_ofs_x;
lv_style_value_t shadow_ofs_y; lv_style_value_t shadow_ofs_y;
lv_style_value_t shadow_spread;
lv_style_value_t shadow_blend_mode;
lv_opa_t shadow_opa; lv_opa_t shadow_opa;
/*Pattern*/ /*Pattern*/

View File

@ -447,7 +447,6 @@ static lv_design_res_t lv_btn_design(lv_obj_t * btn, const lv_area_t * clip_area
lv_draw_rect_dsc_t draw_dsc; lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc); lv_draw_rect_dsc_init(&draw_dsc);
lv_obj_init_draw_rect_dsc(btn, LV_OBJ_PART_MAIN, &draw_dsc); lv_obj_init_draw_rect_dsc(btn, LV_OBJ_PART_MAIN, &draw_dsc);
lv_draw_rect(&btn->coords, clip_area, &draw_dsc); lv_draw_rect(&btn->coords, clip_area, &draw_dsc);
if(lv_obj_get_style_value(btn, LV_OBJ_PART_MAIN, LV_STYLE_CLIP_CORNER)) { if(lv_obj_get_style_value(btn, LV_OBJ_PART_MAIN, LV_STYLE_CLIP_CORNER)) {

View File

@ -1044,9 +1044,6 @@ static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_
return LV_DESIGN_RES_NOT_COVER; return LV_DESIGN_RES_NOT_COVER;
else if(mode == LV_DESIGN_DRAW_MAIN) { else if(mode == LV_DESIGN_DRAW_MAIN) {
lv_area_t coords; lv_area_t coords;
const lv_font_t * font = lv_obj_get_style_ptr(label, LV_LABEL_PART_MAIN, LV_STYLE_FONT);
lv_style_value_t line_space = lv_obj_get_style_value(label, LV_LABEL_PART_MAIN, LV_STYLE_LINE_SPACE);
lv_style_value_t letter_space = lv_obj_get_style_value(label, LV_LABEL_PART_MAIN, LV_STYLE_LETTER_SPACE);
lv_obj_get_coords(label, &coords); lv_obj_get_coords(label, &coords);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label); lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
@ -1078,12 +1075,22 @@ static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_
if(align == LV_LABEL_ALIGN_CENTER) flag |= LV_TXT_FLAG_CENTER; if(align == LV_LABEL_ALIGN_CENTER) flag |= LV_TXT_FLAG_CENTER;
if(align == LV_LABEL_ALIGN_RIGHT) flag |= LV_TXT_FLAG_RIGHT; if(align == LV_LABEL_ALIGN_RIGHT) flag |= LV_TXT_FLAG_RIGHT;
lv_draw_label_dsc_t label_draw_dsc;
lv_draw_label_dsc_init(&label_draw_dsc);
label_draw_dsc.sel_start = lv_label_get_text_sel_start(label);
label_draw_dsc.sel_end = lv_label_get_text_sel_end(label);
label_draw_dsc.ofs_x = ext->offset.x;
label_draw_dsc.ofs_y = ext->offset.y;
label_draw_dsc.flag = flag;
lv_obj_init_draw_label_dsc(label, LV_LABEL_PART_MAIN, &label_draw_dsc);
/* In ROLL mode the CENTER and RIGHT are pointless so remove them. /* In ROLL mode the CENTER and RIGHT are pointless so remove them.
* (In addition they will result mis-alignment is this case)*/ * (In addition they will result mis-alignment is this case)*/
if((ext->long_mode == LV_LABEL_LONG_SROLL || ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) && if((ext->long_mode == LV_LABEL_LONG_SROLL || ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) &&
(ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) { (ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) {
lv_point_t size; lv_point_t size;
lv_txt_get_size(&size, ext->text, font, letter_space, line_space, lv_txt_get_size(&size, ext->text, label_draw_dsc.font, label_draw_dsc.letter_space, label_draw_dsc.line_space,
LV_COORD_MAX, flag); LV_COORD_MAX, flag);
if(size.x > lv_obj_get_width(label)) { if(size.x > lv_obj_get_width(label)) {
flag &= ~LV_TXT_FLAG_RIGHT; flag &= ~LV_TXT_FLAG_RIGHT;
@ -1100,27 +1107,17 @@ static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_
lv_draw_label_hint_t * hint = NULL; lv_draw_label_hint_t * hint = NULL;
#endif #endif
lv_draw_label_dsc_t label_draw_dsc;
lv_draw_label_dsc_init(&label_draw_dsc);
label_draw_dsc.sel_start = lv_label_get_text_sel_start(label);
label_draw_dsc.sel_end = lv_label_get_text_sel_end(label);
label_draw_dsc.ofs_x = ext->offset.x;
label_draw_dsc.ofs_y = ext->offset.y;
label_draw_dsc.flag = flag;
lv_obj_init_draw_label_dsc(label, LV_LABEL_PART_MAIN, &label_draw_dsc);
lv_draw_label(&coords, clip_area, &label_draw_dsc, ext->text, hint); lv_draw_label(&coords, clip_area, &label_draw_dsc, ext->text, hint);
if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) { if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) {
lv_point_t size; lv_point_t size;
lv_txt_get_size(&size, ext->text, font, letter_space, line_space, lv_txt_get_size(&size, ext->text, label_draw_dsc.font, label_draw_dsc.letter_space, label_draw_dsc.line_space,
LV_COORD_MAX, flag); LV_COORD_MAX, flag);
/*Draw the text again next to the original to make an circular effect */ /*Draw the text again next to the original to make an circular effect */
if(size.x > lv_obj_get_width(label)) { if(size.x > lv_obj_get_width(label)) {
label_draw_dsc.ofs_x = ext->offset.x + size.x + label_draw_dsc.ofs_x = ext->offset.x + size.x +
lv_font_get_glyph_width(font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT; lv_font_get_glyph_width(label_draw_dsc.font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT;
label_draw_dsc.ofs_y = ext->offset.y; label_draw_dsc.ofs_y = ext->offset.y;
lv_draw_label(&coords, clip_area, &label_draw_dsc, ext->text, hint); lv_draw_label(&coords, clip_area, &label_draw_dsc, ext->text, hint);
@ -1129,7 +1126,7 @@ static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_
/*Draw the text again below the original to make an circular effect */ /*Draw the text again below the original to make an circular effect */
if(size.y > lv_obj_get_height(label)) { if(size.y > lv_obj_get_height(label)) {
label_draw_dsc.ofs_x = ext->offset.x; label_draw_dsc.ofs_x = ext->offset.x;
label_draw_dsc.ofs_y = ext->offset.y + size.y + lv_font_get_line_height(font); label_draw_dsc.ofs_y = ext->offset.y + size.y + lv_font_get_line_height(label_draw_dsc.font);
lv_draw_label(&coords, clip_area, &label_draw_dsc, ext->text, hint); lv_draw_label(&coords, clip_area, &label_draw_dsc, ext->text, hint);
} }

View File

@ -667,7 +667,7 @@ static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_ar
lv_obj_init_draw_rect_dsc(page, LV_PAGE_PART_BG, &draw_dsc); lv_obj_init_draw_rect_dsc(page, LV_PAGE_PART_BG, &draw_dsc);
/*Draw only a border. It ensures that the page looks "closed" even with overflowing scrollable*/ /*Draw only a border. It ensures that the page looks "closed" even with overflowing scrollable*/
draw_dsc.shadow_blur = 0; draw_dsc.shadow_width = 0;
draw_dsc.bg_opa = LV_OPA_TRANSP; draw_dsc.bg_opa = LV_OPA_TRANSP;
lv_draw_rect(&page->coords, clip_area, &draw_dsc); lv_draw_rect(&page->coords, clip_area, &draw_dsc);

View File

@ -84,7 +84,6 @@ static void basic_init(void)
lv_style_set_color(&panel, LV_STYLE_BORDER_COLOR, LV_COLOR_GRAY); lv_style_set_color(&panel, LV_STYLE_BORDER_COLOR, LV_COLOR_GRAY);
lv_style_set_color(&panel, LV_STYLE_TEXT_COLOR, LV_COLOR_BLACK); lv_style_set_color(&panel, LV_STYLE_TEXT_COLOR, LV_COLOR_BLACK);
lv_style_init(&btn); lv_style_init(&btn);
lv_style_set_value(&btn, LV_STYLE_PAD_LEFT, LV_DPI / 20); lv_style_set_value(&btn, LV_STYLE_PAD_LEFT, LV_DPI / 20);
lv_style_set_value(&btn, LV_STYLE_PAD_RIGHT, LV_DPI / 20); lv_style_set_value(&btn, LV_STYLE_PAD_RIGHT, LV_DPI / 20);
@ -102,9 +101,9 @@ static void basic_init(void)
lv_style_set_color(&btn, LV_STYLE_TEXT_COLOR, LV_COLOR_WHITE); lv_style_set_color(&btn, LV_STYLE_TEXT_COLOR, LV_COLOR_WHITE);
lv_style_set_opa(&btn, LV_STYLE_BG_OPA, LV_OPA_50); lv_style_set_opa(&btn, LV_STYLE_BG_OPA, LV_OPA_50);
lv_style_set_opa(&btn, LV_STYLE_BORDER_OPA, LV_OPA_70); lv_style_set_opa(&btn, LV_STYLE_BORDER_OPA, LV_OPA_70);
lv_style_set_opa(&btn, LV_STYLE_TEXT_OPA, LV_OPA_50); // lv_style_set_opa(&btn, LV_STYLE_TEXT_OPA, LV_OPA_50);
lv_style_set_value(&btn, LV_STYLE_SHADOW_WIDTH, 5); // lv_style_set_value(&btn, LV_STYLE_SHADOW_WIDTH, 5);
lv_style_set_value(&btn, LV_STYLE_SHADOW_OFFSET_Y, 10); // lv_style_set_value(&btn, LV_STYLE_SHADOW_OFFSET_Y, 10);
lv_style_set_color(&btn, LV_STYLE_BORDER_COLOR | LV_STYLE_STATE_FOCUS, LV_COLOR_AQUA); lv_style_set_color(&btn, LV_STYLE_BORDER_COLOR | LV_STYLE_STATE_FOCUS, LV_COLOR_AQUA);
lv_style_set_value(&btn, LV_STYLE_BORDER_WIDTH | LV_STYLE_STATE_FOCUS, 6); lv_style_set_value(&btn, LV_STYLE_BORDER_WIDTH | LV_STYLE_STATE_FOCUS, 6);
lv_style_set_ptr(&btn, LV_STYLE_PATTERN_IMAGE | LV_STYLE_STATE_CHECKED, LV_SYMBOL_OK); lv_style_set_ptr(&btn, LV_STYLE_PATTERN_IMAGE | LV_STYLE_STATE_CHECKED, LV_SYMBOL_OK);
@ -558,65 +557,7 @@ static void roller_init(void)
static void tabview_init(void) static void tabview_init(void)
{ {
#if LV_USE_TABVIEW != 0 #if LV_USE_TABVIEW != 0
static lv_style_t tab_rel, tab_pr, tab_trel, tab_tpr, tab_indic;
lv_style_copy(&tab_rel, &def);
tab_rel.body.main_color = lv_color_hex3(0x666);
tab_rel.body.grad_color = lv_color_hex3(0x666);
tab_rel.body.padding.left = 0;
tab_rel.body.padding.right = 0;
tab_rel.body.padding.top = LV_DPI / 6;
tab_rel.body.padding.bottom = LV_DPI / 6;
tab_rel.body.padding.inner = 0;
tab_rel.body.border.width = 1;
tab_rel.body.border.color = LV_COLOR_SILVER;
tab_rel.body.border.opa = LV_OPA_40;
tab_rel.text.color = lv_color_hex3(0xDDD);
tab_rel.text.font = _font;
lv_style_copy(&tab_pr, &tab_rel);
tab_pr.body.main_color = lv_color_hex3(0x444);
tab_pr.body.grad_color = lv_color_hex3(0x444);
lv_style_copy(&tab_trel, &def);
tab_trel.body.opa = LV_OPA_TRANSP;
tab_trel.body.padding.left = 0;
tab_trel.body.padding.right = 0;
tab_trel.body.padding.top = LV_DPI / 6;
tab_trel.body.padding.bottom = LV_DPI / 6;
tab_trel.body.padding.inner = 0;
tab_trel.body.border.width = 1;
tab_trel.body.border.color = LV_COLOR_SILVER;
tab_trel.body.border.opa = LV_OPA_40;
tab_trel.text.color = lv_color_hsv_to_rgb(_hue, 10, 94);
tab_trel.text.font = _font;
lv_style_copy(&tab_tpr, &def);
tab_tpr.body.main_color = LV_COLOR_GRAY;
tab_tpr.body.grad_color = LV_COLOR_GRAY;
tab_tpr.body.padding.left = 0;
tab_tpr.body.padding.right = 0;
tab_tpr.body.padding.top = LV_DPI / 6;
tab_tpr.body.padding.bottom = LV_DPI / 6;
tab_tpr.body.padding.inner = 0;
tab_tpr.body.border.width = 1;
tab_tpr.body.border.color = LV_COLOR_SILVER;
tab_tpr.body.border.opa = LV_OPA_40;
tab_tpr.text.color = lv_color_hsv_to_rgb(_hue, 10, 94);
tab_tpr.text.font = _font;
lv_style_copy(&tab_indic, &def);
tab_indic.body.border.width = 0;
tab_indic.body.main_color = lv_color_hsv_to_rgb(_hue, 80, 87);
tab_indic.body.grad_color = lv_color_hsv_to_rgb(_hue, 80, 87);
tab_indic.body.padding.inner = LV_DPI / 10; /*Indicator height*/
theme.style.tabview.bg = &bg;
theme.style.tabview.indic = &tab_indic;
theme.style.tabview.btn.bg = &lv_style_transp_tight;
theme.style.tabview.btn.rel = &tab_rel;
theme.style.tabview.btn.pr = &tab_pr;
theme.style.tabview.btn.tgl_rel = &tab_trel;
theme.style.tabview.btn.tgl_pr = &tab_tpr;
#endif #endif
} }