mirror of
https://github.com/lvgl/lvgl.git
synced 2026-05-30 23:51:54 +08:00
feat(arc_label): support more calculate accuracy
This commit is contained in:
@@ -18,6 +18,10 @@
|
|||||||
#include "../../misc/lv_assert.h"
|
#include "../../misc/lv_assert.h"
|
||||||
#include "../../misc/lv_text_private.h"
|
#include "../../misc/lv_text_private.h"
|
||||||
|
|
||||||
|
#if LV_USE_FLOAT
|
||||||
|
#include <math.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/*********************
|
/*********************
|
||||||
* DEFINES
|
* DEFINES
|
||||||
*********************/
|
*********************/
|
||||||
@@ -424,9 +428,13 @@ static void arc_label_draw_main(lv_event_t * e)
|
|||||||
const lv_value_precise_t curr_angle = arc_label->angle_start + (arc_label->dir == LV_ARC_LABEL_DIR_CLOCKWISE ?
|
const lv_value_precise_t curr_angle = arc_label->angle_start + (arc_label->dir == LV_ARC_LABEL_DIR_CLOCKWISE ?
|
||||||
angle_start :
|
angle_start :
|
||||||
-angle_start);
|
-angle_start);
|
||||||
|
#if LV_USE_FLOAT
|
||||||
|
const lv_value_precise_t x = cos(curr_angle * M_PI / 180) * arc_r;
|
||||||
|
const lv_value_precise_t y = sin(curr_angle * M_PI / 180) * arc_r;
|
||||||
|
#else
|
||||||
const lv_value_precise_t x = lv_trigo_cos(curr_angle) * arc_r / (lv_value_precise_t)32767;
|
const lv_value_precise_t x = lv_trigo_cos(curr_angle) * arc_r / (lv_value_precise_t)32767;
|
||||||
const lv_value_precise_t y = lv_trigo_sin(curr_angle) * arc_r / (lv_value_precise_t)32767;
|
const lv_value_precise_t y = lv_trigo_sin(curr_angle) * arc_r / (lv_value_precise_t)32767;
|
||||||
|
#endif
|
||||||
|
|
||||||
lv_point_t point = {
|
lv_point_t point = {
|
||||||
x + lv_area_get_width(&coords) / 2 + coords.x1 + arc_label->center_offset.x,
|
x + lv_area_get_width(&coords) / 2 + coords.x1 + arc_label->center_offset.x,
|
||||||
@@ -450,7 +458,7 @@ static void arc_label_draw_main(lv_event_t * e)
|
|||||||
prev_letter_w = letter_w;
|
prev_letter_w = letter_w;
|
||||||
processed_word_count++;
|
processed_word_count++;
|
||||||
|
|
||||||
#if 1
|
#if DEBUG
|
||||||
lv_draw_line_dsc_t line_dsc;
|
lv_draw_line_dsc_t line_dsc;
|
||||||
lv_draw_line_dsc_init(&line_dsc);
|
lv_draw_line_dsc_init(&line_dsc);
|
||||||
line_dsc.color = lv_color_make(0x11, 0x45, 0x14);
|
line_dsc.color = lv_color_make(0x11, 0x45, 0x14);
|
||||||
|
|||||||
Reference in New Issue
Block a user