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)
{
if(part == LV_OBJ_PART_MAIN) return &obj->style_dsc;
void * p = ∂
lv_res_t res;
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;
}
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:
if(dsc->cache.shadow_width == 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;
}
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:
if(dsc->cache.radius != LV_STYLE_CACHE_RADIUS_SKIPPED) {
return dsc->cache.radius == LV_STYLE_CACHE_RADIUS_CIRCLE ? LV_RADIUS_CIRCLE : dsc->cache.radius;
}
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,7 +2270,9 @@ lv_color_t lv_obj_get_style_color(const lv_obj_t * obj, uint8_t part, lv_style_p
return LV_COLOR_BLACK;
case LV_STYLE_BORDER_COLOR:
return LV_COLOR_BLACK;
}
case LV_STYLE_SHADOW_COLOR:
return LV_COLOR_GRAY;
}
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)
{
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;
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_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) {
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;
@ -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->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);
lv_opa_t opa_scale = lv_obj_get_style_opa(obj, part, LV_STYLE_OPA_SCALE);
if(opa_scale < LV_OPA_MAX) {
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;
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);
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 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);
if(ptr == LV_FONT_DEFAULT) dsc->cache.font = LV_STYLE_CACHE_FONT_DEFAULT;
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
static lv_color_t debug_color = LV_COLOR_RED;
LV_STYLE_CREATE(style_debug, &lv_style_plain);
style_debug.body.main_color = debug_color;
style_debug.body.grad_color = debug_color;
style_debug.body.border.width = 2;
style_debug.body.border.color.full = (debug_color.full + 0x13) * 9;
lv_draw_rect(&obj_ext_mask, &obj_ext_mask, &style_debug, LV_OPA_50);
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
draw_dsc.bg_color.full = debug_color.full;
draw_dsc.bg_opa = LV_OPA_50;
draw_dsc.border_width = 2;
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 += 0xA1;
#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;
attr_act.full = style->map[i + 1];
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) {
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*/
else if((attr_act.bits.state & (~attr.bits.state)) == 0) {
/* 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_SKIPPED 1
#define LV_STYLE_CACHE_BORDER_PART_FULL 0
#define LV_STYLE_CACHE_BORDER_PART_SKIPPED 1
typedef struct {
/*32 bit*/
uint32_t pad_left :6;
@ -188,7 +192,7 @@ typedef struct {
uint32_t pad_inner :6;
uint32_t bg_grad_dir :2;
/*32 bit*/
/*31 bit*/
uint32_t border_width :3;
uint32_t line_width :3;
uint32_t letter_space :3;
@ -209,11 +213,13 @@ typedef struct {
uint32_t text_blend_mode :1;
uint32_t line_blend_mode :1;
uint32_t image_blend_mode :1;
uint32_t shadow_blend_mode :1;
/*32 bit*/
uint32_t radius :4;
uint32_t font :1;
uint32_t clip_corner :1;
uint32_t border_part :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)
{
memset(dsc, 0x00, sizeof(lv_draw_rect_dsc_t));
dsc->bg_opa = LV_OPA_COVER;
dsc->bg_grad_color_stop = 0xFF;
dsc->bg_opa = LV_OPA_COVER;
dsc->border_opa = LV_OPA_COVER;
dsc->overlay_opa = LV_OPA_TRANSP;
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;
/*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,
dsc->bg_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa,
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)
{
// /*Check whether the shadow is visible*/
// if(style->body.shadow.width == 0) return;
//
// if(style->body.shadow.width == 1 && style->body.shadow.offset.x == 0 &&
// style->body.shadow.offset.y == 0 && style->body.shadow.spread <= 0) {
// return;
// }
//
// lv_coord_t sw = style->body.shadow.width;
//
// lv_area_t sh_rect_area;
// sh_rect_area.x1 = coords->x1 + style->body.shadow.offset.x - style->body.shadow.spread;
// sh_rect_area.x2 = coords->x2 + style->body.shadow.offset.x + style->body.shadow.spread;
// sh_rect_area.y1 = coords->y1 + style->body.shadow.offset.y - style->body.shadow.spread;
// sh_rect_area.y2 = coords->y2 + style->body.shadow.offset.y + style->body.shadow.spread;
//
// lv_area_t sh_area;
// sh_area.x1 = sh_rect_area.x1 - 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.y2 = sh_rect_area.y2 + sw / 2 + 1;
//
// lv_opa_t opa = style->body.shadow.opa;
//
// if(opa_scale != LV_OPA_COVER) opa = (opa * opa_scale) >> 8;
//
// 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);
//
// /* Get clipped fill area which is the real draw area.
// * It is always the same or inside `fill_area` */
// lv_area_t draw_area;
// bool is_common;
// is_common = lv_area_intersect(&draw_area, &sh_area, clip);
// if(is_common == false) return;
//
// 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`*/
// draw_area.x1 -= disp_area->x1;
// draw_area.y1 -= 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;
// lv_area_copy(&bg_coords, coords);
// bg_coords.x1 += 1;
// bg_coords.y1 += 1;
// bg_coords.x2 -= 1;
// bg_coords.y2 -= 1;
//
// /*Get the real radius*/
// lv_coord_t r_bg = style->body.radius;
// 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 = style->body.radius;
// 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_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;
// 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;
//
// /*Create a mask*/
// 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);
//
// int16_t mask_rout_id = LV_MASK_ID_INV;
// mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL);
//
// lv_area_t a;
//
// /*Draw the top right corner*/
// a.x2 = sh_area.x2;
// a.x1 = a.x2 - corner_size + 1;
// a.y1 = sh_area.y1;
// a.y2 = a.y1;
//
// lv_coord_t first_px;
// first_px = 0;
// 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) {
// first_px += hor_mid_dist;
// }
// 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;
// if(ver_mid_dist <= 0) ver_mid_dist = 0;
// else {
// if(lv_area_get_height(&sh_area) & 0x1) ver_mid_corr = 1;
// }
// 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++) {
// memcpy(mask_buf, sh_buf_tmp, corner_size);
// 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,
// style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode);
// a.y1++;
// a.y2++;
// sh_buf_tmp += corner_size;
// }
//
// /*Draw the bottom right corner*/
// a.y1 = sh_area.y2;
// a.y2 = a.y1;
//
// sh_buf_tmp = sh_buf ;
//
// for(y = 0; y < corner_size - ver_mid_dist; y++) {
// memcpy(mask_buf, sh_buf_tmp, corner_size);
// 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,
// style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode);
// a.y1--;
// a.y2--;
// sh_buf_tmp += corner_size;
// }
//
// /*Fill the right side*/
// a.y1 = sh_area.y1 + corner_size;
// a.y2 = a.y1;
// sh_buf_tmp = sh_buf + corner_size * (corner_size - 1);
//
// lv_coord_t x;
//
// if(simple_mode) {
// /*Draw vertical lines*/
// lv_area_t va;
// va.x1 = a.x1;
// va.x2 = a.x1;
// 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(x > coords->x2) {
// lv_opa_t opa_tmp = sh_buf_tmp[x - a.x1 + first_px];
// if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
// 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++;
// }
// }
// }
// else {
// for(y = corner_size; y < lv_area_get_height(&sh_area) - corner_size; y++) {
// memcpy(mask_buf, sh_buf_tmp, corner_size);
// 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,
// style->body.shadow.color, mask_buf+first_px, mask_res, opa, style->body.shadow.blend_mode);
// a.y1++;
// a.y2++;
// }
// }
//
// /*Invert the shadow corner buffer and draw the corners on the left*/
// sh_buf_tmp = sh_buf ;
// for(y = 0; y < corner_size; y++) {
// for(x = 0; x < corner_size / 2; x++) {
// lv_opa_t tmp = sh_buf_tmp[x];
// sh_buf_tmp[x] = sh_buf_tmp[corner_size - x - 1];
// sh_buf_tmp[corner_size - x - 1] = tmp;
// }
// sh_buf_tmp += corner_size;
// }
//
// /*Draw the top left corner*/
// a.x1 = sh_area.x1;
// a.x2 = a.x1 + corner_size - 1;
// 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 ;
// }
//
// first_px = 0;
// if(disp_area->x1 >= a.x1) {
// 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++) {
// memcpy(mask_buf, sh_buf_tmp, corner_size);
// 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,
// style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode);
// a.y1++;
// a.y2++;
// sh_buf_tmp += corner_size;
// }
//
// /*Draw the bottom left corner*/
// a.y1 = sh_area.y2;
// a.y2 = a.y1;
//
// sh_buf_tmp = sh_buf ;
//
// for(y = 0; y < corner_size - ver_mid_dist; y++) {
// memcpy(mask_buf, sh_buf_tmp, corner_size);
// 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,
// style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode);
// a.y1--;
// a.y2--;
// sh_buf_tmp += corner_size;
// }
//
// /*Fill the left side*/
// a.y1 = sh_area.y1+corner_size;
// a.y2 = a.y1;
//
// sh_buf_tmp = sh_buf + corner_size * (corner_size - 1);
//
// if(simple_mode) {
// /*Draw vertical lines*/
// lv_area_t va;
// va.x1 = a.x1;
// va.x2 = a.x1;
// 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++) {
// lv_opa_t opa_tmp = sh_buf_tmp[x - a.x1 + first_px];
// if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
// 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++;
// }
// }
// }
// else {
// for(y = corner_size; y < lv_area_get_height(&sh_area) - corner_size; y++) {
// memcpy(mask_buf, sh_buf_tmp, corner_size);
// 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,
// style->body.shadow.color, mask_buf + first_px, mask_res, opa, style->body.shadow.blend_mode);
// a.y1++;
// a.y2++;
// }
// }
//
// /*Fill the top side*/
//
// a.x1 = sh_area.x1 + corner_size;
// a.x2 = sh_area.x2 - corner_size;
// a.y1 = sh_area.y1;
// a.y2 = a.y1;
//
//
// first_px = 0;
// if(disp_area->x1 > a.x1) {
// first_px = disp_area->x1 - a.x1;
// a.x1 += first_px;
// }
//
// if(a.x1 <= a.x2) {
//
// sh_buf_tmp = sh_buf + corner_size - 1;
//
// y_max = corner_size - ver_mid_dist;
// if(simple_mode) {
// 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) {
// memset(mask_buf, sh_buf_tmp[0], lv_area_get_width(&a));
// 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,
// 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_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++;
// 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;
// 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;
//
// for(y = y_min; y < corner_size; y++) {
// if(simple_mode == false) {
// memset(mask_buf, sh_buf_tmp[0], lv_area_get_width(&a));
// 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,
// 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_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++;
// sh_buf_tmp -= corner_size;
// }
// }
//
// /*Finally fill the middle area*/
// if(simple_mode == false) {
// a.y1 = sh_area.y1 + corner_size;
// a.y2 = a.y1;
// if(a.x1 <= a.x2) {
// for(y = 0; y < lv_area_get_height(&sh_area) - corner_size * 2; y++) {
// memset(mask_buf, 0xFF, lv_area_get_width(&a));
// mask_res = lv_draw_mask_apply(mask_buf, a.x1, a.y1, lv_area_get_width(&a));
// lv_blend_fill(clip, &a,
// style->body.shadow.color, mask_buf, mask_res, opa, style->body.shadow.blend_mode);
//
// a.y1++;
// a.y2++;
// }
// }
// }
//
// lv_draw_mask_remove_id(mask_rout_id);
// lv_mem_buf_release(mask_buf);
// lv_mem_buf_release(sh_buf);
/*Check whether the shadow is visible*/
if(dsc->shadow_width == 0) return;
if(dsc->shadow_width == 1 && dsc->shadow_ofs_x == 0 &&
dsc->shadow_ofs_y == 0 && dsc->shadow_spread <= 0) {
return;
}
lv_coord_t sw = dsc->shadow_width;
lv_area_t sh_rect_area;
sh_rect_area.x1 = coords->x1 + dsc->shadow_ofs_x - dsc->shadow_spread;
sh_rect_area.x2 = coords->x2 + dsc->shadow_ofs_x + dsc->shadow_spread;
sh_rect_area.y1 = coords->y1 + dsc->shadow_ofs_y - dsc->shadow_spread;
sh_rect_area.y2 = coords->y2 + dsc->shadow_ofs_y + dsc->shadow_spread;
lv_area_t sh_area;
sh_area.x1 = sh_rect_area.x1 - 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.y2 = sh_rect_area.y2 + sw / 2 + 1;
lv_opa_t opa = dsc->shadow_opa;
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);
/* Get clipped fill area which is the real draw area.
* It is always the same or inside `fill_area` */
lv_area_t draw_area;
bool is_common;
is_common = lv_area_intersect(&draw_area, &sh_area, clip);
if(is_common == false) return;
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`*/
draw_area.x1 -= disp_area->x1;
draw_area.y1 -= 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;
lv_area_copy(&bg_coords, coords);
bg_coords.x1 += 1;
bg_coords.y1 += 1;
bg_coords.x2 -= 1;
bg_coords.y2 -= 1;
/*Get the real radius*/
lv_coord_t r_bg = dsc->radius;
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));
if(r_sh > short_side >> 1) r_sh = short_side >> 1;
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);
bool simple_mode = true;
if(lv_draw_mask_get_cnt() > 0) simple_mode = false;
else if(dsc->shadow_ofs_x != 0 || dsc->shadow_ofs_y != 0) simple_mode = false;
else if(dsc->shadow_spread != 0) simple_mode = false;
lv_coord_t y_max;
/*Create a mask*/
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);
int16_t mask_rout_id = LV_MASK_ID_INV;
mask_rout_id = lv_draw_mask_add(&mask_rout_param, NULL);
lv_area_t a;
/*Draw the top right corner*/
a.x2 = sh_area.x2;
a.x1 = a.x2 - corner_size + 1;
a.y1 = sh_area.y1;
a.y2 = a.y1;
lv_coord_t first_px;
first_px = 0;
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) {
first_px += hor_mid_dist;
}
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;
if(ver_mid_dist <= 0) ver_mid_dist = 0;
else {
if(lv_area_get_height(&sh_area) & 0x1) ver_mid_corr = 1;
}
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++) {
memcpy(mask_buf, sh_buf_tmp, corner_size);
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);
a.y1++;
a.y2++;
sh_buf_tmp += corner_size;
}
/*Draw the bottom right corner*/
a.y1 = sh_area.y2;
a.y2 = a.y1;
sh_buf_tmp = sh_buf ;
for(y = 0; y < corner_size - ver_mid_dist; y++) {
memcpy(mask_buf, sh_buf_tmp, corner_size);
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);
a.y1--;
a.y2--;
sh_buf_tmp += corner_size;
}
/*Fill the right side*/
a.y1 = sh_area.y1 + corner_size;
a.y2 = a.y1;
sh_buf_tmp = sh_buf + corner_size * (corner_size - 1);
lv_coord_t x;
if(simple_mode) {
/*Draw vertical lines*/
lv_area_t va;
va.x1 = a.x1;
va.x2 = a.x1;
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(x > coords->x2) {
lv_opa_t opa_tmp = sh_buf_tmp[x - a.x1 + first_px];
if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
lv_blend_fill(clip, &va,
dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, dsc->shadow_blend_mode);
}
va.x1++;
va.x2++;
}
}
}
else {
for(y = corner_size; y < lv_area_get_height(&sh_area) - corner_size; y++) {
memcpy(mask_buf, sh_buf_tmp, corner_size);
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);
a.y1++;
a.y2++;
}
}
/*Invert the shadow corner buffer and draw the corners on the left*/
sh_buf_tmp = sh_buf ;
for(y = 0; y < corner_size; y++) {
for(x = 0; x < corner_size / 2; x++) {
lv_opa_t tmp = sh_buf_tmp[x];
sh_buf_tmp[x] = sh_buf_tmp[corner_size - x - 1];
sh_buf_tmp[corner_size - x - 1] = tmp;
}
sh_buf_tmp += corner_size;
}
/*Draw the top left corner*/
a.x1 = sh_area.x1;
a.x2 = a.x1 + corner_size - 1;
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 ;
}
first_px = 0;
if(disp_area->x1 >= a.x1) {
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++) {
memcpy(mask_buf, sh_buf_tmp, corner_size);
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);
a.y1++;
a.y2++;
sh_buf_tmp += corner_size;
}
/*Draw the bottom left corner*/
a.y1 = sh_area.y2;
a.y2 = a.y1;
sh_buf_tmp = sh_buf ;
for(y = 0; y < corner_size - ver_mid_dist; y++) {
memcpy(mask_buf, sh_buf_tmp, corner_size);
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);
a.y1--;
a.y2--;
sh_buf_tmp += corner_size;
}
/*Fill the left side*/
a.y1 = sh_area.y1+corner_size;
a.y2 = a.y1;
sh_buf_tmp = sh_buf + corner_size * (corner_size - 1);
if(simple_mode) {
/*Draw vertical lines*/
lv_area_t va;
va.x1 = a.x1;
va.x2 = a.x1;
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++) {
lv_opa_t opa_tmp = sh_buf_tmp[x - a.x1 + first_px];
if(opa_tmp != LV_OPA_COVER || opa != LV_OPA_COVER) opa_tmp = (opa * opa_tmp) >> 8;
lv_blend_fill(clip, &va,
dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, dsc->shadow_blend_mode);
va.x1++;
va.x2++;
}
}
}
else {
for(y = corner_size; y < lv_area_get_height(&sh_area) - corner_size; y++) {
memcpy(mask_buf, sh_buf_tmp, corner_size);
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);
a.y1++;
a.y2++;
}
}
/*Fill the top side*/
a.x1 = sh_area.x1 + corner_size;
a.x2 = sh_area.x2 - corner_size;
a.y1 = sh_area.y1;
a.y2 = a.y1;
first_px = 0;
if(disp_area->x1 > a.x1) {
first_px = disp_area->x1 - a.x1;
a.x1 += first_px;
}
if(a.x1 <= a.x2) {
sh_buf_tmp = sh_buf + corner_size - 1;
y_max = corner_size - ver_mid_dist;
if(simple_mode) {
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) {
memset(mask_buf, sh_buf_tmp[0], lv_area_get_width(&a));
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);
} 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_blend_fill(clip, &a,
dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, dsc->shadow_blend_mode);
}
a.y1++;
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;
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;
for(y = y_min; y < corner_size; y++) {
if(simple_mode == false) {
memset(mask_buf, sh_buf_tmp[0], lv_area_get_width(&a));
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);
} 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_blend_fill(clip, &a,
dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa_tmp, dsc->shadow_blend_mode);
}
a.y1++;
a.y2++;
sh_buf_tmp -= corner_size;
}
}
/*Finally fill the middle area*/
if(simple_mode == false) {
a.y1 = sh_area.y1 + corner_size;
a.y2 = a.y1;
if(a.x1 <= a.x2) {
for(y = 0; y < lv_area_get_height(&sh_area) - corner_size * 2; y++) {
memset(mask_buf, 0xFF, lv_area_get_width(&a));
mask_res = lv_draw_mask_apply(mask_buf, a.x1, a.y1, lv_area_get_width(&a));
lv_blend_fill(clip, &a,
dsc->shadow_color, mask_buf, mask_res, opa, dsc->shadow_blend_mode);
a.y1++;
a.y2++;
}
}
}
lv_draw_mask_remove_id(mask_rout_id);
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)
@ -945,7 +944,6 @@ static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf,
#endif
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)

View File

@ -45,9 +45,11 @@ typedef struct {
/*Shadow*/
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_y;
lv_style_value_t shadow_spread;
lv_style_value_t shadow_blend_mode;
lv_opa_t shadow_opa;
/*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_init(&draw_dsc);
lv_obj_init_draw_rect_dsc(btn, LV_OBJ_PART_MAIN, &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)) {

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;
else if(mode == LV_DESIGN_DRAW_MAIN) {
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_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_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 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) &&
(ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) {
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);
if(size.x > lv_obj_get_width(label)) {
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;
#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);
if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) {
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);
/*Draw the text again next to the original to make an circular effect */
if(size.x > lv_obj_get_width(label)) {
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;
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 */
if(size.y > lv_obj_get_height(label)) {
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);
}

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);
/*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;
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_TEXT_COLOR, LV_COLOR_BLACK);
lv_style_init(&btn);
lv_style_set_value(&btn, LV_STYLE_PAD_LEFT, 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_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_TEXT_OPA, LV_OPA_50);
lv_style_set_value(&btn, LV_STYLE_SHADOW_WIDTH, 5);
lv_style_set_value(&btn, LV_STYLE_SHADOW_OFFSET_Y, 10);
// 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_OFFSET_Y, 10);
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_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)
{
#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
}