feat(point): add helpers to operate point and precise point (#4867)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Neo Xu
2023-11-27 13:26:55 +08:00
committed by GitHub
parent 976a01c0da
commit 5c11abc859
14 changed files with 101 additions and 120 deletions

View File

@@ -160,8 +160,7 @@ void lv_draw_label_iterate_letters(lv_draw_unit_t * draw_unit, const lv_draw_lab
/*Init variables for the first line*/ /*Init variables for the first line*/
int32_t line_width = 0; int32_t line_width = 0;
lv_point_t pos; lv_point_t pos;
pos.x = coords->x1; lv_point_set(&pos, coords->x1, coords->y1);
pos.y = coords->y1;
int32_t x_ofs = 0; int32_t x_ofs = 0;
int32_t y_ofs = 0; int32_t y_ofs = 0;

View File

@@ -256,16 +256,12 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(lv_draw_unit_t * draw_unit, con
lv_point_t p1; lv_point_t p1;
lv_point_t p2; lv_point_t p2;
if(dsc->p1.y < dsc->p2.y) { if(dsc->p1.y < dsc->p2.y) {
p1.y = (int32_t)dsc->p1.y; p1 = lv_point_from_precise(&dsc->p1);
p2.y = (int32_t)dsc->p2.y; p2 = lv_point_from_precise(&dsc->p2);
p1.x = (int32_t)dsc->p1.x;
p2.x = (int32_t)dsc->p2.x;
} }
else { else {
p1.y = (int32_t)dsc->p2.y; p1 = lv_point_from_precise(&dsc->p2);
p2.y = (int32_t)dsc->p1.y; p2 = lv_point_from_precise(&dsc->p1);
p1.x = (int32_t)dsc->p2.x;
p2.x = (int32_t)dsc->p1.x;
} }
int32_t xdiff = p2.x - p1.x; int32_t xdiff = p2.x - p1.x;

View File

@@ -177,14 +177,11 @@ void lv_draw_sw_mask_line_points_init(lv_draw_sw_mask_line_param_t * param, int3
p1y = t; p1y = t;
} }
param->cfg.p1.x = p1x; lv_point_set(&param->cfg.p1, p1x, p1y);
param->cfg.p1.y = p1y; lv_point_set(&param->cfg.p2, p2x, p2y);
param->cfg.p2.x = p2x;
param->cfg.p2.y = p2y;
param->cfg.side = side; param->cfg.side = side;
param->origo.x = p1x; lv_point_set(&param->origo, p1x, p1y);
param->origo.y = p1y;
param->flat = (LV_ABS(p2x - p1x) > LV_ABS(p2y - p1y)) ? 1 : 0; param->flat = (LV_ABS(p2x - p1x) > LV_ABS(p2y - p1y)) ? 1 : 0;
param->yx_steep = 0; param->yx_steep = 0;
param->xy_steep = 0; param->xy_steep = 0;
@@ -302,8 +299,7 @@ void lv_draw_sw_mask_angle_init(lv_draw_sw_mask_angle_param_t * param, int32_t v
param->cfg.start_angle = start_angle; param->cfg.start_angle = start_angle;
param->cfg.end_angle = end_angle; param->cfg.end_angle = end_angle;
param->cfg.vertex_p.x = vertex_x; lv_point_set(&param->cfg.vertex_p, vertex_x, vertex_y);
param->cfg.vertex_p.y = vertex_y;
param->dsc.cb = (lv_draw_sw_mask_xcb_t)lv_draw_mask_angle; param->dsc.cb = (lv_draw_sw_mask_xcb_t)lv_draw_mask_angle;
param->dsc.type = LV_DRAW_SW_MASK_TYPE_ANGLE; param->dsc.type = LV_DRAW_SW_MASK_TYPE_ANGLE;

View File

@@ -28,8 +28,6 @@
/********************** /**********************
* STATIC PROTOTYPES * STATIC PROTOTYPES
**********************/ **********************/
static lv_point_t point_to_normal(const lv_point_precise_t * p);
static void point_swap(lv_point_t * p1, lv_point_t * p2);
/********************** /**********************
* STATIC VARIABLES * STATIC VARIABLES
@@ -60,35 +58,35 @@ void lv_draw_sw_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_
lv_point_t p[3]; lv_point_t p[3];
/*If there is a vertical side use it as p[0] and p[1]*/ /*If there is a vertical side use it as p[0] and p[1]*/
if(dsc->p[0].x == dsc->p[1].x) { if(dsc->p[0].x == dsc->p[1].x) {
p[0] = point_to_normal(&dsc->p[0]); p[0] = lv_point_from_precise(&dsc->p[0]);
p[1] = point_to_normal(&dsc->p[1]); p[1] = lv_point_from_precise(&dsc->p[1]);
p[2] = point_to_normal(&dsc->p[2]); p[2] = lv_point_from_precise(&dsc->p[2]);
} }
else if(dsc->p[0].x == dsc->p[2].x) { else if(dsc->p[0].x == dsc->p[2].x) {
p[0] = point_to_normal(&dsc->p[0]); p[0] = lv_point_from_precise(&dsc->p[0]);
p[1] = point_to_normal(&dsc->p[2]); p[1] = lv_point_from_precise(&dsc->p[2]);
p[2] = point_to_normal(&dsc->p[1]); p[2] = lv_point_from_precise(&dsc->p[1]);
} }
else if(dsc->p[1].x == dsc->p[2].x) { else if(dsc->p[1].x == dsc->p[2].x) {
p[0] = point_to_normal(&dsc->p[1]); p[0] = lv_point_from_precise(&dsc->p[1]);
p[1] = point_to_normal(&dsc->p[2]); p[1] = lv_point_from_precise(&dsc->p[2]);
p[2] = point_to_normal(&dsc->p[0]); p[2] = lv_point_from_precise(&dsc->p[0]);
} }
else { else {
p[0] = point_to_normal(&dsc->p[0]); p[0] = lv_point_from_precise(&dsc->p[0]);
p[1] = point_to_normal(&dsc->p[1]); p[1] = lv_point_from_precise(&dsc->p[1]);
p[2] = point_to_normal(&dsc->p[2]); p[2] = lv_point_from_precise(&dsc->p[2]);
/*Set the smallest y as p[0]*/ /*Set the smallest y as p[0]*/
if(p[0].y > p[1].y) point_swap(&p[0], &p[1]); if(p[0].y > p[1].y) lv_point_swap(&p[0], &p[1]);
if(p[0].y > p[2].y) point_swap(&p[0], &p[2]); if(p[0].y > p[2].y) lv_point_swap(&p[0], &p[2]);
/*Set the greatest y as p[1]*/ /*Set the greatest y as p[1]*/
if(p[1].y < p[2].y) point_swap(&p[1], &p[2]); if(p[1].y < p[2].y) lv_point_swap(&p[1], &p[2]);
} }
/*Be sure p[0] is on the top*/ /*Be sure p[0] is on the top*/
if(p[0].y > p[1].y) point_swap(&p[0], &p[1]); if(p[0].y > p[1].y) lv_point_swap(&p[0], &p[1]);
/*If right == true p[2] is on the right side of the p[0] p[1] line*/ /*If right == true p[2] is on the right side of the p[0] p[1] line*/
bool right = ((p[1].x - p[0].x) * (p[2].y - p[0].y) - (p[1].y - p[0].y) * (p[2].x - p[0].x)) < 0; bool right = ((p[1].x - p[0].x) * (p[2].y - p[0].y) - (p[1].y - p[0].y) * (p[2].x - p[0].x)) < 0;
@@ -190,20 +188,4 @@ void lv_draw_sw_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_
* STATIC FUNCTIONS * STATIC FUNCTIONS
**********************/ **********************/
static lv_point_t point_to_normal(const lv_point_precise_t * p)
{
lv_point_t p_out;
p_out.x = (int32_t)p->x;
p_out.y = (int32_t)p->y;
return p_out;
}
static void point_swap(lv_point_t * p1, lv_point_t * p2)
{
lv_point_t tmp = *p1;
*p1 = *p2;
*p2 = tmp;
}
#endif /*LV_USE_DRAW_SW*/ #endif /*LV_USE_DRAW_SW*/

View File

@@ -336,20 +336,16 @@ bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, int32_
/*Check if the corner points are inside the radius or not*/ /*Check if the corner points are inside the radius or not*/
lv_point_t p; lv_point_t p;
p.x = ain_p->x1; lv_point_set(&p, ain_p->x1, ain_p->y1);
p.y = ain_p->y1;
if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
p.x = ain_p->x2; lv_point_set(&p, ain_p->x2, ain_p->y1);
p.y = ain_p->y1;
if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
p.x = ain_p->x1; lv_point_set(&p, ain_p->x1, ain_p->y2);
p.y = ain_p->y2;
if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
p.x = ain_p->x2; lv_point_set(&p, ain_p->x2, ain_p->y2);
p.y = ain_p->y2;
if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false;
return true; return true;
@@ -374,20 +370,16 @@ bool _lv_area_is_out(const lv_area_t * aout_p, const lv_area_t * aholder_p, int3
/*Check if the corner points are outside the radius or not*/ /*Check if the corner points are outside the radius or not*/
lv_point_t p; lv_point_t p;
p.x = aout_p->x1; lv_point_set(&p, aout_p->x1, aout_p->y1);
p.y = aout_p->y1;
if(_lv_area_is_point_on(aholder_p, &p, radius)) return false; if(_lv_area_is_point_on(aholder_p, &p, radius)) return false;
p.x = aout_p->x2; lv_point_set(&p, aout_p->x2, aout_p->y1);
p.y = aout_p->y1;
if(_lv_area_is_point_on(aholder_p, &p, radius)) return false; if(_lv_area_is_point_on(aholder_p, &p, radius)) return false;
p.x = aout_p->x1; lv_point_set(&p, aout_p->x1, aout_p->y2);
p.y = aout_p->y2;
if(_lv_area_is_point_on(aholder_p, &p, radius)) return false; if(_lv_area_is_point_on(aholder_p, &p, radius)) return false;
p.x = aout_p->x2; lv_point_set(&p, aout_p->x2, aout_p->y2);
p.y = aout_p->y2;
if(_lv_area_is_point_on(aholder_p, &p, radius)) return false; if(_lv_area_is_point_on(aholder_p, &p, radius)) return false;
return true; return true;

View File

@@ -264,6 +264,46 @@ void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t alig
void lv_point_transform(lv_point_t * p, int32_t angle, int32_t scale_x, int32_t scale_y, const lv_point_t * pivot, void lv_point_transform(lv_point_t * p, int32_t angle, int32_t scale_x, int32_t scale_y, const lv_point_t * pivot,
bool zoom_first); bool zoom_first);
static inline lv_point_t lv_point_from_precise(const lv_point_precise_t * p)
{
return (lv_point_t) {
(int32_t)p->x, (int32_t)p->y
};
}
static inline lv_point_precise_t lv_point_to_precise(const lv_point_t * p)
{
return (lv_point_precise_t) {
p->x, p->y
};
}
static inline void lv_point_set(lv_point_t * p, int32_t x, int32_t y)
{
p->x = x;
p->y = y;
}
static inline void lv_point_precise_set(lv_point_precise_t * p, lv_value_precise_t x, lv_value_precise_t y)
{
p->x = x;
p->y = y;
}
static inline void lv_point_swap(lv_point_t * p1, lv_point_t * p2)
{
lv_point_t tmp = *p1;
*p1 = *p2;
*p2 = tmp;
}
static inline void lv_point_precise_swap(lv_point_precise_t * p1, lv_point_precise_t * p2)
{
lv_point_precise_t tmp = *p1;
*p1 = *p2;
*p2 = tmp;
}
/********************** /**********************
* MACROS * MACROS
**********************/ **********************/

View File

@@ -405,8 +405,7 @@ lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * obj, lv_color_t color, lv_di
LV_ASSERT_MALLOC(cursor); LV_ASSERT_MALLOC(cursor);
if(cursor == NULL) return NULL; if(cursor == NULL) return NULL;
cursor->pos.x = LV_CHART_POINT_NONE; lv_point_set(&cursor->pos, LV_CHART_POINT_NONE, LV_CHART_POINT_NONE);
cursor->pos.y = LV_CHART_POINT_NONE;
cursor->point_id = LV_CHART_POINT_NONE; cursor->point_id = LV_CHART_POINT_NONE;
cursor->pos_set = 0; cursor->pos_set = 0;
cursor->color = color; cursor->color = color;
@@ -427,8 +426,7 @@ void lv_chart_set_cursor_pos(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_po
LV_ASSERT_NULL(cursor); LV_ASSERT_NULL(cursor);
LV_UNUSED(chart); LV_UNUSED(chart);
cursor->pos.x = pos->x; cursor->pos = *pos;
cursor->pos.y = pos->y;
cursor->pos_set = 1; cursor->pos_set = 1;
lv_chart_refresh(chart); lv_chart_refresh(chart);
} }

View File

@@ -852,8 +852,7 @@ static void draw_main(lv_event_t * e)
lv_draw_image_dsc_t img_dsc; lv_draw_image_dsc_t img_dsc;
lv_draw_image_dsc_init(&img_dsc); lv_draw_image_dsc_init(&img_dsc);
lv_obj_init_draw_image_dsc(obj, LV_PART_INDICATOR, &img_dsc); lv_obj_init_draw_image_dsc(obj, LV_PART_INDICATOR, &img_dsc);
img_dsc.pivot.x = symbol_w / 2; lv_point_set(&img_dsc.pivot, symbol_w / 2, symbol_h / 2);
img_dsc.pivot.y = symbol_h / 2;
img_dsc.rotation = lv_obj_get_style_transform_rotation(obj, LV_PART_INDICATOR); img_dsc.rotation = lv_obj_get_style_transform_rotation(obj, LV_PART_INDICATOR);
img_dsc.src = dropdown->symbol; img_dsc.src = dropdown->symbol;
lv_draw_image(layer, &img_dsc, &symbol_area); lv_draw_image(layer, &img_dsc, &symbol_area);

View File

@@ -305,8 +305,7 @@ void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y)
a.y2 += obj->coords.y1; a.y2 += obj->coords.y1;
lv_obj_invalidate_area(obj, &a); lv_obj_invalidate_area(obj, &a);
img->pivot.x = x; lv_point_set(&img->pivot, x, y);
img->pivot.y = y;
/* Disable invalidations because lv_obj_refresh_ext_draw_size would invalidate /* Disable invalidations because lv_obj_refresh_ext_draw_size would invalidate
* the whole ext draw area */ * the whole ext draw area */
@@ -535,10 +534,8 @@ static void lv_image_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
img->scale_x = LV_SCALE_NONE; img->scale_x = LV_SCALE_NONE;
img->scale_y = LV_SCALE_NONE; img->scale_y = LV_SCALE_NONE;
img->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0; img->antialias = LV_COLOR_DEPTH > 8 ? 1 : 0;
img->offset.x = 0; lv_point_set(&img->offset, 0, 0);
img->offset.y = 0; lv_point_set(&img->pivot, LV_PCT(50), LV_PCT(50)); /*Default pivot to image center*/
img->pivot.x = LV_PCT(50); /*Default pivot to image center*/
img->pivot.y = LV_PCT(50);
img->align = LV_IMAGE_ALIGN_CENTER; img->align = LV_IMAGE_ALIGN_CENTER;
lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE); lv_obj_remove_flag(obj, LV_OBJ_FLAG_CLICKABLE);

View File

@@ -188,8 +188,7 @@ void lv_label_set_long_mode(lv_obj_t * obj, lv_label_long_mode_t long_mode)
/*Delete the old animation (if exists)*/ /*Delete the old animation (if exists)*/
lv_anim_delete(obj, set_ofs_x_anim); lv_anim_delete(obj, set_ofs_x_anim);
lv_anim_delete(obj, set_ofs_y_anim); lv_anim_delete(obj, set_ofs_y_anim);
label->offset.x = 0; lv_point_set(&label->offset, 0, 0);
label->offset.y = 0;
if(long_mode == LV_LABEL_LONG_SCROLL || long_mode == LV_LABEL_LONG_SCROLL_CIRCULAR || long_mode == LV_LABEL_LONG_CLIP) if(long_mode == LV_LABEL_LONG_SCROLL || long_mode == LV_LABEL_LONG_SCROLL_CIRCULAR || long_mode == LV_LABEL_LONG_CLIP)
label->expand = 1; label->expand = 1;
@@ -622,8 +621,7 @@ static void lv_label_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
label->static_txt = 0; label->static_txt = 0;
label->dot_end = LV_LABEL_DOT_END_INV; label->dot_end = LV_LABEL_DOT_END_INV;
label->long_mode = LV_LABEL_LONG_WRAP; label->long_mode = LV_LABEL_LONG_WRAP;
label->offset.x = 0; lv_point_set(&label->offset, 0, 0);
label->offset.y = 0;
#if LV_LABEL_LONG_TXT_HINT #if LV_LABEL_LONG_TXT_HINT
label->hint.line_start = -1; label->hint.line_start = -1;

View File

@@ -450,17 +450,13 @@ static void scale_draw_indicator(lv_obj_t * obj, lv_event_t * event)
tick_value, tick_idx, &tick_point_a); tick_value, tick_idx, &tick_point_a);
if(is_major_tick) { if(is_major_tick) {
major_tick_dsc.p1.x = tick_point_a.x; major_tick_dsc.p1 = lv_point_to_precise(&tick_point_a);
major_tick_dsc.p1.y = tick_point_a.y; major_tick_dsc.p2 = lv_point_to_precise(&tick_point_b);
major_tick_dsc.p2.x = tick_point_b.x;
major_tick_dsc.p2.y = tick_point_b.y;
lv_draw_line(layer, &major_tick_dsc); lv_draw_line(layer, &major_tick_dsc);
} }
else { else {
minor_tick_dsc.p1.x = tick_point_a.x; minor_tick_dsc.p1 = lv_point_to_precise(&tick_point_a);
minor_tick_dsc.p1.y = tick_point_a.y; minor_tick_dsc.p2 = lv_point_to_precise(&tick_point_b);
minor_tick_dsc.p2.x = tick_point_b.x;
minor_tick_dsc.p2.y = tick_point_b.y;
lv_draw_line(layer, &minor_tick_dsc); lv_draw_line(layer, &minor_tick_dsc);
} }
} }
@@ -557,17 +553,13 @@ static void scale_draw_indicator(lv_obj_t * obj, lv_event_t * event)
scale_store_main_line_tick_width_compensation(obj, tick_idx, is_major_tick, major_tick_dsc.width, minor_tick_dsc.width); scale_store_main_line_tick_width_compensation(obj, tick_idx, is_major_tick, major_tick_dsc.width, minor_tick_dsc.width);
if(is_major_tick) { if(is_major_tick) {
major_tick_dsc.p1.x = tick_point_a.x; major_tick_dsc.p1 = lv_point_to_precise(&tick_point_a);
major_tick_dsc.p1.y = tick_point_a.y; major_tick_dsc.p2 = lv_point_to_precise(&tick_point_b);
major_tick_dsc.p2.x = tick_point_b.x;
major_tick_dsc.p2.y = tick_point_b.y;
lv_draw_line(layer, &major_tick_dsc); lv_draw_line(layer, &major_tick_dsc);
} }
else { else {
minor_tick_dsc.p1.x = tick_point_a.x; minor_tick_dsc.p1 = lv_point_to_precise(&tick_point_a);
minor_tick_dsc.p1.y = tick_point_a.y; minor_tick_dsc.p2 = lv_point_to_precise(&tick_point_b);
minor_tick_dsc.p2.x = tick_point_b.x;
minor_tick_dsc.p2.y = tick_point_b.y;
lv_draw_line(layer, &minor_tick_dsc); lv_draw_line(layer, &minor_tick_dsc);
} }
} }
@@ -644,10 +636,8 @@ static void scale_draw_main(lv_obj_t * obj, lv_event_t * event)
main_line_point_b.x += scale->first_tick_width / 2U; main_line_point_b.x += scale->first_tick_width / 2U;
} }
line_dsc.p1.x = main_line_point_a.x; line_dsc.p1 = lv_point_to_precise(&main_line_point_a);
line_dsc.p1.y = main_line_point_a.y; line_dsc.p2 = lv_point_to_precise(&main_line_point_b);
line_dsc.p2.x = main_line_point_b.x;
line_dsc.p2.y = main_line_point_b.y;
lv_draw_line(layer, &line_dsc); lv_draw_line(layer, &line_dsc);
lv_scale_section_t * section; lv_scale_section_t * section;

View File

@@ -433,8 +433,7 @@ int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width)
/* coords of draw span-txt */ /* coords of draw span-txt */
lv_point_t txt_pos; lv_point_t txt_pos;
txt_pos.y = 0; lv_point_set(&txt_pos, 0, indent); /* first line need add indent */
txt_pos.x = 0 + indent; /* first line need add indent */
lv_span_t * cur_span = _lv_ll_get_head(&spans->child_ll); lv_span_t * cur_span = _lv_ll_get_head(&spans->child_ll);
const char * cur_txt = cur_span->txt; const char * cur_txt = cur_span->txt;
@@ -1032,18 +1031,16 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer)
line_dsc.blend_mode = label_draw_dsc.blend_mode; line_dsc.blend_mode = label_draw_dsc.blend_mode;
if(decor & LV_TEXT_DECOR_STRIKETHROUGH) { if(decor & LV_TEXT_DECOR_STRIKETHROUGH) {
line_dsc.p1.x = txt_pos.x; int32_t y = pos.y + ((pinfo->line_h - line_space) >> 1) + (line_dsc.width >> 1);
line_dsc.p1.y = pos.y + ((pinfo->line_h - line_space) >> 1) + (line_dsc.width >> 1); lv_point_precise_set(&line_dsc.p1, txt_pos.x, y);
line_dsc.p2.x = pos.x; lv_point_precise_set(&line_dsc.p2, pos.x, y);
line_dsc.p2.y = line_dsc.p1.y;
lv_draw_line(layer, &line_dsc); lv_draw_line(layer, &line_dsc);
} }
if(decor & LV_TEXT_DECOR_UNDERLINE) { if(decor & LV_TEXT_DECOR_UNDERLINE) {
line_dsc.p1.x = txt_pos.x; int32_t y = pos.y + pinfo->line_h - line_space - pinfo->font->base_line - pinfo->font->underline_position;
line_dsc.p1.y = pos.y + pinfo->line_h - line_space - pinfo->font->base_line - pinfo->font->underline_position; lv_point_precise_set(&line_dsc.p1, txt_pos.x, y);
line_dsc.p2.x = pos.x; lv_point_precise_set(&line_dsc.p2, pos.x, y);
line_dsc.p2.y = line_dsc.p1.y;
lv_draw_line(layer, &line_dsc); lv_draw_line(layer, &line_dsc);
} }
} }

View File

@@ -18,8 +18,7 @@ static bool enc_pressed;
void lv_test_mouse_read_cb(lv_indev_t * indev, lv_indev_data_t * data) void lv_test_mouse_read_cb(lv_indev_t * indev, lv_indev_data_t * data)
{ {
LV_UNUSED(indev); LV_UNUSED(indev);
data->point.x = x_act; lv_point_set(&data->point, x_act, y_act);
data->point.y = y_act;
data->state = mouse_pressed ? LV_INDEV_STATE_PRESSED : LV_INDEV_STATE_RELEASED; data->state = mouse_pressed ? LV_INDEV_STATE_PRESSED : LV_INDEV_STATE_RELEASED;
} }

View File

@@ -255,10 +255,8 @@ static void draw_to_canvas(lv_obj_t * canvas)
line_draw_dsc.width = 8; line_draw_dsc.width = 8;
line_draw_dsc.round_end = 1; line_draw_dsc.round_end = 1;
line_draw_dsc.round_start = 1; line_draw_dsc.round_start = 1;
line_draw_dsc.p1.x = 150; lv_point_precise_set(&line_draw_dsc.p1, 150, 30);
line_draw_dsc.p1.y = 30; lv_point_precise_set(&line_draw_dsc.p2, 350, 55);
line_draw_dsc.p2.x = 350;
line_draw_dsc.p2.y = 55;
lv_draw_line(&layer, &line_draw_dsc); lv_draw_line(&layer, &line_draw_dsc);
lv_canvas_finish_layer(canvas, &layer); lv_canvas_finish_layer(canvas, &layer);