fix rectangle border drawing with large width
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
|
||||
## v7.7.0 (06.10.2020)
|
||||
## v7.7.0 (20.10.2020)
|
||||
|
||||
### New features
|
||||
- Add PXP GPU support (for NXP MCUs)
|
||||
@@ -18,6 +18,7 @@
|
||||
- Support RTL in pretty layout (draw columns right to left)
|
||||
- Skip objects in groups if they are in disabled state
|
||||
- Fix dropdown selection with RTL basedirection
|
||||
- Fix rectangle border drawing with large width
|
||||
|
||||
## v7.6.1 (06.10.2020)
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t
|
||||
static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, const lv_draw_rect_dsc_t * dsc);
|
||||
#endif
|
||||
static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * area_outer, const lv_area_t * clip,
|
||||
lv_coord_t radius, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
lv_coord_t radius, bool radius_is_in, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(const lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
|
||||
|
||||
/**********************
|
||||
@@ -410,7 +410,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv
|
||||
area_inner.y2 -= ((dsc->border_side & LV_BORDER_SIDE_BOTTOM) ? dsc->border_width : - (dsc->border_width + rout));
|
||||
|
||||
if(dsc->border_side == LV_BORDER_SIDE_FULL) {
|
||||
draw_full_border(&area_inner, coords, clip, dsc->radius, dsc->border_color, dsc->border_opa, dsc->border_blend_mode);
|
||||
draw_full_border(&area_inner, coords, clip, dsc->radius, false, dsc->border_color, dsc->border_opa, dsc->border_blend_mode);
|
||||
}
|
||||
else {
|
||||
lv_opa_t opa = dsc->border_opa;
|
||||
@@ -1176,7 +1176,7 @@ static void draw_outline(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
area_outer.y1 -= dsc->outline_width;
|
||||
area_outer.y2 += dsc->outline_width;
|
||||
|
||||
draw_full_border(&area_inner, &area_outer, clip, dsc->radius, dsc->outline_color, dsc->outline_opa,
|
||||
draw_full_border(&area_inner, &area_outer, clip, dsc->radius, true, dsc->outline_color, dsc->outline_opa,
|
||||
dsc->outline_blend_mode);
|
||||
}
|
||||
#endif
|
||||
@@ -1325,7 +1325,7 @@ static void draw_value_str(const lv_area_t * coords, const lv_area_t * clip, con
|
||||
#endif
|
||||
|
||||
static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * area_outer, const lv_area_t * clip,
|
||||
lv_coord_t radius, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
lv_coord_t radius, bool radius_is_in, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode)
|
||||
{
|
||||
uint8_t other_mask_cnt = lv_draw_mask_get_cnt();
|
||||
bool simple_mode = true;
|
||||
@@ -1334,18 +1334,29 @@ static void draw_full_border(const lv_area_t * area_inner, const lv_area_t * are
|
||||
int32_t inner_w = lv_area_get_width(area_inner);
|
||||
int32_t inner_h = lv_area_get_height(area_inner);
|
||||
lv_coord_t border_width = area_outer->x2 - area_inner->x2;
|
||||
int32_t rin = radius;
|
||||
|
||||
int32_t short_side = LV_MATH_MIN(inner_w, inner_h);
|
||||
if(rin > short_side >> 1) rin = short_side >> 1;
|
||||
|
||||
/*Get the outer area*/
|
||||
int32_t rout = rin + border_width;
|
||||
|
||||
int32_t coords_out_w = lv_area_get_width(area_outer);
|
||||
int32_t coords_out_h = lv_area_get_height(area_outer);
|
||||
short_side = LV_MATH_MIN(coords_out_w, coords_out_h);
|
||||
if(rout > short_side >> 1) rout = short_side >> 1;
|
||||
|
||||
int32_t rin;
|
||||
int32_t rout;
|
||||
if(radius_is_in) {
|
||||
rin = radius;
|
||||
int32_t short_side = LV_MATH_MIN(inner_w, inner_h);
|
||||
if(rin > short_side >> 1) rin = short_side >> 1;
|
||||
|
||||
/*Get the outer area*/
|
||||
rout = rin + border_width;
|
||||
} else {
|
||||
rout = radius;
|
||||
int32_t short_side = LV_MATH_MIN(coords_out_w, coords_out_h);
|
||||
if(rout > short_side >> 1) rout = short_side >> 1;
|
||||
|
||||
/*Get the outer area*/
|
||||
rin = rout - border_width;
|
||||
if(rin < 0) rin = 0;
|
||||
|
||||
}
|
||||
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
lv_disp_buf_t * vdb = lv_disp_get_buf(disp);
|
||||
|
||||
Reference in New Issue
Block a user