mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-30 13:14:37 +08:00
rename lv_area_union to lv_area_intersect
This commit is contained in:
parent
f4a66c4b22
commit
edf94bf1b2
@ -364,7 +364,7 @@ void lv_obj_invalidate(lv_obj_t * obj)
|
||||
|
||||
/*Check through all parents*/
|
||||
while(par != NULL) {
|
||||
union_ok = lv_area_union(&area_trunc, &area_trunc, &par->coords);
|
||||
union_ok = lv_area_intersect(&area_trunc, &area_trunc, &par->coords);
|
||||
if(union_ok == false) break; /*If no common parts with parent break;*/
|
||||
if(lv_obj_get_hidden(par)) return; /*If the parent is hidden then the child is hidden and won't be drawn*/
|
||||
|
||||
|
@ -93,7 +93,7 @@ void lv_inv_area(const lv_area_t * area_p)
|
||||
lv_area_t com_area;
|
||||
bool suc;
|
||||
|
||||
suc = lv_area_union(&com_area, area_p, &scr_area);
|
||||
suc = lv_area_intersect(&com_area, area_p, &scr_area);
|
||||
|
||||
/*The area is truncated to the screen*/
|
||||
if(suc != false) {
|
||||
@ -328,7 +328,7 @@ static void lv_refr_area_part_vdb(const lv_area_t * area_p)
|
||||
/*Get the new mask from the original area and the act. VDB
|
||||
It will be a part of 'area_p'*/
|
||||
lv_area_t start_mask;
|
||||
lv_area_union(&start_mask, area_p, &vdb_p->area);
|
||||
lv_area_intersect(&start_mask, area_p, &vdb_p->area);
|
||||
|
||||
/*Get the most top object which is not covered by others*/
|
||||
top_p = lv_refr_get_top_obj(&start_mask, lv_scr_act());
|
||||
@ -451,7 +451,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
obj_area.y1 -= ext_size;
|
||||
obj_area.x2 += ext_size;
|
||||
obj_area.y2 += ext_size;
|
||||
union_ok = lv_area_union(&obj_ext_mask, mask_ori_p, &obj_area);
|
||||
union_ok = lv_area_intersect(&obj_ext_mask, mask_ori_p, &obj_area);
|
||||
|
||||
/*Draw the parent and its children only if they ore on 'mask_parent'*/
|
||||
if(union_ok != false) {
|
||||
@ -465,7 +465,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
|
||||
/*Create a new 'obj_mask' without 'ext_size' because the children can't be visible there*/
|
||||
lv_obj_get_coords(obj, &obj_area);
|
||||
union_ok = lv_area_union(&obj_mask, mask_ori_p, &obj_area);
|
||||
union_ok = lv_area_intersect(&obj_mask, mask_ori_p, &obj_area);
|
||||
if(union_ok != false) {
|
||||
lv_area_t mask_child; /*Mask from obj and its child*/
|
||||
lv_obj_t * child_p;
|
||||
@ -479,7 +479,7 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
child_area.y2 += ext_size;
|
||||
/* Get the union (common parts) of original mask (from obj)
|
||||
* and its child */
|
||||
union_ok = lv_area_union(&mask_child, &obj_mask, &child_area);
|
||||
union_ok = lv_area_intersect(&mask_child, &obj_mask, &child_area);
|
||||
|
||||
/*If the parent and the child has common area then refresh the child */
|
||||
if(union_ok) {
|
||||
|
@ -431,7 +431,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
|
||||
|
||||
lv_area_t mask_com; /*Common area of mask and cords*/
|
||||
bool union_ok;
|
||||
union_ok = lv_area_union(&mask_com, mask, coords);
|
||||
union_ok = lv_area_intersect(&mask_com, mask, coords);
|
||||
if(union_ok == false) {
|
||||
lv_fs_close(&file);
|
||||
return;
|
||||
@ -506,7 +506,7 @@ void lv_draw_img(const lv_area_t * coords, const lv_area_t * mask,
|
||||
const lv_img_t * img_var = src;
|
||||
lv_area_t mask_com; /*Common area of mask and coords*/
|
||||
bool union_ok;
|
||||
union_ok = lv_area_union(&mask_com, mask, coords);
|
||||
union_ok = lv_area_intersect(&mask_com, mask, coords);
|
||||
if(union_ok == false) {
|
||||
return; /*Out of mask*/
|
||||
}
|
||||
|
@ -76,11 +76,11 @@ void lv_rfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
bool union_ok = true;
|
||||
|
||||
if(mask_p != NULL) {
|
||||
union_ok = lv_area_union(&masked_area, cords_p, mask_p);
|
||||
union_ok = lv_area_intersect(&masked_area, cords_p, mask_p);
|
||||
} else {
|
||||
lv_area_t scr_area;
|
||||
lv_area_set(&scr_area, 0, 0, LV_HOR_RES - 1, LV_VER_RES - 1);
|
||||
union_ok = lv_area_union(&masked_area, cords_p, &scr_area);
|
||||
union_ok = lv_area_intersect(&masked_area, cords_p, &scr_area);
|
||||
}
|
||||
|
||||
if(union_ok != false) {
|
||||
@ -222,7 +222,7 @@ void lv_rmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
lv_area_t masked_a;
|
||||
bool union_ok;
|
||||
|
||||
union_ok = lv_area_union(&masked_a, cords_p, mask_p);
|
||||
union_ok = lv_area_intersect(&masked_a, cords_p, mask_p);
|
||||
|
||||
/*If there are common part of the mask and map then draw the map*/
|
||||
if(union_ok == false) return;
|
||||
|
@ -101,7 +101,7 @@ void lv_vfill(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
/*Get the union of cord and mask*/
|
||||
/* The mask is already truncated to the vdb size
|
||||
* in 'lv_refr_area_with_vdb' function */
|
||||
union_ok = lv_area_union(&res_a, cords_p, mask_p);
|
||||
union_ok = lv_area_intersect(&res_a, cords_p, mask_p);
|
||||
|
||||
/*If there are common part of the three area then draw to the vdb*/
|
||||
if(union_ok == false) return;
|
||||
@ -337,7 +337,7 @@ void lv_vmap(const lv_area_t * cords_p, const lv_area_t * mask_p,
|
||||
/*Get the union of map size and mask*/
|
||||
/* The mask is already truncated to the vdb size
|
||||
* in 'lv_refr_area_with_vdb' function */
|
||||
union_ok = lv_area_union(&masked_a, cords_p, mask_p);
|
||||
union_ok = lv_area_intersect(&masked_a, cords_p, mask_p);
|
||||
|
||||
/*If there are common part of the three area then draw to the vdb*/
|
||||
if(union_ok == false) return;
|
||||
|
@ -102,12 +102,12 @@ uint32_t lv_area_get_size(const lv_area_t * area_p)
|
||||
|
||||
/**
|
||||
* Get the common parts of two areas
|
||||
* @param res_p pointer to an area, the result will be stored her
|
||||
* @param res_p pointer to an area, the result will be stored here
|
||||
* @param a1_p pointer to the first area
|
||||
* @param a2_p pointer to the second area
|
||||
* @return false: the two area has NO common parts, res_p is invalid
|
||||
*/
|
||||
bool lv_area_union(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p)
|
||||
bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p)
|
||||
{
|
||||
/* Get the smaller area from 'a1_p' and 'a2_p' */
|
||||
res_p->x1 = LV_MATH_MAX(a1_p->x1, a2_p->x1);
|
||||
|
@ -123,7 +123,7 @@ uint32_t lv_area_get_size(const lv_area_t * area_p);
|
||||
* @param a2_p pointer to the second area
|
||||
* @return false: the two area has NO common parts, res_p is invalid
|
||||
*/
|
||||
bool lv_area_union(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p);
|
||||
bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p);
|
||||
|
||||
/**
|
||||
* Join two areas into a third which involves the other two
|
||||
|
@ -670,7 +670,7 @@ static void lv_chart_draw_cols(lv_obj_t * chart, const lv_area_t * mask)
|
||||
y_tmp = y_tmp / (ext->ymax - ext->ymin);
|
||||
col_a.y1 = h - y_tmp + chart->coords.y1;
|
||||
|
||||
mask_ret = lv_area_union(&col_mask, mask, &col_a);
|
||||
mask_ret = lv_area_intersect(&col_mask, mask, &col_a);
|
||||
if(mask_ret != false) {
|
||||
lv_draw_rect(&chart->coords, &col_mask, &rects);
|
||||
}
|
||||
|
@ -479,7 +479,7 @@ static bool lv_ddlist_design(lv_obj_t * ddlist, const lv_area_t * mask, lv_desig
|
||||
area_sel.x2 = ddlist->coords.x2;
|
||||
lv_area_t mask_sel;
|
||||
bool area_ok;
|
||||
area_ok = lv_area_union(&mask_sel, mask, &area_sel);
|
||||
area_ok = lv_area_intersect(&mask_sel, mask, &area_sel);
|
||||
if(area_ok) {
|
||||
lv_style_t * sel_style = lv_ddlist_get_style(ddlist, LV_DDLIST_STYLE_SEL);
|
||||
lv_style_t new_style;
|
||||
|
@ -251,7 +251,7 @@ static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_desig
|
||||
rect_area.x2 = roller->coords.x2;
|
||||
lv_area_t mask_sel;
|
||||
bool area_ok;
|
||||
area_ok = lv_area_union(&mask_sel, mask, &rect_area);
|
||||
area_ok = lv_area_intersect(&mask_sel, mask, &rect_area);
|
||||
if(area_ok) {
|
||||
lv_style_t * sel_style = lv_roller_get_style(roller, LV_ROLLER_STYLE_SEL);
|
||||
lv_style_t new_style;
|
||||
@ -416,7 +416,7 @@ static void draw_bg(lv_obj_t * roller, const lv_area_t * mask)
|
||||
half_roller.y1 -= roller->ext_size;
|
||||
half_roller.y2 = roller->coords.y1 + h / 2;
|
||||
|
||||
union_ok = lv_area_union(&half_mask, &half_roller, mask);
|
||||
union_ok = lv_area_intersect(&half_mask, &half_roller, mask);
|
||||
|
||||
half_roller.x1 += roller->ext_size; /*Revert ext. size adding*/
|
||||
half_roller.x2 -= roller->ext_size;
|
||||
@ -433,7 +433,7 @@ static void draw_bg(lv_obj_t * roller, const lv_area_t * mask)
|
||||
half_roller.y1 = roller->coords.y1 + h / 2;
|
||||
if((h & 0x1) == 0) half_roller.y1++; /*With even height the pixels in the middle would be drawn twice*/
|
||||
|
||||
union_ok = lv_area_union(&half_mask, &half_roller, mask);
|
||||
union_ok = lv_area_intersect(&half_mask, &half_roller, mask);
|
||||
|
||||
half_roller.x1 += roller->ext_size; /*Revert ext. size adding*/
|
||||
half_roller.x2 -= roller->ext_size;
|
||||
|
Loading…
Reference in New Issue
Block a user