From 05da56c839e370d7d292c6cc1c9bab3e9e167b0f Mon Sep 17 00:00:00 2001 From: TridentTD Date: Sat, 2 Nov 2019 20:17:45 +0700 Subject: [PATCH] fix rounded-ending arc --- src/lv_objx/lv_arc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/lv_objx/lv_arc.c b/src/lv_objx/lv_arc.c index a95371ac6..85af1c33c 100644 --- a/src/lv_objx/lv_arc.c +++ b/src/lv_objx/lv_arc.c @@ -243,8 +243,8 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area /*Draw circle on the ends if enabled */ if(style->line.rounded) { lv_coord_t thick_half = style->line.width / 2; - lv_coord_t cir_x = ((r - thick_half) * lv_trigo_sin(ext->angle_start) >> LV_TRIGO_SHIFT); - lv_coord_t cir_y = ((r - thick_half) * lv_trigo_sin(ext->angle_start + 90) >> LV_TRIGO_SHIFT); + lv_coord_t cir_x = ((r - thick_half + 1) * lv_trigo_sin(90 - ext->angle_start) >> LV_TRIGO_SHIFT); + lv_coord_t cir_y = ((r - thick_half + 1) * lv_trigo_sin(ext->angle_start) >> LV_TRIGO_SHIFT); lv_style_t cir_style; lv_style_copy(&cir_style, &lv_style_plain); @@ -252,18 +252,18 @@ static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area cir_style.body.main_color = cir_style.body.grad_color; cir_style.body.radius = LV_RADIUS_CIRCLE; lv_area_t cir_area; - cir_area.x1 = cir_x + x - thick_half; - cir_area.y1 = cir_y + y - thick_half; + cir_area.x1 = cir_x + x - thick_half +1; + cir_area.y1 = cir_y + y - thick_half +1; cir_area.x2 = cir_x + x + thick_half; cir_area.y2 = cir_y + y + thick_half; lv_draw_rect(&cir_area, clip_area, &cir_style, opa_scale); - cir_x = ((r - thick_half) * lv_trigo_sin(ext->angle_end) >> LV_TRIGO_SHIFT); - cir_y = ((r - thick_half) * lv_trigo_sin(ext->angle_end + 90) >> LV_TRIGO_SHIFT); + cir_x = ((r - thick_half + 1) * lv_trigo_sin(90 - ext->angle_end) >> LV_TRIGO_SHIFT); + cir_y = ((r - thick_half + 1) * lv_trigo_sin(ext->angle_end) >> LV_TRIGO_SHIFT); - cir_area.x1 = cir_x + x - thick_half; - cir_area.y1 = cir_y + y - thick_half; + cir_area.x1 = cir_x + x - thick_half +1; + cir_area.y1 = cir_y + y - thick_half +1; cir_area.x2 = cir_x + x + thick_half; cir_area.y2 = cir_y + y + thick_half;