1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

fix rounded-ending arc

This commit is contained in:
TridentTD 2019-11-02 20:17:45 +07:00 committed by GitHub
parent bdd0acf53a
commit 05da56c839
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;