lv_area_is_on bugfix

This commit is contained in:
Gabor Kiss-Vamosi
2018-03-07 10:49:25 +01:00
parent d068c85e80
commit 1b1efbd0f0
2 changed files with 13 additions and 39 deletions

View File

@@ -142,6 +142,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT && else if(lv_area_get_height(&vdb_rel_a) > VFILL_HW_ACC_SIZE_LIMIT &&
lv_disp_is_mem_blend_supported()) lv_disp_is_mem_blend_supported())
{ {
/*Fill a one line sized buffer with a color and blend this later*/
if(color_array_tmp[0].full != color.full || last_width != w) { if(color_array_tmp[0].full != color.full || last_width != w) {
uint16_t i; uint16_t i;
for(i = 0; i < w; i++) { for(i = 0; i < w; i++) {
@@ -149,6 +150,8 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
} }
last_width = w; last_width = w;
} }
/*Blend the filled line to every line VDB line-by-line*/
lv_coord_t row; lv_coord_t row;
for(row = vdb_rel_a.y1;row <= vdb_rel_a.y2; 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_array_tmp, w, opa); lv_disp_mem_blend(&vdb_buf_tmp[vdb_rel_a.x1], color_array_tmp, w, opa);

View File

@@ -166,47 +166,18 @@ bool lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p)
*/ */
bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p) bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p)
{ {
/*Two area are on each other if... */ if((a1_p->x1 <= a2_p->x2) &&
(a1_p->x2 >= a2_p->x1) &&
lv_point_t p; (a1_p->y1 <= a2_p->y2) &&
/*a2 left-top corner is on a1*/ (a1_p->y2 >= a2_p->y1))
p.x = a2_p->x1; {
p.y = a2_p->y1;
if(lv_area_is_point_on(a1_p, &p)) return true;
/*a2 right-top corner is on a1*/
p.x = a2_p->x2;
p.y = a2_p->y1;
if(lv_area_is_point_on(a1_p, &p)) return true;
/*a2 left-bottom corner is on a1*/
p.x = a2_p->x1;
p.y = a2_p->y2;
if(lv_area_is_point_on(a1_p, &p)) return true;
/*a2 right-bottom corner is on a1*/
p.x = a2_p->x2;
p.y = a2_p->y2;
if(lv_area_is_point_on(a1_p, &p)) return true;
/*a2 is horizontally bigger then a1 and covers it*/
if((a2_p->x1 <= a1_p->x1 && a2_p->x2 >= a1_p->x2) && /*a2 hor. cover a1?*/
((a2_p->y1 <= a1_p->y1 && a2_p->y1 >= a1_p->y2) || /*upper edge is on a1?*/
(a2_p->y2 <= a1_p->y1 && a2_p->y2 >= a1_p->y2) ||/* or lower edge is on a1?*/
(a2_p->y1 <= a1_p->y1 && a2_p->y2 >= a1_p->y2))) /*or a2 vert bigger then a1*/
return true; return true;
} else {
/*a2 is vertically bigger then a1 and covers it*/
if((a2_p->y1 <= a1_p->y1 && a2_p->y2 >= a1_p->y2) && /*a2 vert. cover a1?*/
((a2_p->x1 <= a1_p->x1 && a2_p->x1 >= a1_p->x2) || /*left edge is on a1?*/
(a2_p->x2 <= a1_p->x1 && a2_p->x2 >= a1_p->x2) ||/* or right edge is on a1?*/
(a2_p->x1 <= a1_p->x1 && a2_p->x2 >= a1_p->x2))) /*or a2 hor. bigger then a1*/
return true;
/*Else no cover*/
return false; return false;
} }
}
/** /**
* Check if an area is fully on an other * Check if an area is fully on an other
* @param ain_p pointer to an area which could be in 'aholder_p' * @param ain_p pointer to an area which could be in 'aholder_p'