fix(shadow): fix overlapping shadow parts on small objects

This commit is contained in:
Gabor Kiss-Vamosi
2021-02-23 11:18:11 +01:00
parent 3ddf26923f
commit 8cfba6ae39

View File

@@ -716,6 +716,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
/*Avoid overlap in the middle with large radius*/
if(ca.x1 <= w_half) ca.x1 = w_half + 1;
if(simple_mode) ca.x1 = LV_MATH_MAX(ca.x1, coords->x2);
/*Draw horizontal lines*/
lv_coord_t w = lv_area_get_width(&ca);
@@ -841,6 +844,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
/*Avoid overlap in the middle with large radius*/
if(ca.x2 > w_half) ca.x2 = w_half;
if(simple_mode) ca.x2 = LV_MATH_MIN(coords->x1, ca.x2);
/*Draw vertical lines*/
lv_coord_t w = lv_area_get_width(&ca);
@@ -879,6 +885,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
/*Avoid overlap in the middle with large radius*/
if(ca.y2 > h_half) ca.y2 = h_half;
if(simple_mode) ca.y2 = LV_MATH_MIN(ca.y2, coords->y1);
/*Draw horizontal lines*/
lv_coord_t w = lv_area_get_width(&ca);
@@ -920,6 +929,9 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
has_com = _lv_area_intersect(&ca, &a, clip);
if(has_com && _lv_area_is_in(&a, &bg_coords, r_bg) == false) {
/*Avoid overlap in the middle with large radius*/
if(ca.y1 <= h_half) ca.y1 = h_half + 1;
if(simple_mode) ca.y1 = LV_MATH_MAX(ca.y1, coords->y2);
/*Draw horizontal lines*/
lv_coord_t w = lv_area_get_width(&ca);