Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(draw) fix border width of simple (radius=0, no masking) borders
  • Loading branch information
kisvegabor committed Aug 25, 2021
1 parent 78725f2 commit 20f1867
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/draw/lv_draw_rect.c
Expand Up @@ -1286,8 +1286,6 @@ void draw_border_generic(const lv_area_t * clip_area, const lv_area_t * outer_ar
static void draw_border_simple(const lv_area_t * clip, const lv_area_t * outer_area, const lv_area_t * inner_area,
lv_color_t color, lv_opa_t opa)
{


bool top_side = outer_area->y1 <= inner_area->y1 ? true : false;
bool bottom_side = outer_area->y2 >= inner_area->y2 ? true : false;
bool left_side = outer_area->x1 <= inner_area->x1 ? true : false;
Expand All @@ -1298,29 +1296,29 @@ static void draw_border_simple(const lv_area_t * clip, const lv_area_t * outer_a
a.x1 = outer_area->x1;
a.x2 = outer_area->x2;
a.y1 = outer_area->y1;
a.y2 = inner_area->y1;
a.y2 = inner_area->y1 - 1;
if(top_side) {
_lv_blend_fill(clip, &a, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, LV_BLEND_MODE_NORMAL);
}

/*Bottom*/
a.y1 = inner_area->y2;
a.y1 = inner_area->y2 + 1;
a.y2 = outer_area->y2;
if(bottom_side) {
_lv_blend_fill(clip, &a, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, LV_BLEND_MODE_NORMAL);
}

/*Left*/
a.x1 = outer_area->x1;
a.x2 = inner_area->x1;
a.x2 = inner_area->x1 - 1;
a.y1 = (top_side) ? inner_area->y1 : outer_area->y1;
a.y2 = (bottom_side) ? inner_area->y2 : outer_area->y2;
if(left_side) {
_lv_blend_fill(clip, &a, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, LV_BLEND_MODE_NORMAL);
}

/*Right*/
a.x1 = inner_area->x2;
a.x1 = inner_area->x2 + 1;
a.x2 = outer_area->x2;
if(right_side) {
_lv_blend_fill(clip, &a, color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, LV_BLEND_MODE_NORMAL);
Expand Down

0 comments on commit 20f1867

Please sign in to comment.