refactor: replace lv_coord_t with int32_t
This commit is contained in:
@@ -11,7 +11,7 @@ static void event_cb(lv_event_t * e)
|
||||
lv_obj_invalidate(chart);
|
||||
}
|
||||
if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
||||
lv_coord_t * s = lv_event_get_param(e);
|
||||
int32_t * s = lv_event_get_param(e);
|
||||
*s = LV_MAX(*s, 20);
|
||||
}
|
||||
else if(code == LV_EVENT_DRAW_POST_END) {
|
||||
@@ -25,8 +25,8 @@ static void event_cb(lv_event_t * e)
|
||||
lv_point_t p;
|
||||
lv_chart_get_point_pos_by_id(chart, ser, id, &p);
|
||||
|
||||
lv_coord_t * y_array = lv_chart_get_y_array(chart, ser);
|
||||
lv_coord_t value = y_array[id];
|
||||
int32_t * y_array = lv_chart_get_y_array(chart, ser);
|
||||
int32_t value = y_array[id];
|
||||
|
||||
char buf[16];
|
||||
lv_snprintf(buf, sizeof(buf), LV_SYMBOL_DUMMY"$%d", value);
|
||||
|
||||
@@ -11,8 +11,8 @@ static void draw_event_cb(lv_event_t * e)
|
||||
lv_draw_fill_dsc_t * fill_dsc = draw_task->draw_dsc;
|
||||
|
||||
lv_obj_t * chart = lv_event_get_target(e);
|
||||
lv_coord_t * y_array = lv_chart_get_y_array(chart, lv_chart_get_series_next(chart, NULL));
|
||||
lv_coord_t v = y_array[base_dsc->id2];
|
||||
int32_t * y_array = lv_chart_get_y_array(chart, lv_chart_get_series_next(chart, NULL));
|
||||
int32_t v = y_array[base_dsc->id2];
|
||||
|
||||
uint32_t ratio = v * 255 / 100;
|
||||
fill_dsc->color = lv_color_mix(lv_palette_main(LV_PALETTE_GREEN), lv_palette_main(LV_PALETTE_RED), ratio);
|
||||
|
||||
@@ -10,8 +10,6 @@ def event_cb(e):
|
||||
chart.invalidate()
|
||||
|
||||
if code == lv.EVENT.REFR_EXT_DRAW_SIZE:
|
||||
# s = lv.coord_t.__cast__(e.get_param())
|
||||
# print("s: {:d}".format(s))
|
||||
e.set_ext_draw_size(20)
|
||||
|
||||
elif code == lv.EVENT.DRAW_POST_END:
|
||||
|
||||
@@ -70,9 +70,9 @@ static void add_faded_area(lv_event_t * e)
|
||||
tri_dsc.p[2].y = LV_MAX(draw_line_dsc->p1_y, draw_line_dsc->p2_y);
|
||||
tri_dsc.bg_grad.dir = LV_GRAD_DIR_VER;
|
||||
|
||||
lv_coord_t full_h = lv_obj_get_height(obj);
|
||||
lv_coord_t fract_uppter = (int32_t)(LV_MIN(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
|
||||
lv_coord_t fract_lower = (int32_t)(LV_MAX(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
|
||||
int32_t full_h = lv_obj_get_height(obj);
|
||||
int32_t fract_uppter = (int32_t)(LV_MIN(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
|
||||
int32_t fract_lower = (int32_t)(LV_MAX(draw_line_dsc->p1_y, draw_line_dsc->p2_y) - obj->coords.y1) * 255 / full_h;
|
||||
tri_dsc.bg_grad.stops[0].color = ser->color;
|
||||
tri_dsc.bg_grad.stops[0].opa = 255 - fract_uppter;
|
||||
tri_dsc.bg_grad.stops[0].frac = 0;
|
||||
|
||||
@@ -15,8 +15,8 @@ static void draw_event_cb(lv_event_t * e)
|
||||
rect_draw_dsc->bg_opa = (LV_OPA_COVER * base_dsc->id2) / (cnt - 1);
|
||||
|
||||
/*Make smaller values blue, higher values red*/
|
||||
lv_coord_t * x_array = lv_chart_get_x_array(obj, ser);
|
||||
lv_coord_t * y_array = lv_chart_get_y_array(obj, ser);
|
||||
int32_t * x_array = lv_chart_get_x_array(obj, ser);
|
||||
int32_t * y_array = lv_chart_get_y_array(obj, ser);
|
||||
/*dsc->id is the tells drawing order, but we need the ID of the point being drawn.*/
|
||||
uint32_t start_point = lv_chart_get_x_start_point(obj, ser);
|
||||
uint32_t p_act = (start_point + base_dsc->id2) % cnt; /*Consider start point to get the index of the array*/
|
||||
|
||||
@@ -11,7 +11,7 @@ static void add_data(lv_timer_t * t)
|
||||
|
||||
uint16_t p = lv_chart_get_point_count(chart);
|
||||
uint16_t s = lv_chart_get_x_start_point(chart, ser);
|
||||
lv_coord_t * a = lv_chart_get_y_array(chart, ser);
|
||||
int32_t * a = lv_chart_get_y_array(chart, ser);
|
||||
|
||||
a[(s + 1) % p] = LV_CHART_POINT_NONE;
|
||||
a[(s + 2) % p] = LV_CHART_POINT_NONE;
|
||||
|
||||
@@ -11,8 +11,8 @@ static void drag_event_handler(lv_event_t * e)
|
||||
lv_point_t vect;
|
||||
lv_indev_get_vect(indev, &vect);
|
||||
|
||||
lv_coord_t x = lv_obj_get_x(obj) + vect.x;
|
||||
lv_coord_t y = lv_obj_get_y(obj) + vect.y;
|
||||
int32_t x = lv_obj_get_x(obj) + vect.x;
|
||||
int32_t y = lv_obj_get_y(obj) + vect.y;
|
||||
lv_obj_set_pos(obj, x, y);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ static void mask_event_cb(lv_event_t * e)
|
||||
else if(code == LV_EVENT_DRAW_MAIN_BEGIN) {
|
||||
/* add mask */
|
||||
const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN);
|
||||
lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN);
|
||||
lv_coord_t font_h = lv_font_get_line_height(font);
|
||||
int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN);
|
||||
int32_t font_h = lv_font_get_line_height(font);
|
||||
|
||||
lv_area_t roller_coords;
|
||||
lv_obj_get_coords(obj, &roller_coords);
|
||||
|
||||
@@ -30,7 +30,7 @@ void lv_example_spinbox_1(void)
|
||||
lv_obj_set_width(spinbox, 100);
|
||||
lv_obj_center(spinbox);
|
||||
|
||||
lv_coord_t h = lv_obj_get_height(spinbox);
|
||||
int32_t h = lv_obj_get_height(spinbox);
|
||||
|
||||
lv_obj_t * btn = lv_button_create(lv_screen_active());
|
||||
lv_obj_set_size(btn, h, h);
|
||||
|
||||
Reference in New Issue
Block a user