fix(draw): fix bottom part of triangle drawing

see #4895
This commit is contained in:
Gabor Kiss-Vamosi 2023-12-05 17:12:04 +01:00
parent 3e1d7524da
commit 3c7e8bd0d4
10 changed files with 10 additions and 4 deletions

View File

@ -451,7 +451,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_line(lv_opa_t *
/*Non sense: Can't be on the right/left of a horizontal line*/
if(p->cfg.side == LV_DRAW_SW_MASK_LINE_SIDE_LEFT ||
p->cfg.side == LV_DRAW_SW_MASK_LINE_SIDE_RIGHT) return LV_DRAW_SW_MASK_RES_FULL_COVER;
else if(p->cfg.side == LV_DRAW_SW_MASK_LINE_SIDE_TOP && abs_y + 1 < 0) return LV_DRAW_SW_MASK_RES_FULL_COVER;
else if(p->cfg.side == LV_DRAW_SW_MASK_LINE_SIDE_TOP && abs_y < 0) return LV_DRAW_SW_MASK_RES_FULL_COVER;
else if(p->cfg.side == LV_DRAW_SW_MASK_LINE_SIDE_BOTTOM && abs_y > 0) return LV_DRAW_SW_MASK_RES_FULL_COVER;
else {
return LV_DRAW_SW_MASK_RES_TRANSP;

View File

@ -104,9 +104,15 @@ void lv_draw_sw_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_
p[2].x, p[2].y,
right ? LV_DRAW_SW_MASK_LINE_SIDE_LEFT : LV_DRAW_SW_MASK_LINE_SIDE_RIGHT);
lv_draw_sw_mask_line_points_init(&mask_bottom, p[1].x, p[1].y,
p[2].x, p[2].y,
right ? LV_DRAW_SW_MASK_LINE_SIDE_LEFT : LV_DRAW_SW_MASK_LINE_SIDE_RIGHT);
if(p[1].y == p[2].y) {
lv_draw_sw_mask_line_points_init(&mask_bottom, p[1].x, p[1].y,
p[2].x, p[2].y, LV_DRAW_SW_MASK_LINE_SIDE_TOP);
}
else {
lv_draw_sw_mask_line_points_init(&mask_bottom, p[1].x, p[1].y,
p[2].x, p[2].y,
right ? LV_DRAW_SW_MASK_LINE_SIDE_LEFT : LV_DRAW_SW_MASK_LINE_SIDE_RIGHT);
}
masks[0] = &mask_left;
masks[1] = &mask_right;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB