fix(draw) overlap outline with background to prevent aliasing artifacts (#2067)

* fix(draw) overlap outline with background to prevent aliasing artifacts

* fix(draw) only overlap outline if padding == 0
This commit is contained in:
embeddedt
2021-02-12 09:16:10 -05:00
committed by GitHub
parent 1566e6fab1
commit 681cf0dc57
2 changed files with 13 additions and 8 deletions
+1
View File
@@ -3,6 +3,7 @@
## v7.10.1 (Planned for 16.02.2021)
### Bugfixes
- fix(draw) overlap outline with background to prevent aliasing artifacts
- fix(indev) clear the indev's `act_obj` in `lv_indev_reset`
- fix(text) fix out of bounds read in `_lv_txt_get_width`
- fix(text) improve Arabic contextual analysis by adding hyphen processing and proper handling of lam-alef sequence
+12 -8
View File
@@ -1160,18 +1160,22 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, const
/*Get the inner radius*/
lv_area_t area_inner;
lv_area_copy(&area_inner, coords);
area_inner.x1 -= dsc->outline_pad;
area_inner.y1 -= dsc->outline_pad;
area_inner.x2 += dsc->outline_pad;
area_inner.y2 += dsc->outline_pad;
/*Extend the outline into the background area if it's overlapping the edge*/
lv_coord_t pad = (dsc->outline_pad == 0 ? (dsc->outline_pad - 1) : dsc->outline_pad);
area_inner.x1 -= pad;
area_inner.y1 -= pad;
area_inner.x2 += pad;
area_inner.y2 += pad;
lv_area_t area_outer;
lv_area_copy(&area_outer, &area_inner);
area_outer.x1 -= dsc->outline_width;
area_outer.x2 += dsc->outline_width;
area_outer.y1 -= dsc->outline_width;
area_outer.y2 += dsc->outline_width;
lv_coord_t width = (dsc->outline_pad == 0 ? (dsc->outline_width + 1) : dsc->outline_width);
area_outer.x1 -= width;
area_outer.x2 += width;
area_outer.y1 -= width;
area_outer.y2 += width;
draw_full_border(&area_inner, &area_outer, clip, dsc->radius, true, dsc->outline_color, dsc->outline_opa,
dsc->outline_blend_mode);