diff --git a/src/lv_objx/lv_line.c b/src/lv_objx/lv_line.c index f958e3d60..5427ecb09 100644 --- a/src/lv_objx/lv_line.c +++ b/src/lv_objx/lv_line.c @@ -217,8 +217,8 @@ static lv_design_res_t lv_line_design(lv_obj_t * line, const lv_area_t * clip_ar lv_opa_t opa_scale = lv_obj_get_opa_scale(line); lv_area_t area; lv_obj_get_coords(line, &area); - lv_coord_t x_ofs = area.x1;// - (style->line.width & 0x1); - lv_coord_t y_ofs = area.y1;// - (style->line.width & 0x1 ? 0 : 1); + lv_coord_t x_ofs = area.x1; + lv_coord_t y_ofs = area.y1; lv_point_t p1; lv_point_t p2; lv_coord_t h = lv_obj_get_height(line); @@ -227,10 +227,12 @@ static lv_design_res_t lv_line_design(lv_obj_t * line, const lv_area_t * clip_ar lv_style_t circle_style_tmp; /*If rounded...*/ lv_style_copy(&circle_style_tmp, style); circle_style_tmp.body.radius = LV_RADIUS_CIRCLE; - circle_style_tmp.body.main_color = style->line.color;//LV_COLOR_RED;//style->line.color; - circle_style_tmp.body.grad_color = style->line.color;//LV_COLOR_RED;//style->line.color; + circle_style_tmp.body.main_color = style->line.color; + circle_style_tmp.body.grad_color = style->line.color; circle_style_tmp.body.opa = style->line.opa; lv_area_t circle_area; + lv_coord_t r = (style->line.width >> 1); + lv_coord_t r_corr = style->line.width & 1 ? 0 : 1; /*Read all points and draw the lines*/ for(i = 0; i < ext->point_num - 1; i++) { @@ -249,22 +251,20 @@ static lv_design_res_t lv_line_design(lv_obj_t * line, const lv_area_t * clip_ar /*Draw circle on the joints if enabled*/ if(style->line.rounded) { - lv_coord_t r = (style->line.width >> 1); circle_area.x1 = p1.x - r; circle_area.y1 = p1.y - r; - circle_area.x2 = p1.x + r - 1; - circle_area.y2 = p1.y + r - 1; + circle_area.x2 = p1.x + r - r_corr; + circle_area.y2 = p1.y + r - r_corr ; lv_draw_rect(&circle_area, clip_area, &circle_style_tmp, opa_scale); } } /*Draw circle on the last point too if enabled*/ if(style->line.rounded) { - lv_coord_t r = (style->line.width >> 1) - 1; - circle_area.x1 = p2.x - r - 1; - circle_area.y1 = p2.y - r - 1; - circle_area.x2 = p2.x + r; - circle_area.y2 = p2.y + r; + circle_area.x1 = p2.x - r; + circle_area.y1 = p2.y - r; + circle_area.x2 = p2.x + r - r_corr; + circle_area.y2 = p2.y + r - r_corr; lv_draw_rect(&circle_area, clip_area, &circle_style_tmp, opa_scale); } }