mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
draw line fixes
the positions weren't pixel perfect
This commit is contained in:
parent
7d675cf1d1
commit
eb6e8c4563
@ -99,14 +99,17 @@ void lv_draw_buf_release(void * p)
|
||||
void lv_draw_buf_free_all(void)
|
||||
{
|
||||
uint8_t i;
|
||||
uint32_t s = 0;
|
||||
for(i = 0; i < LV_DRAW_BUF_MAX_NUM; i++) {
|
||||
if(_lv_draw_buf[i].p) {
|
||||
s+= _lv_draw_buf[i].size;
|
||||
lv_mem_free(_lv_draw_buf[i].p);
|
||||
_lv_draw_buf[i].p = NULL;
|
||||
_lv_draw_buf[i].used = 0;
|
||||
_lv_draw_buf[i].size = 0;
|
||||
}
|
||||
}
|
||||
if(s) printf("draf_buf free %d bytes\n", s);
|
||||
}
|
||||
|
||||
/**********************
|
||||
|
@ -274,14 +274,14 @@ static void draw_line_skew(const lv_point_t * point1, const lv_point_t * point2,
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x, p1.y - w_half0, p2.x, p2.y - w_half0, LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x, p1.y + w_half1, p2.x, p2.y + w_half1, LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
} else {
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x, p1.y + w_half0, p2.x, p2.y + w_half0, LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x, p1.y - w_half1, p2.x, p2.y - w_half1, LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x, p1.y + w_half1, p2.x, p2.y + w_half1, LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x, p1.y - w_half0, p2.x, p2.y - w_half0, LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
}
|
||||
} else {
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x + w_half0, p1.y, p2.x + w_half0, p2.y, LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x - w_half1, p1.y, p2.x - w_half1, p2.y, LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
|
||||
lv_draw_mask_line_points_init(&mask_left_param, p1.x + w_half1, p1.y, p2.x + w_half1, p2.y, LV_DRAW_MASK_LINE_SIDE_LEFT);
|
||||
lv_draw_mask_line_points_init(&mask_right_param, p1.x - w_half0, p1.y, p2.x - w_half0, p2.y, LV_DRAW_MASK_LINE_SIDE_RIGHT);
|
||||
}
|
||||
|
||||
/*Use the normal vector for the endings*/
|
||||
lv_draw_mask_line_points_init(&mask_top_param, p1.x, p1.y, p1.x - ydiff, p1.y + xdiff, LV_DRAW_MASK_LINE_SIDE_BOTTOM);
|
||||
lv_draw_mask_line_points_init(&mask_bottom_param, p2.x, p2.y,p2.x - ydiff, p2.y + xdiff, LV_DRAW_MASK_LINE_SIDE_TOP);
|
||||
|
@ -451,7 +451,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
|
||||
lv_coord_t corner_size = sw + r_sh;
|
||||
|
||||
lv_opa_t sh_buf[corner_size * corner_size];
|
||||
lv_opa_t * sh_buf = lv_draw_buf_get(corner_size * corner_size);
|
||||
shadow_draw_corner_buf(&sh_rect_area, sh_buf, style->body.shadow.width, r_sh);
|
||||
|
||||
bool simple_mode = true;
|
||||
@ -761,6 +761,7 @@ static void draw_shadow(const lv_area_t * coords, const lv_area_t * clip, const
|
||||
|
||||
lv_draw_mask_remove_id(mask_rout_id);
|
||||
lv_draw_buf_release(mask_buf);
|
||||
lv_draw_buf_release(sh_buf);
|
||||
}
|
||||
|
||||
static void shadow_draw_corner_buf(const lv_area_t * coords, lv_opa_t * sh_buf, lv_coord_t sw, lv_coord_t r)
|
||||
|
Loading…
x
Reference in New Issue
Block a user