BigW Consortium Gitlab

Commit 2d09b3db by Gabor Kiss-Vamosi

lv_area: add 'lv_' prefix

parent 83b01aa6
...@@ -92,7 +92,7 @@ static void (*map_fp)(const lv_area_t * coords, const lv_area_t * mask, const lv ...@@ -92,7 +92,7 @@ static void (*map_fp)(const lv_area_t * coords, const lv_area_t * mask, const lv
*/ */
void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style) void lv_draw_rect(const lv_area_t * coords, const lv_area_t * mask, const lv_style_t * style)
{ {
if(area_get_height(coords) < 1 || area_get_width(coords) < 1) return; if(lv_area_get_height(coords) < 1 || lv_area_get_width(coords) < 1) return;
#if LV_NO_SHADOW == 0 #if LV_NO_SHADOW == 0
if(style->body.shadow.width != 0) { if(style->body.shadow.width != 0) {
...@@ -241,7 +241,7 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty ...@@ -241,7 +241,7 @@ void lv_draw_label(const lv_area_t * coords,const lv_area_t * mask, const lv_sty
lv_coord_t w; lv_coord_t w;
if((flag & LV_TXT_FLAG_EXPAND) == 0) { if((flag & LV_TXT_FLAG_EXPAND) == 0) {
w = area_get_width(coords); w = lv_area_get_width(coords);
} else { } else {
lv_point_t p; lv_point_t p;
lv_txt_get_size(&p, txt, style->text.font, style->text.letter_space, style->text.line_space, LV_COORD_MAX, flag); lv_txt_get_size(&p, txt, style->text.font, style->text.letter_space, style->text.line_space, LV_COORD_MAX, flag);
...@@ -367,7 +367,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, ...@@ -367,7 +367,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
/*If the width is greater then real img. width then it is upscaled */ /*If the width is greater then real img. width then it is upscaled */
bool upscale = false; bool upscale = false;
if(area_get_width(coords) > header.w) upscale = true; if(lv_area_get_width(coords) > header.w) upscale = true;
lv_area_t mask_com; /*Common area of mask and cords*/ lv_area_t mask_com; /*Common area of mask and cords*/
bool union_ok; bool union_ok;
...@@ -408,16 +408,16 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask, ...@@ -408,16 +408,16 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
/* Move the file pointer to the start address according to mask /* Move the file pointer to the start address according to mask
* But take care, the upscaled maps look greater*/ * But take care, the upscaled maps look greater*/
uint32_t start_offset = sizeof(lv_img_raw_header_t); uint32_t start_offset = sizeof(lv_img_raw_header_t);
start_offset += (area_get_width(coords) >> us_shift) * start_offset += (lv_area_get_width(coords) >> us_shift) *
((mask_com.y1 - coords->y1) >> us_shift) * sizeof(lv_color_t); /*First row*/ ((mask_com.y1 - coords->y1) >> us_shift) * sizeof(lv_color_t); /*First row*/
start_offset += ((mask_com.x1 - coords->x1) >> us_shift) * sizeof(lv_color_t); /*First col*/ start_offset += ((mask_com.x1 - coords->x1) >> us_shift) * sizeof(lv_color_t); /*First col*/
lv_fs_seek(&file, start_offset); lv_fs_seek(&file, start_offset);
uint32_t useful_data = (area_get_width(&mask_com) >> us_shift) * sizeof(lv_color_t); uint32_t useful_data = (lv_area_get_width(&mask_com) >> us_shift) * sizeof(lv_color_t);
uint32_t next_row = (area_get_width(coords) >> us_shift) * sizeof(lv_color_t) - useful_data; uint32_t next_row = (lv_area_get_width(coords) >> us_shift) * sizeof(lv_color_t) - useful_data;
lv_area_t line; lv_area_t line;
area_cpy(&line, &mask_com); lv_area_copy(&line, &mask_com);
lv_area_set_height(&line, us_val); /*Create a line area. Hold 2 pixels if upscaled*/ lv_area_set_height(&line, us_val); /*Create a line area. Hold 2 pixels if upscaled*/
lv_coord_t row; lv_coord_t row;
...@@ -594,8 +594,8 @@ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * ma ...@@ -594,8 +594,8 @@ static void lv_draw_rect_main_mid(const lv_area_t * coords, const lv_area_t * ma
lv_color_t gcolor = style->body.grad_color; lv_color_t gcolor = style->body.grad_color;
uint8_t mix; uint8_t mix;
lv_opa_t opa = style->body.opa; lv_opa_t opa = style->body.opa;
lv_coord_t height = area_get_height(coords); lv_coord_t height = lv_area_get_height(coords);
lv_coord_t width = area_get_width(coords); lv_coord_t width = lv_area_get_width(coords);
radius = lv_draw_cont_radius_corr(radius, width, height); radius = lv_draw_cont_radius_corr(radius, width, height);
...@@ -645,8 +645,8 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t * ...@@ -645,8 +645,8 @@ static void lv_draw_rect_main_corner(const lv_area_t * coords, const lv_area_t *
lv_color_t act_color; lv_color_t act_color;
lv_opa_t opa = style->body.opa; lv_opa_t opa = style->body.opa;
uint8_t mix; uint8_t mix;
lv_coord_t height = area_get_height(coords); lv_coord_t height = lv_area_get_height(coords);
lv_coord_t width = area_get_width(coords); lv_coord_t width = lv_area_get_width(coords);
radius = lv_draw_cont_radius_corr(radius, width, height); radius = lv_draw_cont_radius_corr(radius, width, height);
...@@ -841,8 +841,8 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area ...@@ -841,8 +841,8 @@ static void lv_draw_rect_border_straight(const lv_area_t * coords, const lv_area
{ {
uint16_t radius = style->body.radius; uint16_t radius = style->body.radius;
lv_coord_t width = area_get_width(coords); lv_coord_t width = lv_area_get_width(coords);
lv_coord_t height = area_get_height(coords); lv_coord_t height = lv_area_get_height(coords);
uint16_t bwidth = style->body.border.width; uint16_t bwidth = style->body.border.width;
lv_opa_t opa = style->body.border.opa; lv_opa_t opa = style->body.border.opa;
lv_border_part_t part = style->body.border.part; lv_border_part_t part = style->body.border.part;
...@@ -1004,8 +1004,8 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t ...@@ -1004,8 +1004,8 @@ static void lv_draw_rect_border_corner(const lv_area_t * coords, const lv_area_t
/*0 px border width drawn as 1 px, so decrement the bwidth*/ /*0 px border width drawn as 1 px, so decrement the bwidth*/
bwidth--; bwidth--;
lv_coord_t width = area_get_width(coords); lv_coord_t width = lv_area_get_width(coords);
lv_coord_t height = area_get_height(coords); lv_coord_t height = lv_area_get_height(coords);
radius = lv_draw_cont_radius_corr(radius, width, height); radius = lv_draw_cont_radius_corr(radius, width, height);
...@@ -1141,19 +1141,19 @@ static void lv_draw_rect_shadow(const lv_area_t * coords, const lv_area_t * mask ...@@ -1141,19 +1141,19 @@ static void lv_draw_rect_shadow(const lv_area_t * coords, const lv_area_t * mask
{ {
/* If mask is in the middle of cords do not draw shadow*/ /* If mask is in the middle of cords do not draw shadow*/
lv_coord_t radius = style->body.radius; lv_coord_t radius = style->body.radius;
lv_coord_t width = area_get_width(coords); lv_coord_t width = lv_area_get_width(coords);
lv_coord_t height = area_get_height(coords); lv_coord_t height = lv_area_get_height(coords);
radius = lv_draw_cont_radius_corr(radius, width, height); radius = lv_draw_cont_radius_corr(radius, width, height);
lv_area_t area_tmp; lv_area_t area_tmp;
/*Check horizontally without radius*/ /*Check horizontally without radius*/
area_cpy(&area_tmp, coords); lv_area_copy(&area_tmp, coords);
area_tmp.x1 += radius; area_tmp.x1 += radius;
area_tmp.x2 -= radius; area_tmp.x2 -= radius;
if(lv_area_is_in(mask, &area_tmp) != false) return; if(lv_area_is_in(mask, &area_tmp) != false) return;
/*Check vertically without radius*/ /*Check vertically without radius*/
area_cpy(&area_tmp, coords); lv_area_copy(&area_tmp, coords);
area_tmp.y1 += radius; area_tmp.y1 += radius;
area_tmp.y2 -= radius; area_tmp.y2 -= radius;
if(lv_area_is_in(mask, &area_tmp) != false) return; if(lv_area_is_in(mask, &area_tmp) != false) return;
...@@ -1169,8 +1169,8 @@ static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t * ...@@ -1169,8 +1169,8 @@ static void lv_draw_cont_shadow_full(const lv_area_t * coords, const lv_area_t *
{ {
lv_coord_t radius = style->body.radius; lv_coord_t radius = style->body.radius;
lv_coord_t width = area_get_width(coords); lv_coord_t width = lv_area_get_width(coords);
lv_coord_t height = area_get_height(coords); lv_coord_t height = lv_area_get_height(coords);
radius = lv_draw_cont_radius_corr(radius, width, height); radius = lv_draw_cont_radius_corr(radius, width, height);
...@@ -1310,8 +1310,8 @@ static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t ...@@ -1310,8 +1310,8 @@ static void lv_draw_cont_shadow_bottom(const lv_area_t * coords, const lv_area_t
{ {
lv_coord_t radius = style->body.radius; lv_coord_t radius = style->body.radius;
lv_coord_t width = area_get_width(coords); lv_coord_t width = lv_area_get_width(coords);
lv_coord_t height = area_get_height(coords); lv_coord_t height = lv_area_get_height(coords);
radius = lv_draw_cont_radius_corr(radius, width, height); radius = lv_draw_cont_radius_corr(radius, width, height);
...@@ -1382,8 +1382,8 @@ static void lv_draw_cont_shadow_full_straight(const lv_area_t * coords, const lv ...@@ -1382,8 +1382,8 @@ static void lv_draw_cont_shadow_full_straight(const lv_area_t * coords, const lv
lv_coord_t radius = style->body.radius; lv_coord_t radius = style->body.radius;
lv_coord_t width = area_get_width(coords); lv_coord_t width = lv_area_get_width(coords);
lv_coord_t height = area_get_height(coords); lv_coord_t height = lv_area_get_height(coords);
radius = lv_draw_cont_radius_corr(radius, width, height); radius = lv_draw_cont_radius_corr(radius, width, height);
......
...@@ -187,14 +187,14 @@ void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p, ...@@ -187,14 +187,14 @@ void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
if(union_ok == false) return; if(union_ok == false) return;
/*Go to the first pixel*/ /*Go to the first pixel*/
lv_coord_t map_width = area_get_width(cords_p); lv_coord_t map_width = lv_area_get_width(cords_p);
map_p+= (masked_a.y1 - cords_p->y1) * map_width; map_p+= (masked_a.y1 - cords_p->y1) * map_width;
map_p += masked_a.x1 - cords_p->x1; map_p += masked_a.x1 - cords_p->x1;
if(transp == false) { if(transp == false) {
lv_coord_t row; lv_coord_t row;
lv_coord_t mask_w = area_get_width(&masked_a) - 1; lv_coord_t mask_w = lv_area_get_width(&masked_a) - 1;
for(row = 0; row < area_get_height(&masked_a); row++) { for(row = 0; row < lv_area_get_height(&masked_a); row++) {
lv_disp_map(masked_a.x1, masked_a.y1 + row, masked_a.x1 + mask_w, masked_a.y1 + row, map_p); lv_disp_map(masked_a.x1, masked_a.y1 + row, masked_a.x1 + mask_w, masked_a.y1 + row, map_p);
map_p += map_width; map_p += map_width;
...@@ -202,9 +202,9 @@ void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p, ...@@ -202,9 +202,9 @@ void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
}else { }else {
lv_color_t transp_color = LV_COLOR_TRANSP; lv_color_t transp_color = LV_COLOR_TRANSP;
lv_coord_t row; lv_coord_t row;
for(row = 0; row < area_get_height(&masked_a); row++) { for(row = 0; row < lv_area_get_height(&masked_a); row++) {
lv_coord_t col; lv_coord_t col;
for(col = 0; col < area_get_width(&masked_a); col ++) { for(col = 0; col < lv_area_get_width(&masked_a); col ++) {
if(map_p[col].full != transp_color.full) { if(map_p[col].full != transp_color.full) {
lv_rpx(masked_a.x1 + col, masked_a.y1 + row, mask_p, map_p[col], opa); lv_rpx(masked_a.x1 + col, masked_a.y1 + row, mask_p, map_p[col], opa);
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
/********************* /*********************
* DEFINES * DEFINES
*********************/ *********************/
#define VFILL_HW_ACC_WIDTH_LIMIT 50 /*Always fill < 50 px with 'sw_color_fill' because of the hw. init overhead*/
/********************** /**********************
* TYPEDEFS * TYPEDEFS
...@@ -34,7 +35,7 @@ ...@@ -34,7 +35,7 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static void sw_color_cpy(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa); static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
static void sw_color_fill(lv_area_t * mem_area, lv_color_t * mem, const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa); static void sw_color_fill(lv_area_t * mem_area, lv_color_t * mem, const lv_area_t * fill_area, lv_color_t color, lv_opa_t opa);
/********************** /**********************
...@@ -68,7 +69,7 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col ...@@ -68,7 +69,7 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
return; return;
} }
uint32_t vdb_width = area_get_width(&vdb_p->area); uint32_t vdb_width = lv_area_get_width(&vdb_p->area);
/*Make the coordinates relative to VDB*/ /*Make the coordinates relative to VDB*/
x-=vdb_p->area.x1; x-=vdb_p->area.x1;
...@@ -94,6 +95,10 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col ...@@ -94,6 +95,10 @@ void lv_vpx(lv_coord_t x, lv_coord_t y, const lv_area_t * mask_p, lv_color_t col
void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
lv_color_t color, lv_opa_t opa) lv_color_t color, lv_opa_t opa)
{ {
/*Used to store color maps for blending*/
static lv_color_t color_map[LV_HOR_RES];
static lv_coord_t last_width = 0;
lv_area_t res_a; lv_area_t res_a;
bool union_ok; bool union_ok;
lv_vdb_t * vdb_p = lv_vdb_get(); lv_vdb_t * vdb_p = lv_vdb_get();
...@@ -113,28 +118,65 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p, ...@@ -113,28 +118,65 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
vdb_rel_a.y2 = res_a.y2 - vdb_p->area.y1; vdb_rel_a.y2 = res_a.y2 - vdb_p->area.y1;
lv_color_t * vdb_buf_tmp = vdb_p->buf; lv_color_t * vdb_buf_tmp = vdb_p->buf;
uint32_t vdb_width = area_get_width(&vdb_p->area); uint32_t vdb_width = lv_area_get_width(&vdb_p->area);
/*Move the vdb_tmp to the first row*/ /*Move the vdb_tmp to the first row*/
vdb_buf_tmp += vdb_width * vdb_rel_a.y1; vdb_buf_tmp += vdb_width * vdb_rel_a.y1;
if(lv_disp_is_copy_supported() == false) {
lv_coord_t w = lv_area_get_width(&vdb_rel_a);
if(w < VFILL_HW_ACC_WIDTH_LIMIT) { /*Don't use hw. acc. for every small fill (because of the init overhead)*/
sw_color_fill(&vdb_p->area, vdb_buf_tmp, &vdb_rel_a, color, opa); sw_color_fill(&vdb_p->area, vdb_buf_tmp, &vdb_rel_a, color, opa);
} else { } else if(opa == LV_OPA_COVER) {
static lv_color_t color_map[LV_HOR_RES]; /*Use hw fill if present*/
static lv_coord_t last_width = 0; if(lv_disp_is_mem_fill_supported()) {
lv_coord_t map_width = area_get_width(&vdb_rel_a); lv_coord_t row;
if(color_map[0].full != color.full || last_width != map_width) { for(row = vdb_rel_a.y1;row <= vdb_rel_a.y2; row++) {
uint16_t i; lv_disp_mem_fill(&vdb_buf_tmp[vdb_rel_a.x1], w, color);
for(i = 0; i < map_width; i++) { vdb_buf_tmp += vdb_width;
color_map[i].full = color.full; }
}
/*Use hw blend if present and the area is not too small*/
else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_WIDTH_LIMIT &&
lv_disp_is_mem_blend_supported())
{
if(color_map[0].full != color.full || last_width != w) {
uint16_t i;
for(i = 0; i < w; i++) {
color_map[i].full = color.full;
}
last_width = w;
}
lv_coord_t row;
for(row = vdb_rel_a.y1;row <= vdb_rel_a.y2; row++) {
lv_disp_mem_blend(&vdb_buf_tmp[vdb_rel_a.x1], color_map, w, opa);
vdb_buf_tmp += vdb_width;
} }
last_width = map_width;
} }
lv_coord_t row; /*Else use sw fill if no better option*/
for(row = vdb_rel_a.y1;row <= vdb_rel_a.y2; row++) { else {
lv_disp_copy(&vdb_buf_tmp[vdb_rel_a.x1], color_map, map_width, opa); sw_color_fill(&vdb_p->area, vdb_buf_tmp, &vdb_rel_a, color, opa);
vdb_buf_tmp += vdb_width; }
}
/*Opacity*/
else
{
if(lv_disp_is_mem_blend_supported() == false) {
sw_color_fill(&vdb_p->area, vdb_buf_tmp, &vdb_rel_a, color, opa);
} else {
if(color_map[0].full != color.full || last_width != w) {
uint16_t i;
for(i = 0; i < w; i++) {
color_map[i].full = color.full;
}
last_width = w;
}
lv_coord_t row;
for(row = vdb_rel_a.y1;row <= vdb_rel_a.y2; row++) {
lv_disp_mem_blend(&vdb_buf_tmp[vdb_rel_a.x1], color_map, w, opa);
vdb_buf_tmp += vdb_width;
}
} }
} }
} }
...@@ -166,7 +208,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p, ...@@ -166,7 +208,7 @@ void lv_vletter(const lv_point_t * pos_p, const lv_area_t * mask_p,
pos_p->y + letter_h < mask_p->y1 || pos_p->y > mask_p->y2) return; pos_p->y + letter_h < mask_p->y1 || pos_p->y > mask_p->y2) return;
lv_vdb_t * vdb_p = lv_vdb_get(); lv_vdb_t * vdb_p = lv_vdb_get();
lv_coord_t vdb_width = area_get_width(&vdb_p->area); lv_coord_t vdb_width = lv_area_get_width(&vdb_p->area);
lv_color_t * vdb_buf_tmp = vdb_p->buf; lv_color_t * vdb_buf_tmp = vdb_p->buf;
lv_coord_t col, row; lv_coord_t col, row;
uint8_t col_bit; uint8_t col_bit;
...@@ -295,7 +337,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, ...@@ -295,7 +337,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
if(upscale != false) ds_shift = 1; if(upscale != false) ds_shift = 1;
/*If the map starts OUT of the masked area then calc. the first pixel*/ /*If the map starts OUT of the masked area then calc. the first pixel*/
lv_coord_t map_width = area_get_width(cords_p) >> ds_shift; lv_coord_t map_width = lv_area_get_width(cords_p) >> ds_shift;
if(cords_p->y1 < masked_a.y1) { if(cords_p->y1 < masked_a.y1) {
map_p += (uint32_t) map_width * ((masked_a.y1 - cords_p->y1) >> ds_shift); map_p += (uint32_t) map_width * ((masked_a.y1 - cords_p->y1) >> ds_shift);
} }
...@@ -309,7 +351,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, ...@@ -309,7 +351,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
masked_a.x2 = masked_a.x2 - vdb_p->area.x1; masked_a.x2 = masked_a.x2 - vdb_p->area.x1;
masked_a.y2 = masked_a.y2 - vdb_p->area.y1; masked_a.y2 = masked_a.y2 - vdb_p->area.y1;
lv_coord_t vdb_width = area_get_width(&vdb_p->area); lv_coord_t vdb_width = lv_area_get_width(&vdb_p->area);
lv_color_t * vdb_buf_tmp = vdb_p->buf; lv_color_t * vdb_buf_tmp = vdb_p->buf;
vdb_buf_tmp += (uint32_t) vdb_width * masked_a.y1; /*Move to the first row*/ vdb_buf_tmp += (uint32_t) vdb_width * masked_a.y1; /*Move to the first row*/
...@@ -319,13 +361,13 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, ...@@ -319,13 +361,13 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
if(upscale == false) { if(upscale == false) {
if(transp == false) { /*Simply copy the pixels to the VDB*/ if(transp == false) { /*Simply copy the pixels to the VDB*/
lv_coord_t row; lv_coord_t row;
lv_coord_t map_useful_w = area_get_width(&masked_a); lv_coord_t map_useful_w = lv_area_get_width(&masked_a);
for(row = masked_a.y1; row <= masked_a.y2; row++) { for(row = masked_a.y1; row <= masked_a.y2; row++) {
if(lv_disp_is_copy_supported() == false) { if(lv_disp_is_mem_blend_supported() == false) {
sw_color_cpy(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa); sw_mem_blend(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa);
} else { } else {
lv_disp_copy(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa); lv_disp_mem_blend(&vdb_buf_tmp[masked_a.x1], &map_p[masked_a.x1], map_useful_w, opa);
} }
map_p += map_width; /*Next row on the map*/ map_p += map_width; /*Next row on the map*/
vdb_buf_tmp += vdb_width; /*Next row on the VDB*/ vdb_buf_tmp += vdb_width; /*Next row on the VDB*/
...@@ -463,13 +505,13 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p, ...@@ -463,13 +505,13 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
**********************/ **********************/
/** /**
* Copy pixels to destination memory using opacity * Blend pixels to destination memory using opacity
* @param dest a memory address. Copy 'src' here. * @param dest a memory address. Copy 'src' here.
* @param src pointer to pixel map. Copy it to 'dest'. * @param src pointer to pixel map. Copy it to 'dest'.
* @param length number of pixels in 'src' * @param length number of pixels in 'src'
* @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover) * @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover)
*/ */
static void sw_color_cpy(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa) static void sw_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
{ {
if(opa == LV_OPA_COVER) { if(opa == LV_OPA_COVER) {
memcpy(dest, src, length * sizeof(lv_color_t)); memcpy(dest, src, length * sizeof(lv_color_t));
...@@ -494,7 +536,7 @@ static void sw_color_fill(lv_area_t * mem_area, lv_color_t * mem, const lv_area_ ...@@ -494,7 +536,7 @@ static void sw_color_fill(lv_area_t * mem_area, lv_color_t * mem, const lv_area_
/*Set all row in vdb to the given color*/ /*Set all row in vdb to the given color*/
lv_coord_t row; lv_coord_t row;
uint32_t col; uint32_t col;
lv_coord_t mem_width = area_get_width(mem_area); lv_coord_t mem_width = lv_area_get_width(mem_area);
/*Run simpler function without opacity*/ /*Run simpler function without opacity*/
if(opa == LV_OPA_COVER) { if(opa == LV_OPA_COVER) {
...@@ -502,6 +544,7 @@ static void sw_color_fill(lv_area_t * mem_area, lv_color_t * mem, const lv_area_ ...@@ -502,6 +544,7 @@ static void sw_color_fill(lv_area_t * mem_area, lv_color_t * mem, const lv_area_
for(col = fill_area->x1; col <= fill_area->x2; col++) { for(col = fill_area->x1; col <= fill_area->x2; col++) {
mem[col] = color; mem[col] = color;
} }
/*Copy the first row to all other rows*/ /*Copy the first row to all other rows*/
lv_color_t * mem_first = &mem[fill_area->x1]; lv_color_t * mem_first = &mem[fill_area->x1];
lv_coord_t copy_size = (fill_area->x2 - fill_area->x1 + 1) * sizeof(lv_color_t); lv_coord_t copy_size = (fill_area->x2 - fill_area->x1 + 1) * sizeof(lv_color_t);
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <stddef.h> #include <stddef.h>
#include "../lv_hal/lv_hal_disp.h" #include "../lv_hal/lv_hal_disp.h"
#include "../lv_misc/lv_mem.h" #include "../lv_misc/lv_mem.h"
#include "../lv_obj/lv_obj.h"
/********************* /*********************
* DEFINES * DEFINES
...@@ -48,9 +49,10 @@ static lv_disp_t *active; ...@@ -48,9 +49,10 @@ static lv_disp_t *active;
*/ */
void lv_disp_drv_init(lv_disp_drv_t *driver) void lv_disp_drv_init(lv_disp_drv_t *driver)
{ {
driver->fill_fp = NULL; driver->disp_fill = NULL;
driver->map_fp = NULL; driver->disp_map = NULL;
driver->blend_fp = NULL; driver->mem_blend = NULL;
driver->mem_fill = NULL;
} }
/** /**
...@@ -73,6 +75,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t *driver) ...@@ -73,6 +75,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t *driver)
if (disp_list == NULL) { if (disp_list == NULL) {
disp_list = node; disp_list = node;
active = node; active = node;
lv_obj_invalidate(lv_scr_act());
} else { } else {
node->next = disp_list; node->next = disp_list;
} }
...@@ -88,6 +91,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t *driver) ...@@ -88,6 +91,7 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t *driver)
void lv_disp_set_active(lv_disp_t * disp) void lv_disp_set_active(lv_disp_t * disp)
{ {
active = disp; active = disp;
lv_obj_invalidate(lv_scr_act());
} }
/** /**
...@@ -125,7 +129,7 @@ lv_disp_t * lv_disp_next(lv_disp_t * disp) ...@@ -125,7 +129,7 @@ lv_disp_t * lv_disp_next(lv_disp_t * disp)
void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color) void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color)
{ {
if(active == NULL) return; if(active == NULL) return;
if(active->driver.fill_fp != NULL) active->driver.fill_fp(x1, y1, x2, y2, color); if(active->driver.disp_fill != NULL) active->driver.disp_fill(x1, y1, x2, y2, color);
} }
/** /**
...@@ -139,31 +143,54 @@ void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t col ...@@ -139,31 +143,54 @@ void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t col
void lv_disp_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_map) void lv_disp_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_map)
{ {
if(active == NULL) return; if(active == NULL) return;
if(active->driver.map_fp != NULL) active->driver.map_fp(x1, y1, x2, y2, color_map); if(active->driver.disp_map != NULL) active->driver.disp_map(x1, y1, x2, y2, color_map);
} }
/**
* Blend pixels to a destination memory from a source memory
* In 'lv_disp_drv_t' 'mem_blend' is optional. (NULL if not available)
* @param dest a memory address. Blend 'src' here.
* @param src pointer to pixel map. Blend it to 'dest'.
* @param length number of pixels in 'src'
* @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover)
*/
void lv_disp_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
{
if(active == NULL) return;
if(active->driver.mem_blend != NULL) active->driver.mem_blend(dest, src, length, opa);
}
/** /**
* Copy pixels to a destination memory applying opacity * Fill a memory with a color (GPUs may support it)
* In 'lv_disp_drv_t' 'copy' is optional. (NULL to use the built-in copy function) * In 'lv_disp_drv_t' 'mem_fill' is optional. (NULL if not available)
* @param dest a memory address. Copy 'src' here. * @param dest a memory address. Copy 'src' here.
* @param src pointer to pixel map. Copy it to 'dest'. * @param src pointer to pixel map. Copy it to 'dest'.
* @param length number of pixels in 'src' * @param length number of pixels in 'src'
* @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover) * @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover)
*/ */
void lv_disp_copy(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa) void lv_disp_mem_fill(lv_color_t * dest, uint32_t length, lv_color_t color)
{ {
if(active == NULL) return; if(active == NULL) return;
if(active->driver.blend_fp != NULL) active->driver.blend_fp(dest, src, length, opa); if(active->driver.mem_fill != NULL) active->driver.mem_fill(dest, length, color);
}
/**
* Shows if memory blending (by GPU) is supported or not
* @return false: 'mem_blend' is not supported in the driver; true: 'mem_blend' is supported in the driver
*/
bool lv_disp_is_mem_blend_supported(void)
{
if(active->driver.mem_blend) return true;
else return false;
} }
/** /**
* Shows if 'copy' is supported or not * Shows if memory fill (by GPU) is supported or not
* @return false: 'copy' is not supported in the drover; true: 'copy' is supported in the driver * @return false: 'mem_fill' is not supported in the drover; true: 'mem_fill' is supported in the driver
*/ */
bool lv_disp_is_copy_supported(void) bool lv_disp_is_mem_fill_supported(void)
{ {
if(active->driver.blend_fp) return true; if(active->driver.mem_fill) return true;
else return false; else return false;
} }
......
...@@ -32,9 +32,10 @@ extern "C" { ...@@ -32,9 +32,10 @@ extern "C" {
* Display Driver structure to be registered by HAL * Display Driver structure to be registered by HAL
*/ */
typedef struct _disp_drv_t { typedef struct _disp_drv_t {
void (*fill_fp)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color); void (*disp_fill)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t color);
void (*map_fp)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p); void (*disp_map)(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_p);
void (*blend_fp)(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa); void (*mem_blend)(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
void (*mem_fill)(lv_color_t * dest, uint32_t length, lv_color_t color);
} lv_disp_drv_t; } lv_disp_drv_t;
typedef struct _disp_t { typedef struct _disp_t {
...@@ -102,20 +103,35 @@ void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t col ...@@ -102,20 +103,35 @@ void lv_disp_fill(int32_t x1, int32_t y1, int32_t x2, int32_t y2, lv_color_t col
void lv_disp_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_map); void lv_disp_map(int32_t x1, int32_t y1, int32_t x2, int32_t y2, const lv_color_t * color_map);
/** /**
* Copy pixels to a destination memory applying opacity * Blend pixels to a destination memory from a source memory
* In 'lv_disp_drv_t' 'copy' is optional. (NULL to use the built-in copy function) * In 'lv_disp_drv_t' 'mem_blend' is optional. (NULL if not available)
* @param dest a memory address. Blend 'src' here.
* @param src pointer to pixel map. Blend it to 'dest'.
* @param length number of pixels in 'src'
* @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover)
*/
void lv_disp_mem_blend(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
/**
* Fill a memory with a color (GPUs may support it)
* In 'lv_disp_drv_t' 'mem_fill' is optional. (NULL if not available)
* @param dest a memory address. Copy 'src' here. * @param dest a memory address. Copy 'src' here.
* @param src pointer to pixel map. Copy it to 'dest'. * @param src pointer to pixel map. Copy it to 'dest'.
* @param length number of pixels in 'src' * @param length number of pixels in 'src'
* @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover) * @param opa opacity (0, LV_OPA_TRANSP: transparent ... 255, LV_OPA_COVER, fully cover)
*/ */
void lv_disp_copy(lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa); void lv_disp_mem_fill(lv_color_t * dest, uint32_t length, lv_color_t color);
/**
* Shows if memory blending (by GPU) is supported or not
* @return false: 'mem_blend' is not supported in the driver; true: 'mem_blend' is supported in the driver
*/
bool lv_disp_is_mem_blend_supported(void);
/** /**
* Shows if 'copy' is supported or not * Shows if memory fill (by GPU) is supported or not
* @return false: 'copy' is not supported in the drover; true: 'copy' is supported in the driver * @return false: 'mem_fill' is not supported in the drover; true: 'mem_fill' is supported in the driver
*/ */
bool lv_disp_is_copy_supported(void); bool lv_disp_is_mem_fill_supported(void);
/********************** /**********************
* MACROS * MACROS
......
...@@ -14,7 +14,7 @@ extern "C" { ...@@ -14,7 +14,7 @@ extern "C" {
/********************* /*********************
* INCLUDES * INCLUDES
*********************/ *********************/
#include "../../../lv_conf.h" #include "../../lv_conf.h"
#if LV_NO_ANIM == 0 #if LV_NO_ANIM == 0
#include <stdint.h> #include <stdint.h>
......
...@@ -77,8 +77,8 @@ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h) ...@@ -77,8 +77,8 @@ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h)
*/ */
void lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y) void lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y)
{ {
lv_coord_t w = area_get_width(area_p); lv_coord_t w = lv_area_get_width(area_p);
lv_coord_t h = area_get_height(area_p); lv_coord_t h = lv_area_get_height(area_p);
area_p->x1 = x; area_p->x1 = x;
area_p->y1 = y; area_p->y1 = y;
lv_area_set_width(area_p, w); lv_area_set_width(area_p, w);
......
...@@ -62,7 +62,7 @@ void lv_area_set(lv_area_t * area_p, lv_coord_t x1, lv_coord_t y1, lv_coord_t x2 ...@@ -62,7 +62,7 @@ void lv_area_set(lv_area_t * area_p, lv_coord_t x1, lv_coord_t y1, lv_coord_t x2
* @param dest pointer to the destination area * @param dest pointer to the destination area
* @param src pointer to the source area * @param src pointer to the source area
*/ */
static void inline area_cpy(lv_area_t * dest, const lv_area_t * src) static void inline lv_area_copy(lv_area_t * dest, const lv_area_t * src)
{ {
memcpy(dest, src, sizeof(lv_area_t)); memcpy(dest, src, sizeof(lv_area_t));
} }
...@@ -72,7 +72,7 @@ static void inline area_cpy(lv_area_t * dest, const lv_area_t * src) ...@@ -72,7 +72,7 @@ static void inline area_cpy(lv_area_t * dest, const lv_area_t * src)
* @param area_p pointer to an area * @param area_p pointer to an area
* @return the width of the area (if x1 == x2 -> width = 1) * @return the width of the area (if x1 == x2 -> width = 1)
*/ */
static inline lv_coord_t area_get_width(const lv_area_t * area_p) static inline lv_coord_t lv_area_get_width(const lv_area_t * area_p)
{ {
return area_p->x2 - area_p->x1 + 1; return area_p->x2 - area_p->x1 + 1;
} }
...@@ -82,7 +82,7 @@ static inline lv_coord_t area_get_width(const lv_area_t * area_p) ...@@ -82,7 +82,7 @@ static inline lv_coord_t area_get_width(const lv_area_t * area_p)
* @param area_p pointer to an area * @param area_p pointer to an area
* @return the height of the area (if y1 == y2 -> height = 1) * @return the height of the area (if y1 == y2 -> height = 1)
*/ */
static inline lv_coord_t area_get_height(const lv_area_t * area_p) static inline lv_coord_t lv_area_get_height(const lv_area_t * area_p)
{ {
return area_p->y2 - area_p->y1 + 1; return area_p->y2 - area_p->y1 + 1;
} }
......
...@@ -214,7 +214,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy) ...@@ -214,7 +214,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy)
} }
if(copy != NULL) { if(copy != NULL) {
area_cpy(&new_obj->coords, &copy->coords); lv_area_copy(&new_obj->coords, &copy->coords);
new_obj->ext_size = copy->ext_size; new_obj->ext_size = copy->ext_size;
/*Set free data*/ /*Set free data*/
...@@ -357,7 +357,7 @@ void lv_obj_invalidate(lv_obj_t * obj) ...@@ -357,7 +357,7 @@ void lv_obj_invalidate(lv_obj_t * obj)
bool union_ok = true; bool union_ok = true;
/*Start with the original coordinates*/ /*Start with the original coordinates*/
lv_coord_t ext_size = obj->ext_size; lv_coord_t ext_size = obj->ext_size;
area_cpy(&area_trunc, &obj->coords); lv_area_copy(&area_trunc, &obj->coords);
area_trunc.x1 -= ext_size; area_trunc.x1 -= ext_size;
area_trunc.y1 -= ext_size; area_trunc.y1 -= ext_size;
area_trunc.x2 += ext_size; area_trunc.x2 += ext_size;
...@@ -1122,7 +1122,7 @@ uint16_t lv_obj_count_children(lv_obj_t * obj) ...@@ -1122,7 +1122,7 @@ uint16_t lv_obj_count_children(lv_obj_t * obj)
*/ */
void lv_obj_get_coords(lv_obj_t * obj, lv_area_t * cords_p) void lv_obj_get_coords(lv_obj_t * obj, lv_area_t * cords_p)
{ {
area_cpy(cords_p, &obj->coords); lv_area_copy(cords_p, &obj->coords);
} }
...@@ -1161,7 +1161,7 @@ lv_coord_t lv_obj_get_y(lv_obj_t * obj) ...@@ -1161,7 +1161,7 @@ lv_coord_t lv_obj_get_y(lv_obj_t * obj)
*/ */
lv_coord_t lv_obj_get_width(lv_obj_t * obj) lv_coord_t lv_obj_get_width(lv_obj_t * obj)
{ {
return area_get_width(&obj->coords); return lv_area_get_width(&obj->coords);
} }
/** /**
...@@ -1171,7 +1171,7 @@ lv_coord_t lv_obj_get_width(lv_obj_t * obj) ...@@ -1171,7 +1171,7 @@ lv_coord_t lv_obj_get_width(lv_obj_t * obj)
*/ */
lv_coord_t lv_obj_get_height(lv_obj_t * obj) lv_coord_t lv_obj_get_height(lv_obj_t * obj)
{ {
return area_get_height(&obj->coords); return lv_area_get_height(&obj->coords);
} }
/** /**
......
...@@ -115,10 +115,10 @@ void lv_inv_area(const lv_area_t * area_p) ...@@ -115,10 +115,10 @@ void lv_inv_area(const lv_area_t * area_p)
/*Save the area*/ /*Save the area*/
if(inv_buf_p < LV_INV_FIFO_SIZE) { if(inv_buf_p < LV_INV_FIFO_SIZE) {
area_cpy(&inv_buf[inv_buf_p].area,&com_area); lv_area_copy(&inv_buf[inv_buf_p].area,&com_area);
} else {/*If no place for the area add the screen*/ } else {/*If no place for the area add the screen*/
inv_buf_p = 0; inv_buf_p = 0;
area_cpy(&inv_buf[inv_buf_p].area,&scr_area); lv_area_copy(&inv_buf[inv_buf_p].area,&scr_area);
} }
inv_buf_p ++; inv_buf_p ++;
} }
...@@ -199,7 +199,7 @@ static void lv_refr_join_area(void) ...@@ -199,7 +199,7 @@ static void lv_refr_join_area(void)
/*Join two area only if the joined area size is smaller*/ /*Join two area only if the joined area size is smaller*/
if(lv_area_get_size(&joined_area) < if(lv_area_get_size(&joined_area) <
(lv_area_get_size(&inv_buf[join_in].area) + lv_area_get_size(&inv_buf[join_from].area))) { (lv_area_get_size(&inv_buf[join_in].area) + lv_area_get_size(&inv_buf[join_from].area))) {
area_cpy(&inv_buf[join_in].area, &joined_area); lv_area_copy(&inv_buf[join_in].area, &joined_area);
/*Mark 'join_form' is joined into 'join_in'*/ /*Mark 'join_form' is joined into 'join_in'*/
inv_buf[join_from].joined = 1; inv_buf[join_from].joined = 1;
...@@ -257,8 +257,8 @@ static void lv_refr_area_no_vdb(const lv_area_t * area_p) ...@@ -257,8 +257,8 @@ static void lv_refr_area_no_vdb(const lv_area_t * area_p)
static void lv_refr_area_with_vdb(const lv_area_t * area_p) static void lv_refr_area_with_vdb(const lv_area_t * area_p)
{ {
/*Calculate the max row num*/ /*Calculate the max row num*/
uint32_t max_row = (uint32_t) LV_VDB_SIZE / (area_get_width(area_p)); uint32_t max_row = (uint32_t) LV_VDB_SIZE / (lv_area_get_width(area_p));
if(max_row > area_get_height(area_p)) max_row = area_get_height(area_p); if(max_row > lv_area_get_height(area_p)) max_row = lv_area_get_height(area_p);
/*Round the row number with downscale*/ /*Round the row number with downscale*/
#if LV_ANTIALIAS == 1 #if LV_ANTIALIAS == 1
......
...@@ -111,7 +111,7 @@ void lv_vdb_flush(void) ...@@ -111,7 +111,7 @@ void lv_vdb_flush(void)
* */ * */
lv_coord_t x; lv_coord_t x;
lv_coord_t y; lv_coord_t y;
lv_coord_t w = area_get_width(&vdb_act->area); lv_coord_t w = lv_area_get_width(&vdb_act->area);
lv_color_t * in1_buf = vdb_act->buf; /*Pointer to the first row*/ lv_color_t * in1_buf = vdb_act->buf; /*Pointer to the first row*/
lv_color_t * in2_buf = vdb_act->buf + w; /*Pointer to the second row*/ lv_color_t * in2_buf = vdb_act->buf + w; /*Pointer to the second row*/
lv_color_t * out_buf = vdb_act->buf; /*Store the result here*/ lv_color_t * out_buf = vdb_act->buf; /*Store the result here*/
......
...@@ -276,14 +276,14 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode ...@@ -276,14 +276,14 @@ static bool lv_bar_design(lv_obj_t * bar, const lv_area_t * mask, lv_design_mode
lv_style_t *style_indic = lv_bar_get_style(bar, LV_BAR_STYLE_INDIC); lv_style_t *style_indic = lv_bar_get_style(bar, LV_BAR_STYLE_INDIC);
lv_area_t indic_area; lv_area_t indic_area;
area_cpy(&indic_area, &bar->coords); lv_area_copy(&indic_area, &bar->coords);
indic_area.x1 += style_indic->body.padding.hor; indic_area.x1 += style_indic->body.padding.hor;
indic_area.x2 -= style_indic->body.padding.hor; indic_area.x2 -= style_indic->body.padding.hor;
indic_area.y1 += style_indic->body.padding.ver; indic_area.y1 += style_indic->body.padding.ver;
indic_area.y2 -= style_indic->body.padding.ver; indic_area.y2 -= style_indic->body.padding.ver;
lv_coord_t w = area_get_width(&indic_area); lv_coord_t w = lv_area_get_width(&indic_area);
lv_coord_t h = area_get_height(&indic_area); lv_coord_t h = lv_area_get_height(&indic_area);
if(w >= h) { if(w >= h) {
indic_area.x2 = (int32_t) ((int32_t)w * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value); indic_area.x2 = (int32_t) ((int32_t)w * (ext->cur_value - ext->min_value)) / (ext->max_value - ext->min_value);
......
...@@ -400,14 +400,14 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo ...@@ -400,14 +400,14 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo
/*Skip hidden buttons*/ /*Skip hidden buttons*/
if(button_is_hidden(ext->map_p[txt_i])) continue; if(button_is_hidden(ext->map_p[txt_i])) continue;
area_cpy(&area_tmp, &ext->button_areas[btn_i]); lv_area_copy(&area_tmp, &ext->button_areas[btn_i]);
area_tmp.x1 += area_btnm.x1; area_tmp.x1 += area_btnm.x1;
area_tmp.y1 += area_btnm.y1; area_tmp.y1 += area_btnm.y1;
area_tmp.x2 += area_btnm.x1; area_tmp.x2 += area_btnm.x1;
area_tmp.y2 += area_btnm.y1; area_tmp.y2 += area_btnm.y1;
btn_w = area_get_width(&area_tmp); btn_w = lv_area_get_width(&area_tmp);
btn_h = area_get_height(&area_tmp); btn_h = lv_area_get_height(&area_tmp);
/*Load the style*/ /*Load the style*/
if(button_is_inactive(ext->map_p[txt_i])) btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_INA); if(button_is_inactive(ext->map_p[txt_i])) btn_style = lv_btnm_get_style(btnm, LV_BTNM_STYLE_BTN_INA);
...@@ -437,7 +437,7 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo ...@@ -437,7 +437,7 @@ static bool lv_btnm_design(lv_obj_t * btnm, const lv_area_t * mask, lv_design_mo
lv_point_t txt_size; lv_point_t txt_size;
lv_txt_get_size(&txt_size, ext->map_p[txt_i], font, lv_txt_get_size(&txt_size, ext->map_p[txt_i], font,
btn_style->text.letter_space, btn_style->text.line_space, btn_style->text.letter_space, btn_style->text.line_space,
area_get_width(&area_btnm), LV_TXT_FLAG_NONE); lv_area_get_width(&area_btnm), LV_TXT_FLAG_NONE);
area_tmp.x1 += (btn_w - txt_size.x) / 2; area_tmp.x1 += (btn_w - txt_size.x) / 2;
area_tmp.y1 += (btn_h - txt_size.y) / 2; area_tmp.y1 += (btn_h - txt_size.y) / 2;
...@@ -487,7 +487,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) ...@@ -487,7 +487,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
if(btn_pr != ext->btn_id_pr) { if(btn_pr != ext->btn_id_pr) {
lv_indev_reset_lpr(param); lv_indev_reset_lpr(param);
if(ext->btn_id_pr != LV_BTNM_PR_NONE) { if(ext->btn_id_pr != LV_BTNM_PR_NONE) {
area_cpy(&btn_area, &ext->button_areas[ext->btn_id_pr]); lv_area_copy(&btn_area, &ext->button_areas[ext->btn_id_pr]);
btn_area.x1 += btnm_area.x1; btn_area.x1 += btnm_area.x1;
btn_area.y1 += btnm_area.y1; btn_area.y1 += btnm_area.y1;
btn_area.x2 += btnm_area.x1; btn_area.x2 += btnm_area.x1;
...@@ -495,7 +495,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) ...@@ -495,7 +495,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
lv_inv_area(&btn_area); lv_inv_area(&btn_area);
} }
if(btn_pr != LV_BTNM_PR_NONE) { if(btn_pr != LV_BTNM_PR_NONE) {
area_cpy(&btn_area, &ext->button_areas[btn_pr]); lv_area_copy(&btn_area, &ext->button_areas[btn_pr]);
btn_area.x1 += btnm_area.x1; btn_area.x1 += btnm_area.x1;
btn_area.y1 += btnm_area.y1; btn_area.y1 += btnm_area.y1;
btn_area.x2 += btnm_area.x1; btn_area.x2 += btnm_area.x1;
...@@ -529,7 +529,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) ...@@ -529,7 +529,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
/*Invalidate to old pressed area*/; /*Invalidate to old pressed area*/;
lv_obj_get_coords(btnm, &btnm_area); lv_obj_get_coords(btnm, &btnm_area);
area_cpy(&btn_area, &ext->button_areas[ext->btn_id_pr]); lv_area_copy(&btn_area, &ext->button_areas[ext->btn_id_pr]);
btn_area.x1 += btnm_area.x1; btn_area.x1 += btnm_area.x1;
btn_area.y1 += btnm_area.y1; btn_area.y1 += btnm_area.y1;
btn_area.x2 += btnm_area.x1; btn_area.x2 += btnm_area.x1;
...@@ -538,7 +538,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param) ...@@ -538,7 +538,7 @@ static lv_res_t lv_btnm_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
if(ext->toggle != 0) { if(ext->toggle != 0) {
/*Invalidate to old toggled area*/; /*Invalidate to old toggled area*/;
area_cpy(&btn_area, &ext->button_areas[ext->btn_id_tgl]); lv_area_copy(&btn_area, &ext->button_areas[ext->btn_id_tgl]);
btn_area.x1 += btnm_area.x1; btn_area.x1 += btnm_area.x1;
btn_area.y1 += btnm_area.y1; btn_area.y1 += btnm_area.y1;
btn_area.x2 += btnm_area.x1; btn_area.x2 += btnm_area.x1;
...@@ -682,7 +682,7 @@ static uint16_t get_button_from_point(lv_obj_t * btnm, lv_point_t * p) ...@@ -682,7 +682,7 @@ static uint16_t get_button_from_point(lv_obj_t * btnm, lv_point_t * p)
lv_obj_get_coords(btnm, &btnm_cords); lv_obj_get_coords(btnm, &btnm_cords);
for(i = 0; i < ext->btn_cnt; i++) { for(i = 0; i < ext->btn_cnt; i++) {
area_cpy(&btn_area, &ext->button_areas[i]); lv_area_copy(&btn_area, &ext->button_areas[i]);
btn_area.x1 += btnm_cords.x1; btn_area.x1 += btnm_cords.x1;
btn_area.y1 += btnm_cords.y1; btn_area.y1 += btnm_cords.y1;
btn_area.x2 += btnm_cords.x1; btn_area.x2 += btnm_cords.x1;
......
...@@ -201,8 +201,8 @@ static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param) ...@@ -201,8 +201,8 @@ static lv_res_t lv_cont_signal(lv_obj_t * cont, lv_signal_t sign, void * param)
lv_cont_refr_layout(cont); lv_cont_refr_layout(cont);
lv_cont_refr_autofit(cont); lv_cont_refr_autofit(cont);
} else if(sign == LV_SIGNAL_CORD_CHG) { } else if(sign == LV_SIGNAL_CORD_CHG) {
if(lv_obj_get_width(cont) != area_get_width(param) || if(lv_obj_get_width(cont) != lv_area_get_width(param) ||
lv_obj_get_height(cont) != area_get_height(param)) { lv_obj_get_height(cont) != lv_area_get_height(param)) {
lv_cont_refr_layout(cont); lv_cont_refr_layout(cont);
lv_cont_refr_autofit(cont); lv_cont_refr_autofit(cont);
} }
...@@ -582,7 +582,7 @@ static void lv_cont_refr_autofit(lv_obj_t * cont) ...@@ -582,7 +582,7 @@ static void lv_cont_refr_autofit(lv_obj_t * cont)
cont->coords.y2 != new_cords.y2) { cont->coords.y2 != new_cords.y2) {
lv_obj_invalidate(cont); lv_obj_invalidate(cont);
area_cpy(&cont->coords, &new_cords); lv_area_copy(&cont->coords, &new_cords);
lv_obj_invalidate(cont); lv_obj_invalidate(cont);
/*Notify the object about its new coordinates*/ /*Notify the object about its new coordinates*/
......
...@@ -685,8 +685,8 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param ...@@ -685,8 +685,8 @@ static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param
lv_label_refr_text(label); lv_label_refr_text(label);
} }
else if (sign == LV_SIGNAL_CORD_CHG) { else if (sign == LV_SIGNAL_CORD_CHG) {
if(area_get_width(&label->coords) != area_get_width(param) || if(lv_area_get_width(&label->coords) != lv_area_get_width(param) ||
area_get_height(&label->coords) != area_get_height(param)) lv_area_get_height(&label->coords) != lv_area_get_height(param))
{ {
lv_label_revert_dots(label); lv_label_revert_dots(label);
lv_label_refr_text(label); lv_label_refr_text(label);
......
...@@ -479,7 +479,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param) ...@@ -479,7 +479,7 @@ static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
if(sign == LV_SIGNAL_CORD_CHG) { if(sign == LV_SIGNAL_CORD_CHG) {
/*Be sure the width of the buttons are correct*/ /*Be sure the width of the buttons are correct*/
lv_coord_t w = lv_obj_get_width(list); lv_coord_t w = lv_obj_get_width(list);
if(w != area_get_width(param)) { /*Width changed*/ if(w != lv_area_get_width(param)) { /*Width changed*/
refr_btn_width(list); refr_btn_width(list);
} }
} }
......
...@@ -351,7 +351,7 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param) ...@@ -351,7 +351,7 @@ static lv_res_t lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox); lv_mbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
if(sign == LV_SIGNAL_CORD_CHG) { if(sign == LV_SIGNAL_CORD_CHG) {
if(lv_obj_get_width(mbox) != area_get_width(param)) { if(lv_obj_get_width(mbox) != lv_area_get_width(param)) {
mbox_realign(mbox); mbox_realign(mbox);
} }
......
...@@ -352,7 +352,7 @@ static bool lv_page_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mo ...@@ -352,7 +352,7 @@ static bool lv_page_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mo
lv_area_t sb_area; lv_area_t sb_area;
if(ext->sb.hor_draw) { if(ext->sb.hor_draw) {
/*Convert the relative coordinates to absolute*/ /*Convert the relative coordinates to absolute*/
area_cpy(&sb_area, &ext->sb.hor_area); lv_area_copy(&sb_area, &ext->sb.hor_area);
sb_area.x1 += scrl->coords.x1; sb_area.x1 += scrl->coords.x1;
sb_area.y1 += scrl->coords.y1; sb_area.y1 += scrl->coords.y1;
sb_area.x2 += scrl->coords.x1; sb_area.x2 += scrl->coords.x1;
...@@ -362,7 +362,7 @@ static bool lv_page_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mo ...@@ -362,7 +362,7 @@ static bool lv_page_design(lv_obj_t * scrl, const lv_area_t * mask, lv_design_mo
if(ext->sb.ver_draw) { if(ext->sb.ver_draw) {
/*Convert the relative coordinates to absolute*/ /*Convert the relative coordinates to absolute*/
area_cpy(&sb_area, &ext->sb.ver_area); lv_area_copy(&sb_area, &ext->sb.ver_area);
sb_area.x1 += scrl->coords.x1; sb_area.x1 += scrl->coords.x1;
sb_area.y1 += scrl->coords.y1; sb_area.y1 += scrl->coords.y1;
sb_area.x2 += scrl->coords.x1; sb_area.x2 += scrl->coords.x1;
...@@ -463,8 +463,8 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param) ...@@ -463,8 +463,8 @@ static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
} }
else if(sign == LV_SIGNAL_CORD_CHG) { else if(sign == LV_SIGNAL_CORD_CHG) {
/*Refresh the scrollbar and notify the scrl if the size is changed*/ /*Refresh the scrollbar and notify the scrl if the size is changed*/
if(ext->scrl != NULL && (lv_obj_get_width(page) != area_get_width(param) || if(ext->scrl != NULL && (lv_obj_get_width(page) != lv_area_get_width(param) ||
lv_obj_get_height(page) != area_get_height(param))) lv_obj_get_height(page) != lv_area_get_height(param)))
{ {
/*If no hor_fit enabled set the scrollable's width to the page's width*/ /*If no hor_fit enabled set the scrollable's width to the page's width*/
if(lv_cont_get_hor_fit(ext->scrl) == false) { if(lv_cont_get_hor_fit(ext->scrl) == false) {
...@@ -540,7 +540,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi ...@@ -540,7 +540,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
lv_obj_get_coords(page, &page_cords); lv_obj_get_coords(page, &page_cords);
/*scrollable width smaller then page width? -> align to left*/ /*scrollable width smaller then page width? -> align to left*/
if(area_get_width(&scrl_cords) + 2 * hpad < area_get_width(&page_cords)) { if(lv_area_get_width(&scrl_cords) + 2 * hpad < lv_area_get_width(&page_cords)) {
if(scrl_cords.x1 != page_cords.x1 + hpad) { if(scrl_cords.x1 != page_cords.x1 + hpad) {
new_x = hpad; new_x = hpad;
refr_x = true; refr_x = true;
...@@ -548,7 +548,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi ...@@ -548,7 +548,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
} else { } else {
/*The edges of the scrollable can not be in the page (minus hpad) */ /*The edges of the scrollable can not be in the page (minus hpad) */
if(scrl_cords.x2 < page_cords.x2 - hpad) { if(scrl_cords.x2 < page_cords.x2 - hpad) {
new_x = area_get_width(&page_cords) - area_get_width(&scrl_cords) - hpad; /* Right align */ new_x = lv_area_get_width(&page_cords) - lv_area_get_width(&scrl_cords) - hpad; /* Right align */
refr_x = true; refr_x = true;
} }
if (scrl_cords.x1 > page_cords.x1 + hpad) { if (scrl_cords.x1 > page_cords.x1 + hpad) {
...@@ -558,7 +558,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi ...@@ -558,7 +558,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
} }
/*scrollable height smaller then page height? -> align to left*/ /*scrollable height smaller then page height? -> align to left*/
if(area_get_height(&scrl_cords) + 2 * vpad < area_get_height(&page_cords)) { if(lv_area_get_height(&scrl_cords) + 2 * vpad < lv_area_get_height(&page_cords)) {
if(scrl_cords.y1 != page_cords.y1 + vpad) { if(scrl_cords.y1 != page_cords.y1 + vpad) {
new_y = vpad; new_y = vpad;
refr_y = true; refr_y = true;
...@@ -566,7 +566,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi ...@@ -566,7 +566,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
} else { } else {
/*The edges of the scrollable can not be in the page (minus vpad) */ /*The edges of the scrollable can not be in the page (minus vpad) */
if(scrl_cords.y2 < page_cords.y2 - vpad) { if(scrl_cords.y2 < page_cords.y2 - vpad) {
new_y = area_get_height(&page_cords) - area_get_height(&scrl_cords) - vpad; /* Bottom align */ new_y = lv_area_get_height(&page_cords) - lv_area_get_height(&scrl_cords) - vpad; /* Bottom align */
refr_y = true; refr_y = true;
} }
if (scrl_cords.y1 > page_cords.y1 + vpad) { if (scrl_cords.y1 > page_cords.y1 + vpad) {
...@@ -585,7 +585,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi ...@@ -585,7 +585,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
if(page_ext->sb.mode == LV_SB_MODE_DRAG) { if(page_ext->sb.mode == LV_SB_MODE_DRAG) {
lv_area_t sb_area_tmp; lv_area_t sb_area_tmp;
if(page_ext->sb.hor_draw) { if(page_ext->sb.hor_draw) {
area_cpy(&sb_area_tmp, &page_ext->sb.hor_area); lv_area_copy(&sb_area_tmp, &page_ext->sb.hor_area);
sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x2; sb_area_tmp.x2 += page->coords.x2;
...@@ -594,7 +594,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi ...@@ -594,7 +594,7 @@ static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, voi
page_ext->sb.hor_draw = 0; page_ext->sb.hor_draw = 0;
} }
if(page_ext->sb.ver_draw) { if(page_ext->sb.ver_draw) {
area_cpy(&sb_area_tmp, &page_ext->sb.ver_area); lv_area_copy(&sb_area_tmp, &page_ext->sb.ver_area);
sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x2; sb_area_tmp.x2 += page->coords.x2;
...@@ -656,7 +656,7 @@ static void lv_page_sb_refresh(lv_obj_t * page) ...@@ -656,7 +656,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
/*Invalidate the current (old) scrollbar areas*/ /*Invalidate the current (old) scrollbar areas*/
lv_area_t sb_area_tmp; lv_area_t sb_area_tmp;
if(ext->sb.hor_draw != 0) { if(ext->sb.hor_draw != 0) {
area_cpy(&sb_area_tmp, &ext->sb.hor_area); lv_area_copy(&sb_area_tmp, &ext->sb.hor_area);
sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x2; sb_area_tmp.x2 += page->coords.x2;
...@@ -664,7 +664,7 @@ static void lv_page_sb_refresh(lv_obj_t * page) ...@@ -664,7 +664,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
lv_inv_area(&sb_area_tmp); lv_inv_area(&sb_area_tmp);
} }
if(ext->sb.ver_draw != 0) { if(ext->sb.ver_draw != 0) {
area_cpy(&sb_area_tmp, &ext->sb.ver_area); lv_area_copy(&sb_area_tmp, &ext->sb.ver_area);
sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x2; sb_area_tmp.x2 += page->coords.x2;
...@@ -718,7 +718,7 @@ static void lv_page_sb_refresh(lv_obj_t * page) ...@@ -718,7 +718,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
/*Invalidate the new scrollbar areas*/ /*Invalidate the new scrollbar areas*/
if(ext->sb.hor_draw != 0) { if(ext->sb.hor_draw != 0) {
area_cpy(&sb_area_tmp, &ext->sb.hor_area); lv_area_copy(&sb_area_tmp, &ext->sb.hor_area);
sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x2; sb_area_tmp.x2 += page->coords.x2;
...@@ -726,7 +726,7 @@ static void lv_page_sb_refresh(lv_obj_t * page) ...@@ -726,7 +726,7 @@ static void lv_page_sb_refresh(lv_obj_t * page)
lv_inv_area(&sb_area_tmp); lv_inv_area(&sb_area_tmp);
} }
if(ext->sb.ver_draw != 0) { if(ext->sb.ver_draw != 0) {
area_cpy(&sb_area_tmp, &ext->sb.ver_area); lv_area_copy(&sb_area_tmp, &ext->sb.ver_area);
sb_area_tmp.x1 += page->coords.x1; sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1; sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x2; sb_area_tmp.x2 += page->coords.x2;
......
...@@ -262,8 +262,8 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par ...@@ -262,8 +262,8 @@ static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * par
refr_position(roller, false); refr_position(roller, false);
} else if(sign == LV_SIGNAL_CORD_CHG) { } else if(sign == LV_SIGNAL_CORD_CHG) {
if(lv_obj_get_width(roller) != area_get_width(param) || if(lv_obj_get_width(roller) != lv_area_get_width(param) ||
lv_obj_get_height(roller) != area_get_height(param)) { lv_obj_get_height(roller) != lv_area_get_height(param)) {
lv_ddlist_set_fix_height(roller, lv_obj_get_height(roller)); lv_ddlist_set_fix_height(roller, lv_obj_get_height(roller));
lv_obj_set_height(lv_page_get_scrl(roller), lv_obj_set_height(lv_page_get_scrl(roller),
...@@ -363,7 +363,7 @@ static void draw_bg(lv_obj_t *roller, const lv_area_t *mask) ...@@ -363,7 +363,7 @@ static void draw_bg(lv_obj_t *roller, const lv_area_t *mask)
lv_area_t half_roller; lv_area_t half_roller;
lv_coord_t h = lv_obj_get_height(roller); lv_coord_t h = lv_obj_get_height(roller);
bool union_ok; bool union_ok;
area_cpy(&half_roller, &roller->coords); lv_area_copy(&half_roller, &roller->coords);
half_roller.x1 -= roller->ext_size; /*Add ext size too (e.g. because of shadow draw) */ half_roller.x1 -= roller->ext_size; /*Add ext size too (e.g. because of shadow draw) */
half_roller.x2 += roller->ext_size; half_roller.x2 += roller->ext_size;
......
...@@ -243,15 +243,15 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig ...@@ -243,15 +243,15 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
/*Draw the bar*/ /*Draw the bar*/
lv_area_t area_bar; lv_area_t area_bar;
area_cpy(&area_bar, &slider->coords); lv_area_copy(&area_bar, &slider->coords);
/*Be sure at least vpad/hpad width bar will remain*/ /*Be sure at least vpad/hpad width bar will remain*/
lv_coord_t pad_ver_bar = style_slider->body.padding.ver; lv_coord_t pad_ver_bar = style_slider->body.padding.ver;
lv_coord_t pad_hor_bar = style_slider->body.padding.hor; lv_coord_t pad_hor_bar = style_slider->body.padding.hor;
if(pad_ver_bar * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) { if(pad_ver_bar * 2 + LV_SLIDER_SIZE_MIN > lv_area_get_height(&area_bar)) {
pad_ver_bar = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1; pad_ver_bar = (lv_area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
} }
if(pad_hor_bar * 2 + LV_SLIDER_SIZE_MIN > area_get_width(&area_bar)) { if(pad_hor_bar * 2 + LV_SLIDER_SIZE_MIN > lv_area_get_width(&area_bar)) {
pad_hor_bar = (area_get_width(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1; pad_hor_bar = (lv_area_get_width(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
} }
area_bar.x1 += pad_hor_bar; area_bar.x1 += pad_hor_bar;
...@@ -262,16 +262,16 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig ...@@ -262,16 +262,16 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
/*Draw the indicator*/ /*Draw the indicator*/
lv_area_t area_indic; lv_area_t area_indic;
area_cpy(&area_indic, &area_bar); lv_area_copy(&area_indic, &area_bar);
/*Be sure at least vpad/hpad width indicator will remain*/ /*Be sure at least vpad/hpad width indicator will remain*/
lv_coord_t pad_ver_indic = style_indic->body.padding.ver; lv_coord_t pad_ver_indic = style_indic->body.padding.ver;
lv_coord_t pad_hor_indic = style_indic->body.padding.hor; lv_coord_t pad_hor_indic = style_indic->body.padding.hor;
if(pad_ver_indic * 2 + LV_SLIDER_SIZE_MIN > area_get_height(&area_bar)) { if(pad_ver_indic * 2 + LV_SLIDER_SIZE_MIN > lv_area_get_height(&area_bar)) {
pad_ver_indic = (area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1; pad_ver_indic = (lv_area_get_height(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
} }
if(pad_hor_indic * 2 + LV_SLIDER_SIZE_MIN > area_get_width(&area_bar)) { if(pad_hor_indic * 2 + LV_SLIDER_SIZE_MIN > lv_area_get_width(&area_bar)) {
pad_hor_indic = (area_get_width(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1; pad_hor_indic = (lv_area_get_width(&area_bar) - LV_SLIDER_SIZE_MIN) >> 1;
} }
area_indic.x1 += pad_hor_indic; area_indic.x1 += pad_hor_indic;
...@@ -279,8 +279,8 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig ...@@ -279,8 +279,8 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
area_indic.y1 += pad_ver_indic; area_indic.y1 += pad_ver_indic;
area_indic.y2 -= pad_ver_indic; area_indic.y2 -= pad_ver_indic;
lv_coord_t slider_w = area_get_width(&slider->coords); lv_coord_t slider_w = lv_area_get_width(&slider->coords);
lv_coord_t slider_h = area_get_height(&slider->coords); lv_coord_t slider_h = lv_area_get_height(&slider->coords);
lv_coord_t cur_value = lv_slider_get_value(slider); lv_coord_t cur_value = lv_slider_get_value(slider);
lv_coord_t min_value = lv_slider_get_min_value(slider); lv_coord_t min_value = lv_slider_get_min_value(slider);
...@@ -290,11 +290,11 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig ...@@ -290,11 +290,11 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
if(ext->drag_value != LV_SLIDER_NOT_PRESSED) cur_value = ext->drag_value; if(ext->drag_value != LV_SLIDER_NOT_PRESSED) cur_value = ext->drag_value;
if(slider_w >= slider_h) { if(slider_w >= slider_h) {
area_indic.x2 = (int32_t) ((int32_t)area_get_width(&area_indic) * (cur_value - min_value)) / (max_value - min_value); area_indic.x2 = (int32_t) ((int32_t)lv_area_get_width(&area_indic) * (cur_value - min_value)) / (max_value - min_value);
area_indic.x2 += area_indic.x1; area_indic.x2 += area_indic.x1;
} else { } else {
area_indic.y1 = (int32_t) ((int32_t)area_get_height(&area_indic) * (cur_value - min_value)) / (max_value - min_value); area_indic.y1 = (int32_t) ((int32_t)lv_area_get_height(&area_indic) * (cur_value - min_value)) / (max_value - min_value);
area_indic.y1 = area_indic.y2 - area_indic.y1; area_indic.y1 = area_indic.y2 - area_indic.y1;
} }
...@@ -302,7 +302,7 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig ...@@ -302,7 +302,7 @@ static bool lv_slider_design(lv_obj_t * slider, const lv_area_t * mask, lv_desig
/*Draw the knob*/ /*Draw the knob*/
lv_area_t knob_area; lv_area_t knob_area;
area_cpy(&knob_area, &slider->coords); lv_area_copy(&knob_area, &slider->coords);
if(slider_w >= slider_h) { if(slider_w >= slider_h) {
if(ext->knob_in == 0) { if(ext->knob_in == 0) {
...@@ -395,8 +395,8 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par ...@@ -395,8 +395,8 @@ static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * par
else if(sign == LV_SIGNAL_CORD_CHG) { else if(sign == LV_SIGNAL_CORD_CHG) {
/* The knob size depends on slider size. /* The knob size depends on slider size.
* During the drawing method the ext. size is used by the knob so refresh the ext. size.*/ * During the drawing method the ext. size is used by the knob so refresh the ext. size.*/
if(lv_obj_get_width(slider) != area_get_width(param) || if(lv_obj_get_width(slider) != lv_area_get_width(param) ||
lv_obj_get_height(slider) != area_get_height(param)) { lv_obj_get_height(slider) != lv_area_get_height(param)) {
slider->signal_func(slider, LV_SIGNAL_REFR_EXT_SIZE, NULL); slider->signal_func(slider, LV_SIGNAL_REFR_EXT_SIZE, NULL);
} }
} else if(sign == LV_SIGNAL_REFR_EXT_SIZE) { } else if(sign == LV_SIGNAL_REFR_EXT_SIZE) {
......
...@@ -915,8 +915,8 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param) ...@@ -915,8 +915,8 @@ static lv_res_t lv_ta_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
} else if(sign == LV_SIGNAL_CORD_CHG) { } else if(sign == LV_SIGNAL_CORD_CHG) {
/*Set the label width according to the text area width*/ /*Set the label width according to the text area width*/
if(ext->label) { if(ext->label) {
if(lv_obj_get_width(ta) != area_get_width(param) || if(lv_obj_get_width(ta) != lv_area_get_width(param) ||
lv_obj_get_height(ta) != area_get_height(param)) { lv_obj_get_height(ta) != lv_area_get_height(param)) {
lv_obj_t * scrl = lv_page_get_scrl(ta); lv_obj_t * scrl = lv_page_get_scrl(ta);
lv_style_t * style_scrl = lv_obj_get_style(scrl); lv_style_t * style_scrl = lv_obj_get_style(scrl);
lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor); lv_obj_set_width(ext->label, lv_obj_get_width(scrl) - 2 * style_scrl->body.padding.hor);
......
...@@ -506,8 +506,8 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p ...@@ -506,8 +506,8 @@ static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * p
} }
else if(sign == LV_SIGNAL_CORD_CHG) { else if(sign == LV_SIGNAL_CORD_CHG) {
if(ext->content != NULL && if(ext->content != NULL &&
(lv_obj_get_width(tabview) != area_get_width(param) || (lv_obj_get_width(tabview) != lv_area_get_width(param) ||
lv_obj_get_height(tabview) != area_get_height(param))) lv_obj_get_height(tabview) != lv_area_get_height(param)))
{ {
tabview_realign(tabview); tabview_realign(tabview);
} }
......
...@@ -443,8 +443,8 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param) ...@@ -443,8 +443,8 @@ static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
} }
else if(sign == LV_SIGNAL_CORD_CHG) { else if(sign == LV_SIGNAL_CORD_CHG) {
/*If the size is changed refresh the window*/ /*If the size is changed refresh the window*/
if(area_get_width(param) != lv_obj_get_width(win) || if(lv_area_get_width(param) != lv_obj_get_width(win) ||
area_get_height(param) != lv_obj_get_height(win)) { lv_area_get_height(param) != lv_obj_get_height(win)) {
lv_win_realign(win); lv_win_realign(win);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment