diff options
Diffstat (limited to 'src')
139 files changed, 2103 insertions, 2104 deletions
diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index 0448607f4..b73b9874d 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -323,8 +323,8 @@ static void lv_obj_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_obj_t * parent = obj->parent; if(parent) { - lv_coord_t sl = lv_obj_get_scroll_left(parent); - lv_coord_t st = lv_obj_get_scroll_top(parent); + int32_t sl = lv_obj_get_scroll_left(parent); + int32_t st = lv_obj_get_scroll_top(parent); obj->coords.y1 = parent->coords.y1 + lv_obj_get_style_pad_top(parent, LV_PART_MAIN) - st; obj->coords.y2 = obj->coords.y1 - 1; @@ -402,9 +402,9 @@ static void lv_obj_draw(lv_event_t * e) } /*Most trivial test. Is the mask fully IN the object? If no it surely doesn't cover it*/ - lv_coord_t r = lv_obj_get_style_radius(obj, LV_PART_MAIN); - lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + int32_t r = lv_obj_get_style_radius(obj, LV_PART_MAIN); + int32_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + int32_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); lv_area_t coords; lv_area_copy(&coords, &obj->coords); lv_area_increase(&coords, w, h); @@ -438,8 +438,8 @@ static void lv_obj_draw(lv_event_t * e) draw_dsc.border_post = 1; } - lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + int32_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + int32_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); lv_area_t coords; lv_area_copy(&coords, &obj->coords); lv_area_increase(&coords, w, h); @@ -460,8 +460,8 @@ static void lv_obj_draw(lv_event_t * e) draw_dsc.shadow_opa = LV_OPA_TRANSP; lv_obj_init_draw_rect_dsc(obj, LV_PART_MAIN, &draw_dsc); - lv_coord_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + int32_t w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + int32_t h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); lv_area_t coords; lv_area_copy(&coords, &obj->coords); lv_area_increase(&coords, w, h); @@ -598,8 +598,8 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e) else if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE | LV_OBJ_FLAG_SCROLL_WITH_ARROW) && !lv_obj_is_editable(obj)) { /*scroll by keypad or encoder*/ lv_anim_enable_t anim_enable = LV_ANIM_OFF; - lv_coord_t sl = lv_obj_get_scroll_left(obj); - lv_coord_t sr = lv_obj_get_scroll_right(obj); + int32_t sl = lv_obj_get_scroll_left(obj); + int32_t sr = lv_obj_get_scroll_right(obj); char c = *((char *)lv_event_get_param(e)); if(c == LV_KEY_DOWN) { /*use scroll_to_x/y functions to enforce scroll limits*/ @@ -666,7 +666,7 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_obj_remove_state(obj, LV_STATE_FOCUSED | LV_STATE_EDITED | LV_STATE_FOCUS_KEY); } else if(code == LV_EVENT_SIZE_CHANGED) { - lv_coord_t align = lv_obj_get_style_align(obj, LV_PART_MAIN); + int32_t align = lv_obj_get_style_align(obj, LV_PART_MAIN); uint16_t layout = lv_obj_get_style_layout(obj, LV_PART_MAIN); if(layout || align) { lv_obj_mark_layout_as_dirty(obj); @@ -680,16 +680,16 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e) } } else if(code == LV_EVENT_CHILD_CHANGED) { - lv_coord_t w = lv_obj_get_style_width(obj, LV_PART_MAIN); - lv_coord_t h = lv_obj_get_style_height(obj, LV_PART_MAIN); - lv_coord_t align = lv_obj_get_style_align(obj, LV_PART_MAIN); + int32_t w = lv_obj_get_style_width(obj, LV_PART_MAIN); + int32_t h = lv_obj_get_style_height(obj, LV_PART_MAIN); + int32_t align = lv_obj_get_style_align(obj, LV_PART_MAIN); uint16_t layout = lv_obj_get_style_layout(obj, LV_PART_MAIN); if(layout || align || w == LV_SIZE_CONTENT || h == LV_SIZE_CONTENT) { lv_obj_mark_layout_as_dirty(obj); } } else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN); + int32_t d = lv_obj_calculate_ext_draw_size(obj, LV_PART_MAIN); lv_event_set_ext_draw_size(e, d); } else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST || code == LV_EVENT_COVER_CHECK) { diff --git a/src/core/lv_obj.h b/src/core/lv_obj.h index 902d4242b..eacbbae39 100644 --- a/src/core/lv_obj.h +++ b/src/core/lv_obj.h @@ -210,8 +210,8 @@ typedef struct { lv_point_t scroll; /**< The current X/Y scroll offset*/ - lv_coord_t ext_click_pad; /**< Extra click padding in all direction*/ - lv_coord_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/ + int32_t ext_click_pad; /**< Extra click padding in all direction*/ + int32_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/ lv_scrollbar_mode_t scrollbar_mode : 2; /**< How to display scrollbars*/ lv_scroll_snap_t scroll_snap_x : 2; /**< Where to align the snappable children horizontally*/ diff --git a/src/core/lv_obj_class.h b/src/core/lv_obj_class.h index 61f1c35e6..f3b3df7e2 100644 --- a/src/core/lv_obj_class.h +++ b/src/core/lv_obj_class.h @@ -72,8 +72,8 @@ typedef struct _lv_obj_class_t { void * user_data; const char * name; - lv_coord_t width_def; - lv_coord_t height_def; + int32_t width_def; + int32_t height_def; uint32_t editable : 2; /**< Value from ::lv_obj_class_editable_t*/ uint32_t group_def : 2; /**< Value from ::lv_obj_class_group_def_t*/ uint32_t instance_size : 16; diff --git a/src/core/lv_obj_draw.c b/src/core/lv_obj_draw.c index 12a78ff31..d6dde65b1 100644 --- a/src/core/lv_obj_draw.c +++ b/src/core/lv_obj_draw.c @@ -250,35 +250,35 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc->rounded = lv_obj_get_style_arc_rounded(obj, part); } -lv_coord_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part) +int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part) { - lv_coord_t s = 0; + int32_t s = 0; - lv_coord_t sh_width = lv_obj_get_style_shadow_width(obj, part); + int32_t sh_width = lv_obj_get_style_shadow_width(obj, part); if(sh_width) { lv_opa_t sh_opa = lv_obj_get_style_shadow_opa(obj, part); if(sh_opa > LV_OPA_MIN) { sh_width = sh_width / 2 + 1; /*The blur adds only half width*/ sh_width += lv_obj_get_style_shadow_spread(obj, part); - lv_coord_t sh_ofs_x = lv_obj_get_style_shadow_offset_x(obj, part); - lv_coord_t sh_ofs_y = lv_obj_get_style_shadow_offset_y(obj, part); + int32_t sh_ofs_x = lv_obj_get_style_shadow_offset_x(obj, part); + int32_t sh_ofs_y = lv_obj_get_style_shadow_offset_y(obj, part); sh_width += LV_MAX(LV_ABS(sh_ofs_x), LV_ABS(sh_ofs_y)); s = LV_MAX(s, sh_width); } } - lv_coord_t outline_width = lv_obj_get_style_outline_width(obj, part); + int32_t outline_width = lv_obj_get_style_outline_width(obj, part); if(outline_width) { lv_opa_t outline_opa = lv_obj_get_style_outline_opa(obj, part); if(outline_opa > LV_OPA_MIN) { - lv_coord_t outline_pad = lv_obj_get_style_outline_pad(obj, part); + int32_t outline_pad = lv_obj_get_style_outline_pad(obj, part); s = LV_MAX(s, outline_pad + outline_width); } } - lv_coord_t w = lv_obj_get_style_transform_width(obj, part); - lv_coord_t h = lv_obj_get_style_transform_height(obj, part); - lv_coord_t wh = LV_MAX(w, h); + int32_t w = lv_obj_get_style_transform_width(obj, part); + int32_t h = lv_obj_get_style_transform_height(obj, part); + int32_t wh = LV_MAX(w, h); if(wh > 0) s += wh; return s; @@ -288,8 +288,8 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_coord_t s_old = _lv_obj_get_ext_draw_size(obj); - lv_coord_t s_new = 0; + int32_t s_old = _lv_obj_get_ext_draw_size(obj); + int32_t s_new = 0; lv_obj_send_event(obj, LV_EVENT_REFR_EXT_DRAW_SIZE, &s_new); if(s_new != s_old) lv_obj_invalidate(obj); @@ -308,7 +308,7 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj) if(s_new != s_old) lv_obj_invalidate(obj); } -lv_coord_t _lv_obj_get_ext_draw_size(const lv_obj_t * obj) +int32_t _lv_obj_get_ext_draw_size(const lv_obj_t * obj) { if(obj->spec_attr) return obj->spec_attr->ext_draw_size; else return 0; diff --git a/src/core/lv_obj_draw.h b/src/core/lv_obj_draw.h index a6aa97fd2..a378ec389 100644 --- a/src/core/lv_obj_draw.h +++ b/src/core/lv_obj_draw.h @@ -92,7 +92,7 @@ void lv_obj_init_draw_arc_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_arc * @param part part of the object * @return the extra size required around the object */ -lv_coord_t lv_obj_calculate_ext_draw_size(struct _lv_obj_t * obj, uint32_t part); +int32_t lv_obj_calculate_ext_draw_size(struct _lv_obj_t * obj, uint32_t part); /** * Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size. @@ -106,7 +106,7 @@ void lv_obj_refresh_ext_draw_size(struct _lv_obj_t * obj); * @param obj pointer to an object * @return the size extended draw area around the real coordinates */ -lv_coord_t _lv_obj_get_ext_draw_size(const struct _lv_obj_t * obj); +int32_t _lv_obj_get_ext_draw_size(const struct _lv_obj_t * obj); lv_layer_type_t _lv_obj_get_layer_type(const struct _lv_obj_t * obj); diff --git a/src/core/lv_obj_event.c b/src/core/lv_obj_event.c index 4e236a7a6..eaa206038 100644 --- a/src/core/lv_obj_event.c +++ b/src/core/lv_obj_event.c @@ -230,10 +230,10 @@ lv_anim_t * lv_event_get_scroll_anim(lv_event_t * e) } } -void lv_event_set_ext_draw_size(lv_event_t * e, lv_coord_t size) +void lv_event_set_ext_draw_size(lv_event_t * e, int32_t size) { if(e->code == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * cur_size = lv_event_get_param(e); + int32_t * cur_size = lv_event_get_param(e); *cur_size = LV_MAX(*cur_size, size); } else { diff --git a/src/core/lv_obj_event.h b/src/core/lv_obj_event.h index b7ba46856..15522d068 100644 --- a/src/core/lv_obj_event.h +++ b/src/core/lv_obj_event.h @@ -155,7 +155,7 @@ lv_anim_t * lv_event_get_scroll_anim(lv_event_t * e); * @param e pointer to an event * @param size The new extra draw size */ -void lv_event_set_ext_draw_size(lv_event_t * e, lv_coord_t size); +void lv_event_set_ext_draw_size(lv_event_t * e, int32_t size); /** * Get a pointer to an `lv_point_t` variable in which the self size should be saved (width in `point->x` and height `point->y`). diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 82fe454df..88eda30a3 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -25,8 +25,8 @@ /********************** * STATIC PROTOTYPES **********************/ -static lv_coord_t calc_content_width(lv_obj_t * obj); -static lv_coord_t calc_content_height(lv_obj_t * obj); +static int32_t calc_content_width(lv_obj_t * obj); +static int32_t calc_content_height(lv_obj_t * obj); static void layout_update_core(lv_obj_t * obj); static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv); @@ -42,7 +42,7 @@ static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv); * GLOBAL FUNCTIONS **********************/ -void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) +void lv_obj_set_pos(lv_obj_t * obj, int32_t x, int32_t y) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -50,7 +50,7 @@ void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) lv_obj_set_y(obj, y); } -void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x) +void lv_obj_set_x(lv_obj_t * obj, int32_t x) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -64,7 +64,7 @@ void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x) } } -void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y) +void lv_obj_set_y(lv_obj_t * obj, int32_t y) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -91,7 +91,7 @@ bool lv_obj_refr_size(lv_obj_t * obj) bool w_is_content = false; bool w_is_pct = false; - lv_coord_t w; + int32_t w; if(obj->w_layout) { w = lv_obj_get_width(obj); } @@ -99,7 +99,7 @@ bool lv_obj_refr_size(lv_obj_t * obj) w = lv_obj_get_style_width(obj, LV_PART_MAIN); w_is_content = w == LV_SIZE_CONTENT; w_is_pct = LV_COORD_IS_PCT(w); - lv_coord_t parent_w = lv_obj_get_content_width(parent); + int32_t parent_w = lv_obj_get_content_width(parent); if(w_is_content) { w = calc_content_width(obj); @@ -116,12 +116,12 @@ bool lv_obj_refr_size(lv_obj_t * obj) } } - lv_coord_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN); - lv_coord_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN); + int32_t minw = lv_obj_get_style_min_width(obj, LV_PART_MAIN); + int32_t maxw = lv_obj_get_style_max_width(obj, LV_PART_MAIN); w = lv_clamp_width(w, minw, maxw, parent_w); } - lv_coord_t h; + int32_t h; bool h_is_content = false; bool h_is_pct = false; if(obj->h_layout) { @@ -131,7 +131,7 @@ bool lv_obj_refr_size(lv_obj_t * obj) h = lv_obj_get_style_height(obj, LV_PART_MAIN); h_is_content = h == LV_SIZE_CONTENT; h_is_pct = LV_COORD_IS_PCT(h); - lv_coord_t parent_h = lv_obj_get_content_height(parent); + int32_t parent_h = lv_obj_get_content_height(parent); if(h_is_content) { h = calc_content_height(obj); @@ -148,8 +148,8 @@ bool lv_obj_refr_size(lv_obj_t * obj) } } - lv_coord_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN); - lv_coord_t maxh = lv_obj_get_style_max_height(obj, LV_PART_MAIN); + int32_t minh = lv_obj_get_style_min_height(obj, LV_PART_MAIN); + int32_t maxh = lv_obj_get_style_max_height(obj, LV_PART_MAIN); h = lv_clamp_height(h, minh, maxh, parent_h); } @@ -204,7 +204,7 @@ bool lv_obj_refr_size(lv_obj_t * obj) return true; } -void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) +void lv_obj_set_size(lv_obj_t * obj, int32_t w, int32_t h) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -212,7 +212,7 @@ void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) lv_obj_set_height(obj, h); } -void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w) +void lv_obj_set_width(lv_obj_t * obj, int32_t w) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_result_t res_w; @@ -225,7 +225,7 @@ void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w) } } -void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h) +void lv_obj_set_height(lv_obj_t * obj, int32_t h) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_result_t res_h; @@ -238,17 +238,17 @@ void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h) } } -void lv_obj_set_content_width(lv_obj_t * obj, lv_coord_t w) +void lv_obj_set_content_width(lv_obj_t * obj, int32_t w) { - lv_coord_t left = lv_obj_get_style_space_left(obj, LV_PART_MAIN); - lv_coord_t right = lv_obj_get_style_space_right(obj, LV_PART_MAIN); + int32_t left = lv_obj_get_style_space_left(obj, LV_PART_MAIN); + int32_t right = lv_obj_get_style_space_right(obj, LV_PART_MAIN); lv_obj_set_width(obj, w + left + right); } -void lv_obj_set_content_height(lv_obj_t * obj, lv_coord_t h) +void lv_obj_set_content_height(lv_obj_t * obj, int32_t h) { - lv_coord_t top = lv_obj_get_style_space_top(obj, LV_PART_MAIN); - lv_coord_t bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN); + int32_t top = lv_obj_get_style_space_top(obj, LV_PART_MAIN); + int32_t bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN); lv_obj_set_height(obj, h + top + bottom); } @@ -311,13 +311,13 @@ void lv_obj_set_align(lv_obj_t * obj, lv_align_t align) lv_obj_set_style_align(obj, align, 0); } -void lv_obj_align(lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs) +void lv_obj_align(lv_obj_t * obj, lv_align_t align, int32_t x_ofs, int32_t y_ofs) { lv_obj_set_style_align(obj, align, 0); lv_obj_set_pos(obj, x_ofs, y_ofs); } -void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs) +void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, int32_t x_ofs, int32_t y_ofs) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -326,18 +326,18 @@ void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv LV_ASSERT_OBJ(base, MY_CLASS); - lv_coord_t x = 0; - lv_coord_t y = 0; + int32_t x = 0; + int32_t y = 0; lv_obj_t * parent = lv_obj_get_parent(obj); LV_ASSERT_OBJ(parent, MY_CLASS); - lv_coord_t pleft = lv_obj_get_style_space_left(parent, LV_PART_MAIN); - lv_coord_t ptop = lv_obj_get_style_space_top(parent, LV_PART_MAIN); + int32_t pleft = lv_obj_get_style_space_left(parent, LV_PART_MAIN); + int32_t ptop = lv_obj_get_style_space_top(parent, LV_PART_MAIN); - lv_coord_t bleft = lv_obj_get_style_space_left(base, LV_PART_MAIN); - lv_coord_t btop = lv_obj_get_style_space_top(base, LV_PART_MAIN); + int32_t bleft = lv_obj_get_style_space_left(base, LV_PART_MAIN); + int32_t btop = lv_obj_get_style_space_top(base, LV_PART_MAIN); if(align == LV_ALIGN_DEFAULT) { if(lv_obj_get_style_base_dir(base, LV_PART_MAIN) == LV_BASE_DIR_RTL) align = LV_ALIGN_TOP_RIGHT; @@ -469,11 +469,11 @@ void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * coords) lv_area_copy(coords, &obj->coords); } -lv_coord_t lv_obj_get_x(const lv_obj_t * obj) +int32_t lv_obj_get_x(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_coord_t rel_x; + int32_t rel_x; lv_obj_t * parent = lv_obj_get_parent(obj); if(parent) { rel_x = obj->coords.x1 - parent->coords.x1; @@ -486,18 +486,18 @@ lv_coord_t lv_obj_get_x(const lv_obj_t * obj) return rel_x; } -lv_coord_t lv_obj_get_x2(const lv_obj_t * obj) +int32_t lv_obj_get_x2(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); return lv_obj_get_x(obj) + lv_obj_get_width(obj); } -lv_coord_t lv_obj_get_y(const lv_obj_t * obj) +int32_t lv_obj_get_y(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_coord_t rel_y; + int32_t rel_y; lv_obj_t * parent = lv_obj_get_parent(obj); if(parent) { rel_y = obj->coords.y1 - parent->coords.y1; @@ -510,54 +510,54 @@ lv_coord_t lv_obj_get_y(const lv_obj_t * obj) return rel_y; } -lv_coord_t lv_obj_get_y2(const lv_obj_t * obj) +int32_t lv_obj_get_y2(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); return lv_obj_get_y(obj) + lv_obj_get_height(obj); } -lv_coord_t lv_obj_get_x_aligned(const lv_obj_t * obj) +int32_t lv_obj_get_x_aligned(const lv_obj_t * obj) { return lv_obj_get_style_x(obj, LV_PART_MAIN); } -lv_coord_t lv_obj_get_y_aligned(const lv_obj_t * obj) +int32_t lv_obj_get_y_aligned(const lv_obj_t * obj) { return lv_obj_get_style_y(obj, LV_PART_MAIN); } -lv_coord_t lv_obj_get_width(const lv_obj_t * obj) +int32_t lv_obj_get_width(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); return lv_area_get_width(&obj->coords); } -lv_coord_t lv_obj_get_height(const lv_obj_t * obj) +int32_t lv_obj_get_height(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); return lv_area_get_height(&obj->coords); } -lv_coord_t lv_obj_get_content_width(const lv_obj_t * obj) +int32_t lv_obj_get_content_width(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_coord_t left = lv_obj_get_style_space_left(obj, LV_PART_MAIN); - lv_coord_t right = lv_obj_get_style_space_right(obj, LV_PART_MAIN); + int32_t left = lv_obj_get_style_space_left(obj, LV_PART_MAIN); + int32_t right = lv_obj_get_style_space_right(obj, LV_PART_MAIN); return lv_obj_get_width(obj) - left - right; } -lv_coord_t lv_obj_get_content_height(const lv_obj_t * obj) +int32_t lv_obj_get_content_height(const lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_coord_t top = lv_obj_get_style_space_top(obj, LV_PART_MAIN); - lv_coord_t bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN); + int32_t top = lv_obj_get_style_space_top(obj, LV_PART_MAIN); + int32_t bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN); return lv_obj_get_height(obj) - top - bottom; } @@ -574,14 +574,14 @@ void lv_obj_get_content_coords(const lv_obj_t * obj, lv_area_t * area) } -lv_coord_t lv_obj_get_self_width(const lv_obj_t * obj) +int32_t lv_obj_get_self_width(const lv_obj_t * obj) { lv_point_t p = {0, LV_COORD_MIN}; lv_obj_send_event((lv_obj_t *)obj, LV_EVENT_GET_SELF_SIZE, &p); return p.x; } -lv_coord_t lv_obj_get_self_height(const lv_obj_t * obj) +int32_t lv_obj_get_self_height(const lv_obj_t * obj) { lv_point_t p = {LV_COORD_MIN, 0}; lv_obj_send_event((lv_obj_t *)obj, LV_EVENT_GET_SELF_SIZE, &p); @@ -590,8 +590,8 @@ lv_coord_t lv_obj_get_self_height(const lv_obj_t * obj) bool lv_obj_refresh_self_size(lv_obj_t * obj) { - lv_coord_t w_set = lv_obj_get_style_width(obj, LV_PART_MAIN); - lv_coord_t h_set = lv_obj_get_style_height(obj, LV_PART_MAIN); + int32_t w_set = lv_obj_get_style_width(obj, LV_PART_MAIN); + int32_t h_set = lv_obj_get_style_height(obj, LV_PART_MAIN); if(w_set != LV_SIZE_CONTENT && h_set != LV_SIZE_CONTENT) return false; lv_obj_mark_layout_as_dirty(obj); @@ -604,8 +604,8 @@ void lv_obj_refr_pos(lv_obj_t * obj) lv_obj_t * parent = lv_obj_get_parent(obj); - lv_coord_t x = lv_obj_get_style_x(obj, LV_PART_MAIN); - lv_coord_t y = lv_obj_get_style_y(obj, LV_PART_MAIN); + int32_t x = lv_obj_get_style_x(obj, LV_PART_MAIN); + int32_t y = lv_obj_get_style_y(obj, LV_PART_MAIN); if(parent == NULL) { lv_obj_move_to(obj, x, y); @@ -613,16 +613,16 @@ void lv_obj_refr_pos(lv_obj_t * obj) } /*Handle percentage value*/ - lv_coord_t pw = lv_obj_get_content_width(parent); - lv_coord_t ph = lv_obj_get_content_height(parent); + int32_t pw = lv_obj_get_content_width(parent); + int32_t ph = lv_obj_get_content_height(parent); if(LV_COORD_IS_PCT(x)) x = (pw * LV_COORD_GET_PCT(x)) / 100; if(LV_COORD_IS_PCT(y)) y = (ph * LV_COORD_GET_PCT(y)) / 100; /*Handle percentage value of translate*/ - lv_coord_t tr_x = lv_obj_get_style_translate_x(obj, LV_PART_MAIN); - lv_coord_t tr_y = lv_obj_get_style_translate_y(obj, LV_PART_MAIN); - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); + int32_t tr_x = lv_obj_get_style_translate_x(obj, LV_PART_MAIN); + int32_t tr_y = lv_obj_get_style_translate_y(obj, LV_PART_MAIN); + int32_t w = lv_obj_get_width(obj); + int32_t h = lv_obj_get_height(obj); if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; if(LV_COORD_IS_PCT(tr_y)) tr_y = (h * LV_COORD_GET_PCT(tr_y)) / 100; @@ -675,7 +675,7 @@ void lv_obj_refr_pos(lv_obj_t * obj) lv_obj_move_to(obj, x, y); } -void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) +void lv_obj_move_to(lv_obj_t * obj, int32_t x, int32_t y) { /*Convert x and y to absolute coordinates*/ lv_obj_t * parent = obj->parent; @@ -744,7 +744,7 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) } } -void lv_obj_move_children_by(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating) +void lv_obj_move_children_by(lv_obj_t * obj, int32_t x_diff, int32_t y_diff, bool ignore_floating) { uint32_t i; uint32_t child_cnt = lv_obj_get_child_cnt(obj); @@ -818,7 +818,7 @@ void lv_obj_invalidate(const lv_obj_t * obj) /*Truncate the area to the object*/ lv_area_t obj_coords; - lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj); + int32_t ext_size = _lv_obj_get_ext_draw_size(obj); lv_area_copy(&obj_coords, &obj->coords); obj_coords.x1 -= ext_size; obj_coords.y1 -= ext_size; @@ -845,7 +845,7 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area) /*Truncate the area to the object*/ lv_area_t obj_coords; - lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj); + int32_t ext_size = _lv_obj_get_ext_draw_size(obj); lv_area_copy(&obj_coords, &obj->coords); lv_area_increase(&obj_coords, ext_size, ext_size); @@ -863,7 +863,7 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area) /*Truncate to the parent and if no common parts break*/ lv_area_t parent_coords = parent->coords; if(lv_obj_has_flag(parent, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) { - lv_coord_t parent_ext_size = _lv_obj_get_ext_draw_size(parent); + int32_t parent_ext_size = _lv_obj_get_ext_draw_size(parent); lv_area_increase(&parent_coords, parent_ext_size, parent_ext_size); } @@ -881,7 +881,7 @@ bool lv_obj_is_visible(const lv_obj_t * obj) LV_ASSERT_OBJ(obj, MY_CLASS); lv_area_t obj_coords; - lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj); + int32_t ext_size = _lv_obj_get_ext_draw_size(obj); lv_area_copy(&obj_coords, &obj->coords); obj_coords.x1 -= ext_size; obj_coords.y1 -= ext_size; @@ -891,7 +891,7 @@ bool lv_obj_is_visible(const lv_obj_t * obj) return lv_obj_area_is_visible(obj, &obj_coords); } -void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t size) +void lv_obj_set_ext_click_area(lv_obj_t * obj, int32_t size) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -927,14 +927,14 @@ bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point) return res; } -lv_coord_t lv_clamp_width(lv_coord_t width, lv_coord_t min_width, lv_coord_t max_width, lv_coord_t ref_width) +int32_t lv_clamp_width(int32_t width, int32_t min_width, int32_t max_width, int32_t ref_width) { if(LV_COORD_IS_PCT(min_width)) min_width = (ref_width * LV_COORD_GET_PCT(min_width)) / 100; if(LV_COORD_IS_PCT(max_width)) max_width = (ref_width * LV_COORD_GET_PCT(max_width)) / 100; return LV_CLAMP(min_width, width, max_width); } -lv_coord_t lv_clamp_height(lv_coord_t height, lv_coord_t min_height, lv_coord_t max_height, lv_coord_t ref_height) +int32_t lv_clamp_height(int32_t height, int32_t min_height, int32_t max_height, int32_t ref_height) { if(LV_COORD_IS_PCT(min_height)) min_height = (ref_height * LV_COORD_GET_PCT(min_height)) / 100; if(LV_COORD_IS_PCT(max_height)) max_height = (ref_height * LV_COORD_GET_PCT(max_height)) / 100; @@ -947,24 +947,24 @@ lv_coord_t lv_clamp_height(lv_coord_t height, lv_coord_t min_height, lv_coord_t * STATIC FUNCTIONS **********************/ -static lv_coord_t calc_content_width(lv_obj_t * obj) +static int32_t calc_content_width(lv_obj_t * obj) { - lv_coord_t scroll_x_tmp = lv_obj_get_scroll_x(obj); + int32_t scroll_x_tmp = lv_obj_get_scroll_x(obj); if(obj->spec_attr) obj->spec_attr->scroll.x = 0; - lv_coord_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN); - lv_coord_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN); + int32_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN); + int32_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN); - lv_coord_t self_w; + int32_t self_w; self_w = lv_obj_get_self_width(obj) + space_left + space_right; - lv_coord_t child_res = LV_COORD_MIN; + int32_t child_res = LV_COORD_MIN; uint32_t i; uint32_t child_cnt = lv_obj_get_child_cnt(obj); /*With RTL find the left most coordinate*/ if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) == LV_BASE_DIR_RTL) { for(i = 0; i < child_cnt; i++) { - lv_coord_t child_res_tmp = LV_COORD_MIN; + int32_t child_res_tmp = LV_COORD_MIN; lv_obj_t * child = obj->spec_attr->children[i]; if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue; @@ -1000,7 +1000,7 @@ static lv_coord_t calc_content_width(lv_obj_t * obj) /*Else find the right most coordinate*/ else { for(i = 0; i < child_cnt; i++) { - lv_coord_t child_res_tmp = LV_COORD_MIN; + int32_t child_res_tmp = LV_COORD_MIN; lv_obj_t * child = obj->spec_attr->children[i]; if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue; @@ -1042,22 +1042,22 @@ static lv_coord_t calc_content_width(lv_obj_t * obj) return LV_MAX(child_res, self_w); } -static lv_coord_t calc_content_height(lv_obj_t * obj) +static int32_t calc_content_height(lv_obj_t * obj) { - lv_coord_t scroll_y_tmp = lv_obj_get_scroll_y(obj); + int32_t scroll_y_tmp = lv_obj_get_scroll_y(obj); if(obj->spec_attr) obj->spec_attr->scroll.y = 0; - lv_coord_t space_top = lv_obj_get_style_space_top(obj, LV_PART_MAIN); - lv_coord_t space_bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN); + int32_t space_top = lv_obj_get_style_space_top(obj, LV_PART_MAIN); + int32_t space_bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN); - lv_coord_t self_h; + int32_t self_h; self_h = lv_obj_get_self_height(obj) + space_top + space_bottom; - lv_coord_t child_res = LV_COORD_MIN; + int32_t child_res = LV_COORD_MIN; uint32_t i; uint32_t child_cnt = lv_obj_get_child_cnt(obj); for(i = 0; i < child_cnt; i++) { - lv_coord_t child_res_tmp = LV_COORD_MIN; + int32_t child_res_tmp = LV_COORD_MIN; lv_obj_t * child = obj->spec_attr->children[i]; if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue; @@ -1117,9 +1117,9 @@ static void layout_update_core(lv_obj_t * obj) static void transform_point(const lv_obj_t * obj, lv_point_t * p, bool inv) { - lv_coord_t angle = lv_obj_get_style_transform_rotation(obj, 0); - lv_coord_t zoom_x = lv_obj_get_style_transform_scale_x_safe(obj, 0); - lv_coord_t zoom_y = lv_obj_get_style_transform_scale_y_safe(obj, 0); + int32_t angle = lv_obj_get_style_transform_rotation(obj, 0); + int32_t zoom_x = lv_obj_get_style_transform_scale_x_safe(obj, 0); + int32_t zoom_y = lv_obj_get_style_transform_scale_y_safe(obj, 0); if(angle == 0 && zoom_x == LV_SCALE_NONE && zoom_y == LV_SCALE_NONE) return; diff --git a/src/core/lv_obj_pos.h b/src/core/lv_obj_pos.h index a7aac531d..97718db81 100644 --- a/src/core/lv_obj_pos.h +++ b/src/core/lv_obj_pos.h @@ -37,7 +37,7 @@ extern "C" { * @note The position is interpreted on the content area of the parent * @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)` */ -void lv_obj_set_pos(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y); +void lv_obj_set_pos(struct _lv_obj_t * obj, int32_t x, int32_t y); /** * Set the x coordinate of an object @@ -48,7 +48,7 @@ void lv_obj_set_pos(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y); * @note The position is interpreted on the content area of the parent * @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)` */ -void lv_obj_set_x(struct _lv_obj_t * obj, lv_coord_t x); +void lv_obj_set_x(struct _lv_obj_t * obj, int32_t x); /** * Set the y coordinate of an object @@ -59,7 +59,7 @@ void lv_obj_set_x(struct _lv_obj_t * obj, lv_coord_t x); * @note The position is interpreted on the content area of the parent * @note The values can be set in pixel or in percentage of parent size with `lv_pct(v)` */ -void lv_obj_set_y(struct _lv_obj_t * obj, lv_coord_t y); +void lv_obj_set_y(struct _lv_obj_t * obj, int32_t y); /** * Set the size of an object. @@ -72,7 +72,7 @@ void lv_obj_set_y(struct _lv_obj_t * obj, lv_coord_t y); * LV_SIZE_PCT(x) to set size in percentage of the parent's content area size (the size without paddings). * x should be in [0..1000]% range */ -void lv_obj_set_size(struct _lv_obj_t * obj, lv_coord_t w, lv_coord_t h); +void lv_obj_set_size(struct _lv_obj_t * obj, int32_t w, int32_t h); /** * Recalculate the size of the object @@ -91,7 +91,7 @@ bool lv_obj_refr_size(struct _lv_obj_t * obj); * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). * x should be in [0..1000]% range */ -void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w); +void lv_obj_set_width(struct _lv_obj_t * obj, int32_t w); /** * Set the height of an object @@ -103,21 +103,21 @@ void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w); * lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings). * x should be in [0..1000]% range */ -void lv_obj_set_height(struct _lv_obj_t * obj, lv_coord_t h); +void lv_obj_set_height(struct _lv_obj_t * obj, int32_t h); /** * Set the width reduced by the left and right padding and the border width. * @param obj pointer to an object * @param w the width without paddings in pixels */ -void lv_obj_set_content_width(struct _lv_obj_t * obj, lv_coord_t w); +void lv_obj_set_content_width(struct _lv_obj_t * obj, int32_t w); /** * Set the height reduced by the top and bottom padding and the border width. * @param obj pointer to an object * @param h the height without paddings in pixels */ -void lv_obj_set_content_height(struct _lv_obj_t * obj, lv_coord_t h); +void lv_obj_set_content_height(struct _lv_obj_t * obj, int32_t h); /** * Set a layout for an object @@ -162,7 +162,7 @@ void lv_obj_set_align(struct _lv_obj_t * obj, lv_align_t align); * @param x_ofs x coordinate offset after alignment * @param y_ofs y coordinate offset after alignment */ -void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs); +void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, int32_t x_ofs, int32_t y_ofs); /** * Align an object to an other object. @@ -173,8 +173,8 @@ void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv * @param y_ofs y coordinate offset after alignment * @note if the position or size of `base` changes `obj` needs to be aligned manually again */ -void lv_obj_align_to(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, - lv_coord_t y_ofs); +void lv_obj_align_to(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_align_t align, int32_t x_ofs, + int32_t y_ofs); /** * Align an object to the center on its parent. @@ -204,7 +204,7 @@ void lv_obj_get_coords(const struct _lv_obj_t * obj, lv_area_t * coords); * @note Scrolling of the parent doesn't change the returned value. * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. */ -lv_coord_t lv_obj_get_x(const struct _lv_obj_t * obj); +int32_t lv_obj_get_x(const struct _lv_obj_t * obj); /** * Get the x2 coordinate of object. @@ -216,7 +216,7 @@ lv_coord_t lv_obj_get_x(const struct _lv_obj_t * obj); * @note Scrolling of the parent doesn't change the returned value. * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. */ -lv_coord_t lv_obj_get_x2(const struct _lv_obj_t * obj); +int32_t lv_obj_get_x2(const struct _lv_obj_t * obj); /** * Get the y coordinate of object. @@ -228,7 +228,7 @@ lv_coord_t lv_obj_get_x2(const struct _lv_obj_t * obj); * @note Scrolling of the parent doesn't change the returned value. * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. */ -lv_coord_t lv_obj_get_y(const struct _lv_obj_t * obj); +int32_t lv_obj_get_y(const struct _lv_obj_t * obj); /** * Get the y2 coordinate of object. @@ -240,21 +240,21 @@ lv_coord_t lv_obj_get_y(const struct _lv_obj_t * obj); * @note Scrolling of the parent doesn't change the returned value. * @note The returned value is always the distance from the parent even if `obj` is positioned by a layout. */ -lv_coord_t lv_obj_get_y2(const struct _lv_obj_t * obj); +int32_t lv_obj_get_y2(const struct _lv_obj_t * obj); /** * Get the actually set x coordinate of object, i.e. the offset form the set alignment * @param obj pointer to an object * @return the set x coordinate */ -lv_coord_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj); +int32_t lv_obj_get_x_aligned(const struct _lv_obj_t * obj); /** * Get the actually set y coordinate of object, i.e. the offset form the set alignment * @param obj pointer to an object * @return the set y coordinate */ -lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj); +int32_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj); /** * Get the width of an object @@ -263,7 +263,7 @@ lv_coord_t lv_obj_get_y_aligned(const struct _lv_obj_t * obj); * call `lv_obj_update_layout(obj)`. * @return the width in pixels */ -lv_coord_t lv_obj_get_width(const struct _lv_obj_t * obj); +int32_t lv_obj_get_width(const struct _lv_obj_t * obj); /** * Get the height of an object @@ -272,7 +272,7 @@ lv_coord_t lv_obj_get_width(const struct _lv_obj_t * obj); * call `lv_obj_update_layout(obj)`. * @return the height in pixels */ -lv_coord_t lv_obj_get_height(const struct _lv_obj_t * obj); +int32_t lv_obj_get_height(const struct _lv_obj_t * obj); /** * Get the width reduced by the left and right padding and the border width. @@ -281,7 +281,7 @@ lv_coord_t lv_obj_get_height(const struct _lv_obj_t * obj); * call `lv_obj_update_layout(obj)`. * @return the width which still fits into its parent without causing overflow (making the parent scrollable) */ -lv_coord_t lv_obj_get_content_width(const struct _lv_obj_t * obj); +int32_t lv_obj_get_content_width(const struct _lv_obj_t * obj); /** * Get the height reduced by the top and bottom padding and the border width. @@ -290,7 +290,7 @@ lv_coord_t lv_obj_get_content_width(const struct _lv_obj_t * obj); * call `lv_obj_update_layout(obj)`. * @return the height which still fits into the parent without causing overflow (making the parent scrollable) */ -lv_coord_t lv_obj_get_content_height(const struct _lv_obj_t * obj); +int32_t lv_obj_get_content_height(const struct _lv_obj_t * obj); /** * Get the area reduced by the paddings and the border width. @@ -308,7 +308,7 @@ void lv_obj_get_content_coords(const struct _lv_obj_t * obj, lv_area_t * area); * @note This size independent from the real size of the widget. * It just tells how large the internal ("virtual") content is. */ -lv_coord_t lv_obj_get_self_width(const struct _lv_obj_t * obj); +int32_t lv_obj_get_self_width(const struct _lv_obj_t * obj); /** * Get the height occupied by the "parts" of the widget. E.g. the height of all rows of a table. @@ -317,7 +317,7 @@ lv_coord_t lv_obj_get_self_width(const struct _lv_obj_t * obj); * @note This size independent from the real size of the widget. * It just tells how large the internal ("virtual") content is. */ -lv_coord_t lv_obj_get_self_height(const struct _lv_obj_t * obj); +int32_t lv_obj_get_self_height(const struct _lv_obj_t * obj); /** * Handle if the size of the internal ("virtual") content of an object has changed. @@ -328,10 +328,10 @@ bool lv_obj_refresh_self_size(struct _lv_obj_t * obj); void lv_obj_refr_pos(struct _lv_obj_t * obj); -void lv_obj_move_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y); +void lv_obj_move_to(struct _lv_obj_t * obj, int32_t x, int32_t y); -void lv_obj_move_children_by(struct _lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating); +void lv_obj_move_children_by(struct _lv_obj_t * obj, int32_t x_diff, int32_t y_diff, bool ignore_floating); /** * Transform a point using the angle and zoom style properties of an object @@ -385,7 +385,7 @@ bool lv_obj_is_visible(const struct _lv_obj_t * obj); * @param obj pointer to an object * @param size extended clickable area in all 4 directions [px] */ -void lv_obj_set_ext_click_area(struct _lv_obj_t * obj, lv_coord_t size); +void lv_obj_set_ext_click_area(struct _lv_obj_t * obj, int32_t size); /** * Get the an area where to object can be clicked. @@ -411,7 +411,7 @@ bool lv_obj_hit_test(struct _lv_obj_t * obj, const lv_point_t * point); * @param ref_width the reference width used when min/max width is in percentage * @return the clamped width */ -lv_coord_t lv_clamp_width(lv_coord_t width, lv_coord_t min_width, lv_coord_t max_width, lv_coord_t ref_width); +int32_t lv_clamp_width(int32_t width, int32_t min_width, int32_t max_width, int32_t ref_width); /** * Clamp a height between min and max height. If the min/max height is in percentage value use the ref_height @@ -421,7 +421,7 @@ lv_coord_t lv_clamp_width(lv_coord_t width, lv_coord_t min_width, lv_coord_t max * @param ref_height the reference height used when min/max height is in percentage * @return the clamped height */ -lv_coord_t lv_clamp_height(lv_coord_t height, lv_coord_t min_height, lv_coord_t max_height, lv_coord_t ref_height); +int32_t lv_clamp_height(int32_t height, int32_t min_height, int32_t max_height, int32_t ref_height); /********************** * MACROS diff --git a/src/core/lv_obj_scroll.c b/src/core/lv_obj_scroll.c index 0b495c257..45cec5244 100644 --- a/src/core/lv_obj_scroll.c +++ b/src/core/lv_obj_scroll.c @@ -113,53 +113,53 @@ lv_scroll_snap_t lv_obj_get_scroll_snap_y(const lv_obj_t * obj) else return LV_SCROLL_SNAP_NONE; } -lv_coord_t lv_obj_get_scroll_x(const lv_obj_t * obj) +int32_t lv_obj_get_scroll_x(const lv_obj_t * obj) { if(obj->spec_attr == NULL) return 0; return -obj->spec_attr->scroll.x; } -lv_coord_t lv_obj_get_scroll_y(const lv_obj_t * obj) +int32_t lv_obj_get_scroll_y(const lv_obj_t * obj) { if(obj->spec_attr == NULL) return 0; return -obj->spec_attr->scroll.y; } -lv_coord_t lv_obj_get_scroll_top(lv_obj_t * obj) +int32_t lv_obj_get_scroll_top(lv_obj_t * obj) { if(obj->spec_attr == NULL) return 0; return -obj->spec_attr->scroll.y; } -lv_coord_t lv_obj_get_scroll_bottom(lv_obj_t * obj) +int32_t lv_obj_get_scroll_bottom(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_coord_t child_res = LV_COORD_MIN; + int32_t child_res = LV_COORD_MIN; uint32_t i; uint32_t child_cnt = lv_obj_get_child_cnt(obj); for(i = 0; i < child_cnt; i++) { lv_obj_t * child = obj->spec_attr->children[i]; if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue; - lv_coord_t tmp_y = child->coords.y2 + lv_obj_get_style_margin_bottom(child, LV_PART_MAIN); + int32_t tmp_y = child->coords.y2 + lv_obj_get_style_margin_bottom(child, LV_PART_MAIN); child_res = LV_MAX(child_res, tmp_y); } - lv_coord_t space_top = lv_obj_get_style_space_top(obj, LV_PART_MAIN); - lv_coord_t space_bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN); + int32_t space_top = lv_obj_get_style_space_top(obj, LV_PART_MAIN); + int32_t space_bottom = lv_obj_get_style_space_bottom(obj, LV_PART_MAIN); if(child_res != LV_COORD_MIN) { child_res -= (obj->coords.y2 - space_bottom); } - lv_coord_t self_h = lv_obj_get_self_height(obj); + int32_t self_h = lv_obj_get_self_height(obj); self_h = self_h - (lv_obj_get_height(obj) - space_top - space_bottom); self_h -= lv_obj_get_scroll_y(obj); return LV_MAX(child_res, self_h); } -lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj) +int32_t lv_obj_get_scroll_left(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -171,19 +171,19 @@ lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj) } /*With RTL base direction scrolling the left is normal so find the left most coordinate*/ - lv_coord_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN); - lv_coord_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN); + int32_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN); + int32_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN); - lv_coord_t child_res = 0; + int32_t child_res = 0; uint32_t i; - lv_coord_t x1 = LV_COORD_MAX; + int32_t x1 = LV_COORD_MAX; uint32_t child_cnt = lv_obj_get_child_cnt(obj); for(i = 0; i < child_cnt; i++) { lv_obj_t * child = obj->spec_attr->children[i]; if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue; - lv_coord_t tmp_x = child->coords.x1 - lv_obj_get_style_margin_left(child, LV_PART_MAIN); + int32_t tmp_x = child->coords.x1 - lv_obj_get_style_margin_left(child, LV_PART_MAIN); x1 = LV_MIN(x1, tmp_x); } @@ -195,14 +195,14 @@ lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj) child_res = LV_COORD_MIN; } - lv_coord_t self_w = lv_obj_get_self_width(obj); + int32_t self_w = lv_obj_get_self_width(obj); self_w = self_w - (lv_obj_get_width(obj) - space_right - space_left); self_w += lv_obj_get_scroll_x(obj); return LV_MAX(child_res, self_w); } -lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj) +int32_t lv_obj_get_scroll_right(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -214,25 +214,25 @@ lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj) } /*With other base direction (LTR) scrolling to the right is normal so find the right most coordinate*/ - lv_coord_t child_res = LV_COORD_MIN; + int32_t child_res = LV_COORD_MIN; uint32_t i; uint32_t child_cnt = lv_obj_get_child_cnt(obj); for(i = 0; i < child_cnt; i++) { lv_obj_t * child = obj->spec_attr->children[i]; if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue; - lv_coord_t tmp_x = child->coords.x2 + lv_obj_get_style_margin_right(child, LV_PART_MAIN); + int32_t tmp_x = child->coords.x2 + lv_obj_get_style_margin_right(child, LV_PART_MAIN); child_res = LV_MAX(child_res, tmp_x); } - lv_coord_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN); - lv_coord_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN); + int32_t space_right = lv_obj_get_style_space_right(obj, LV_PART_MAIN); + int32_t space_left = lv_obj_get_style_space_left(obj, LV_PART_MAIN); if(child_res != LV_COORD_MIN) { child_res -= (obj->coords.x2 - space_right); } - lv_coord_t self_w; + int32_t self_w; self_w = lv_obj_get_self_width(obj); self_w = self_w - (lv_obj_get_width(obj) - space_right - space_left); self_w -= lv_obj_get_scroll_x(obj); @@ -253,7 +253,7 @@ void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end) * Other functions *====================*/ -void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en) +void lv_obj_scroll_by_bounded(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en) { if(dx == 0 && dy == 0) return; @@ -261,13 +261,13 @@ void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_a lv_obj_update_layout(obj); /*Don't let scroll more than naturally possible by the size of the content*/ - lv_coord_t x_current = -lv_obj_get_scroll_x(obj); - lv_coord_t x_bounded = x_current + dx; + int32_t x_current = -lv_obj_get_scroll_x(obj); + int32_t x_bounded = x_current + dx; if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) != LV_BASE_DIR_RTL) { if(x_bounded > 0) x_bounded = 0; if(x_bounded < 0) { - lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj); + int32_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj); if(scroll_max < 0) scroll_max = 0; if(x_bounded < -scroll_max) x_bounded = -scroll_max; @@ -276,7 +276,7 @@ void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_a else { if(x_bounded < 0) x_bounded = 0; if(x_bounded > 0) { - lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj); + int32_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj); if(scroll_max < 0) scroll_max = 0; if(x_bounded > scroll_max) x_bounded = scroll_max; @@ -284,12 +284,12 @@ void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_a } /*Don't let scroll more than naturally possible by the size of the content*/ - lv_coord_t y_current = -lv_obj_get_scroll_y(obj); - lv_coord_t y_bounded = y_current + dy; + int32_t y_current = -lv_obj_get_scroll_y(obj); + int32_t y_bounded = y_current + dy; if(y_bounded > 0) y_bounded = 0; if(y_bounded < 0) { - lv_coord_t scroll_max = lv_obj_get_scroll_top(obj) + lv_obj_get_scroll_bottom(obj); + int32_t scroll_max = lv_obj_get_scroll_top(obj) + lv_obj_get_scroll_bottom(obj); if(scroll_max < 0) scroll_max = 0; if(y_bounded < -scroll_max) y_bounded = -scroll_max; } @@ -302,7 +302,7 @@ void lv_obj_scroll_by_bounded(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_a } -void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en) +void lv_obj_scroll_by(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en) { if(dx == 0 && dy == 0) return; if(anim_en == LV_ANIM_ON) { @@ -317,7 +317,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN; if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX; lv_anim_set_time(&a, t); - lv_coord_t sx = lv_obj_get_scroll_x(obj); + int32_t sx = lv_obj_get_scroll_x(obj); lv_anim_set_values(&a, -sx, -sx + dx); lv_anim_set_exec_cb(&a, scroll_x_anim); lv_anim_set_path_cb(&a, lv_anim_path_ease_out); @@ -333,7 +333,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab if(t < SCROLL_ANIM_TIME_MIN) t = SCROLL_ANIM_TIME_MIN; if(t > SCROLL_ANIM_TIME_MAX) t = SCROLL_ANIM_TIME_MAX; lv_anim_set_time(&a, t); - lv_coord_t sy = lv_obj_get_scroll_y(obj); + int32_t sy = lv_obj_get_scroll_y(obj); lv_anim_set_values(&a, -sy, -sy + dy); lv_anim_set_exec_cb(&a, scroll_y_anim); lv_anim_set_path_cb(&a, lv_anim_path_ease_out); @@ -361,28 +361,28 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enab } } -void lv_obj_scroll_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en) +void lv_obj_scroll_to(lv_obj_t * obj, int32_t x, int32_t y, lv_anim_enable_t anim_en) { lv_obj_scroll_to_x(obj, x, anim_en); lv_obj_scroll_to_y(obj, y, anim_en); } -void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en) +void lv_obj_scroll_to_x(lv_obj_t * obj, int32_t x, lv_anim_enable_t anim_en) { lv_anim_delete(obj, scroll_x_anim); - lv_coord_t scroll_x = lv_obj_get_scroll_x(obj); - lv_coord_t diff = -x + scroll_x; + int32_t scroll_x = lv_obj_get_scroll_x(obj); + int32_t diff = -x + scroll_x; lv_obj_scroll_by_bounded(obj, diff, 0, anim_en); } -void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en) +void lv_obj_scroll_to_y(lv_obj_t * obj, int32_t y, lv_anim_enable_t anim_en) { lv_anim_delete(obj, scroll_y_anim); - lv_coord_t scroll_y = lv_obj_get_scroll_y(obj); - lv_coord_t diff = -y + scroll_y; + int32_t scroll_y = lv_obj_get_scroll_y(obj); + int32_t diff = -y + scroll_y; lv_obj_scroll_by_bounded(obj, 0, diff, anim_en); } @@ -411,7 +411,7 @@ void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en) } } -lv_result_t _lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) +lv_result_t _lv_obj_scroll_by_raw(lv_obj_t * obj, int32_t x, int32_t y) { if(x == 0 && y == 0) return LV_RESULT_OK; @@ -467,10 +467,10 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * if(indev == NULL) return; } - lv_coord_t st = lv_obj_get_scroll_top(obj); - lv_coord_t sb = lv_obj_get_scroll_bottom(obj); - lv_coord_t sl = lv_obj_get_scroll_left(obj); - lv_coord_t sr = lv_obj_get_scroll_right(obj); + int32_t st = lv_obj_get_scroll_top(obj); + int32_t sb = lv_obj_get_scroll_bottom(obj); + int32_t sl = lv_obj_get_scroll_left(obj); + int32_t sr = lv_obj_get_scroll_right(obj); lv_dir_t dir = lv_obj_get_scroll_dir(obj); @@ -495,19 +495,19 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * bool rtl = lv_obj_get_style_base_dir(obj, LV_PART_SCROLLBAR) == LV_BASE_DIR_RTL; - lv_coord_t top_space = lv_obj_get_style_pad_top(obj, LV_PART_SCROLLBAR); - lv_coord_t bottom_space = lv_obj_get_style_pad_bottom(obj, LV_PART_SCROLLBAR); - lv_coord_t left_space = lv_obj_get_style_pad_left(obj, LV_PART_SCROLLBAR); - lv_coord_t right_space = lv_obj_get_style_pad_right(obj, LV_PART_SCROLLBAR); - lv_coord_t thickness = lv_obj_get_style_width(obj, LV_PART_SCROLLBAR); + int32_t top_space = lv_obj_get_style_pad_top(obj, LV_PART_SCROLLBAR); + int32_t bottom_space = lv_obj_get_style_pad_bottom(obj, LV_PART_SCROLLBAR); + int32_t left_space = lv_obj_get_style_pad_left(obj, LV_PART_SCROLLBAR); + int32_t right_space = lv_obj_get_style_pad_right(obj, LV_PART_SCROLLBAR); + int32_t thickness = lv_obj_get_style_width(obj, LV_PART_SCROLLBAR); - lv_coord_t obj_h = lv_obj_get_height(obj); - lv_coord_t obj_w = lv_obj_get_width(obj); + int32_t obj_h = lv_obj_get_height(obj); + int32_t obj_w = lv_obj_get_width(obj); /*Space required for the vertical and horizontal scrollbars*/ - lv_coord_t ver_reg_space = ver_draw ? thickness : 0; - lv_coord_t hor_req_space = hor_draw ? thickness : 0; - lv_coord_t rem; + int32_t ver_reg_space = ver_draw ? thickness : 0; + int32_t hor_req_space = hor_draw ? thickness : 0; + int32_t rem; if(lv_obj_get_style_bg_opa(obj, LV_PART_SCROLLBAR) < LV_OPA_MIN && lv_obj_get_style_border_opa(obj, LV_PART_SCROLLBAR) < LV_OPA_MIN) { @@ -515,7 +515,7 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * } /*Draw vertical scrollbar if the mode is ON or can be scrolled in this direction*/ - lv_coord_t content_h = obj_h + st + sb; + int32_t content_h = obj_h + st + sb; if(ver_draw && content_h) { ver_area->y1 = obj->coords.y1; ver_area->y2 = obj->coords.y2; @@ -528,17 +528,17 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * ver_area->x1 = ver_area->x2 - thickness + 1; } - lv_coord_t sb_h = ((obj_h - top_space - bottom_space - hor_req_space) * obj_h) / content_h; + int32_t sb_h = ((obj_h - top_space - bottom_space - hor_req_space) * obj_h) / content_h; sb_h = LV_MAX(sb_h, SCROLLBAR_MIN_SIZE); rem = (obj_h - top_space - bottom_space - hor_req_space) - sb_h; /*Remaining size from the scrollbar track that is not the scrollbar itself*/ - lv_coord_t scroll_h = content_h - obj_h; /*The size of the content which can be really scrolled*/ + int32_t scroll_h = content_h - obj_h; /*The size of the content which can be really scrolled*/ if(scroll_h <= 0) { ver_area->y1 = obj->coords.y1 + top_space; ver_area->y2 = obj->coords.y2 - bottom_space - hor_req_space - 1; } else { - lv_coord_t sb_y = (rem * sb) / scroll_h; + int32_t sb_y = (rem * sb) / scroll_h; sb_y = rem - sb_y; ver_area->y1 = obj->coords.y1 + sb_y + top_space; @@ -559,18 +559,18 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * } /*Draw horizontal scrollbar if the mode is ON or can be scrolled in this direction*/ - lv_coord_t content_w = obj_w + sl + sr; + int32_t content_w = obj_w + sl + sr; if(hor_draw && content_w) { hor_area->y2 = obj->coords.y2 - bottom_space; hor_area->y1 = hor_area->y2 - thickness + 1; hor_area->x1 = obj->coords.x1; hor_area->x2 = obj->coords.x2; - lv_coord_t sb_w = ((obj_w - left_space - right_space - ver_reg_space) * obj_w) / content_w; + int32_t sb_w = ((obj_w - left_space - right_space - ver_reg_space) * obj_w) / content_w; sb_w = LV_MAX(sb_w, SCROLLBAR_MIN_SIZE); rem = (obj_w - left_space - right_space - ver_reg_space) - sb_w; /*Remaining size from the scrollbar track that is not the scrollbar itself*/ - lv_coord_t scroll_w = content_w - obj_w; /*The size of the content which can be really scrolled*/ + int32_t scroll_w = content_w - obj_w; /*The size of the content which can be really scrolled*/ if(scroll_w <= 0) { if(rtl) { hor_area->x1 = obj->coords.x1 + left_space + ver_reg_space - 1; @@ -582,7 +582,7 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * } } else { - lv_coord_t sb_x = (rem * sr) / scroll_w; + int32_t sb_x = (rem * sr) / scroll_w; sb_x = rem - sb_x; if(rtl) { @@ -638,8 +638,8 @@ void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en) /*Be sure the bottom side is not remains scrolled in*/ /*With snapping the content can't be scrolled in*/ if(lv_obj_get_scroll_snap_y(obj) == LV_SCROLL_SNAP_NONE) { - lv_coord_t st = lv_obj_get_scroll_top(obj); - lv_coord_t sb = lv_obj_get_scroll_bottom(obj); + int32_t st = lv_obj_get_scroll_top(obj); + int32_t sb = lv_obj_get_scroll_bottom(obj); if(sb < 0 && st > 0) { sb = LV_MIN(st, -sb); lv_obj_scroll_by(obj, 0, sb, anim_en); @@ -647,8 +647,8 @@ void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en) } if(lv_obj_get_scroll_snap_x(obj) == LV_SCROLL_SNAP_NONE) { - lv_coord_t sl = lv_obj_get_scroll_left(obj); - lv_coord_t sr = lv_obj_get_scroll_right(obj); + int32_t sl = lv_obj_get_scroll_left(obj); + int32_t sr = lv_obj_get_scroll_right(obj); if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) != LV_BASE_DIR_RTL) { /*Be sure the left side is not remains scrolled in*/ if(sr < 0 && sl > 0) { @@ -693,31 +693,31 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p if(!lv_obj_has_flag(parent, LV_OBJ_FLAG_SCROLLABLE)) return; lv_dir_t scroll_dir = lv_obj_get_scroll_dir(parent); - lv_coord_t snap_goal = 0; - lv_coord_t act = 0; + int32_t snap_goal = 0; + int32_t act = 0; const lv_area_t * area_tmp; - lv_coord_t y_scroll = 0; + int32_t y_scroll = 0; lv_scroll_snap_t snap_y = lv_obj_get_scroll_snap_y(parent); if(snap_y != LV_SCROLL_SNAP_NONE) area_tmp = &child->coords; else area_tmp = area; - lv_coord_t stop = lv_obj_get_style_space_top(parent, LV_PART_MAIN); - lv_coord_t sbottom = lv_obj_get_style_space_bottom(parent, LV_PART_MAIN); - lv_coord_t top_diff = parent->coords.y1 + stop - area_tmp->y1 - scroll_value->y; - lv_coord_t bottom_diff = -(parent->coords.y2 - sbottom - area_tmp->y2 - scroll_value->y); - lv_coord_t parent_h = lv_obj_get_height(parent) - stop - sbottom; + int32_t stop = lv_obj_get_style_space_top(parent, LV_PART_MAIN); + int32_t sbottom = lv_obj_get_style_space_bottom(parent, LV_PART_MAIN); + int32_t top_diff = parent->coords.y1 + stop - area_tmp->y1 - scroll_value->y; + int32_t bottom_diff = -(parent->coords.y2 - sbottom - area_tmp->y2 - scroll_value->y); + int32_t parent_h = lv_obj_get_height(parent) - stop - sbottom; if((top_diff >= 0 && bottom_diff >= 0)) y_scroll = 0; else if(top_diff > 0) { y_scroll = top_diff; /*Do not let scrolling in*/ - lv_coord_t st = lv_obj_get_scroll_top(parent); + int32_t st = lv_obj_get_scroll_top(parent); if(st - y_scroll < 0) y_scroll = 0; } else if(bottom_diff > 0) { y_scroll = -bottom_diff; /*Do not let scrolling in*/ - lv_coord_t sb = lv_obj_get_scroll_bottom(parent); + int32_t sb = lv_obj_get_scroll_bottom(parent); if(sb + y_scroll < 0) y_scroll = 0; } @@ -739,30 +739,30 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p break; } - lv_coord_t x_scroll = 0; + int32_t x_scroll = 0; lv_scroll_snap_t snap_x = lv_obj_get_scroll_snap_x(parent); if(snap_x != LV_SCROLL_SNAP_NONE) area_tmp = &child->coords; else area_tmp = area; - lv_coord_t sleft = lv_obj_get_style_space_left(parent, LV_PART_MAIN); - lv_coord_t sright = lv_obj_get_style_space_right(parent, LV_PART_MAIN); - lv_coord_t left_diff = parent->coords.x1 + sleft - area_tmp->x1 - scroll_value->x; - lv_coord_t right_diff = -(parent->coords.x2 - sright - area_tmp->x2 - scroll_value->x); + int32_t sleft = lv_obj_get_style_space_left(parent, LV_PART_MAIN); + int32_t sright = lv_obj_get_style_space_right(parent, LV_PART_MAIN); + int32_t left_diff = parent->coords.x1 + sleft - area_tmp->x1 - scroll_value->x; + int32_t right_diff = -(parent->coords.x2 - sright - area_tmp->x2 - scroll_value->x); if((left_diff >= 0 && right_diff >= 0)) x_scroll = 0; else if(left_diff > 0) { x_scroll = left_diff; /*Do not let scrolling in*/ - lv_coord_t sl = lv_obj_get_scroll_left(parent); + int32_t sl = lv_obj_get_scroll_left(parent); if(sl - x_scroll < 0) x_scroll = 0; } else if(right_diff > 0) { x_scroll = -right_diff; /*Do not let scrolling in*/ - lv_coord_t sr = lv_obj_get_scroll_right(parent); + int32_t sr = lv_obj_get_scroll_right(parent); if(sr + x_scroll < 0) x_scroll = 0; } - lv_coord_t parent_w = lv_obj_get_width(parent) - sleft - sright; + int32_t parent_w = lv_obj_get_width(parent) - sleft - sright; switch(snap_x) { case LV_SCROLL_SNAP_START: snap_goal = parent->coords.x1 + sleft; diff --git a/src/core/lv_obj_scroll.h b/src/core/lv_obj_scroll.h index b07a6cc6f..1884ff0eb 100644 --- a/src/core/lv_obj_scroll.h +++ b/src/core/lv_obj_scroll.h @@ -132,7 +132,7 @@ lv_scroll_snap_t lv_obj_get_scroll_snap_y(const struct _lv_obj_t * obj); * If scrolled return > 0 * If scrolled in (elastic scroll) return < 0 */ -lv_coord_t lv_obj_get_scroll_x(const struct _lv_obj_t * obj); +int32_t lv_obj_get_scroll_x(const struct _lv_obj_t * obj); /** * Get current Y scroll position. @@ -142,7 +142,7 @@ lv_coord_t lv_obj_get_scroll_x(const struct _lv_obj_t * obj); * If scrolled return > 0 * If scrolled inside return < 0 */ -lv_coord_t lv_obj_get_scroll_y(const struct _lv_obj_t * obj); +int32_t lv_obj_get_scroll_y(const struct _lv_obj_t * obj); /** * Return the height of the area above the object. @@ -151,7 +151,7 @@ lv_coord_t lv_obj_get_scroll_y(const struct _lv_obj_t * obj); * @param obj pointer to an object * @return the scrollable area above the object in pixels */ -lv_coord_t lv_obj_get_scroll_top(struct _lv_obj_t * obj); +int32_t lv_obj_get_scroll_top(struct _lv_obj_t * obj); /** * Return the height of the area below the object. @@ -160,7 +160,7 @@ lv_coord_t lv_obj_get_scroll_top(struct _lv_obj_t * obj); * @param obj pointer to an object * @return the scrollable area below the object in pixels */ -lv_coord_t lv_obj_get_scroll_bottom(struct _lv_obj_t * obj); +int32_t lv_obj_get_scroll_bottom(struct _lv_obj_t * obj); /** * Return the width of the area on the left the object. @@ -169,7 +169,7 @@ lv_coord_t lv_obj_get_scroll_bottom(struct _lv_obj_t * obj); * @param obj pointer to an object * @return the scrollable area on the left the object in pixels */ -lv_coord_t lv_obj_get_scroll_left(struct _lv_obj_t * obj); +int32_t lv_obj_get_scroll_left(struct _lv_obj_t * obj); /** * Return the width of the area on the right the object. @@ -178,7 +178,7 @@ lv_coord_t lv_obj_get_scroll_left(struct _lv_obj_t * obj); * @param obj pointer to an object * @return the scrollable area on the right the object in pixels */ -lv_coord_t lv_obj_get_scroll_right(struct _lv_obj_t * obj); +int32_t lv_obj_get_scroll_right(struct _lv_obj_t * obj); /** * Get the X and Y coordinates where the scrolling will end for this object if a scrolling animation is in progress. @@ -201,7 +201,7 @@ void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end); * @note > 0 value means scroll right/bottom (show the more content on the right/bottom) * @note e.g. dy = -20 means scroll down 20 px */ -void lv_obj_scroll_by(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en); +void lv_obj_scroll_by(struct _lv_obj_t * obj, int32_t x, int32_t y, lv_anim_enable_t anim_en); /** * Scroll by a given amount of pixels. @@ -212,7 +212,7 @@ void lv_obj_scroll_by(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_ani * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately * @note e.g. dy = -20 means scroll down 20 px */ -void lv_obj_scroll_by_bounded(struct _lv_obj_t * obj, lv_coord_t dx, lv_coord_t dy, lv_anim_enable_t anim_en); +void lv_obj_scroll_by_bounded(struct _lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t anim_en); /** * Scroll to a given coordinate on an object. @@ -222,7 +222,7 @@ void lv_obj_scroll_by_bounded(struct _lv_obj_t * obj, lv_coord_t dx, lv_coord_t * @param y pixels to scroll vertically * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately */ -void lv_obj_scroll_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en); +void lv_obj_scroll_to(struct _lv_obj_t * obj, int32_t x, int32_t y, lv_anim_enable_t anim_en); /** * Scroll to a given X coordinate on an object. @@ -231,7 +231,7 @@ void lv_obj_scroll_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_ani * @param x pixels to scroll horizontally * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately */ -void lv_obj_scroll_to_x(struct _lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en); +void lv_obj_scroll_to_x(struct _lv_obj_t * obj, int32_t x, lv_anim_enable_t anim_en); /** * Scroll to a given Y coordinate on an object @@ -240,7 +240,7 @@ void lv_obj_scroll_to_x(struct _lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t a * @param y pixels to scroll vertically * @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately */ -void lv_obj_scroll_to_y(struct _lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en); +void lv_obj_scroll_to_y(struct _lv_obj_t * obj, int32_t y, lv_anim_enable_t anim_en); /** * Scroll to an object until it becomes visible on its parent @@ -268,7 +268,7 @@ void lv_obj_scroll_to_view_recursive(struct _lv_obj_t * obj, lv_anim_enable_t an * @return `LV_RESULT_INVALID`: to object was deleted in `LV_EVENT_SCROLL`; * `LV_RESULT_OK`: if the object is still valid */ -lv_result_t _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y); +lv_result_t _lv_obj_scroll_by_raw(struct _lv_obj_t * obj, int32_t x, int32_t y); /** * Tell whether an object is being scrolled or not at this moment diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index 267d1138d..88241d373 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -532,8 +532,8 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t if(tr_dsc->prop == LV_STYLE_RADIUS) { if(v1.num == LV_RADIUS_CIRCLE || v2.num == LV_RADIUS_CIRCLE) { - lv_coord_t whalf = lv_obj_get_width(obj) / 2; - lv_coord_t hhalf = lv_obj_get_height(obj) / 2; + int32_t whalf = lv_obj_get_width(obj) / 2; + int32_t hhalf = lv_obj_get_height(obj) / 2; if(v1.num == LV_RADIUS_CIRCLE) v1.num = LV_MIN(whalf + 1, hhalf + 1); if(v2.num == LV_RADIUS_CIRCLE) v2.num = LV_MIN(whalf + 1, hhalf + 1); } diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h index 1e74d952e..477cc54d1 100644 --- a/src/core/lv_obj_style.h +++ b/src/core/lv_obj_style.h @@ -226,7 +226,7 @@ static inline lv_part_t lv_obj_style_get_selector_part(lv_style_selector_t selec #include "lv_obj_style_gen.h" -static inline void lv_obj_set_style_pad_all(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_pad_all(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_obj_set_style_pad_left(obj, value, selector); lv_obj_set_style_pad_right(obj, value, selector); @@ -234,19 +234,19 @@ static inline void lv_obj_set_style_pad_all(struct _lv_obj_t * obj, lv_coord_t v lv_obj_set_style_pad_bottom(obj, value, selector); } -static inline void lv_obj_set_style_pad_hor(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_pad_hor(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_obj_set_style_pad_left(obj, value, selector); lv_obj_set_style_pad_right(obj, value, selector); } -static inline void lv_obj_set_style_pad_ver(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_pad_ver(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_obj_set_style_pad_top(obj, value, selector); lv_obj_set_style_pad_bottom(obj, value, selector); } -static inline void lv_obj_set_style_margin_all(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_margin_all(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_obj_set_style_margin_left(obj, value, selector); lv_obj_set_style_margin_right(obj, value, selector); @@ -254,79 +254,79 @@ static inline void lv_obj_set_style_margin_all(struct _lv_obj_t * obj, lv_coord_ lv_obj_set_style_margin_bottom(obj, value, selector); } -static inline void lv_obj_set_style_margin_hor(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_margin_hor(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_obj_set_style_margin_left(obj, value, selector); lv_obj_set_style_margin_right(obj, value, selector); } -static inline void lv_obj_set_style_margin_ver(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_margin_ver(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_obj_set_style_margin_top(obj, value, selector); lv_obj_set_style_margin_bottom(obj, value, selector); } -static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_obj_set_style_pad_row(obj, value, selector); lv_obj_set_style_pad_column(obj, value, selector); } -static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t width, lv_coord_t height, +static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, int32_t width, int32_t height, lv_style_selector_t selector) { lv_obj_set_style_width(obj, width, selector); lv_obj_set_style_height(obj, height, selector); } -static inline void lv_obj_set_style_transform_scale(struct _lv_obj_t * obj, lv_coord_t value, +static inline void lv_obj_set_style_transform_scale(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_obj_set_style_transform_scale_x(obj, value, selector); lv_obj_set_style_transform_scale_y(obj, value, selector); } -static inline lv_coord_t lv_obj_get_style_space_left(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_space_left(const struct _lv_obj_t * obj, uint32_t part) { - lv_coord_t padding = lv_obj_get_style_pad_left(obj, part); - lv_coord_t border_width = lv_obj_get_style_border_width(obj, part); + int32_t padding = lv_obj_get_style_pad_left(obj, part); + int32_t border_width = lv_obj_get_style_border_width(obj, part); lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); return (border_side & LV_BORDER_SIDE_LEFT) ? padding + border_width : padding; } -static inline lv_coord_t lv_obj_get_style_space_right(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_space_right(const struct _lv_obj_t * obj, uint32_t part) { - lv_coord_t padding = lv_obj_get_style_pad_right(obj, part); - lv_coord_t border_width = lv_obj_get_style_border_width(obj, part); + int32_t padding = lv_obj_get_style_pad_right(obj, part); + int32_t border_width = lv_obj_get_style_border_width(obj, part); lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); return (border_side & LV_BORDER_SIDE_RIGHT) ? padding + border_width : padding; } -static inline lv_coord_t lv_obj_get_style_space_top(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_space_top(const struct _lv_obj_t * obj, uint32_t part) { - lv_coord_t padding = lv_obj_get_style_pad_top(obj, part); - lv_coord_t border_width = lv_obj_get_style_border_width(obj, part); + int32_t padding = lv_obj_get_style_pad_top(obj, part); + int32_t border_width = lv_obj_get_style_border_width(obj, part); lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); return (border_side & LV_BORDER_SIDE_TOP) ? padding + border_width : padding; } -static inline lv_coord_t lv_obj_get_style_space_bottom(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_space_bottom(const struct _lv_obj_t * obj, uint32_t part) { - lv_coord_t padding = lv_obj_get_style_pad_bottom(obj, part); - lv_coord_t border_width = lv_obj_get_style_border_width(obj, part); + int32_t padding = lv_obj_get_style_pad_bottom(obj, part); + int32_t border_width = lv_obj_get_style_border_width(obj, part); lv_border_side_t border_side = lv_obj_get_style_border_side(obj, part); return (border_side & LV_BORDER_SIDE_BOTTOM) ? padding + border_width : padding; } lv_text_align_t lv_obj_calculate_style_text_align(const struct _lv_obj_t * obj, lv_part_t part, const char * txt); -static inline lv_coord_t lv_obj_get_style_transform_scale_x_safe(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_scale_x_safe(const struct _lv_obj_t * obj, uint32_t part) { int16_t zoom = lv_obj_get_style_transform_scale_x(obj, part); return zoom != 0 ? zoom : 1; } -static inline lv_coord_t lv_obj_get_style_transform_scale_y_safe(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_scale_y_safe(const struct _lv_obj_t * obj, uint32_t part) { int16_t zoom = lv_obj_get_style_transform_scale_y(obj, part); return zoom != 0 ? zoom : 1; diff --git a/src/core/lv_obj_style_gen.c b/src/core/lv_obj_style_gen.c index 4f24721dc..f71c47871 100644 --- a/src/core/lv_obj_style_gen.c +++ b/src/core/lv_obj_style_gen.c @@ -10,7 +10,7 @@ #include "lv_obj.h" -void lv_obj_set_style_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -18,7 +18,7 @@ void lv_obj_set_style_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_s lv_obj_set_local_style_prop(obj, LV_STYLE_WIDTH, v, selector); } -void lv_obj_set_style_min_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_min_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -26,7 +26,7 @@ void lv_obj_set_style_min_width(struct _lv_obj_t * obj, lv_coord_t value, lv_sty lv_obj_set_local_style_prop(obj, LV_STYLE_MIN_WIDTH, v, selector); } -void lv_obj_set_style_max_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_max_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -34,7 +34,7 @@ void lv_obj_set_style_max_width(struct _lv_obj_t * obj, lv_coord_t value, lv_sty lv_obj_set_local_style_prop(obj, LV_STYLE_MAX_WIDTH, v, selector); } -void lv_obj_set_style_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_height(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -42,7 +42,7 @@ void lv_obj_set_style_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_ lv_obj_set_local_style_prop(obj, LV_STYLE_HEIGHT, v, selector); } -void lv_obj_set_style_min_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_min_height(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -50,7 +50,7 @@ void lv_obj_set_style_min_height(struct _lv_obj_t * obj, lv_coord_t value, lv_st lv_obj_set_local_style_prop(obj, LV_STYLE_MIN_HEIGHT, v, selector); } -void lv_obj_set_style_max_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_max_height(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -58,7 +58,7 @@ void lv_obj_set_style_max_height(struct _lv_obj_t * obj, lv_coord_t value, lv_st lv_obj_set_local_style_prop(obj, LV_STYLE_MAX_HEIGHT, v, selector); } -void lv_obj_set_style_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -66,7 +66,7 @@ void lv_obj_set_style_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selec lv_obj_set_local_style_prop(obj, LV_STYLE_X, v, selector); } -void lv_obj_set_style_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -82,7 +82,7 @@ void lv_obj_set_style_align(struct _lv_obj_t * obj, lv_align_t value, lv_style_s lv_obj_set_local_style_prop(obj, LV_STYLE_ALIGN, v, selector); } -void lv_obj_set_style_transform_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_transform_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -90,7 +90,7 @@ void lv_obj_set_style_transform_width(struct _lv_obj_t * obj, lv_coord_t value, lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_WIDTH, v, selector); } -void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -98,7 +98,7 @@ void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, lv_coord_t value, lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_HEIGHT, v, selector); } -void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -106,7 +106,7 @@ void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, lv_coord_t value, lv_s lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_X, v, selector); } -void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -114,7 +114,7 @@ void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_s lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSLATE_Y, v, selector); } -void lv_obj_set_style_transform_scale_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_transform_scale_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -122,7 +122,7 @@ void lv_obj_set_style_transform_scale_x(struct _lv_obj_t * obj, lv_coord_t value lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_SCALE_X, v, selector); } -void lv_obj_set_style_transform_scale_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_transform_scale_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -130,7 +130,7 @@ void lv_obj_set_style_transform_scale_y(struct _lv_obj_t * obj, lv_coord_t value lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_SCALE_Y, v, selector); } -void lv_obj_set_style_transform_rotation(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_transform_rotation(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -138,7 +138,7 @@ void lv_obj_set_style_transform_rotation(struct _lv_obj_t * obj, lv_coord_t valu lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_ROTATION, v, selector); } -void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -146,7 +146,7 @@ void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_PIVOT_X, v, selector); } -void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -154,7 +154,7 @@ void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, lv_coord_t value lv_obj_set_local_style_prop(obj, LV_STYLE_TRANSFORM_PIVOT_Y, v, selector); } -void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -162,7 +162,7 @@ void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style lv_obj_set_local_style_prop(obj, LV_STYLE_PAD_TOP, v, selector); } -void lv_obj_set_style_pad_bottom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_pad_bottom(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -170,7 +170,7 @@ void lv_obj_set_style_pad_bottom(struct _lv_obj_t * obj, lv_coord_t value, lv_st lv_obj_set_local_style_prop(obj, LV_STYLE_PAD_BOTTOM, v, selector); } -void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -178,7 +178,7 @@ void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, lv_coord_t value, lv_styl lv_obj_set_local_style_prop(obj, LV_STYLE_PAD_LEFT, v, selector); } -void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -186,7 +186,7 @@ void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, lv_coord_t value, lv_sty lv_obj_set_local_style_prop(obj, LV_STYLE_PAD_RIGHT, v, selector); } -void lv_obj_set_style_pad_row(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_pad_row(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -194,7 +194,7 @@ void lv_obj_set_style_pad_row(struct _lv_obj_t * obj, lv_coord_t value, lv_style lv_obj_set_local_style_prop(obj, LV_STYLE_PAD_ROW, v, selector); } -void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -202,7 +202,7 @@ void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, lv_coord_t value, lv_st lv_obj_set_local_style_prop(obj, LV_STYLE_PAD_COLUMN, v, selector); } -void lv_obj_set_style_margin_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_margin_top(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -210,7 +210,7 @@ void lv_obj_set_style_margin_top(struct _lv_obj_t * obj, lv_coord_t value, lv_st lv_obj_set_local_style_prop(obj, LV_STYLE_MARGIN_TOP, v, selector); } -void lv_obj_set_style_margin_bottom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_margin_bottom(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -218,7 +218,7 @@ void lv_obj_set_style_margin_bottom(struct _lv_obj_t * obj, lv_coord_t value, lv lv_obj_set_local_style_prop(obj, LV_STYLE_MARGIN_BOTTOM, v, selector); } -void lv_obj_set_style_margin_left(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_margin_left(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -226,7 +226,7 @@ void lv_obj_set_style_margin_left(struct _lv_obj_t * obj, lv_coord_t value, lv_s lv_obj_set_local_style_prop(obj, LV_STYLE_MARGIN_LEFT, v, selector); } -void lv_obj_set_style_margin_right(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_margin_right(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -266,7 +266,7 @@ void lv_obj_set_style_bg_grad_dir(struct _lv_obj_t * obj, lv_grad_dir_t value, l lv_obj_set_local_style_prop(obj, LV_STYLE_BG_GRAD_DIR, v, selector); } -void lv_obj_set_style_bg_main_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_bg_main_stop(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -274,7 +274,7 @@ void lv_obj_set_style_bg_main_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_ lv_obj_set_local_style_prop(obj, LV_STYLE_BG_MAIN_STOP, v, selector); } -void lv_obj_set_style_bg_grad_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_bg_grad_stop(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -362,7 +362,7 @@ void lv_obj_set_style_border_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_styl lv_obj_set_local_style_prop(obj, LV_STYLE_BORDER_OPA, v, selector); } -void lv_obj_set_style_border_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_border_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -386,7 +386,7 @@ void lv_obj_set_style_border_post(struct _lv_obj_t * obj, bool value, lv_style_s lv_obj_set_local_style_prop(obj, LV_STYLE_BORDER_POST, v, selector); } -void lv_obj_set_style_outline_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_outline_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -410,7 +410,7 @@ void lv_obj_set_style_outline_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_sty lv_obj_set_local_style_prop(obj, LV_STYLE_OUTLINE_OPA, v, selector); } -void lv_obj_set_style_outline_pad(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_outline_pad(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -418,7 +418,7 @@ void lv_obj_set_style_outline_pad(struct _lv_obj_t * obj, lv_coord_t value, lv_s lv_obj_set_local_style_prop(obj, LV_STYLE_OUTLINE_PAD, v, selector); } -void lv_obj_set_style_shadow_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_shadow_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -426,7 +426,7 @@ void lv_obj_set_style_shadow_width(struct _lv_obj_t * obj, lv_coord_t value, lv_ lv_obj_set_local_style_prop(obj, LV_STYLE_SHADOW_WIDTH, v, selector); } -void lv_obj_set_style_shadow_offset_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_shadow_offset_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -434,7 +434,7 @@ void lv_obj_set_style_shadow_offset_x(struct _lv_obj_t * obj, lv_coord_t value, lv_obj_set_local_style_prop(obj, LV_STYLE_SHADOW_OFFSET_X, v, selector); } -void lv_obj_set_style_shadow_offset_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_shadow_offset_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -442,7 +442,7 @@ void lv_obj_set_style_shadow_offset_y(struct _lv_obj_t * obj, lv_coord_t value, lv_obj_set_local_style_prop(obj, LV_STYLE_SHADOW_OFFSET_Y, v, selector); } -void lv_obj_set_style_shadow_spread(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_shadow_spread(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -490,7 +490,7 @@ void lv_obj_set_style_image_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_obj_set_local_style_prop(obj, LV_STYLE_IMAGE_RECOLOR_OPA, v, selector); } -void lv_obj_set_style_line_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_line_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -498,7 +498,7 @@ void lv_obj_set_style_line_width(struct _lv_obj_t * obj, lv_coord_t value, lv_st lv_obj_set_local_style_prop(obj, LV_STYLE_LINE_WIDTH, v, selector); } -void lv_obj_set_style_line_dash_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_line_dash_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -506,7 +506,7 @@ void lv_obj_set_style_line_dash_width(struct _lv_obj_t * obj, lv_coord_t value, lv_obj_set_local_style_prop(obj, LV_STYLE_LINE_DASH_WIDTH, v, selector); } -void lv_obj_set_style_line_dash_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_line_dash_gap(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -538,7 +538,7 @@ void lv_obj_set_style_line_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_ lv_obj_set_local_style_prop(obj, LV_STYLE_LINE_OPA, v, selector); } -void lv_obj_set_style_arc_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_arc_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -602,7 +602,7 @@ void lv_obj_set_style_text_font(struct _lv_obj_t * obj, const lv_font_t * value, lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_FONT, v, selector); } -void lv_obj_set_style_text_letter_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_text_letter_space(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -610,7 +610,7 @@ void lv_obj_set_style_text_letter_space(struct _lv_obj_t * obj, lv_coord_t value lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_LETTER_SPACE, v, selector); } -void lv_obj_set_style_text_line_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_text_line_space(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -634,7 +634,7 @@ void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_t value, lv_obj_set_local_style_prop(obj, LV_STYLE_TEXT_ALIGN, v, selector); } -void lv_obj_set_style_radius(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_radius(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -780,7 +780,7 @@ void lv_obj_set_style_flex_grow(struct _lv_obj_t * obj, uint8_t value, lv_style_ lv_obj_set_local_style_prop(obj, LV_STYLE_FLEX_GROW, v, selector); } -void lv_obj_set_style_grid_column_dsc_array(struct _lv_obj_t * obj, const lv_coord_t * value, +void lv_obj_set_style_grid_column_dsc_array(struct _lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector) { lv_style_value_t v = { @@ -797,7 +797,7 @@ void lv_obj_set_style_grid_column_align(struct _lv_obj_t * obj, lv_grid_align_t lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_COLUMN_ALIGN, v, selector); } -void lv_obj_set_style_grid_row_dsc_array(struct _lv_obj_t * obj, const lv_coord_t * value, lv_style_selector_t selector) +void lv_obj_set_style_grid_row_dsc_array(struct _lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector) { lv_style_value_t v = { .ptr = value @@ -813,7 +813,7 @@ void lv_obj_set_style_grid_row_align(struct _lv_obj_t * obj, lv_grid_align_t val lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_ROW_ALIGN, v, selector); } -void lv_obj_set_style_grid_cell_column_pos(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_grid_cell_column_pos(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -829,7 +829,7 @@ void lv_obj_set_style_grid_cell_x_align(struct _lv_obj_t * obj, lv_grid_align_t lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_X_ALIGN, v, selector); } -void lv_obj_set_style_grid_cell_column_span(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_grid_cell_column_span(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -837,7 +837,7 @@ void lv_obj_set_style_grid_cell_column_span(struct _lv_obj_t * obj, lv_coord_t v lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_COLUMN_SPAN, v, selector); } -void lv_obj_set_style_grid_cell_row_pos(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_grid_cell_row_pos(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value @@ -853,7 +853,7 @@ void lv_obj_set_style_grid_cell_y_align(struct _lv_obj_t * obj, lv_grid_align_t lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_Y_ALIGN, v, selector); } -void lv_obj_set_style_grid_cell_row_span(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) +void lv_obj_set_style_grid_cell_row_span(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector) { lv_style_value_t v = { .num = (int32_t)value diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h index ecaf16b4b..976c88998 100644 --- a/src/core/lv_obj_style_gen.h +++ b/src/core/lv_obj_style_gen.h @@ -14,52 +14,52 @@ #include "../misc/lv_style.h" #include "../core/lv_obj_style.h" -static inline lv_coord_t lv_obj_get_style_width(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_WIDTH); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_min_width(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_min_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_WIDTH); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_max_width(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_max_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_WIDTH); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_height(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_height(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_HEIGHT); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_min_height(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_min_height(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_HEIGHT); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_max_height(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_max_height(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_HEIGHT); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_x(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_x(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_X); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_y(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_y(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_Y); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline lv_align_t lv_obj_get_style_align(const struct _lv_obj_t * obj, uint32_t part) @@ -68,118 +68,118 @@ static inline lv_align_t lv_obj_get_style_align(const struct _lv_obj_t * obj, ui return (lv_align_t)v.num; } -static inline lv_coord_t lv_obj_get_style_transform_width(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_WIDTH); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_transform_height(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_height(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_HEIGHT); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_translate_x(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_translate_x(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_X); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_translate_y(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_translate_y(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_Y); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_transform_scale_x(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_scale_x(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE_X); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_transform_scale_y(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_scale_y(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE_Y); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_transform_rotation(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_rotation(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ROTATION); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_transform_pivot_x(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_pivot_x(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_X); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_transform_pivot_y(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_pivot_y(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_Y); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_pad_top(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_top(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_pad_bottom(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_bottom(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_BOTTOM); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_pad_left(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_left(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_LEFT); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_pad_right(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_right(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_RIGHT); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_pad_row(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_row(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_ROW); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_pad_column(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_column(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_COLUMN); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_margin_top(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_margin_top(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_TOP); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_margin_bottom(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_margin_bottom(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_BOTTOM); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_margin_left(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_margin_left(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_LEFT); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_margin_right(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_margin_right(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_RIGHT); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline lv_color_t lv_obj_get_style_bg_color(const struct _lv_obj_t * obj, uint32_t part) @@ -219,16 +219,16 @@ static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const struct _lv_obj_t return (lv_grad_dir_t)v.num; } -static inline lv_coord_t lv_obj_get_style_bg_main_stop(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_bg_main_stop(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_STOP); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_bg_grad_stop(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_bg_grad_stop(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_STOP); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline lv_opa_t lv_obj_get_style_bg_main_opa(const struct _lv_obj_t * obj, uint32_t part) @@ -305,10 +305,10 @@ static inline lv_opa_t lv_obj_get_style_border_opa(const struct _lv_obj_t * obj, return (lv_opa_t)v.num; } -static inline lv_coord_t lv_obj_get_style_border_width(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_border_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_WIDTH); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline lv_border_side_t lv_obj_get_style_border_side(const struct _lv_obj_t * obj, uint32_t part) @@ -323,10 +323,10 @@ static inline bool lv_obj_get_style_border_post(const struct _lv_obj_t * obj, ui return (bool)v.num; } -static inline lv_coord_t lv_obj_get_style_outline_width(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_outline_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_WIDTH); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline lv_color_t lv_obj_get_style_outline_color(const struct _lv_obj_t * obj, uint32_t part) @@ -348,34 +348,34 @@ static inline lv_opa_t lv_obj_get_style_outline_opa(const struct _lv_obj_t * obj return (lv_opa_t)v.num; } -static inline lv_coord_t lv_obj_get_style_outline_pad(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_outline_pad(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_PAD); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_shadow_width(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_shadow_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_WIDTH); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_shadow_offset_x(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_shadow_offset_x(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFFSET_X); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_shadow_offset_y(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_shadow_offset_y(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFFSET_Y); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_shadow_spread(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_shadow_spread(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_SPREAD); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline lv_color_t lv_obj_get_style_shadow_color(const struct _lv_obj_t * obj, uint32_t part) @@ -422,22 +422,22 @@ static inline lv_opa_t lv_obj_get_style_image_recolor_opa(const struct _lv_obj_t return (lv_opa_t)v.num; } -static inline lv_coord_t lv_obj_get_style_line_width(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_line_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_WIDTH); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_line_dash_width(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_line_dash_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_WIDTH); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_line_dash_gap(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_line_dash_gap(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_GAP); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline bool lv_obj_get_style_line_rounded(const struct _lv_obj_t * obj, uint32_t part) @@ -464,10 +464,10 @@ static inline lv_opa_t lv_obj_get_style_line_opa(const struct _lv_obj_t * obj, u return (lv_opa_t)v.num; } -static inline lv_coord_t lv_obj_get_style_arc_width(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_arc_width(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_WIDTH); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline bool lv_obj_get_style_arc_rounded(const struct _lv_obj_t * obj, uint32_t part) @@ -524,16 +524,16 @@ static inline const lv_font_t * lv_obj_get_style_text_font(const struct _lv_obj_ return (const lv_font_t *)v.ptr; } -static inline lv_coord_t lv_obj_get_style_text_letter_space(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_text_letter_space(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LETTER_SPACE); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_text_line_space(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_text_line_space(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LINE_SPACE); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline lv_text_decor_t lv_obj_get_style_text_decor(const struct _lv_obj_t * obj, uint32_t part) @@ -548,10 +548,10 @@ static inline lv_text_align_t lv_obj_get_style_text_align(const struct _lv_obj_t return (lv_text_align_t)v.num; } -static inline lv_coord_t lv_obj_get_style_radius(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_radius(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIUS); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline bool lv_obj_get_style_clip_corner(const struct _lv_obj_t * obj, uint32_t part) @@ -657,10 +657,10 @@ static inline uint8_t lv_obj_get_style_flex_grow(const struct _lv_obj_t * obj, u return (uint8_t)v.num; } -static inline const lv_coord_t * lv_obj_get_style_grid_column_dsc_array(const struct _lv_obj_t * obj, uint32_t part) +static inline const int32_t * lv_obj_get_style_grid_column_dsc_array(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_DSC_ARRAY); - return (const lv_coord_t *)v.ptr; + return (const int32_t *)v.ptr; } static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const struct _lv_obj_t * obj, uint32_t part) @@ -669,10 +669,10 @@ static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const struct _l return (lv_grid_align_t)v.num; } -static inline const lv_coord_t * lv_obj_get_style_grid_row_dsc_array(const struct _lv_obj_t * obj, uint32_t part) +static inline const int32_t * lv_obj_get_style_grid_row_dsc_array(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_DSC_ARRAY); - return (const lv_coord_t *)v.ptr; + return (const int32_t *)v.ptr; } static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const struct _lv_obj_t * obj, uint32_t part) @@ -681,10 +681,10 @@ static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const struct _lv_o return (lv_grid_align_t)v.num; } -static inline lv_coord_t lv_obj_get_style_grid_cell_column_pos(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_grid_cell_column_pos(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_POS); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline lv_grid_align_t lv_obj_get_style_grid_cell_x_align(const struct _lv_obj_t * obj, uint32_t part) @@ -693,16 +693,16 @@ static inline lv_grid_align_t lv_obj_get_style_grid_cell_x_align(const struct _l return (lv_grid_align_t)v.num; } -static inline lv_coord_t lv_obj_get_style_grid_cell_column_span(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_grid_cell_column_span(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_SPAN); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -static inline lv_coord_t lv_obj_get_style_grid_cell_row_pos(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_grid_cell_row_pos(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_POS); - return (lv_coord_t)v.num; + return (int32_t)v.num; } static inline lv_grid_align_t lv_obj_get_style_grid_cell_y_align(const struct _lv_obj_t * obj, uint32_t part) @@ -711,46 +711,46 @@ static inline lv_grid_align_t lv_obj_get_style_grid_cell_y_align(const struct _l return (lv_grid_align_t)v.num; } -static inline lv_coord_t lv_obj_get_style_grid_cell_row_span(const struct _lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_grid_cell_row_span(const struct _lv_obj_t * obj, uint32_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_SPAN); - return (lv_coord_t)v.num; + return (int32_t)v.num; } -void lv_obj_set_style_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_min_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_max_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_min_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_max_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_min_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_max_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_height(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_min_height(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_max_height(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_align(struct _lv_obj_t * obj, lv_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_transform_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_transform_scale_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_transform_scale_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_transform_rotation(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_pad_bottom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_pad_row(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_margin_top(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_margin_bottom(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_margin_left(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_margin_right(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_transform_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_transform_height(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_translate_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_translate_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_transform_scale_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_transform_scale_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_transform_rotation(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_transform_pivot_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_transform_pivot_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_pad_top(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_pad_bottom(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_pad_left(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_pad_right(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_pad_row(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_margin_top(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_margin_bottom(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_margin_left(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_margin_right(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_bg_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); void lv_obj_set_style_bg_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_bg_grad_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); void lv_obj_set_style_bg_grad_dir(struct _lv_obj_t * obj, lv_grad_dir_t value, lv_style_selector_t selector); -void lv_obj_set_style_bg_main_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_bg_grad_stop(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_bg_main_stop(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_bg_grad_stop(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_bg_main_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_bg_grad_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_bg_grad(struct _lv_obj_t * obj, const lv_grad_dsc_t * value, lv_style_selector_t selector); @@ -761,29 +761,29 @@ void lv_obj_set_style_bg_image_recolor_opa(struct _lv_obj_t * obj, lv_opa_t valu void lv_obj_set_style_bg_image_tiled(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector); void lv_obj_set_style_border_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); void lv_obj_set_style_border_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); -void lv_obj_set_style_border_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_border_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_border_side(struct _lv_obj_t * obj, lv_border_side_t value, lv_style_selector_t selector); void lv_obj_set_style_border_post(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector); -void lv_obj_set_style_outline_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_outline_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_outline_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); void lv_obj_set_style_outline_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); -void lv_obj_set_style_outline_pad(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_shadow_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_shadow_offset_x(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_shadow_offset_y(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_shadow_spread(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_outline_pad(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_shadow_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_shadow_offset_x(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_shadow_offset_y(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_shadow_spread(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_shadow_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); void lv_obj_set_style_shadow_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_image_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_image_recolor(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); void lv_obj_set_style_image_recolor_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); -void lv_obj_set_style_line_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_line_dash_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_line_dash_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_line_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_line_dash_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_line_dash_gap(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_line_rounded(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector); void lv_obj_set_style_line_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); void lv_obj_set_style_line_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); -void lv_obj_set_style_arc_width(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_arc_width(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_arc_rounded(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector); void lv_obj_set_style_arc_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); void lv_obj_set_style_arc_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); @@ -791,11 +791,11 @@ void lv_obj_set_style_arc_image_src(struct _lv_obj_t * obj, const void * value, void lv_obj_set_style_text_color(struct _lv_obj_t * obj, lv_color_t value, lv_style_selector_t selector); void lv_obj_set_style_text_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_text_font(struct _lv_obj_t * obj, const lv_font_t * value, lv_style_selector_t selector); -void lv_obj_set_style_text_letter_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_text_line_space(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_text_letter_space(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_text_line_space(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_text_decor(struct _lv_obj_t * obj, lv_text_decor_t value, lv_style_selector_t selector); void lv_obj_set_style_text_align(struct _lv_obj_t * obj, lv_text_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_radius(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_radius(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector); void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_opa_layered(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); @@ -815,17 +815,17 @@ void lv_obj_set_style_flex_main_place(struct _lv_obj_t * obj, lv_flex_align_t va void lv_obj_set_style_flex_cross_place(struct _lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); void lv_obj_set_style_flex_track_place(struct _lv_obj_t * obj, lv_flex_align_t value, lv_style_selector_t selector); void lv_obj_set_style_flex_grow(struct _lv_obj_t * obj, uint8_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_column_dsc_array(struct _lv_obj_t * obj, const lv_coord_t * value, +void lv_obj_set_style_grid_column_dsc_array(struct _lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector); void lv_obj_set_style_grid_column_align(struct _lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_row_dsc_array(struct _lv_obj_t * obj, const lv_coord_t * value, +void lv_obj_set_style_grid_row_dsc_array(struct _lv_obj_t * obj, const int32_t * value, lv_style_selector_t selector); void lv_obj_set_style_grid_row_align(struct _lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_cell_column_pos(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_grid_cell_column_pos(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_grid_cell_x_align(struct _lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_cell_column_span(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_cell_row_pos(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_grid_cell_column_span(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); +void lv_obj_set_style_grid_cell_row_pos(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); void lv_obj_set_style_grid_cell_y_align(struct _lv_obj_t * obj, lv_grid_align_t value, lv_style_selector_t selector); -void lv_obj_set_style_grid_cell_row_span(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector); +void lv_obj_set_style_grid_cell_row_span(struct _lv_obj_t * obj, int32_t value, lv_style_selector_t selector); #endif /* LV_OBJ_STYLE_GEN_H */ diff --git a/src/core/lv_obj_tree.c b/src/core/lv_obj_tree.c index 8f5911845..00b1e1418 100644 --- a/src/core/lv_obj_tree.c +++ b/src/core/lv_obj_tree.c @@ -35,7 +35,7 @@ static void lv_obj_delete_async_cb(void * obj); static void obj_delete_core(lv_obj_t * obj); static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb, void * user_data); -static lv_obj_tree_walk_res_t dump_tree_core(lv_obj_t * obj, lv_coord_t depth); +static lv_obj_tree_walk_res_t dump_tree_core(lv_obj_t * obj, int32_t depth); /********************** * STATIC VARIABLES @@ -514,7 +514,7 @@ static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb return LV_OBJ_TREE_WALK_NEXT; } -static lv_obj_tree_walk_res_t dump_tree_core(lv_obj_t * obj, lv_coord_t depth) +static lv_obj_tree_walk_res_t dump_tree_core(lv_obj_t * obj, int32_t depth) { lv_obj_tree_walk_res_t res; const char * id; diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index c56618577..340c334a3 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -41,7 +41,7 @@ static void refr_area_part(lv_layer_t * layer); static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj); static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj); static void refr_obj(lv_layer_t * layer, lv_obj_t * obj); -static uint32_t get_max_row(lv_display_t * disp, lv_coord_t area_w, lv_coord_t area_h); +static uint32_t get_max_row(lv_display_t * disp, int32_t area_w, int32_t area_h); static void draw_buf_flush(lv_display_t * disp); static void call_flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_map); static void wait_for_flushing(lv_display_t * disp); @@ -95,7 +95,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj) /*Truncate the clip area to `obj size + ext size` area*/ lv_area_t obj_coords_ext; lv_obj_get_coords(obj, &obj_coords_ext); - lv_coord_t ext_draw_size = _lv_obj_get_ext_draw_size(obj); + int32_t ext_draw_size = _lv_obj_get_ext_draw_size(obj); lv_area_increase(&obj_coords_ext, ext_draw_size, ext_draw_size); if(!_lv_area_intersect(&clip_coords_for_obj, &clip_area_ori, &obj_coords_ext)) return; @@ -145,7 +145,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj) layer->clip_area = clip_coords_for_children; bool clip_corner = lv_obj_get_style_clip_corner(obj, LV_PART_MAIN); - lv_coord_t radius = 0; + int32_t radius = 0; if(clip_corner) { radius = lv_obj_get_style_radius(obj, LV_PART_MAIN); if(radius == 0) clip_corner = false; @@ -607,15 +607,15 @@ static void refr_area(const lv_area_t * area_p) /*Normal refresh: draw the area in parts*/ /*Calculate the max row num*/ - lv_coord_t w = lv_area_get_width(area_p); - lv_coord_t h = lv_area_get_height(area_p); - lv_coord_t y2 = area_p->y2 >= lv_display_get_vertical_resolution(disp_refr) ? - lv_display_get_vertical_resolution(disp_refr) - 1 : area_p->y2; + int32_t w = lv_area_get_width(area_p); + int32_t h = lv_area_get_height(area_p); + int32_t y2 = area_p->y2 >= lv_display_get_vertical_resolution(disp_refr) ? + lv_display_get_vertical_resolution(disp_refr) - 1 : area_p->y2; int32_t max_row = get_max_row(disp_refr, w, h); - lv_coord_t row; - lv_coord_t row_last = 0; + int32_t row; + int32_t row_last = 0; lv_area_t sub_area; for(row = area_p->y1; row + max_row - 1 <= y2; row += max_row) { /*Calc. the next y coordinates of draw_buf*/ @@ -801,7 +801,7 @@ static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj) static lv_result_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_type_t layer_type, lv_area_t * layer_area_out) { - lv_coord_t ext_draw_size = _lv_obj_get_ext_draw_size(obj); + int32_t ext_draw_size = _lv_obj_get_ext_draw_size(obj); lv_area_t obj_coords_ext; lv_obj_get_coords(obj, &obj_coords_ext); lv_area_increase(&obj_coords_ext, ext_draw_size, ext_draw_size); @@ -878,7 +878,7 @@ void refr_obj(lv_layer_t * layer, lv_obj_t * obj) uint32_t max_rgb_row_height = lv_area_get_height(&layer_area_full); uint32_t max_argb_row_height = lv_area_get_height(&layer_area_full); if(layer_type == LV_LAYER_TYPE_SIMPLE) { - lv_coord_t w = lv_area_get_width(&layer_area_full); + int32_t w = lv_area_get_width(&layer_area_full); uint8_t px_size = lv_color_format_get_size(disp_refr->color_format); max_rgb_row_height = LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE / w / px_size; max_argb_row_height = LV_DRAW_SW_LAYER_SIMPLE_BUF_SIZE / w / sizeof(lv_color32_t); @@ -928,7 +928,7 @@ void refr_obj(lv_layer_t * layer, lv_obj_t * obj) } -static uint32_t get_max_row(lv_display_t * disp, lv_coord_t area_w, lv_coord_t area_h) +static uint32_t get_max_row(lv_display_t * disp, int32_t area_w, int32_t area_h) { bool has_alpha = lv_color_format_has_alpha(disp->color_format); uint32_t px_size_disp = lv_color_format_get_size(disp->color_format); @@ -943,7 +943,7 @@ static uint32_t get_max_row(lv_display_t * disp, lv_coord_t area_w, lv_coord_t a tmp.x2 = 0; tmp.y1 = 0; - lv_coord_t h_tmp = max_row; + int32_t h_tmp = max_row; do { tmp.y2 = h_tmp - 1; lv_display_send_event(disp_refr, LV_EVENT_INVALIDATE_AREA, &tmp); diff --git a/src/dev/display/drm/lv_linux_drm.c b/src/dev/display/drm/lv_linux_drm.c index e9f7f7b63..5843fc666 100644 --- a/src/dev/display/drm/lv_linux_drm.c +++ b/src/dev/display/drm/lv_linux_drm.c @@ -152,9 +152,9 @@ void lv_linux_drm_set_file(lv_display_t * disp, const char * file, int64_t conne LV_LOG_INFO("DRM subsystem and buffer mapped successfully"); - lv_coord_t hor_res = drm_dev->width; - lv_coord_t ver_res = drm_dev->height; - lv_coord_t width = drm_dev->mmWidth; + int32_t hor_res = drm_dev->width; + int32_t ver_res = drm_dev->height; + int32_t width = drm_dev->mmWidth; lv_display_set_draw_buffers(disp, drm_dev->intermediate_buffer, NULL, drm_dev->intermediate_buffer_size, LV_DISPLAY_RENDER_MODE_DIRECT); diff --git a/src/dev/display/fb/lv_linux_fbdev.c b/src/dev/display/fb/lv_linux_fbdev.c index e3a79a25d..ea0c18af5 100644 --- a/src/dev/display/fb/lv_linux_fbdev.c +++ b/src/dev/display/fb/lv_linux_fbdev.c @@ -189,9 +189,9 @@ void lv_linux_fbdev_set_file(lv_display_t * disp, const char * file) LV_LOG_INFO("The framebuffer device was mapped to memory successfully"); - lv_coord_t hor_res = dsc->vinfo.xres; - lv_coord_t ver_res = dsc->vinfo.yres; - lv_coord_t width = dsc->vinfo.width; + int32_t hor_res = dsc->vinfo.xres; + int32_t ver_res = dsc->vinfo.yres; + int32_t width = dsc->vinfo.width; uint32_t draw_buf_size = hor_res * dsc->vinfo.bits_per_pixel >> 3; if(LV_LINUX_FBDEV_BUFFER_COUNT < 1) { draw_buf_size *= LV_LINUX_FBDEV_BUFFER_SIZE; @@ -230,7 +230,7 @@ static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * colo return; } - lv_coord_t w = lv_area_get_width(area); + int32_t w = lv_area_get_width(area); uint32_t px_size = lv_color_format_get_size(lv_display_get_color_format(disp)); uint32_t color_pos = (area->x1 + dsc->vinfo.xoffset) * px_size + area->y1 * dsc->finfo.line_length; uint32_t fb_pos = color_pos + dsc->vinfo.yoffset * dsc->finfo.line_length; diff --git a/src/dev/nuttx/lv_nuttx_lcd.c b/src/dev/nuttx/lv_nuttx_lcd.c index 9f29359d0..d7bd69653 100644 --- a/src/dev/nuttx/lv_nuttx_lcd.c +++ b/src/dev/nuttx/lv_nuttx_lcd.c @@ -44,7 +44,7 @@ typedef struct { * STATIC PROTOTYPES **********************/ -static lv_coord_t align_round_up(lv_coord_t v, uint16_t align); +static int32_t align_round_up(int32_t v, uint16_t align); static void rounder_cb(lv_event_t * e); static void flush_cb(lv_display_t * disp, const lv_area_t * area_p, uint8_t * color_p); @@ -109,7 +109,7 @@ lv_display_t * lv_nuttx_lcd_create(const char * dev_path) * STATIC FUNCTIONS **********************/ -static lv_coord_t align_round_up(lv_coord_t v, uint16_t align) +static int32_t align_round_up(int32_t v, uint16_t align) { return (v + align - 1) & ~(align - 1); } @@ -120,8 +120,8 @@ static void rounder_cb(lv_event_t * e) lv_nuttx_lcd_t * lcd = lv_event_get_user_data(e); lv_area_t * area = lv_event_get_param(e); struct lcddev_area_align_s * align_info = &lcd->align_info; - lv_coord_t w; - lv_coord_t h; + int32_t w; + int32_t h; area->x1 &= ~(align_info->col_start_align - 1); area->y1 &= ~(align_info->row_start_align - 1); diff --git a/src/dev/nuttx/lv_nuttx_touchscreen.c b/src/dev/nuttx/lv_nuttx_touchscreen.c index 23d4c0d54..91e33da50 100644 --- a/src/dev/nuttx/lv_nuttx_touchscreen.c +++ b/src/dev/nuttx/lv_nuttx_touchscreen.c @@ -100,8 +100,8 @@ static void touchscreen_read(lv_indev_t * drv, lv_indev_data_t * data) if(touch_flags & TOUCH_DOWN || touch_flags & TOUCH_MOVE) { const lv_display_t * disp_drv = drv->disp; - lv_coord_t ver_max = disp_drv->ver_res - 1; - lv_coord_t hor_max = disp_drv->hor_res - 1; + int32_t ver_max = disp_drv->ver_res - 1; + int32_t hor_max = disp_drv->hor_res - 1; data->point.x = LV_CLAMP(0, sample.point[0].x, hor_max); data->point.y = LV_CLAMP(0, sample.point[0].y, ver_max); diff --git a/src/dev/sdl/lv_sdl_mouse.c b/src/dev/sdl/lv_sdl_mouse.c index 9dfef6120..0fdedcd12 100644 --- a/src/dev/sdl/lv_sdl_mouse.c +++ b/src/dev/sdl/lv_sdl_mouse.c @@ -117,8 +117,8 @@ void _lv_sdl_mouse_handler(SDL_Event * event) lv_sdl_mouse_t * indev_dev = lv_indev_get_driver_data(indev); if(indev_dev == NULL) return; - lv_coord_t hor_res = lv_display_get_horizontal_resolution(disp); - lv_coord_t ver_res = lv_display_get_vertical_resolution(disp); + int32_t hor_res = lv_display_get_horizontal_resolution(disp); + int32_t ver_res = lv_display_get_vertical_resolution(disp); uint8_t zoom = lv_sdl_window_get_zoom(disp); switch(event->type) { diff --git a/src/dev/sdl/lv_sdl_window.c b/src/dev/sdl/lv_sdl_window.c index 4493707bd..02cc6678c 100644 --- a/src/dev/sdl/lv_sdl_window.c +++ b/src/dev/sdl/lv_sdl_window.c @@ -68,7 +68,7 @@ static lv_timer_t * event_handler_timer; * GLOBAL FUNCTIONS **********************/ -lv_display_t * lv_sdl_window_create(lv_coord_t hor_res, lv_coord_t ver_res) +lv_display_t * lv_sdl_window_create(int32_t hor_res, int32_t ver_res) { if(!inited) { SDL_Init(SDL_INIT_VIDEO); @@ -171,7 +171,7 @@ static void flush_cb(lv_display_t * disp, const lv_area_t * area, uint8_t * px_m uint8_t * fb_tmp = dsc->fb_act; uint32_t px_size = lv_color_format_get_size(lv_display_get_color_format(disp)); uint32_t px_map_stride = lv_area_get_width(area) * px_size; - lv_coord_t fb_stride = lv_display_get_horizontal_resolution(disp) * px_size; + int32_t fb_stride = lv_display_get_horizontal_resolution(disp) * px_size; fb_tmp += area->y1 * fb_stride; fb_tmp += area->x1 * px_size; for(y = area->y1; y <= area->y2; y++) { @@ -265,8 +265,8 @@ static void window_create(lv_display_t * disp) flag |= SDL_WINDOW_FULLSCREEN; #endif - lv_coord_t hor_res = lv_display_get_horizontal_resolution(disp); - lv_coord_t ver_res = lv_display_get_vertical_resolution(disp); + int32_t hor_res = lv_display_get_horizontal_resolution(disp); + int32_t ver_res = lv_display_get_vertical_resolution(disp); dsc->window = SDL_CreateWindow("LVGL Simulator", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, hor_res * dsc->zoom, ver_res * dsc->zoom, flag); /*last param. SDL_WINDOW_BORDERLESS to hide borders*/ @@ -286,7 +286,7 @@ static void window_create(lv_display_t * disp) static void window_update(lv_display_t * disp) { lv_sdl_window_t * dsc = lv_display_get_driver_data(disp); - lv_coord_t hor_res = lv_display_get_horizontal_resolution(disp); + int32_t hor_res = lv_display_get_horizontal_resolution(disp); uint32_t stride = lv_draw_buf_width_to_stride(hor_res, lv_display_get_color_format(disp)); SDL_UpdateTexture(dsc->texture, NULL, dsc->fb_act, stride); @@ -299,8 +299,8 @@ static void window_update(lv_display_t * disp) static void texture_resize(lv_display_t * disp) { - lv_coord_t hor_res = lv_display_get_horizontal_resolution(disp); - lv_coord_t ver_res = lv_display_get_vertical_resolution(disp); + int32_t hor_res = lv_display_get_horizontal_resolution(disp); + int32_t ver_res = lv_display_get_vertical_resolution(disp); uint32_t stride = lv_draw_buf_width_to_stride(hor_res, lv_display_get_color_format(disp)); lv_sdl_window_t * dsc = lv_display_get_driver_data(disp); diff --git a/src/dev/sdl/lv_sdl_window.h b/src/dev/sdl/lv_sdl_window.h index 387e2ec3c..765685896 100644 --- a/src/dev/sdl/lv_sdl_window.h +++ b/src/dev/sdl/lv_sdl_window.h @@ -31,7 +31,7 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ -lv_display_t * lv_sdl_window_create(lv_coord_t hor_res, lv_coord_t ver_res); +lv_display_t * lv_sdl_window_create(int32_t hor_res, int32_t ver_res); void lv_sdl_window_set_zoom(lv_display_t * disp, uint8_t zoom); diff --git a/src/display/lv_display.c b/src/display/lv_display.c index 7dd59540e..3a30b75ae 100644 --- a/src/display/lv_display.c +++ b/src/display/lv_display.c @@ -54,7 +54,7 @@ static void disp_event_cb(lv_event_t * e); * GLOBAL FUNCTIONS **********************/ -lv_display_t * lv_display_create(lv_coord_t hor_res, lv_coord_t ver_res) +lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res) { lv_display_t * disp = _lv_ll_ins_head(disp_ll_p); LV_ASSERT_MALLOC(disp); @@ -207,7 +207,7 @@ lv_display_t * lv_display_get_next(lv_display_t * disp) * RESOLUTION *--------------------*/ -void lv_display_set_resolution(lv_display_t * disp, lv_coord_t hor_res, lv_coord_t ver_res) +void lv_display_set_resolution(lv_display_t * disp, int32_t hor_res, int32_t ver_res) { if(disp == NULL) disp = lv_display_get_default(); if(disp == NULL) return; @@ -220,7 +220,7 @@ void lv_display_set_resolution(lv_display_t * disp, lv_coord_t hor_res, lv_coord update_resolution(disp); } -void lv_display_set_physical_resolution(lv_display_t * disp, lv_coord_t hor_res, lv_coord_t ver_res) +void lv_display_set_physical_resolution(lv_display_t * disp, int32_t hor_res, int32_t ver_res) { if(disp == NULL) disp = lv_display_get_default(); if(disp == NULL) return; @@ -232,7 +232,7 @@ void lv_display_set_physical_resolution(lv_display_t * disp, lv_coord_t hor_res, } -void lv_display_set_offset(lv_display_t * disp, lv_coord_t x, lv_coord_t y) +void lv_display_set_offset(lv_display_t * disp, int32_t x, int32_t y) { if(disp == NULL) disp = lv_display_get_default(); if(disp == NULL) return; @@ -244,7 +244,7 @@ void lv_display_set_offset(lv_display_t * disp, lv_coord_t x, lv_coord_t y) } -void lv_display_set_dpi(lv_display_t * disp, lv_coord_t dpi) +void lv_display_set_dpi(lv_display_t * disp, int32_t dpi) { if(disp == NULL) disp = lv_display_get_default(); if(disp == NULL) return; @@ -252,7 +252,7 @@ void lv_display_set_dpi(lv_display_t * disp, lv_coord_t dpi) disp->dpi = dpi; } -lv_coord_t lv_display_get_horizontal_resolution(const lv_display_t * disp) +int32_t lv_display_get_horizontal_resolution(const lv_display_t * disp) { if(disp == NULL) disp = lv_display_get_default(); @@ -270,7 +270,7 @@ lv_coord_t lv_display_get_horizontal_resolution(const lv_display_t * disp) } } -lv_coord_t lv_display_get_vertical_resolution(const lv_display_t * disp) +int32_t lv_display_get_vertical_resolution(const lv_display_t * disp) { if(disp == NULL) disp = lv_display_get_default(); @@ -288,7 +288,7 @@ lv_coord_t lv_display_get_vertical_resolution(const lv_display_t * disp) } } -lv_coord_t lv_display_get_physical_horizontal_resolution(const lv_display_t * disp) +int32_t lv_display_get_physical_horizontal_resolution(const lv_display_t * disp) { if(disp == NULL) disp = lv_display_get_default(); @@ -306,7 +306,7 @@ lv_coord_t lv_display_get_physical_horizontal_resolution(const lv_display_t * di } } -lv_coord_t lv_display_get_physical_vertical_resolution(const lv_display_t * disp) +int32_t lv_display_get_physical_vertical_resolution(const lv_display_t * disp) { if(disp == NULL) disp = lv_display_get_default(); @@ -324,7 +324,7 @@ lv_coord_t lv_display_get_physical_vertical_resolution(const lv_display_t * disp } } -lv_coord_t lv_display_get_offset_x(const lv_display_t * disp) +int32_t lv_display_get_offset_x(const lv_display_t * disp) { if(disp == NULL) disp = lv_display_get_default(); @@ -345,7 +345,7 @@ lv_coord_t lv_display_get_offset_x(const lv_display_t * disp) } } -lv_coord_t lv_display_get_offset_y(const lv_display_t * disp) +int32_t lv_display_get_offset_y(const lv_display_t * disp) { if(disp == NULL) disp = lv_display_get_default(); @@ -366,7 +366,7 @@ lv_coord_t lv_display_get_offset_y(const lv_display_t * disp) } } -lv_coord_t lv_display_get_dpi(const lv_display_t * disp) +int32_t lv_display_get_dpi(const lv_display_t * disp) { if(disp == NULL) disp = lv_display_get_default(); if(disp == NULL) return LV_DPI_DEF; /*Do not return 0 because it might be a divider*/ @@ -856,8 +856,8 @@ void * lv_display_get_driver_data(lv_display_t * disp) static void update_resolution(lv_display_t * disp) { - lv_coord_t hor_res = lv_display_get_horizontal_resolution(disp); - lv_coord_t ver_res = lv_display_get_vertical_resolution(disp); + int32_t hor_res = lv_display_get_horizontal_resolution(disp); + int32_t ver_res = lv_display_get_vertical_resolution(disp); lv_area_t prev_coords; lv_obj_get_coords(disp->sys_layer, &prev_coords); diff --git a/src/display/lv_display.h b/src/display/lv_display.h index cccbdb521..112e1b4f0 100644 --- a/src/display/lv_display.h +++ b/src/display/lv_display.h @@ -97,7 +97,7 @@ typedef void (*lv_display_flush_wait_cb_t)(struct _lv_display_t * disp); * @param ver_res vertical resolution in pixels * @return pointer to a display object or `NULL` on error */ -lv_display_t * lv_display_create(lv_coord_t hor_res, lv_coord_t ver_res); +lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res); /** * Remove a display @@ -136,7 +136,7 @@ lv_display_t * lv_display_get_next(lv_display_t * disp); * @param hor_res the new horizontal resolution * @param ver_res the new vertical resolution */ -void lv_display_set_resolution(lv_display_t * disp, lv_coord_t hor_res, lv_coord_t ver_res); +void lv_display_set_resolution(lv_display_t * disp, int32_t hor_res, int32_t ver_res); /** * It's not mandatory to use the whole display for LVGL, however in some cases physical resolution is important. @@ -146,7 +146,7 @@ void lv_display_set_resolution(lv_display_t * disp, lv_coord_t hor_res, lv_coord * @param hor_res the new physical horizontal resolution, or -1 to assume it's the same as the normal hor. res. * @param ver_res the new physical vertical resolution, or -1 to assume it's the same as the normal hor. res. */ -void lv_display_set_physical_resolution(lv_display_t * disp, lv_coord_t hor_res, lv_coord_t ver_res); +void lv_display_set_physical_resolution(lv_display_t * disp, int32_t hor_res, int32_t ver_res); /** * If physical resolution is not the same as the normal resolution @@ -155,7 +155,7 @@ void lv_display_set_physical_resolution(lv_display_t * disp, lv_coord_t hor_res, * @param x X offset * @param y Y offset */ -void lv_display_set_offset(lv_display_t * disp, lv_coord_t x, lv_coord_t y); +void lv_display_set_offset(lv_display_t * disp, int32_t x, int32_t y); /** * Set the rotation of this display. LVGL will swap the horizontal and vertical resolutions internally. @@ -172,49 +172,49 @@ void lv_display_set_rotation(lv_display_t * disp, lv_display_rotation_t rotation * @param disp pointer to a display * @param dpi the new DPI */ -void lv_display_set_dpi(lv_display_t * disp, lv_coord_t dpi); +void lv_display_set_dpi(lv_display_t * disp, int32_t dpi); /** * Get the horizontal resolution of a display. * @param disp pointer to a display (NULL to use the default display) * @return the horizontal resolution of the display. */ -lv_coord_t lv_display_get_horizontal_resolution(const lv_display_t * disp); +int32_t lv_display_get_horizontal_resolution(const lv_display_t * disp); /** * Get the vertical resolution of a display * @param disp pointer to a display (NULL to use the default display) * @return the vertical resolution of the display */ -lv_coord_t lv_display_get_vertical_resolution(const lv_display_t * disp); +int32_t lv_display_get_vertical_resolution(const lv_display_t * disp); /** * Get the physical horizontal resolution of a display * @param disp pointer to a display (NULL to use the default display) * @return the physical horizontal resolution of the display */ -lv_coord_t lv_display_get_physical_horizontal_resolution(const lv_display_t * disp); +int32_t lv_display_get_physical_horizontal_resolution(const lv_display_t * disp); /** * Get the physical vertical resolution of a display * @param disp pointer to a display (NULL to use the default display) * @return the physical vertical resolution of the display */ -lv_coord_t lv_display_get_physical_vertical_resolution(const lv_display_t * disp); +int32_t lv_display_get_physical_vertical_resolution(const lv_display_t * disp); /** * Get the horizontal offset from the full / physical display * @param disp pointer to a display (NULL to use the default display) * @return the horizontal offset from the physical display */ -lv_coord_t lv_display_get_offset_x(const lv_display_t * disp); +int32_t lv_display_get_offset_x(const lv_display_t * disp); /** * Get the vertical offset from the full / physical display * @param disp pointer to a display (NULL to use the default display) * @return the horizontal offset from the physical display */ -lv_coord_t lv_display_get_offset_y(const lv_display_t * disp); +int32_t lv_display_get_offset_y(const lv_display_t * disp); /** * Get the current rotation of this display. @@ -228,7 +228,7 @@ lv_display_rotation_t lv_display_get_rotation(lv_display_t * disp); * @param disp pointer to a display (NULL to use the default display) * @return dpi of the display */ -lv_coord_t lv_display_get_dpi(const lv_display_t * disp); +int32_t lv_display_get_dpi(const lv_display_t * disp); /*--------------------- * BUFFERING @@ -547,7 +547,7 @@ void * lv_display_get_driver_data(lv_display_t * disp); * @param n the number of pixels to scale * @return `n x current_dpi/160` */ -static inline lv_coord_t lv_dpx(lv_coord_t n) +static inline int32_t lv_dpx(int32_t n) { return LV_DPX(n); } @@ -561,7 +561,7 @@ static inline lv_coord_t lv_dpx(lv_coord_t n) * @param n the number of pixels to scale * @return `n x current_dpi/160` */ -static inline lv_coord_t lv_display_dpx(const lv_display_t * disp, lv_coord_t n) +static inline int32_t lv_display_dpx(const lv_display_t * disp, int32_t n) { return _LV_DPX_CALC(lv_display_get_dpi(disp), n); } diff --git a/src/display/lv_display_private.h b/src/display/lv_display_private.h index 1628b045e..eaac3bb50 100644 --- a/src/display/lv_display_private.h +++ b/src/display/lv_display_private.h @@ -37,22 +37,22 @@ struct _lv_display_t { *--------------------*/ /** Horizontal resolution.*/ - lv_coord_t hor_res; + int32_t hor_res; /** Vertical resolution.*/ - lv_coord_t ver_res; + int32_t ver_res; /** Horizontal resolution of the full / physical display. Set to -1 for fullscreen mode.*/ - lv_coord_t physical_hor_res; + int32_t physical_hor_res; /** Vertical resolution of the full / physical display. Set to -1 for fullscreen mode.*/ - lv_coord_t physical_ver_res; + int32_t physical_ver_res; /** Horizontal offset from the full / physical display. Set to 0 for fullscreen mode.*/ - lv_coord_t offset_x; + int32_t offset_x; /** Vertical offset from the full / physical display. Set to 0 for fullscreen mode.*/ - lv_coord_t offset_y; + int32_t offset_y; uint32_t dpi; /** DPI (dot per inch) of the display. Default value is `LV_DPI_DEF`.*/ diff --git a/src/draw/lv_draw.c b/src/draw/lv_draw.c index c84816c91..c35deca1e 100644 --- a/src/draw/lv_draw.c +++ b/src/draw/lv_draw.c @@ -283,8 +283,8 @@ lv_draw_task_t * lv_draw_get_next_available_task(lv_layer_t * layer, lv_draw_tas LV_PROFILER_BEGIN; /*If the first task is screen sized, there cannot be independent areas*/ if(layer->draw_task_head) { - lv_coord_t hor_res = lv_display_get_horizontal_resolution(_lv_refr_get_disp_refreshing()); - lv_coord_t ver_res = lv_display_get_vertical_resolution(_lv_refr_get_disp_refreshing()); + int32_t hor_res = lv_display_get_horizontal_resolution(_lv_refr_get_disp_refreshing()); + int32_t ver_res = lv_display_get_vertical_resolution(_lv_refr_get_disp_refreshing()); lv_draw_task_t * t = layer->draw_task_head; if(t->state != LV_DRAW_TASK_STATE_QUEUED && t->area.x1 <= 0 && t->area.x2 >= hor_res - 1 && @@ -370,7 +370,7 @@ void * lv_draw_layer_alloc_buf(lv_layer_t * layer) return lv_draw_buf_align(layer->buf, layer->color_format); } -void * lv_draw_layer_go_to_xy(lv_layer_t * layer, lv_coord_t x, lv_coord_t y) +void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y) { uint32_t stride = lv_draw_buf_width_to_stride(lv_area_get_width(&layer->buf_area), layer->color_format); return lv_draw_buf_go_to_xy(layer->buf, stride, layer->color_format, x, y); diff --git a/src/draw/lv_draw.h b/src/draw/lv_draw.h index 6eb99e71a..52ada8118 100644 --- a/src/draw/lv_draw.h +++ b/src/draw/lv_draw.h @@ -245,7 +245,7 @@ void * lv_draw_layer_alloc_buf(lv_layer_t * layer); * @param y the target X coordinate * @return `buf` offset to point to the given X and Y coordinate */ -void * lv_draw_layer_go_to_xy(lv_layer_t * layer, lv_coord_t x, lv_coord_t y); +void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y); /********************** * GLOBAL VARIABLES diff --git a/src/draw/lv_draw_arc.c b/src/draw/lv_draw_arc.c index 6dd0aeaab..9f8a8b0f9 100644 --- a/src/draw/lv_draw_arc.c +++ b/src/draw/lv_draw_arc.c @@ -66,11 +66,11 @@ void lv_draw_arc(lv_layer_t * layer, const lv_draw_arc_dsc_t * dsc) LV_PROFILER_END; } -void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, lv_value_precise_t start_angle, +void lv_draw_arc_get_area(int32_t x, int32_t y, uint16_t radius, lv_value_precise_t start_angle, lv_value_precise_t end_angle, - lv_coord_t w, bool rounded, lv_area_t * area) + int32_t w, bool rounded, lv_area_t * area) { - lv_coord_t rout = radius; + int32_t rout = radius; int32_t start_angle_int = (int32_t) start_angle; int32_t end_angle_int = (int32_t) end_angle; @@ -86,8 +86,8 @@ void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, lv_value if(start_angle_int > 360) start_angle_int -= 360; if(end_angle_int > 360) end_angle_int -= 360; - lv_coord_t rin = radius - w; - lv_coord_t extra_area = rounded ? w / 2 + 1 : 0; + int32_t rin = radius - w; + int32_t extra_area = rounded ? w / 2 + 1 : 0; uint8_t start_quarter = start_angle_int / 90; uint8_t end_quarter = end_angle_int / 90; diff --git a/src/draw/lv_draw_arc.h b/src/draw/lv_draw_arc.h index 5b06a04cb..ec39c698d 100644 --- a/src/draw/lv_draw_arc.h +++ b/src/draw/lv_draw_arc.h @@ -29,7 +29,7 @@ typedef struct { lv_draw_dsc_base_t base; lv_color_t color; - lv_coord_t width; + int32_t width; lv_value_precise_t start_angle; lv_value_precise_t end_angle; lv_point_t center; @@ -60,9 +60,9 @@ void lv_draw_arc(struct _lv_layer_t * layer, const lv_draw_arc_dsc_t * dsc); * @param rounded true: the arc is rounded * @param area store the area to invalidate here */ -void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, lv_value_precise_t start_angle, +void lv_draw_arc_get_area(int32_t x, int32_t y, uint16_t radius, lv_value_precise_t start_angle, lv_value_precise_t end_angle, - lv_coord_t w, bool rounded, lv_area_t * area); + int32_t w, bool rounded, lv_area_t * area); /********************** * MACROS diff --git a/src/draw/lv_draw_buf.c b/src/draw/lv_draw_buf.c index 44f711c92..23b8565d8 100644 --- a/src/draw/lv_draw_buf.c +++ b/src/draw/lv_draw_buf.c @@ -28,8 +28,8 @@ static void * buf_malloc(size_t size, lv_color_format_t color_format); static void buf_free(void * buf); static void * buf_align(void * buf, lv_color_format_t color_format); static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format); -static void * buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, lv_coord_t x, - lv_coord_t y); +static void * buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, int32_t x, + int32_t y); static void buf_clear(void * buf, uint32_t w, uint32_t h, lv_color_format_t color_format, const lv_area_t * a); @@ -96,8 +96,8 @@ void lv_draw_buf_invalidate_cache(void * buf, uint32_t stride, lv_color_format_t if(handlers.invalidate_cache_cb) handlers.invalidate_cache_cb(buf, stride, color_format, area); } -void * lv_draw_buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, lv_coord_t x, - lv_coord_t y) +void * lv_draw_buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, int32_t x, + int32_t y) { if(handlers.go_to_xy_cb) return handlers.go_to_xy_cb(buf, stride, color_format, x, y); else return NULL; @@ -157,8 +157,8 @@ static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format) return (width_byte + LV_DRAW_BUF_STRIDE_ALIGN - 1) & ~(LV_DRAW_BUF_STRIDE_ALIGN - 1); } -static void * buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, lv_coord_t x, - lv_coord_t y) +static void * buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, int32_t x, + int32_t y) { const uint8_t * buf_tmp = buf; buf_tmp += stride * y; @@ -181,7 +181,7 @@ static void buf_clear(void * buf, uint32_t w, uint32_t h, lv_color_format_t colo bufc += a->x1 * px_size; uint32_t line_length = lv_area_get_width(a) * px_size; - lv_coord_t y; + int32_t y; for(y = a->y1; y <= a->y2; y++) { lv_memzero(bufc, line_length); bufc += stride; @@ -211,7 +211,7 @@ static void buf_copy(void * dest_buf, uint32_t dest_w, uint32_t dest_h, const lv src_bufc += src_area_to_copy->x1 * px_size; uint32_t line_length = lv_area_get_width(dest_area_to_copy) * px_size; - lv_coord_t y; + int32_t y; for(y = dest_area_to_copy->y1; y <= dest_area_to_copy->y2; y++) { lv_memcpy(dest_bufc, src_bufc, line_length); dest_bufc += dest_stride; diff --git a/src/draw/lv_draw_buf.h b/src/draw/lv_draw_buf.h index 6e520d6f0..f9e8b95fe 100644 --- a/src/draw/lv_draw_buf.h +++ b/src/draw/lv_draw_buf.h @@ -36,7 +36,7 @@ typedef void (*lv_draw_buf_invalidate_cache_cb)(void * buf, uint32_t stride, lv_ typedef uint32_t (*lv_draw_buf_width_to_stride_cb)(uint32_t w, lv_color_format_t color_format); typedef void * (*lv_draw_buf_go_to_xy_cb)(const void * buf, uint32_t stride, lv_color_format_t color_format, - lv_coord_t x, lv_coord_t y); + int32_t x, int32_t y); typedef void (*lv_draw_buf_clear_cb)(void * buf, uint32_t w, uint32_t h, lv_color_format_t color_format, const lv_area_t * a); @@ -123,8 +123,8 @@ uint32_t lv_draw_buf_width_to_stride(uint32_t w, lv_color_format_t color_format) * @param y the target X coordinate * @return `buf` offset to point to the given X and Y coordinate */ -void * lv_draw_buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, lv_coord_t x, - lv_coord_t y); +void * lv_draw_buf_go_to_xy(const void * buf, uint32_t stride, lv_color_format_t color_format, int32_t x, + int32_t y); /** * Clear an area on the buffer diff --git a/src/draw/lv_draw_image.h b/src/draw/lv_draw_image.h index 552693b36..95b6c2ac7 100644 --- a/src/draw/lv_draw_image.h +++ b/src/draw/lv_draw_image.h @@ -43,9 +43,9 @@ typedef struct _lv_draw_image_dsc_t { lv_image_header_t header; - lv_coord_t rotation; - lv_coord_t zoom_x; - lv_coord_t zoom_y; + int32_t rotation; + int32_t zoom_x; + int32_t zoom_y; lv_point_t pivot; lv_color_t recolor; diff --git a/src/draw/lv_draw_label.c b/src/draw/lv_draw_label.c index 2e2153d5d..2263bb1c8 100644 --- a/src/draw/lv_draw_label.c +++ b/src/draw/lv_draw_label.c @@ -240,8 +240,8 @@ void lv_draw_label_iterate_letters(lv_draw_unit_t * draw_unit, const lv_draw_lab lv_draw_fill_dsc_t fill_dsc; lv_draw_fill_dsc_init(&fill_dsc); fill_dsc.opa = dsc->opa; - lv_coord_t underline_width = font->underline_thickness ? font->underline_thickness : 1; - lv_coord_t line_start_x; + int32_t underline_width = font->underline_thickness ? font->underline_thickness : 1; + int32_t line_start_x; uint32_t i; int32_t letter_w; diff --git a/src/draw/lv_draw_label.h b/src/draw/lv_draw_label.h index 08f71fb80..6682d157f 100644 --- a/src/draw/lv_draw_label.h +++ b/src/draw/lv_draw_label.h @@ -57,10 +57,10 @@ typedef struct { lv_color_t color; lv_color_t sel_color; lv_color_t sel_bg_color; - lv_coord_t line_space; - lv_coord_t letter_space; - lv_coord_t ofs_x; - lv_coord_t ofs_y; + int32_t line_space; + int32_t letter_space; + int32_t ofs_x; + int32_t ofs_y; lv_opa_t opa; lv_base_dir_t bidi_dir; lv_text_align_t align; diff --git a/src/draw/lv_draw_line.h b/src/draw/lv_draw_line.h index 31a35ed72..dcf22e684 100644 --- a/src/draw/lv_draw_line.h +++ b/src/draw/lv_draw_line.h @@ -33,9 +33,9 @@ typedef struct { lv_value_precise_t p2_x; lv_value_precise_t p2_y; lv_color_t color; - lv_coord_t width; - lv_coord_t dash_width; - lv_coord_t dash_gap; + int32_t width; + int32_t dash_width; + int32_t dash_gap; lv_opa_t opa; lv_blend_mode_t blend_mode : 2; uint8_t round_start : 1; diff --git a/src/draw/lv_draw_mask.h b/src/draw/lv_draw_mask.h index 8ad457a19..b8f431111 100644 --- a/src/draw/lv_draw_mask.h +++ b/src/draw/lv_draw_mask.h @@ -29,7 +29,7 @@ typedef struct { lv_draw_dsc_base_t base; lv_area_t area; - lv_coord_t radius; + int32_t radius; } lv_draw_mask_rect_dsc_t; struct _lv_layer_t; diff --git a/src/draw/lv_draw_rect.h b/src/draw/lv_draw_rect.h index 7220830ce..b3fec02d4 100644 --- a/src/draw/lv_draw_rect.h +++ b/src/draw/lv_draw_rect.h @@ -32,7 +32,7 @@ LV_EXPORT_CONST_INT(LV_RADIUS_CIRCLE); typedef struct { lv_draw_dsc_base_t base; - lv_coord_t radius; + int32_t radius; /*Background*/ lv_opa_t bg_opa; @@ -49,30 +49,30 @@ typedef struct { /*Border*/ lv_color_t border_color; - lv_coord_t border_width; + int32_t border_width; lv_opa_t border_opa; lv_border_side_t border_side : 5; uint8_t border_post : 1; /*The border will be drawn later*/ /*Outline*/ lv_color_t outline_color; - lv_coord_t outline_width; - lv_coord_t outline_pad; + int32_t outline_width; + int32_t outline_pad; lv_opa_t outline_opa; /*Shadow*/ lv_color_t shadow_color; - lv_coord_t shadow_width; - lv_coord_t shadow_offset_x; - lv_coord_t shadow_offset_y; - lv_coord_t shadow_spread; + int32_t shadow_width; + int32_t shadow_offset_x; + int32_t shadow_offset_y; + int32_t shadow_spread; lv_opa_t shadow_opa; } lv_draw_rect_dsc_t; typedef struct { lv_draw_dsc_base_t base; - lv_coord_t radius; + int32_t radius; lv_opa_t opa; lv_color_t color; @@ -82,7 +82,7 @@ typedef struct { typedef struct { lv_draw_dsc_base_t base; - lv_coord_t radius; + int32_t radius; const void * src; const void * font; @@ -96,10 +96,10 @@ typedef struct { typedef struct { lv_draw_dsc_base_t base; - lv_coord_t radius; + int32_t radius; lv_color_t color; - lv_coord_t width; + int32_t width; lv_opa_t opa; lv_border_side_t side : 5; @@ -108,13 +108,13 @@ typedef struct { typedef struct { lv_draw_dsc_base_t base; - lv_coord_t radius; + int32_t radius; lv_color_t color; - lv_coord_t width; - lv_coord_t spread; - lv_coord_t ofs_x; - lv_coord_t ofs_y; + int32_t width; + int32_t spread; + int32_t ofs_x; + int32_t ofs_y; lv_opa_t opa; uint8_t bg_cover : 1; } lv_draw_box_shadow_dsc_t; diff --git a/src/draw/lv_image_buf.c b/src/draw/lv_image_buf.c index f060726bd..a50acca1f 100644 --- a/src/draw/lv_image_buf.c +++ b/src/draw/lv_image_buf.c @@ -59,7 +59,7 @@ void lv_image_buf_free(lv_image_dsc_t * dsc) } } -void _lv_image_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, lv_coord_t angle, uint16_t zoom_x, +void _lv_image_buf_get_transformed_area(lv_area_t * res, int32_t w, int32_t h, int32_t angle, uint16_t zoom_x, uint16_t zoom_y, const lv_point_t * pivot) { diff --git a/src/draw/lv_image_buf.h b/src/draw/lv_image_buf.h index 3032d2d24..11456c332 100644 --- a/src/draw/lv_image_buf.h +++ b/src/draw/lv_image_buf.h @@ -116,7 +116,7 @@ void lv_image_buf_free(lv_image_dsc_t * dsc); * @param zoom_y zoom in y direction, (256 no zoom) * @param pivot x,y pivot coordinates of rotation */ -void _lv_image_buf_get_transformed_area(lv_area_t * res, lv_coord_t w, lv_coord_t h, lv_coord_t angle, uint16_t zoom_x, +void _lv_image_buf_get_transformed_area(lv_area_t * res, int32_t w, int32_t h, int32_t angle, uint16_t zoom_x, uint16_t zoom_y, const lv_point_t * pivot); diff --git a/src/draw/lv_image_decoder.c b/src/draw/lv_image_decoder.c index 89629e02a..21b45fd88 100644 --- a/src/draw/lv_image_decoder.c +++ b/src/draw/lv_image_decoder.c @@ -32,9 +32,9 @@ typedef struct { /********************** * STATIC PROTOTYPES **********************/ -static lv_result_t decode_indexed_line(lv_color_format_t color_format, const lv_color32_t * palette, lv_coord_t x, - lv_coord_t y, - lv_coord_t w_px, const uint8_t * in, lv_color32_t * out); +static lv_result_t decode_indexed_line(lv_color_format_t color_format, const lv_color32_t * palette, int32_t x, + int32_t y, + int32_t w_px, const uint8_t * in, lv_color32_t * out); static uint32_t img_width_to_stride(lv_image_header_t * header); static lv_fs_res_t fs_read_file_at(lv_fs_file_t * f, uint32_t pos, uint8_t * buff, uint32_t btr, uint32_t * br); @@ -678,7 +678,7 @@ lv_result_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ lv_image_decoder_built_in_data_t * decoder_data = dsc->user_data; lv_fs_file_t * f = &decoder_data->f; uint32_t bpp = lv_color_format_get_bpp(cf); - lv_coord_t w_px = lv_area_get_width(full_area); + int32_t w_px = lv_area_get_width(full_area); uint8_t * img_data = NULL; uint32_t offset = sizeof(lv_image_header_t); /*All image starts with image header*/ @@ -707,7 +707,7 @@ lv_result_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ } if(LV_COLOR_FORMAT_IS_INDEXED(cf)) { - lv_coord_t x_fraction = decoded_area->x1 % (8 / bpp); + int32_t x_fraction = decoded_area->x1 % (8 / bpp); uint32_t len = (w_px * bpp + 7) / 8 + 1; /*10px for 1bpp may across 3bytes*/ uint8_t * buf = lv_malloc(len); LV_ASSERT_NULL(buf); @@ -776,16 +776,16 @@ lv_result_t lv_image_decoder_built_in_get_area(lv_image_decoder_t * decoder, lv_ * STATIC FUNCTIONS **********************/ -static lv_result_t decode_indexed_line(lv_color_format_t color_format, const lv_color32_t * palette, lv_coord_t x, - lv_coord_t y, - lv_coord_t w_px, const uint8_t * in, lv_color32_t * out) +static lv_result_t decode_indexed_line(lv_color_format_t color_format, const lv_color32_t * palette, int32_t x, + int32_t y, + int32_t w_px, const uint8_t * in, lv_color32_t * out) { uint8_t px_size; uint16_t mask; out += w_px * y; - lv_coord_t w_byte = 0; + int32_t w_byte = 0; int8_t shift = 0; switch(color_format) { case LV_COLOR_FORMAT_I1: @@ -822,7 +822,7 @@ static lv_result_t decode_indexed_line(lv_color_format_t color_format, const lv_ mask = (1 << px_size) - 1; /*E.g. px_size = 2; mask = 0x03*/ - lv_coord_t i; + int32_t i; for(i = 0; i < w_px; i++) { uint8_t val_act = (*in >> shift) & mask; out[i] = palette[val_act]; diff --git a/src/draw/nxp/pxp/lv_draw_pxp_fill.c b/src/draw/nxp/pxp/lv_draw_pxp_fill.c index 20ce0e274..6112de60b 100644 --- a/src/draw/nxp/pxp/lv_draw_pxp_fill.c +++ b/src/draw/nxp/pxp/lv_draw_pxp_fill.c @@ -32,7 +32,7 @@ * STATIC PROTOTYPES **********************/ -static void _pxp_fill(uint8_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, +static void _pxp_fill(uint8_t * dest_buf, const lv_area_t * dest_area, int32_t dest_stride, lv_color_format_t dest_cf, const lv_draw_fill_dsc_t * dsc); /********************** @@ -68,7 +68,7 @@ void lv_draw_pxp_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc return; /*Fully clipped, nothing to do*/ uint8_t * dest_buf = layer->draw_buf.buf; - lv_coord_t dest_stride = lv_draw_buf_get_stride(&layer->draw_buf); + int32_t dest_stride = lv_draw_buf_get_stride(&layer->draw_buf); lv_color_format_t dest_cf = layer->draw_buf.color_format; _pxp_fill(dest_buf, &blend_area, dest_stride, dest_cf, dsc); @@ -78,11 +78,11 @@ void lv_draw_pxp_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc * STATIC FUNCTIONS **********************/ -static void _pxp_fill(uint8_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, +static void _pxp_fill(uint8_t * dest_buf, const lv_area_t * dest_area, int32_t dest_stride, lv_color_format_t dest_cf, const lv_draw_fill_dsc_t * dsc) { - lv_coord_t dest_w = lv_area_get_width(dest_area); - lv_coord_t dest_h = lv_area_get_height(dest_area); + int32_t dest_w = lv_area_get_width(dest_area); + int32_t dest_h = lv_area_get_height(dest_area); lv_pxp_reset(); diff --git a/src/draw/nxp/pxp/lv_draw_pxp_img.c b/src/draw/nxp/pxp/lv_draw_pxp_img.c index 69bb061e4..ec0431360 100644 --- a/src/draw/nxp/pxp/lv_draw_pxp_img.c +++ b/src/draw/nxp/pxp/lv_draw_pxp_img.c @@ -35,19 +35,19 @@ **********************/ /* Blit w/ recolor for images w/o opa and alpha channel */ -static void _pxp_blit_recolor(uint8_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, +static void _pxp_blit_recolor(uint8_t * dest_buf, const lv_area_t * dest_area, int32_t dest_stride, lv_color_format_t dest_cf, const uint8_t * src_buf, const lv_area_t * src_area, - lv_coord_t src_stride, lv_color_format_t src_cf, const lv_draw_image_dsc_t * dsc); + int32_t src_stride, lv_color_format_t src_cf, const lv_draw_image_dsc_t * dsc); /* Blit w/ transformation for images w/o opa and alpha channel */ -static void _pxp_blit_transform(uint8_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, +static void _pxp_blit_transform(uint8_t * dest_buf, const lv_area_t * dest_area, int32_t dest_stride, lv_color_format_t dest_cf, const uint8_t * src_buf, const lv_area_t * src_area, - lv_coord_t src_stride, lv_color_format_t src_cf, const lv_draw_image_dsc_t * dsc); + int32_t src_stride, lv_color_format_t src_cf, const lv_draw_image_dsc_t * dsc); /* Blit simple w/ opa and alpha channel */ -static void _pxp_blit(uint8_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, +static void _pxp_blit(uint8_t * dest_buf, const lv_area_t * dest_area, int32_t dest_stride, lv_color_format_t dest_cf, const uint8_t * src_buf, const lv_area_t * src_area, - lv_coord_t src_stride, lv_color_format_t src_cf, lv_opa_t opa); + int32_t src_stride, lv_color_format_t src_cf, lv_opa_t opa); /********************** * STATIC VARIABLES @@ -92,11 +92,11 @@ void lv_draw_pxp_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc src_area.y1 = blend_area.y1 - (coords->y1 - layer->draw_buf_ofs.y); src_area.x2 = src_area.x1 + lv_area_get_width(coords) - 1; src_area.y2 = src_area.y1 + lv_area_get_height(coords) - 1; - lv_coord_t src_stride = img_dsc->header.stride; + int32_t src_stride = img_dsc->header.stride; lv_color_format_t src_cf = img_dsc->header.cf; uint8_t * dest_buf = layer->draw_buf.buf; - lv_coord_t dest_stride = lv_draw_buf_get_stride(&layer->draw_buf); + int32_t dest_stride = lv_draw_buf_get_stride(&layer->draw_buf); lv_color_format_t dest_cf = layer->draw_buf.color_format; bool has_recolor = (dsc->recolor_opa != LV_OPA_TRANSP); @@ -115,15 +115,15 @@ void lv_draw_pxp_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc * STATIC FUNCTIONS **********************/ -static void _pxp_blit_recolor(uint8_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, +static void _pxp_blit_recolor(uint8_t * dest_buf, const lv_area_t * dest_area, int32_t dest_stride, lv_color_format_t dest_cf, const uint8_t * src_buf, const lv_area_t * src_area, - lv_coord_t src_stride, lv_color_format_t src_cf, const lv_draw_image_dsc_t * dsc) + int32_t src_stride, lv_color_format_t src_cf, const lv_draw_image_dsc_t * dsc) { - lv_coord_t dest_w = lv_area_get_width(dest_area); - lv_coord_t dest_h = lv_area_get_height(dest_area); - lv_coord_t src_w = lv_area_get_width(src_area); - lv_coord_t src_h = lv_area_get_height(src_area); + int32_t dest_w = lv_area_get_width(dest_area); + int32_t dest_h = lv_area_get_height(dest_area); + int32_t src_w = lv_area_get_width(src_area); + int32_t src_h = lv_area_get_height(src_area); bool src_has_alpha = (src_cf == LV_COLOR_FORMAT_ARGB8888); uint8_t src_px_size = lv_color_format_get_size(src_cf); @@ -181,21 +181,21 @@ static void _pxp_blit_recolor(uint8_t * dest_buf, const lv_area_t * dest_area, l lv_pxp_run(); } -static void _pxp_blit_transform(uint8_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, +static void _pxp_blit_transform(uint8_t * dest_buf, const lv_area_t * dest_area, int32_t dest_stride, lv_color_format_t dest_cf, const uint8_t * src_buf, const lv_area_t * src_area, - lv_coord_t src_stride, lv_color_format_t src_cf, const lv_draw_image_dsc_t * dsc) + int32_t src_stride, lv_color_format_t src_cf, const lv_draw_image_dsc_t * dsc) { - lv_coord_t src_w = lv_area_get_width(src_area); - lv_coord_t src_h = lv_area_get_height(src_area); - lv_coord_t dest_w = lv_area_get_width(dest_area); - lv_coord_t dest_h = lv_area_get_height(dest_area); + int32_t src_w = lv_area_get_width(src_area); + int32_t src_h = lv_area_get_height(src_area); + int32_t dest_w = lv_area_get_width(dest_area); + int32_t dest_h = lv_area_get_height(dest_area); lv_point_t pivot = dsc->pivot; /*The offsets are now relative to the transformation result with pivot ULC*/ - lv_coord_t piv_offset_x = 0; - lv_coord_t piv_offset_y = 0; + int32_t piv_offset_x = 0; + int32_t piv_offset_y = 0; - lv_coord_t trim_size = 0; + int32_t trim_size = 0; bool has_rotation = (dsc->rotation != 0); bool has_scale = (dsc->zoom != LV_SCALE_NONE); @@ -239,7 +239,7 @@ static void _pxp_blit_transform(uint8_t * dest_buf, const lv_area_t * dest_area, if(has_scale) { float scale_factor_fp = (float)dsc->zoom / LV_SCALE_NONE; - lv_coord_t scale_factor_int = (lv_coord_t)scale_factor_fp; + int32_t scale_factor_int = (int32_t)scale_factor_fp; /*Any scale_factor in (k, k + 1] will result in a trim equal to k*/ if(scale_factor_fp == scale_factor_int) @@ -288,14 +288,14 @@ static void _pxp_blit_transform(uint8_t * dest_buf, const lv_area_t * dest_area, lv_pxp_run(); } -static void _pxp_blit(uint8_t * dest_buf, const lv_area_t * dest_area, lv_coord_t dest_stride, +static void _pxp_blit(uint8_t * dest_buf, const lv_area_t * dest_area, int32_t dest_stride, lv_color_format_t dest_cf, const uint8_t * src_buf, const lv_area_t * src_area, - lv_coord_t src_stride, lv_color_format_t src_cf, lv_opa_t opa) + int32_t src_stride, lv_color_format_t src_cf, lv_opa_t opa) { - lv_coord_t dest_w = lv_area_get_width(dest_area); - lv_coord_t dest_h = lv_area_get_height(dest_area); - lv_coord_t src_w = lv_area_get_width(src_area); - lv_coord_t src_h = lv_area_get_height(src_area); + int32_t dest_w = lv_area_get_width(dest_area); + int32_t dest_h = lv_area_get_height(dest_area); + int32_t src_w = lv_area_get_width(src_area); + int32_t src_h = lv_area_get_height(src_area); bool src_has_alpha = (src_cf == LV_COLOR_FORMAT_ARGB8888); uint8_t src_px_size = lv_color_format_get_size(src_cf); diff --git a/src/draw/nxp/vglite/lv_draw_buf_vglite.c b/src/draw/nxp/vglite/lv_draw_buf_vglite.c index fcd42e25c..91bfbb22c 100644 --- a/src/draw/nxp/vglite/lv_draw_buf_vglite.c +++ b/src/draw/nxp/vglite/lv_draw_buf_vglite.c @@ -43,7 +43,7 @@ static void _invalidate_cache(lv_draw_buf_t * draw_buf, const char * area); static uint32_t _width_to_stride(uint32_t w, lv_color_format_t cf); -static void * _go_to_xy(lv_draw_buf_t * draw_buf, lv_coord_t x, lv_coord_t y); +static void * _go_to_xy(lv_draw_buf_t * draw_buf, int32_t x, int32_t y); static void _vglite_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * area); @@ -120,7 +120,7 @@ static uint32_t _width_to_stride(uint32_t w, lv_color_format_t cf) return (width_bytes + align_bytes - 1) & ~(align_bytes - 1); } -static void * _go_to_xy(lv_draw_buf_t * draw_buf, lv_coord_t x, lv_coord_t y) +static void * _go_to_xy(lv_draw_buf_t * draw_buf, int32_t x, int32_t y) { uint8_t bits_per_pixel = vglite_get_px_size(draw_buf->color_format); uint32_t stride = lv_draw_buf_get_stride(draw_buf); diff --git a/src/draw/nxp/vglite/lv_draw_vglite_arc.c b/src/draw/nxp/vglite/lv_draw_vglite_arc.c index 4f45ce963..409c48500 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_arc.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_arc.c @@ -575,7 +575,7 @@ static void _vglite_draw_arc(const lv_point_t * center, const lv_area_t * clip_a lv_memset(arc_path, 0, sizeof(arc_path)); /*** Init path ***/ - lv_coord_t width = dsc->width; /* inner arc radius = outer arc radius - width */ + int32_t width = dsc->width; /* inner arc radius = outer arc radius - width */ uint16_t radius = dsc->radius; if(width > radius) diff --git a/src/draw/nxp/vglite/lv_draw_vglite_border.c b/src/draw/nxp/vglite/lv_draw_vglite_border.c index fd014007f..0ea8073ea 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_border.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_border.c @@ -73,7 +73,7 @@ void lv_draw_vglite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_ lv_layer_t * layer = draw_unit->target_layer; lv_area_t rel_coords; - lv_coord_t width = dsc->width; + int32_t width = dsc->width; /* Move border inwards to align with software rendered border */ rel_coords.x1 = coords->x1 + ceil(width / 2.0f); @@ -82,7 +82,7 @@ void lv_draw_vglite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_ rel_coords.y2 = coords->y2 - floor(width / 2.0f); /* Move outline outwards to align with software rendered outline */ - //lv_coord_t outline_pad = dsc->outline_pad - 1; + //int32_t outline_pad = dsc->outline_pad - 1; //rel_coords.x1 = coords->x1 - outline_pad - floor(dsc->outline_width / 2.0f); //rel_coords.x2 = coords->x2 + outline_pad + ceil(dsc->outline_width / 2.0f); //rel_coords.y1 = coords->y1 - outline_pad - floor(dsc->outline_width / 2.0f); @@ -109,20 +109,20 @@ static void _vglite_draw_border(const lv_area_t * coords, const lv_area_t * clip const lv_draw_border_dsc_t * dsc) { vg_lite_error_t err = VG_LITE_SUCCESS; - lv_coord_t radius = dsc->radius; + int32_t radius = dsc->radius; vg_lite_buffer_t * vgbuf = vglite_get_dest_buf(); if(radius < 0) return; - lv_coord_t border_half = (lv_coord_t)floor(dsc->width / 2.0f); + int32_t border_half = (int32_t)floor(dsc->width / 2.0f); if(radius > border_half) radius = radius - border_half; //else { // /* Draw outline - always has radius, leave the same radius in the circle case */ - // lv_coord_t outline_half = (lv_coord_t)ceil(dsc->outline_width / 2.0f); - // if(radius < (lv_coord_t)LV_RADIUS_CIRCLE - outline_half) + // int32_t outline_half = (int32_t)ceil(dsc->outline_width / 2.0f); + // if(radius < (int32_t)LV_RADIUS_CIRCLE - outline_half) // radius = radius + outline_half; //} @@ -147,7 +147,7 @@ static void _vglite_draw_border(const lv_area_t * coords, const lv_area_t * clip vg_lite_matrix_t matrix; vg_lite_identity(&matrix); - lv_coord_t line_width = dsc->width; + int32_t line_width = dsc->width; /*** Draw border ***/ err = vg_lite_set_draw_path_type(&path, VG_LITE_DRAW_STROKE_PATH); diff --git a/src/draw/nxp/vglite/lv_draw_vglite_fill.c b/src/draw/nxp/vglite/lv_draw_vglite_fill.c index df943891e..eef062c16 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_fill.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_fill.c @@ -163,9 +163,9 @@ static void _vglite_draw_rect(const lv_area_t * coords, const lv_area_t * clip_a const lv_draw_fill_dsc_t * dsc) { vg_lite_error_t err = VG_LITE_SUCCESS; - lv_coord_t width = lv_area_get_width(coords); - lv_coord_t height = lv_area_get_height(coords); - lv_coord_t radius = dsc->radius; + int32_t width = lv_area_get_width(coords); + int32_t height = lv_area_get_height(coords); + int32_t radius = dsc->radius; vg_lite_buffer_t * vgbuf = vglite_get_dest_buf(); if(dsc->radius < 0) diff --git a/src/draw/nxp/vglite/lv_draw_vglite_img.c b/src/draw/nxp/vglite/lv_draw_vglite_img.c index 229fa1ec7..f5be3231c 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_img.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_img.c @@ -246,7 +246,7 @@ static void _move_buf_close_to_area(void ** buf, lv_area_t * area, uint32_t stri uint16_t align_pixels = align_bytes * 8 / bits_per_pixel; - if(area->x1 >= (lv_coord_t)(area->x1 % align_pixels)) { + if(area->x1 >= (int32_t)(area->x1 % align_pixels)) { uint16_t shift_x = area->x1 - (area->x1 % align_pixels); area->x1 -= shift_x; @@ -313,8 +313,8 @@ static void _vglite_blit_split(void * dest_buf, lv_area_t * dest_area, uint32_t lv_area_get_width(dest_area), lv_area_get_height(dest_area), (uintptr_t)src_buf, (uintptr_t)dest_buf); - lv_coord_t width = LV_MIN(lv_area_get_width(src_area), lv_area_get_width(dest_area)); - lv_coord_t height = LV_MIN(lv_area_get_height(src_area), lv_area_get_height(dest_area)); + int32_t width = LV_MIN(lv_area_get_width(src_area), lv_area_get_width(dest_area)); + int32_t height = LV_MIN(lv_area_get_height(src_area), lv_area_get_height(dest_area)); /* Number of tiles needed */ uint8_t total_tiles_x = (src_area->x1 + width + VGLITE_BLIT_SPLIT_THR - 1) / diff --git a/src/draw/nxp/vglite/lv_draw_vglite_line.c b/src/draw/nxp/vglite/lv_draw_vglite_line.c index db536aa17..ea7c36e91 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_line.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_line.c @@ -112,7 +112,7 @@ static void _vglite_draw_line(const lv_point_t * point1, const lv_point_t * poin vg_lite_blend_t vglite_blend_mode = vglite_get_blend_mode(dsc->blend_mode); /*** Init path ***/ - lv_coord_t width = dsc->width; + int32_t width = dsc->width; int32_t line_path[] = { /*VG line path*/ VLC_OP_MOVE, point1->x, point1->y, diff --git a/src/draw/nxp/vglite/lv_vglite_buf.c b/src/draw/nxp/vglite/lv_vglite_buf.c index 8d0efcf62..baf8b26b0 100644 --- a/src/draw/nxp/vglite/lv_vglite_buf.c +++ b/src/draw/nxp/vglite/lv_vglite_buf.c @@ -76,14 +76,14 @@ void vglite_set_dest_buf(const lv_draw_buf_t * draw_buf) lv_draw_buf_get_stride(draw_buf), draw_buf->color_format); } -void vglite_set_src_buf(const void * buf, lv_coord_t width, lv_coord_t height, uint32_t stride, +void vglite_set_src_buf(const void * buf, int32_t width, int32_t height, uint32_t stride, lv_color_format_t cf) { vglite_set_buf(&_src_vgbuf, (void *)buf, width, height, stride, cf); } void vglite_set_buf(vg_lite_buffer_t * vgbuf, void * buf, - lv_coord_t width, lv_coord_t height, uint32_t stride, + int32_t width, int32_t height, uint32_t stride, lv_color_format_t cf) { vg_lite_buffer_format_t vgformat = vglite_get_buf_format(cf); diff --git a/src/draw/nxp/vglite/lv_vglite_buf.h b/src/draw/nxp/vglite/lv_vglite_buf.h index c70d470f7..822ec44b5 100644 --- a/src/draw/nxp/vglite/lv_vglite_buf.h +++ b/src/draw/nxp/vglite/lv_vglite_buf.h @@ -89,7 +89,7 @@ void vglite_set_dest_buf(const lv_draw_buf_t * draw_buf); * @param[in] cf Source buffer color format * */ -void vglite_set_src_buf(const void * buf, lv_coord_t width, lv_coord_t height, uint32_t stride, +void vglite_set_src_buf(const void * buf, int32_t width, int32_t height, uint32_t stride, lv_color_format_t cf); /** @@ -104,7 +104,7 @@ void vglite_set_src_buf(const void * buf, lv_coord_t width, lv_coord_t height, u * */ void vglite_set_buf(vg_lite_buffer_t * vgbuf, void * buf, - lv_coord_t width, lv_coord_t height, uint32_t stride, + int32_t width, int32_t height, uint32_t stride, lv_color_format_t cf); /********************** diff --git a/src/draw/nxp/vglite/lv_vglite_path.c b/src/draw/nxp/vglite/lv_vglite_path.c index c682ea5d8..ca163021b 100644 --- a/src/draw/nxp/vglite/lv_vglite_path.c +++ b/src/draw/nxp/vglite/lv_vglite_path.c @@ -44,11 +44,11 @@ **********************/ void vglite_create_rect_path_data(int32_t * path_data, uint32_t * path_data_size, - lv_coord_t radius, + int32_t radius, const lv_area_t * coords) { - lv_coord_t rect_width = lv_area_get_width(coords); - lv_coord_t rect_height = lv_area_get_height(coords); + int32_t rect_width = lv_area_get_width(coords); + int32_t rect_height = lv_area_get_height(coords); /* Get the final radius. Can't be larger than the half of the shortest side */ int32_t shortest_side = LV_MIN(rect_width, rect_height); @@ -57,7 +57,7 @@ void vglite_create_rect_path_data(int32_t * path_data, uint32_t * path_data_size /* Path data element index */ uint8_t pidx = 0; - if((radius == (lv_coord_t)LV_RADIUS_CIRCLE) && (rect_width == rect_height)) { + if((radius == (int32_t)LV_RADIUS_CIRCLE) && (rect_width == rect_height)) { /* Get the control point offset for rounded cases */ int32_t cpoff = (int32_t)((float)final_radius * BEZIER_OPTIM_CIRCLE); diff --git a/src/draw/nxp/vglite/lv_vglite_path.h b/src/draw/nxp/vglite/lv_vglite_path.h index 842b03543..8ae82f379 100644 --- a/src/draw/nxp/vglite/lv_vglite_path.h +++ b/src/draw/nxp/vglite/lv_vglite_path.h @@ -72,7 +72,7 @@ extern "C" { * */ void vglite_create_rect_path_data(int32_t * path_data, uint32_t * path_data_size, - lv_coord_t radius, + int32_t radius, const lv_area_t * coords); /********************** diff --git a/src/draw/sw/blend/lv_draw_sw_blend.h b/src/draw/sw/blend/lv_draw_sw_blend.h index f6a4f7b05..80c95b129 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend.h +++ b/src/draw/sw/blend/lv_draw_sw_blend.h @@ -40,7 +40,7 @@ typedef struct { const lv_opa_t * mask_buf; /**< NULL if ignored, or an alpha mask to apply on `blend_area`*/ lv_draw_sw_mask_res_t mask_res; /**< The result of the previous mask operation */ const lv_area_t * mask_area; /**< The area of `mask_buf` with absolute coordinates*/ - lv_coord_t mask_stride; + int32_t mask_stride; lv_blend_mode_t blend_mode; /**< E.g. LV_BLEND_MODE_ADDITIVE*/ } lv_draw_sw_blend_dsc_t; @@ -49,24 +49,24 @@ struct _lv_draw_unit_t; typedef struct { void * dest_buf; - lv_coord_t dest_w; - lv_coord_t dest_h; - lv_coord_t dest_stride; + int32_t dest_w; + int32_t dest_h; + int32_t dest_stride; const lv_opa_t * mask_buf; - lv_coord_t mask_stride; + int32_t mask_stride; lv_color_t color; lv_opa_t opa; } _lv_draw_sw_blend_fill_dsc_t; typedef struct { void * dest_buf; - lv_coord_t dest_w; - lv_coord_t dest_h; - lv_coord_t dest_stride; + int32_t dest_w; + int32_t dest_h; + int32_t dest_stride; const lv_opa_t * mask_buf; - lv_coord_t mask_stride; + int32_t mask_stride; const void * src_buf; - lv_coord_t src_stride; + int32_t src_stride; lv_color_format_t src_color_format; lv_opa_t opa; lv_blend_mode_t blend_mode; diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c index 6580ad6f1..5bcca6f6a 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.c @@ -68,8 +68,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_ int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; const lv_opa_t * mask = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; - lv_coord_t dest_stride = dsc->dest_stride; + int32_t mask_stride = dsc->mask_stride; + int32_t dest_stride = dsc->dest_stride; lv_color_mix_alpha_cache_t cache; lv_color_mix_with_alpha_cache_init(&cache); @@ -183,11 +183,11 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; lv_color32_t * dest_buf_c32 = dsc->dest_buf; - lv_coord_t dest_stride = dsc->dest_stride; + int32_t dest_stride = dsc->dest_stride; const lv_color16_t * src_buf_c16 = (const lv_color16_t *) dsc->src_buf; - lv_coord_t src_stride = dsc->src_stride; + int32_t src_stride = dsc->src_stride; const lv_opa_t * mask_buf = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; + int32_t mask_stride = dsc->mask_stride; lv_color32_t color_argb; lv_color_mix_alpha_cache_t cache; @@ -264,11 +264,11 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; lv_color32_t * dest_buf_c32 = dsc->dest_buf; - lv_coord_t dest_stride = dsc->dest_stride; + int32_t dest_stride = dsc->dest_stride; const uint8_t * src_buf = dsc->src_buf; - lv_coord_t src_stride = dsc->src_stride * src_px_size; + int32_t src_stride = dsc->src_stride * src_px_size; const lv_opa_t * mask_buf = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; + int32_t mask_stride = dsc->mask_stride; lv_color32_t color_argb; lv_color_mix_alpha_cache_t cache; @@ -369,11 +369,11 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; lv_color32_t * dest_buf_c32 = dsc->dest_buf; - lv_coord_t dest_stride = dsc->dest_stride; + int32_t dest_stride = dsc->dest_stride; const lv_color32_t * src_buf_c32 = dsc->src_buf; - lv_coord_t src_stride = dsc->src_stride; + int32_t src_stride = dsc->src_stride; const lv_opa_t * mask_buf = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; + int32_t mask_stride = dsc->mask_stride; lv_color32_t color_argb; lv_color_mix_alpha_cache_t cache; diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c index 439787272..c37a63f2d 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.c @@ -68,9 +68,9 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi uint16_t color16 = lv_color_to_u16(dsc->color); lv_opa_t opa = dsc->opa; const lv_opa_t * mask = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; + int32_t mask_stride = dsc->mask_stride; uint16_t * dest_buf_u16 = dsc->dest_buf; - lv_coord_t dest_stride = dsc->dest_stride; + int32_t dest_stride = dsc->dest_stride; int32_t x; int32_t y; @@ -232,11 +232,11 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; uint16_t * dest_buf_u16 = dsc->dest_buf; - lv_coord_t dest_stride = dsc->dest_stride; + int32_t dest_stride = dsc->dest_stride; const uint16_t * src_buf_u16 = dsc->src_buf; - lv_coord_t src_stride = dsc->src_stride; + int32_t src_stride = dsc->src_stride; const lv_opa_t * mask_buf = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; + int32_t mask_stride = dsc->mask_stride; int32_t x; int32_t y; @@ -332,11 +332,11 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; uint16_t * dest_buf_u16 = dsc->dest_buf; - lv_coord_t dest_stride = dsc->dest_stride; + int32_t dest_stride = dsc->dest_stride; const uint8_t * src_buf_u8 = dsc->src_buf; - lv_coord_t src_stride = dsc->src_stride * src_px_size; + int32_t src_stride = dsc->src_stride * src_px_size; const lv_opa_t * mask_buf = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; + int32_t mask_stride = dsc->mask_stride; int32_t dest_x; int32_t src_x; @@ -433,11 +433,11 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; uint16_t * dest_buf_u16 = dsc->dest_buf; - lv_coord_t dest_stride = dsc->dest_stride; + int32_t dest_stride = dsc->dest_stride; const uint8_t * src_buf_u8 = dsc->src_buf; - lv_coord_t src_stride = dsc->src_stride * 4; + int32_t src_stride = dsc->src_stride * 4; const lv_opa_t * mask_buf = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; + int32_t mask_stride = dsc->mask_stride; int32_t dest_x; int32_t src_x; diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c index 85e0e041c..0b318f069 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.c @@ -63,8 +63,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fi int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; const lv_opa_t * mask = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; - lv_coord_t dest_stride = dsc->dest_stride; + int32_t mask_stride = dsc->mask_stride; + int32_t dest_stride = dsc->dest_stride; int32_t x; int32_t y; @@ -227,11 +227,11 @@ LV_ATTRIBUTE_FAST_MEM static void rgb565_image_blend(_lv_draw_sw_blend_image_dsc int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; uint8_t * dest_buf_u8 = dsc->dest_buf; - lv_coord_t dest_stride = dsc->dest_stride * dest_px_size; + int32_t dest_stride = dsc->dest_stride * dest_px_size; const lv_color16_t * src_buf_c16 = (const lv_color16_t *) dsc->src_buf; - lv_coord_t src_stride = dsc->src_stride; + int32_t src_stride = dsc->src_stride; const lv_opa_t * mask_buf = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; + int32_t mask_stride = dsc->mask_stride; int32_t src_x; int32_t dest_x; @@ -316,11 +316,11 @@ LV_ATTRIBUTE_FAST_MEM static void rgb888_image_blend(_lv_draw_sw_blend_image_dsc int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; uint8_t * dest_buf = dsc->dest_buf; - lv_coord_t dest_stride = dsc->dest_stride * dest_px_size; + int32_t dest_stride = dsc->dest_stride * dest_px_size; const uint8_t * src_buf = dsc->src_buf; - lv_coord_t src_stride = dsc->src_stride * src_px_size; + int32_t src_stride = dsc->src_stride * src_px_size; const lv_opa_t * mask_buf = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; + int32_t mask_stride = dsc->mask_stride; int32_t dest_x; int32_t src_x; @@ -405,11 +405,11 @@ LV_ATTRIBUTE_FAST_MEM static void argb8888_image_blend(_lv_draw_sw_blend_image_d int32_t h = dsc->dest_h; lv_opa_t opa = dsc->opa; uint8_t * dest_buf = dsc->dest_buf; - lv_coord_t dest_stride = dsc->dest_stride * dest_px_size; + int32_t dest_stride = dsc->dest_stride * dest_px_size; const lv_color32_t * src_buf_c32 = dsc->src_buf; - lv_coord_t src_stride = dsc->src_stride; + int32_t src_stride = dsc->src_stride; const lv_opa_t * mask_buf = dsc->mask_buf; - lv_coord_t mask_stride = dsc->mask_stride; + int32_t mask_stride = dsc->mask_stride; int32_t dest_x; int32_t src_x; diff --git a/src/draw/sw/lv_draw_sw.h b/src/draw/sw/lv_draw_sw.h index 6c28988a9..97c31f6c2 100644 --- a/src/draw/sw/lv_draw_sw.h +++ b/src/draw/sw/lv_draw_sw.h @@ -77,7 +77,7 @@ void lv_draw_sw_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_ void lv_draw_sw_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_rect_dsc_t * dsc, const lv_area_t * coords); void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_area, const void * src_buf, - lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, + int32_t src_w, int32_t src_h, int32_t src_stride, const lv_draw_image_dsc_t * draw_dsc, const lv_draw_image_sup_t * sup, lv_color_format_t cf, void * dest_buf); /*********************** diff --git a/src/draw/sw/lv_draw_sw_arc.c b/src/draw/sw/lv_draw_sw_arc.c index 5a54d27c6..b201a3a53 100644 --- a/src/draw/sw/lv_draw_sw_arc.c +++ b/src/draw/sw/lv_draw_sw_arc.c @@ -18,8 +18,8 @@ static void add_circle(const lv_opa_t * circle_mask, const lv_area_t * blend_area, const lv_area_t * circle_area, - lv_opa_t * mask_buf, lv_coord_t width); -static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area); + lv_opa_t * mask_buf, int32_t width); +static void get_rounded_area(int16_t angle, int32_t radius, uint8_t thickness, lv_area_t * res_area); /********************* * DEFINES @@ -54,7 +54,7 @@ void lv_draw_sw_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * dsc, c if(dsc->width == 0) return; if(dsc->start_angle == dsc->end_angle) return; - lv_coord_t width = dsc->width; + int32_t width = dsc->width; if(width > dsc->radius) width = dsc->radius; lv_area_t area_out = *coords; @@ -108,9 +108,9 @@ void lv_draw_sw_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * dsc, c mask_in_param_valid = true; } - lv_coord_t blend_h = lv_area_get_height(&clipped_area); - lv_coord_t blend_w = lv_area_get_width(&clipped_area); - lv_coord_t h; + int32_t blend_h = lv_area_get_height(&clipped_area); + int32_t blend_w = lv_area_get_width(&clipped_area); + int32_t h; lv_opa_t * mask_buf = lv_malloc(blend_w); lv_area_t blend_area = clipped_area; @@ -130,7 +130,7 @@ void lv_draw_sw_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * dsc, c img_area.y1 = 0; img_area.x2 = decoder_dsc.header.w - 1; img_area.y2 = decoder_dsc.header.h - 1; - lv_coord_t ofs = decoder_dsc.header.w / 2; + int32_t ofs = decoder_dsc.header.w / 2; lv_area_move(&img_area, dsc->center.x - ofs, dsc->center.y - ofs); blend_dsc.src_area = &img_area; blend_dsc.src_buf = decoder_dsc.img_data; @@ -218,7 +218,7 @@ void lv_draw_sw_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * dsc, c **********************/ static void add_circle(const lv_opa_t * circle_mask, const lv_area_t * blend_area, const lv_area_t * circle_area, - lv_opa_t * mask_buf, lv_coord_t width) + lv_opa_t * mask_buf, int32_t width) { lv_area_t circle_common_area; if(_lv_area_intersect(&circle_common_area, circle_area, blend_area)) { @@ -237,7 +237,7 @@ static void add_circle(const lv_opa_t * circle_mask, const lv_area_t * blend_are } -static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area) +static void get_rounded_area(int16_t angle, int32_t radius, uint8_t thickness, lv_area_t * res_area) { int32_t thick_half = thickness / 2; uint8_t thick_corr = (thickness & 0x01) ? 0 : 1; diff --git a/src/draw/sw/lv_draw_sw_border.c b/src/draw/sw/lv_draw_sw_border.c index 02bdf3bfd..7a58ed958 100644 --- a/src/draw/sw/lv_draw_sw_border.c +++ b/src/draw/sw/lv_draw_sw_border.c @@ -31,7 +31,7 @@ * STATIC PROTOTYPES **********************/ static void draw_border_complex(lv_draw_unit_t * draw_unit, const lv_area_t * outer_area, const lv_area_t * inner_area, - lv_coord_t rout, lv_coord_t rin, lv_color_t color, lv_opa_t opa); + int32_t rout, int32_t rin, lv_color_t color, lv_opa_t opa); static void draw_border_simple(lv_draw_unit_t * draw_unit, const lv_area_t * outer_area, const lv_area_t * inner_area, lv_color_t color, lv_opa_t opa); @@ -69,7 +69,7 @@ void lv_draw_sw_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_t * area_inner.y1 += ((dsc->side & LV_BORDER_SIDE_TOP) ? dsc->width : - (dsc->width + rout)); area_inner.y2 -= ((dsc->side & LV_BORDER_SIDE_BOTTOM) ? dsc->width : - (dsc->width + rout)); - lv_coord_t rin = rout - dsc->width; + int32_t rin = rout - dsc->width; if(rin < 0) rin = 0; if(rout == 0 && rin == 0) { @@ -86,7 +86,7 @@ void lv_draw_sw_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_t * **********************/ void draw_border_complex(lv_draw_unit_t * draw_unit, const lv_area_t * outer_area, const lv_area_t * inner_area, - lv_coord_t rout, lv_coord_t rin, lv_color_t color, lv_opa_t opa) + int32_t rout, int32_t rin, lv_color_t color, lv_opa_t opa) { #if LV_DRAW_SW_COMPLEX /*Get clipped draw area which is the real draw area. @@ -129,7 +129,7 @@ void draw_border_complex(lv_draw_unit_t * draw_unit, const lv_area_t * outer_are core_area.x2 = LV_MIN(outer_area->x2 - rout, inner_area->x2); core_area.y1 = LV_MAX(outer_area->y1 + rout, inner_area->y1); core_area.y2 = LV_MIN(outer_area->y2 - rout, inner_area->y2); - lv_coord_t core_w = lv_area_get_width(&core_area); + int32_t core_w = lv_area_get_width(&core_area); bool top_side = outer_area->y1 <= inner_area->y1; bool bottom_side = outer_area->y2 >= inner_area->y2; @@ -190,17 +190,17 @@ void draw_border_complex(lv_draw_unit_t * draw_unit, const lv_area_t * outer_are } /*Draw the corners*/ - lv_coord_t blend_w; + int32_t blend_w; /*Left and right corner together if they are close to each other*/ if(!split_hor) { /*Calculate the top corner and mirror it to the bottom*/ blend_area.x1 = draw_area.x1; blend_area.x2 = draw_area.x2; - lv_coord_t max_h = LV_MAX(rout, inner_area->y1 - outer_area->y1); + int32_t max_h = LV_MAX(rout, inner_area->y1 - outer_area->y1); for(h = 0; h < max_h; h++) { - lv_coord_t top_y = outer_area->y1 + h; - lv_coord_t bottom_y = outer_area->y2 - h; + int32_t top_y = outer_area->y1 + h; + int32_t bottom_y = outer_area->y2 - h; if(top_y < draw_area.y1 && bottom_y > draw_area.y2) continue; /*This line is clipped now*/ lv_memset(mask_buf, 0xff, draw_area_w); diff --git a/src/draw/sw/lv_draw_sw_box_shadow.c b/src/draw/sw/lv_draw_sw_box_shadow.c index 690540bd3..505059e05 100644 --- a/src/draw/sw/lv_draw_sw_box_shadow.c +++ b/src/draw/sw/lv_draw_sw_box_shadow.c @@ -35,9 +35,9 @@ * STATIC PROTOTYPES **********************/ #if LV_DRAW_SW_COMPLEX -LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t s, - lv_coord_t r); -LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, uint16_t * sh_ups_buf); +LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, int32_t s, + int32_t r); +LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(int32_t size, int32_t sw, uint16_t * sh_ups_buf); #endif /*LV_DRAW_SW_COMPLEX*/ @@ -84,7 +84,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ /*Get the clamped radius*/ int32_t r_bg = dsc->radius; - lv_coord_t short_side = LV_MIN(lv_area_get_width(&bg_area), lv_area_get_height(&bg_area)); + int32_t short_side = LV_MIN(lv_area_get_width(&bg_area), lv_area_get_height(&bg_area)); if(r_bg > short_side >> 1) r_bg = short_side >> 1; /*Get the clamped radius*/ @@ -138,7 +138,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ lv_area_t blend_area; lv_area_t clip_area_sub; lv_opa_t * sh_buf_tmp; - lv_coord_t y; + int32_t y; bool simple_sub; lv_draw_sw_blend_dsc_t blend_dsc; @@ -149,8 +149,8 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_dsc.color = dsc->color; blend_dsc.opa = dsc->opa; - lv_coord_t w_half = shadow_area.x1 + lv_area_get_width(&shadow_area) / 2; - lv_coord_t h_half = shadow_area.y1 + lv_area_get_height(&shadow_area) / 2; + int32_t w_half = shadow_area.x1 + lv_area_get_width(&shadow_area) / 2; + int32_t h_half = shadow_area.y1 + lv_area_get_height(&shadow_area) / 2; /*Draw the corners if they are on the current clip area and not fully covered by the bg*/ @@ -165,7 +165,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { - lv_coord_t w = lv_area_get_width(&clip_area_sub); + int32_t w = lv_area_get_width(&clip_area_sub); sh_buf_tmp = sh_buf; sh_buf_tmp += (clip_area_sub.y1 - shadow_area.y1) * corner_size; sh_buf_tmp += clip_area_sub.x1 - (shadow_area.x2 - corner_size + 1); @@ -208,7 +208,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { - lv_coord_t w = lv_area_get_width(&clip_area_sub); + int32_t w = lv_area_get_width(&clip_area_sub); sh_buf_tmp = sh_buf; sh_buf_tmp += (blend_area.y2 - clip_area_sub.y2) * corner_size; sh_buf_tmp += clip_area_sub.x1 - (shadow_area.x2 - corner_size + 1); @@ -248,7 +248,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { - lv_coord_t w = lv_area_get_width(&clip_area_sub); + int32_t w = lv_area_get_width(&clip_area_sub); sh_buf_tmp = sh_buf; sh_buf_tmp += (clip_area_sub.y1 - blend_area.y1) * corner_size; @@ -296,7 +296,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { - lv_coord_t w = lv_area_get_width(&clip_area_sub); + int32_t w = lv_area_get_width(&clip_area_sub); sh_buf_tmp = sh_buf; sh_buf_tmp += (blend_area.y2 - clip_area_sub.y2) * corner_size; if(w > 0) { @@ -351,7 +351,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { - lv_coord_t w = lv_area_get_width(&clip_area_sub); + int32_t w = lv_area_get_width(&clip_area_sub); sh_buf_tmp = sh_buf; sh_buf_tmp += (corner_size - 1) * corner_size; sh_buf_tmp += clip_area_sub.x1 - (shadow_area.x2 - corner_size + 1); @@ -408,7 +408,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { - lv_coord_t w = lv_area_get_width(&clip_area_sub); + int32_t w = lv_area_get_width(&clip_area_sub); sh_buf_tmp = sh_buf; sh_buf_tmp += (corner_size - 1) * corner_size; sh_buf_tmp += clip_area_sub.x1 - blend_area.x1; @@ -447,7 +447,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { - lv_coord_t w = lv_area_get_width(&clip_area_sub); + int32_t w = lv_area_get_width(&clip_area_sub); sh_buf_tmp = sh_buf; sh_buf_tmp += (clip_area_sub.y1 - blend_area.y1) * corner_size; sh_buf_tmp += clip_area_sub.x1 - blend_area.x1; @@ -492,7 +492,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { - lv_coord_t w = lv_area_get_width(&clip_area_sub); + int32_t w = lv_area_get_width(&clip_area_sub); sh_buf_tmp = sh_buf; sh_buf_tmp += (blend_area.y2 - clip_area_sub.y2) * corner_size; sh_buf_tmp += clip_area_sub.x1 - blend_area.x1; @@ -532,7 +532,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { - lv_coord_t w = lv_area_get_width(&clip_area_sub); + int32_t w = lv_area_get_width(&clip_area_sub); if(w > 0) { blend_area.x1 = clip_area_sub.x1; blend_area.x2 = clip_area_sub.x2; @@ -568,8 +568,8 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ * @param sw shadow width * @param r radius */ -LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, lv_coord_t sw, - lv_coord_t r) +LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coords, uint16_t * sh_buf, int32_t sw, + int32_t r) { int32_t sw_ori = sw; int32_t size = sw_ori + r; @@ -655,7 +655,7 @@ LV_ATTRIBUTE_FAST_MEM static void shadow_draw_corner_buf(const lv_area_t * coord } -LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(lv_coord_t size, lv_coord_t sw, uint16_t * sh_ups_buf) +LV_ATTRIBUTE_FAST_MEM static void shadow_blur_corner(int32_t size, int32_t sw, uint16_t * sh_ups_buf) { int32_t s_left = sw >> 1; int32_t s_right = (sw >> 1); diff --git a/src/draw/sw/lv_draw_sw_fill.c b/src/draw/sw/lv_draw_sw_fill.c index 9d2f0e5e9..01aac052d 100644 --- a/src/draw/sw/lv_draw_sw_fill.c +++ b/src/draw/sw/lv_draw_sw_fill.c @@ -73,8 +73,8 @@ void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc, lv_opa_t opa = dsc->opa >= LV_OPA_MAX ? LV_OPA_COVER : dsc->opa; /*Get the real radius. Can't be larger than the half of the shortest side */ - lv_coord_t coords_bg_w = lv_area_get_width(&bg_coords); - lv_coord_t coords_bg_h = lv_area_get_height(&bg_coords); + int32_t coords_bg_w = lv_area_get_width(&bg_coords); + int32_t coords_bg_h = lv_area_get_height(&bg_coords); int32_t short_side = LV_MIN(coords_bg_w, coords_bg_h); int32_t rout = LV_MIN(dsc->radius, short_side >> 1); @@ -123,8 +123,8 @@ void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc, /* Draw the top of the rectangle line by line and mirror it to the bottom. */ for(h = 0; h < rout; h++) { - lv_coord_t top_y = bg_coords.y1 + h; - lv_coord_t bottom_y = bg_coords.y2 - h; + int32_t top_y = bg_coords.y1 + h; + int32_t bottom_y = bg_coords.y2 - h; if(top_y < clipped_coords.y1 && bottom_y > clipped_coords.y2) continue; /*This line is clipped now*/ /* Initialize the mask to opa instead of 0xFF and blend with LV_OPA_COVER. @@ -143,7 +143,7 @@ void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc, } else if(grad_dir == LV_GRAD_DIR_HOR) { if(grad_opa_map) { - lv_coord_t i; + int32_t i; for(i = 0; i < clipped_w; i++) { if(grad_opa_map[i] < LV_OPA_MAX) mask_buf[i] = (mask_buf[i] * grad_opa_map[i]) >> 8; } diff --git a/src/draw/sw/lv_draw_sw_gradient.c b/src/draw/sw/lv_draw_sw_gradient.c index 5f440fd59..665158f53 100644 --- a/src/draw/sw/lv_draw_sw_gradient.c +++ b/src/draw/sw/lv_draw_sw_gradient.c @@ -30,7 +30,7 @@ * STATIC PROTOTYPES **********************/ typedef lv_result_t (*op_cache_t)(lv_grad_t * c, void * ctx); -static lv_grad_t * allocate_item(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord_t h); +static lv_grad_t * allocate_item(const lv_grad_dsc_t * g, int32_t w, int32_t h); /********************** * STATIC VARIABLE @@ -40,9 +40,9 @@ static lv_grad_t * allocate_item(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord * STATIC FUNCTIONS **********************/ -static lv_grad_t * allocate_item(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord_t h) +static lv_grad_t * allocate_item(const lv_grad_dsc_t * g, int32_t w, int32_t h) { - lv_coord_t size = g->dir == LV_GRAD_DIR_HOR ? w : h; + int32_t size = g->dir == LV_GRAD_DIR_HOR ? w : h; size_t req_size = ALIGN(sizeof(lv_grad_t)) + ALIGN(size * sizeof(lv_color_t)) + ALIGN(size * sizeof(lv_opa_t)); lv_grad_t * item = lv_malloc(req_size); @@ -61,7 +61,7 @@ static lv_grad_t * allocate_item(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord * FUNCTIONS **********************/ -lv_grad_t * lv_gradient_get(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord_t h) +lv_grad_t * lv_gradient_get(const lv_grad_dsc_t * g, int32_t w, int32_t h) { /* No gradient, no cache */ if(g->dir == LV_GRAD_DIR_NONE) return NULL; @@ -81,8 +81,8 @@ lv_grad_t * lv_gradient_get(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord_t h) return item; } -LV_ATTRIBUTE_FAST_MEM void lv_gradient_color_calculate(const lv_grad_dsc_t * dsc, lv_coord_t range, - lv_coord_t frac, lv_grad_color_t * color_out, lv_opa_t * opa_out) +LV_ATTRIBUTE_FAST_MEM void lv_gradient_color_calculate(const lv_grad_dsc_t * dsc, int32_t range, + int32_t frac, lv_grad_color_t * color_out, lv_opa_t * opa_out) { lv_grad_color_t tmp; /*Clip out-of-bounds first*/ diff --git a/src/draw/sw/lv_draw_sw_gradient.h b/src/draw/sw/lv_draw_sw_gradient.h index 486aa72f5..af7ea3718 100644 --- a/src/draw/sw/lv_draw_sw_gradient.h +++ b/src/draw/sw/lv_draw_sw_gradient.h @@ -47,12 +47,12 @@ typedef struct _lv_gradient_cache_t { * @param frac The current part used in the range. frac is in [0; range] */ -LV_ATTRIBUTE_FAST_MEM void lv_gradient_color_calculate(const lv_grad_dsc_t * dsc, lv_coord_t range, - lv_coord_t frac, lv_grad_color_t * color_out, lv_opa_t * opa_out); +LV_ATTRIBUTE_FAST_MEM void lv_gradient_color_calculate(const lv_grad_dsc_t * dsc, int32_t range, + int32_t frac, lv_grad_color_t * color_out, lv_opa_t * opa_out); /** Get a gradient cache from the given parameters */ -lv_grad_t * lv_gradient_get(const lv_grad_dsc_t * gradient, lv_coord_t w, lv_coord_t h); +lv_grad_t * lv_gradient_get(const lv_grad_dsc_t * gradient, int32_t w, int32_t h); /** * Clean up the gradient item after it was get with `lv_grad_get_from_cache`. diff --git a/src/draw/sw/lv_draw_sw_img.c b/src/draw/sw/lv_draw_sw_img.c index 36aee15e0..48a270e87 100644 --- a/src/draw/sw/lv_draw_sw_img.c +++ b/src/draw/sw/lv_draw_sw_img.c @@ -253,8 +253,8 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t lv_draw_sw_blend(draw_unit, &blend_dsc); } else if(!transformed && cf == LV_COLOR_FORMAT_RGB565A8 && draw_dsc->recolor_opa == LV_OPA_TRANSP) { - lv_coord_t src_h = lv_area_get_height(img_coords); - lv_coord_t src_w = lv_area_get_width(img_coords); + int32_t src_h = lv_area_get_height(img_coords); + int32_t src_w = lv_area_get_width(img_coords); blend_dsc.src_area = img_coords; blend_dsc.src_buf = src_buf; blend_dsc.mask_buf = (lv_opa_t *)src_buf; @@ -279,10 +279,10 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t lv_area_t blend_area = *draw_area; blend_dsc.blend_area = &blend_area; - lv_coord_t src_w = lv_area_get_width(img_coords); - lv_coord_t src_h = lv_area_get_height(img_coords); - lv_coord_t blend_w = lv_area_get_width(&blend_area); - lv_coord_t blend_h = lv_area_get_height(&blend_area); + int32_t src_w = lv_area_get_width(img_coords); + int32_t src_h = lv_area_get_height(img_coords); + int32_t blend_w = lv_area_get_width(&blend_area); + int32_t blend_h = lv_area_get_height(&blend_area); lv_color_format_t cf_final = cf; if(transformed) { @@ -291,7 +291,7 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t } uint8_t * tmp_buf; uint32_t px_size = lv_color_format_get_size(cf_final); - lv_coord_t buf_h; + int32_t buf_h; if(cf_final == LV_COLOR_FORMAT_RGB565A8) { uint32_t buf_stride = lv_draw_buf_width_to_stride(blend_w, LV_COLOR_FORMAT_RGB565); buf_stride += blend_w; /*For the A8 part which is not stride aligned*/ @@ -309,7 +309,7 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t uint8_t * tmp_buf_aligned = lv_draw_buf_align(tmp_buf, cf_final); blend_dsc.src_buf = tmp_buf_aligned; blend_dsc.src_color_format = cf_final; - lv_coord_t y_last = blend_area.y2; + int32_t y_last = blend_area.y2; blend_area.y2 = blend_area.y1 + buf_h - 1; blend_dsc.src_area = &blend_area; @@ -346,7 +346,7 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t draw_dsc, sup, cf, tmp_buf_aligned); } else if(draw_dsc->recolor_opa >= LV_OPA_MIN) { - lv_coord_t h = lv_area_get_height(&relative_area); + int32_t h = lv_area_get_height(&relative_area); if(cf_final == LV_COLOR_FORMAT_RGB565A8) { uint32_t stride_px = img_stride / 2; const uint8_t * rgb_src_buf = src_buf + stride_px * 2 * relative_area.y1 + relative_area.x1 * 2; @@ -354,7 +354,7 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t relative_area.x1; uint8_t * rgb_dest_buf = tmp_buf_aligned; uint8_t * a_dest_buf = (uint8_t *)blend_dsc.mask_buf; - lv_coord_t i; + int32_t i; for(i = 0; i < h; i++) { lv_memcpy(rgb_dest_buf, rgb_src_buf, blend_w * 2); lv_memcpy(a_dest_buf, a_src_buf, blend_w); @@ -367,7 +367,7 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t else if(cf_final != LV_COLOR_FORMAT_A8) { const uint8_t * src_buf_tmp = src_buf + img_stride * relative_area.y1 + relative_area.x1 * px_size; uint8_t * dest_buf_tmp = tmp_buf_aligned; - lv_coord_t i; + int32_t i; for(i = 0; i < h; i++) { lv_memcpy(dest_buf_tmp, src_buf_tmp, blend_w * px_size); dest_buf_tmp += blend_w * px_size; @@ -387,8 +387,8 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t c_mult[1] = (color.green >> 2) * mix; c_mult[2] = (color.red >> 3) * mix; uint16_t * buf16 = (uint16_t *)tmp_buf_aligned; - lv_coord_t i; - lv_coord_t size = lv_draw_buf_width_to_stride(blend_w, LV_COLOR_FORMAT_RGB565) / 2 * lv_area_get_height(&blend_area); + int32_t i; + int32_t size = lv_draw_buf_width_to_stride(blend_w, LV_COLOR_FORMAT_RGB565) / 2 * lv_area_get_height(&blend_area); for(i = 0; i < size; i++) { buf16[i] = (((c_mult[2] + ((buf16[i] >> 11) & 0x1F) * mix_inv) << 3) & 0xF800) + (((c_mult[1] + ((buf16[i] >> 5) & 0x3F) * mix_inv) >> 3) & 0x07E0) + diff --git a/src/draw/sw/lv_draw_sw_line.c b/src/draw/sw/lv_draw_sw_line.c index e510f506a..076a97b8e 100644 --- a/src/draw/sw/lv_draw_sw_line.c +++ b/src/draw/sw/lv_draw_sw_line.c @@ -136,10 +136,10 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(lv_draw_unit_t * draw_unit, cons int32_t blend_area_w = lv_area_get_width(&blend_area); - lv_coord_t y2 = blend_area.y2; + int32_t y2 = blend_area.y2; blend_area.y2 = blend_area.y1; - lv_coord_t dash_start = blend_area.x1 % (dsc->dash_gap + dsc->dash_width); + int32_t dash_start = blend_area.x1 % (dsc->dash_gap + dsc->dash_width); lv_opa_t * mask_buf = lv_malloc(blend_area_w); blend_dsc.mask_buf = mask_buf; @@ -149,8 +149,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(lv_draw_unit_t * draw_unit, cons for(h = blend_area.y1; h <= y2; h++) { lv_memset(mask_buf, 0xff, blend_area_w); - lv_coord_t dash_cnt = dash_start; - lv_coord_t i; + int32_t dash_cnt = dash_start; + int32_t i; for(i = 0; i < blend_area_w; i++, dash_cnt++) { if(dash_cnt <= dsc->dash_width) { int16_t diff = dsc->dash_width - dash_cnt; @@ -211,16 +211,16 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(lv_draw_unit_t * draw_unit, cons else { int32_t draw_area_w = lv_area_get_width(&blend_area); - lv_coord_t y2 = blend_area.y2; + int32_t y2 = blend_area.y2; blend_area.y2 = blend_area.y1; lv_opa_t * mask_buf = lv_malloc(draw_area_w); blend_dsc.mask_buf = mask_buf; blend_dsc.mask_area = &blend_area; blend_dsc.mask_res = LV_DRAW_SW_MASK_RES_CHANGED; - lv_coord_t dash_start = (blend_area.y1) % (dsc->dash_gap + dsc->dash_width); + int32_t dash_start = (blend_area.y1) % (dsc->dash_gap + dsc->dash_width); - lv_coord_t dash_cnt = dash_start; + int32_t dash_cnt = dash_start; int32_t h; for(h = blend_area.y1; h <= y2; h++) { @@ -353,7 +353,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_skew(lv_draw_unit_t * draw_unit, con size_t mask_buf_size = LV_MIN(lv_area_get_size(&blend_area), hor_res); lv_opa_t * mask_buf = lv_malloc(mask_buf_size); - lv_coord_t y2 = blend_area.y2; + int32_t y2 = blend_area.y2; blend_area.y2 = blend_area.y1; uint32_t mask_p = 0; diff --git a/src/draw/sw/lv_draw_sw_mask.c b/src/draw/sw/lv_draw_sw_mask.c index b7715c614..8af24e418 100644 --- a/src/draw/sw/lv_draw_sw_mask.c +++ b/src/draw/sw/lv_draw_sw_mask.c @@ -32,37 +32,37 @@ /********************** * STATIC PROTOTYPES **********************/ -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, int32_t len, lv_draw_sw_mask_line_param_t * param); -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, int32_t len, lv_draw_sw_mask_radius_param_t * param); -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, int32_t len, lv_draw_sw_mask_angle_param_t * param); -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, int32_t len, lv_draw_sw_mask_fade_param_t * param); -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, int32_t len, lv_draw_sw_mask_map_param_t * param); -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, - lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, + int32_t len, lv_draw_sw_mask_line_param_t * p); -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, - lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, + int32_t len, lv_draw_sw_mask_line_param_t * p); -static void circ_init(lv_point_t * c, lv_coord_t * tmp, lv_coord_t radius); +static void circ_init(lv_point_t * c, int32_t * tmp, int32_t radius); static bool circ_cont(lv_point_t * c); -static void circ_next(lv_point_t * c, lv_coord_t * tmp); -static void circ_calc_aa4(_lv_draw_sw_mask_radius_circle_dsc_t * c, lv_coord_t radius); -static lv_opa_t * get_next_line(_lv_draw_sw_mask_radius_circle_dsc_t * c, lv_coord_t y, lv_coord_t * len, - lv_coord_t * x_start); +static void circ_next(lv_point_t * c, int32_t * tmp); +static void circ_calc_aa4(_lv_draw_sw_mask_radius_circle_dsc_t * c, int32_t radius); +static lv_opa_t * get_next_line(_lv_draw_sw_mask_radius_circle_dsc_t * c, int32_t y, int32_t * len, + int32_t * x_start); LV_ATTRIBUTE_FAST_MEM static inline lv_opa_t mask_mix(lv_opa_t mask_act, lv_opa_t mask_new); /********************** @@ -83,9 +83,9 @@ void lv_draw_sw_mask_init(void) } -LV_ATTRIBUTE_FAST_MEM lv_draw_sw_mask_res_t lv_draw_sw_mask_apply(void * masks[], lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, - lv_coord_t len) +LV_ATTRIBUTE_FAST_MEM lv_draw_sw_mask_res_t lv_draw_sw_mask_apply(void * masks[], lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, + int32_t len) { bool changed = false; _lv_draw_sw_mask_common_dsc_t * dsc; @@ -151,9 +151,9 @@ void _lv_draw_sw_mask_cleanup(void) * With `LV_DRAW_SW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept * With `LV_DRAW_SW_MASK_LINE_SIDE_TOP/BOTTOM` and vertical line all pixels are kept */ -void lv_draw_sw_mask_line_points_init(lv_draw_sw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t p1y, - lv_coord_t p2x, - lv_coord_t p2y, lv_draw_sw_mask_line_side_t side) +void lv_draw_sw_mask_line_points_init(lv_draw_sw_mask_line_param_t * param, int32_t p1x, int32_t p1y, + int32_t p2x, + int32_t p2y, lv_draw_sw_mask_line_side_t side) { lv_memzero(param, sizeof(lv_draw_sw_mask_line_param_t)); @@ -163,7 +163,7 @@ void lv_draw_sw_mask_line_points_init(lv_draw_sw_mask_line_param_t * param, lv_c } if(p1y > p2y) { - lv_coord_t t; + int32_t t; t = p2x; p2x = p1x; p1x = t; @@ -246,7 +246,7 @@ void lv_draw_sw_mask_line_points_init(lv_draw_sw_mask_line_param_t * param, lv_c * With `LV_DRAW_SW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept * With `LV_DRAW_SW_MASK_LINE_SIDE_TOP/BOTTOM` and vertical line all pixels are kept */ -void lv_draw_sw_mask_line_angle_init(lv_draw_sw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t py, int16_t angle, +void lv_draw_sw_mask_line_angle_init(lv_draw_sw_mask_line_param_t * param, int32_t p1x, int32_t py, int16_t angle, lv_draw_sw_mask_line_side_t side) { /*Find an optimal degree. @@ -272,8 +272,8 @@ void lv_draw_sw_mask_line_angle_init(lv_draw_sw_mask_line_param_t * param, lv_co * @param start_angle start angle in degrees. 0 deg on the right, 90 deg, on the bottom * @param end_angle end angle */ -void lv_draw_sw_mask_angle_init(lv_draw_sw_mask_angle_param_t * param, lv_coord_t vertex_x, lv_coord_t vertex_y, - lv_coord_t start_angle, lv_coord_t end_angle) +void lv_draw_sw_mask_angle_init(lv_draw_sw_mask_angle_param_t * param, int32_t vertex_x, int32_t vertex_y, + int32_t start_angle, int32_t end_angle) { lv_draw_sw_mask_line_side_t start_side; lv_draw_sw_mask_line_side_t end_side; @@ -333,11 +333,11 @@ void lv_draw_sw_mask_angle_init(lv_draw_sw_mask_angle_param_t * param, lv_coord_ * @param radius radius of the rectangle * @param inv true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle */ -void lv_draw_sw_mask_radius_init(lv_draw_sw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, +void lv_draw_sw_mask_radius_init(lv_draw_sw_mask_radius_param_t * param, const lv_area_t * rect, int32_t radius, bool inv) { - lv_coord_t w = lv_area_get_width(rect); - lv_coord_t h = lv_area_get_height(rect); + int32_t w = lv_area_get_width(rect); + int32_t h = lv_area_get_height(rect); int32_t short_side = LV_MIN(w, h); if(radius > short_side >> 1) radius = short_side >> 1; if(radius < 0) radius = 0; @@ -407,8 +407,8 @@ void lv_draw_sw_mask_radius_init(lv_draw_sw_mask_radius_param_t * param, const l * @param y_bottom at which coordinate reach `opa_bottom`. */ void lv_draw_sw_mask_fade_init(lv_draw_sw_mask_fade_param_t * param, const lv_area_t * coords, lv_opa_t opa_top, - lv_coord_t y_top, - lv_opa_t opa_bottom, lv_coord_t y_bottom) + int32_t y_top, + lv_opa_t opa_bottom, int32_t y_bottom) { lv_area_copy(¶m->cfg.coords, coords); param->cfg.opa_top = opa_top; @@ -437,8 +437,8 @@ void lv_draw_sw_mask_map_init(lv_draw_sw_mask_map_param_t * param, const lv_area * STATIC FUNCTIONS **********************/ -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_line(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, int32_t len, lv_draw_sw_mask_line_param_t * p) { /*Make to points relative to the vertex*/ @@ -497,9 +497,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_line(lv_opa_t * return res; } -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, - lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t line_mask_flat(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, + int32_t len, lv_draw_sw_mask_line_param_t * p) { @@ -614,9 +614,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t line_mask_flat(lv_opa_t * mas return LV_DRAW_SW_MASK_RES_CHANGED; } -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, - lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t line_mask_steep(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, + int32_t len, lv_draw_sw_mask_line_param_t * p) { int32_t k; @@ -757,8 +757,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t line_mask_steep(lv_opa_t * ma return LV_DRAW_SW_MASK_RES_CHANGED; } -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_angle(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, int32_t len, lv_draw_sw_mask_angle_param_t * p) { int32_t rel_y = abs_y - p->cfg.vertex_p.y; @@ -897,8 +897,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_angle(lv_opa_t * -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_radius(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, int32_t len, lv_draw_sw_mask_radius_param_t * p) { bool outer = p->cfg.outer; @@ -955,9 +955,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_radius(lv_opa_t abs_x -= rect.x1; abs_y -= rect.y1; - lv_coord_t aa_len; - lv_coord_t x_start; - lv_coord_t cir_y; + int32_t aa_len; + int32_t x_start; + int32_t cir_y; if(abs_y < radius) { cir_y = radius - abs_y - 1; } @@ -965,9 +965,9 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_radius(lv_opa_t cir_y = abs_y - (h - radius); } lv_opa_t * aa_opa = get_next_line(p->circle, cir_y, &aa_len, &x_start); - lv_coord_t cir_x_right = k + w - radius + x_start; - lv_coord_t cir_x_left = k + radius - x_start - 1; - lv_coord_t i; + int32_t cir_x_right = k + w - radius + x_start; + int32_t cir_x_left = k + radius - x_start - 1; + int32_t i; if(outer == false) { for(i = 0; i < aa_len; i++) { @@ -999,16 +999,16 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_radius(lv_opa_t } } - lv_coord_t clr_start = LV_CLAMP(0, cir_x_left + 1, len); - lv_coord_t clr_len = LV_CLAMP(0, cir_x_right - clr_start, len - clr_start); + int32_t clr_start = LV_CLAMP(0, cir_x_left + 1, len); + int32_t clr_len = LV_CLAMP(0, cir_x_right - clr_start, len - clr_start); lv_memzero(&mask_buf[clr_start], clr_len); } return LV_DRAW_SW_MASK_RES_CHANGED; } -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_fade(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, int32_t len, lv_draw_sw_mask_fade_param_t * p) { if(abs_y < p->cfg.coords.y1) return LV_DRAW_SW_MASK_RES_FULL_COVER; @@ -1053,8 +1053,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_fade(lv_opa_t * } } -LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t len, +LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_map(lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, int32_t len, lv_draw_sw_mask_map_param_t * p) { /*Handle out of the mask cases*/ @@ -1093,7 +1093,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_sw_mask_res_t lv_draw_mask_map(lv_opa_t * m * @param tmp point to a variable. It will store temporary data * @param radius radius of the circle */ -static void circ_init(lv_point_t * c, lv_coord_t * tmp, lv_coord_t radius) +static void circ_init(lv_point_t * c, int32_t * tmp, int32_t radius) { c->x = radius; c->y = 0; @@ -1115,7 +1115,7 @@ static bool circ_cont(lv_point_t * c) * @param c same as in circ_init. The next point stored here. * @param tmp same as in circ_init. */ -static void circ_next(lv_point_t * c, lv_coord_t * tmp) +static void circ_next(lv_point_t * c, int32_t * tmp) { if(*tmp <= 0) { @@ -1128,7 +1128,7 @@ static void circ_next(lv_point_t * c, lv_coord_t * tmp) c->y++; } -static void circ_calc_aa4(_lv_draw_sw_mask_radius_circle_dsc_t * c, lv_coord_t radius) +static void circ_calc_aa4(_lv_draw_sw_mask_radius_circle_dsc_t * c, int32_t radius) { if(radius == 0) return; c->radius = radius; @@ -1151,20 +1151,20 @@ static void circ_calc_aa4(_lv_draw_sw_mask_radius_circle_dsc_t * c, lv_coord_t r return; } - const size_t cir_xy_size = (radius + 1) * 2 * 2 * sizeof(lv_coord_t); - lv_coord_t * cir_x = lv_malloc(cir_xy_size); + const size_t cir_xy_size = (radius + 1) * 2 * 2 * sizeof(int32_t); + int32_t * cir_x = lv_malloc(cir_xy_size); lv_memset(cir_x, 0, cir_xy_size); - lv_coord_t * cir_y = &cir_x[(radius + 1) * 2]; + int32_t * cir_y = &cir_x[(radius + 1) * 2]; uint32_t y_8th_cnt = 0; lv_point_t cp; - lv_coord_t tmp; + int32_t tmp; circ_init(&cp, &tmp, radius * 4); /*Upscale by 4*/ int32_t i; uint32_t x_int[4]; uint32_t x_fract[4]; - lv_coord_t cir_size = 0; + int32_t cir_size = 0; x_int[0] = cp.x >> 2; x_fract[0] = 0; @@ -1263,7 +1263,7 @@ static void circ_calc_aa4(_lv_draw_sw_mask_radius_circle_dsc_t * c, lv_coord_t r c->cir_opa[cir_size] = c->cir_opa[i]; } - lv_coord_t y = 0; + int32_t y = 0; i = 0; c->opa_start_on_y[0] = 0; while(i < cir_size) { @@ -1278,8 +1278,8 @@ static void circ_calc_aa4(_lv_draw_sw_mask_radius_circle_dsc_t * c, lv_coord_t r lv_free(cir_x); } -static lv_opa_t * get_next_line(_lv_draw_sw_mask_radius_circle_dsc_t * c, lv_coord_t y, lv_coord_t * len, - lv_coord_t * x_start) +static lv_opa_t * get_next_line(_lv_draw_sw_mask_radius_circle_dsc_t * c, int32_t y, int32_t * len, + int32_t * x_start) { *len = c->opa_start_on_y[y + 1] - c->opa_start_on_y[y]; *x_start = c->x_start_on_y[y]; diff --git a/src/draw/sw/lv_draw_sw_mask.h b/src/draw/sw/lv_draw_sw_mask.h index 60d8b1639..9588108ea 100644 --- a/src/draw/sw/lv_draw_sw_mask.h +++ b/src/draw/sw/lv_draw_sw_mask.h @@ -65,8 +65,8 @@ enum { * A common callback type for every mask type. * Used internally by the library. */ -typedef lv_draw_sw_mask_res_t (*lv_draw_sw_mask_xcb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, - lv_coord_t len, +typedef lv_draw_sw_mask_res_t (*lv_draw_sw_mask_xcb_t)(lv_opa_t * mask_buf, int32_t abs_x, int32_t abs_y, + int32_t len, void * p); typedef uint8_t lv_draw_sw_mask_line_side_t; @@ -120,8 +120,8 @@ typedef struct { struct { lv_point_t vertex_p; - lv_coord_t start_angle; - lv_coord_t end_angle; + int32_t start_angle; + int32_t end_angle; } cfg; lv_draw_sw_mask_line_param_t start_line; @@ -136,7 +136,7 @@ typedef struct { uint16_t * opa_start_on_y; /*The index of `cir_opa` for each y value*/ int32_t life; /*How many times the entry way used*/ uint32_t used_cnt; /*Like a semaphore to count the referencing masks*/ - lv_coord_t radius; /*The radius of the entry*/ + int32_t radius; /*The radius of the entry*/ } _lv_draw_sw_mask_radius_circle_dsc_t; typedef _lv_draw_sw_mask_radius_circle_dsc_t _lv_draw_sw_mask_radius_circle_dsc_arr_t[LV_DRAW_SW_CIRCLE_CACHE_SIZE]; @@ -147,7 +147,7 @@ typedef struct { struct { lv_area_t rect; - lv_coord_t radius; + int32_t radius; /*Invert the mask. 0: Keep the pixels inside.*/ uint8_t outer: 1; } cfg; @@ -162,8 +162,8 @@ typedef struct { struct { lv_area_t coords; - lv_coord_t y_top; - lv_coord_t y_bottom; + int32_t y_top; + int32_t y_bottom; lv_opa_t opa_top; lv_opa_t opa_bottom; } cfg; @@ -202,9 +202,9 @@ void lv_draw_sw_mask_init(void); * - `LV_DRAW_MASK_RES_FULL_COVER`: the whole line is fully visible. `mask_buf` is unchanged * - `LV_DRAW_MASK_RES_CHANGED`: `mask_buf` has changed, it shows the desired opacity of each pixel in the given line */ -LV_ATTRIBUTE_FAST_MEM lv_draw_sw_mask_res_t lv_draw_sw_mask_apply(void * masks[], lv_opa_t * mask_buf, lv_coord_t abs_x, - lv_coord_t abs_y, - lv_coord_t len); +LV_ATTRIBUTE_FAST_MEM lv_draw_sw_mask_res_t lv_draw_sw_mask_apply(void * masks[], lv_opa_t * mask_buf, int32_t abs_x, + int32_t abs_y, + int32_t len); //! @endcond @@ -234,9 +234,9 @@ void _lv_draw_sw_mask_cleanup(void); * With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept * With `LV_DRAW_MASK_LINE_SIDE_TOP/BOTTOM` and vertical line all pixels are kept */ -void lv_draw_sw_mask_line_points_init(lv_draw_sw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t p1y, - lv_coord_t p2x, - lv_coord_t p2y, lv_draw_sw_mask_line_side_t side); +void lv_draw_sw_mask_line_points_init(lv_draw_sw_mask_line_param_t * param, int32_t p1x, int32_t p1y, + int32_t p2x, + int32_t p2y, lv_draw_sw_mask_line_side_t side); /** *Initialize a line mask from a point and an angle. @@ -248,7 +248,7 @@ void lv_draw_sw_mask_line_points_init(lv_draw_sw_mask_line_param_t * param, lv_c * With `LV_DRAW_MASK_LINE_SIDE_LEFT/RIGHT` and horizontal line all pixels are kept * With `LV_DRAW_MASK_LINE_SIDE_TOP/BOTTOM` and vertical line all pixels are kept */ -void lv_draw_sw_mask_line_angle_init(lv_draw_sw_mask_line_param_t * param, lv_coord_t p1x, lv_coord_t py, int16_t angle, +void lv_draw_sw_mask_line_angle_init(lv_draw_sw_mask_line_param_t * param, int32_t p1x, int32_t py, int16_t angle, lv_draw_sw_mask_line_side_t side); /** @@ -259,8 +259,8 @@ void lv_draw_sw_mask_line_angle_init(lv_draw_sw_mask_line_param_t * param, lv_co * @param start_angle start angle in degrees. 0 deg on the right, 90 deg, on the bottom * @param end_angle end angle */ -void lv_draw_sw_mask_angle_init(lv_draw_sw_mask_angle_param_t * param, lv_coord_t vertex_x, lv_coord_t vertex_y, - lv_coord_t start_angle, lv_coord_t end_angle); +void lv_draw_sw_mask_angle_init(lv_draw_sw_mask_angle_param_t * param, int32_t vertex_x, int32_t vertex_y, + int32_t start_angle, int32_t end_angle); /** * Initialize a fade mask. @@ -269,7 +269,7 @@ void lv_draw_sw_mask_angle_init(lv_draw_sw_mask_angle_param_t * param, lv_coord_ * @param radius radius of the rectangle * @param inv true: keep the pixels inside the rectangle; keep the pixels outside of the rectangle */ -void lv_draw_sw_mask_radius_init(lv_draw_sw_mask_radius_param_t * param, const lv_area_t * rect, lv_coord_t radius, +void lv_draw_sw_mask_radius_init(lv_draw_sw_mask_radius_param_t * param, const lv_area_t * rect, int32_t radius, bool inv); /** @@ -282,8 +282,8 @@ void lv_draw_sw_mask_radius_init(lv_draw_sw_mask_radius_param_t * param, const l * @param y_bottom at which coordinate reach `opa_bottom`. */ void lv_draw_sw_mask_fade_init(lv_draw_sw_mask_fade_param_t * param, const lv_area_t * coords, lv_opa_t opa_top, - lv_coord_t y_top, - lv_opa_t opa_bottom, lv_coord_t y_bottom); + int32_t y_top, + lv_opa_t opa_bottom, int32_t y_bottom); /** * Initialize a map mask. diff --git a/src/draw/sw/lv_draw_sw_mask_rect.c b/src/draw/sw/lv_draw_sw_mask_rect.c index 14fb081c3..38b9b39c1 100644 --- a/src/draw/sw/lv_draw_sw_mask_rect.c +++ b/src/draw/sw/lv_draw_sw_mask_rect.c @@ -59,7 +59,7 @@ void lv_draw_sw_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_rect_ds uint32_t area_w = lv_area_get_width(&draw_area); lv_opa_t * mask_buf = lv_malloc(area_w); - lv_coord_t y; + int32_t y; for(y = draw_area.y1; y <= draw_area.y2; y++) { lv_memset(mask_buf, 0xff, area_w); lv_draw_sw_mask_res_t res = lv_draw_sw_mask_apply(masks, mask_buf, draw_area.x1, y, area_w); diff --git a/src/draw/sw/lv_draw_sw_transform.c b/src/draw/sw/lv_draw_sw_transform.c index c3ad2b08a..f38894522 100644 --- a/src/draw/sw/lv_draw_sw_transform.c +++ b/src/draw/sw/lv_draw_sw_transform.c @@ -50,20 +50,20 @@ typedef struct { static void transform_point_upscaled(point_transform_dsc_t * t, int32_t xin, int32_t yin, int32_t * xout, int32_t * yout); -static void transform_rgb888(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, +static void transform_rgb888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, int32_t x_end, uint8_t * dest_buf, bool aa, uint32_t px_size); -static void transform_argb8888(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, +static void transform_argb8888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, int32_t x_end, uint8_t * dest_buf, bool aa); -static void transform_rgb565a8(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, +static void transform_rgb565a8(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, int32_t x_end, uint16_t * cbuf, uint8_t * abuf, bool src_has_a8, bool aa); -static void transform_a8(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, +static void transform_a8(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, int32_t x_end, uint8_t * abuf, bool aa); @@ -80,7 +80,7 @@ static void transform_a8(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h **********************/ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_area, const void * src_buf, - lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, + int32_t src_w, int32_t src_h, int32_t src_stride, const lv_draw_image_dsc_t * draw_dsc, const lv_draw_image_sup_t * sup, lv_color_format_t src_cf, void * dest_buf) { LV_UNUSED(draw_unit); @@ -110,12 +110,12 @@ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_are tr_dsc.pivot_y_256 = tr_dsc.pivot.y * 256; - lv_coord_t dest_w = lv_area_get_width(dest_area); - lv_coord_t dest_h = lv_area_get_height(dest_area); + int32_t dest_w = lv_area_get_width(dest_area); + int32_t dest_h = lv_area_get_height(dest_area); - lv_coord_t dest_stride_a8 = dest_w; - lv_coord_t dest_stride; - lv_coord_t src_stride_px; + int32_t dest_stride_a8 = dest_w; + int32_t dest_stride; + int32_t src_stride_px; if(src_cf == LV_COLOR_FORMAT_RGB888) { dest_stride = lv_draw_buf_width_to_stride(dest_w, LV_COLOR_FORMAT_ARGB8888); src_stride_px = src_stride / lv_color_format_get_size(LV_COLOR_FORMAT_RGB888); @@ -140,7 +140,7 @@ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_are bool aa = draw_dsc->antialias; - lv_coord_t y; + int32_t y; for(y = 0; y < dest_h; y++) { int32_t xs1_ups, ys1_ups, xs2_ups, ys2_ups; @@ -197,7 +197,7 @@ void lv_draw_sw_transform(lv_draw_unit_t * draw_unit, const lv_area_t * dest_are * STATIC FUNCTIONS **********************/ -static void transform_rgb888(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, +static void transform_rgb888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, int32_t x_end, uint8_t * dest_buf, bool aa, uint32_t px_size) { @@ -205,7 +205,7 @@ static void transform_rgb888(const uint8_t * src, lv_coord_t src_w, lv_coord_t s int32_t ys_ups_start = ys_ups; lv_color32_t * dest_c32 = (lv_color32_t *) dest_buf; - lv_coord_t x; + int32_t x; for(x = 0; x < x_end; x++) { xs_ups = xs_ups_start + ((xs_step * x) >> 8); ys_ups = ys_ups_start + ((ys_step * x) >> 8); @@ -298,7 +298,7 @@ static void transform_rgb888(const uint8_t * src, lv_coord_t src_w, lv_coord_t s #include "../../stdlib/lv_string.h" -static void transform_argb8888(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, +static void transform_argb8888(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, int32_t x_end, uint8_t * dest_buf, bool aa) { @@ -307,7 +307,7 @@ static void transform_argb8888(const uint8_t * src, lv_coord_t src_w, lv_coord_t int32_t ys_ups_start = ys_ups; lv_color32_t * dest_c32 = (lv_color32_t *) dest_buf; - lv_coord_t x; + int32_t x; for(x = 0; x < x_end; x++) { xs_ups = xs_ups_start + ((xs_step * x) >> 8); ys_ups = ys_ups_start + ((ys_step * x) >> 8); @@ -392,7 +392,7 @@ static void transform_argb8888(const uint8_t * src, lv_coord_t src_w, lv_coord_t } } -static void transform_rgb565a8(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, +static void transform_rgb565a8(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, int32_t x_end, uint16_t * cbuf, uint8_t * abuf, bool src_has_a8, bool aa) { @@ -402,7 +402,7 @@ static void transform_rgb565a8(const uint8_t * src, lv_coord_t src_w, lv_coord_t const uint16_t * src_rgb = (const uint16_t *)src; const lv_opa_t * src_alpha = src + src_stride * src_h * 2; - lv_coord_t x; + int32_t x; for(x = 0; x < x_end; x++) { xs_ups = xs_ups_start + ((xs_step * x) >> 8); ys_ups = ys_ups_start + ((ys_step * x) >> 8); @@ -503,14 +503,14 @@ static void transform_rgb565a8(const uint8_t * src, lv_coord_t src_w, lv_coord_t } } -static void transform_a8(const uint8_t * src, lv_coord_t src_w, lv_coord_t src_h, lv_coord_t src_stride, +static void transform_a8(const uint8_t * src, int32_t src_w, int32_t src_h, int32_t src_stride, int32_t xs_ups, int32_t ys_ups, int32_t xs_step, int32_t ys_step, int32_t x_end, uint8_t * abuf, bool aa) { int32_t xs_ups_start = xs_ups; int32_t ys_ups_start = ys_ups; - lv_coord_t x; + int32_t x; for(x = 0; x < x_end; x++) { xs_ups = xs_ups_start + ((xs_step * x) >> 8); ys_ups = ys_ups_start + ((ys_step * x) >> 8); diff --git a/src/draw/sw/lv_draw_sw_triangle.c b/src/draw/sw/lv_draw_sw_triangle.c index 574ce9d73..315f8a472 100644 --- a/src/draw/sw/lv_draw_sw_triangle.c +++ b/src/draw/sw/lv_draw_sw_triangle.c @@ -113,7 +113,7 @@ void lv_draw_sw_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_ masks[0] = &mask_left; masks[1] = &mask_right; masks[2] = &mask_bottom; - lv_coord_t area_w = lv_area_get_width(&draw_area); + int32_t area_w = lv_area_get_width(&draw_area); lv_opa_t * mask_buf = lv_malloc(area_w); lv_area_t blend_area = draw_area; @@ -151,7 +151,7 @@ void lv_draw_sw_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_ } else if(grad_dir == LV_GRAD_DIR_HOR) { if(grad_opa_map) { - lv_coord_t i; + int32_t i; if(blend_dsc.mask_res == LV_DRAW_SW_MASK_RES_CHANGED) { blend_dsc.mask_buf = mask_buf; for(i = 0; i < area_w; i++) { diff --git a/src/font/lv_font.h b/src/font/lv_font.h index c10c6400d..dc1585e12 100644 --- a/src/font/lv_font.h +++ b/src/font/lv_font.h @@ -85,8 +85,8 @@ typedef struct _lv_font_t { const uint8_t * (*get_glyph_bitmap)(const struct _lv_font_t *, uint32_t, uint8_t *); /*Pointer to the font in a font pack (must have the same line height)*/ - lv_coord_t line_height; /**< The real line height where any text fits*/ - lv_coord_t base_line; /**< Base line measured from the top of the line_height*/ + int32_t line_height; /**< The real line height where any text fits*/ + int32_t base_line; /**< Base line measured from the top of the line_height*/ uint8_t subpx : 2; /**< An element of `lv_font_subpx_t`*/ uint8_t kerning : 1; /**< An element of `lv_font_kerning_t`*/ @@ -136,7 +136,7 @@ uint16_t lv_font_get_glyph_width(const lv_font_t * font, uint32_t letter, uint32 * @param font pointer to a font * @return the height of a font */ -static inline lv_coord_t lv_font_get_line_height(const lv_font_t * font) +static inline int32_t lv_font_get_line_height(const lv_font_t * font) { return font->line_height; } diff --git a/src/font/lv_font_fmt_txt.c b/src/font/lv_font_fmt_txt.c index f3ff53499..b4a81f390 100644 --- a/src/font/lv_font_fmt_txt.c +++ b/src/font/lv_font_fmt_txt.c @@ -36,8 +36,8 @@ static int32_t kern_pair_8_compare(const void * ref, const void * element); static int32_t kern_pair_16_compare(const void * ref, const void * element); #if LV_USE_FONT_COMPRESSED - static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord_t h, uint8_t bpp, bool prefilter); - static inline void decompress_line(uint8_t * out, lv_coord_t w); + static void decompress(const uint8_t * in, uint8_t * out, int32_t w, int32_t h, uint8_t bpp, bool prefilter); + static inline void decompress_line(uint8_t * out, int32_t w); static inline uint8_t get_bits(const uint8_t * in, uint32_t bit_pos, uint8_t len); static inline void rle_init(const uint8_t * in, uint8_t bpp); static inline uint8_t rle_next(void); @@ -354,7 +354,7 @@ static int32_t kern_pair_16_compare(const void * ref, const void * element) * @param bpp bit per pixel (bpp = 3 will be converted to bpp = 4) * @param prefilter true: the lines are XORed */ -static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord_t h, uint8_t bpp, bool prefilter) +static void decompress(const uint8_t * in, uint8_t * out, int32_t w, int32_t h, uint8_t bpp, bool prefilter) { const lv_opa_t * opa_table; switch(bpp) { @@ -384,8 +384,8 @@ static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord decompress_line(line_buf1, w); - lv_coord_t y; - lv_coord_t x; + int32_t y; + int32_t x; uint32_t stride = lv_draw_buf_width_to_stride(w, LV_COLOR_FORMAT_A8); for(x = 0; x < w; x++) { @@ -421,9 +421,9 @@ static void decompress(const uint8_t * in, uint8_t * out, lv_coord_t w, lv_coord * @param out output buffer * @param w width of the line in pixel count */ -static inline void decompress_line(uint8_t * out, lv_coord_t w) +static inline void decompress_line(uint8_t * out, int32_t w) { - lv_coord_t i; + int32_t i; for(i = 0; i < w; i++) { out[i] = rle_next(); } diff --git a/src/indev/lv_indev.c b/src/indev/lv_indev.c index 808a0130f..3b3923dcb 100644 --- a/src/indev/lv_indev.c +++ b/src/indev/lv_indev.c @@ -476,7 +476,7 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point) /*If the point is on this object check its children too*/ lv_area_t obj_coords = obj->coords; if(lv_obj_has_flag(obj, LV_OBJ_FLAG_OVERFLOW_VISIBLE)) { - lv_coord_t ext_draw_size = _lv_obj_get_ext_draw_size(obj); + int32_t ext_draw_size = _lv_obj_get_ext_draw_size(obj); lv_area_increase(&obj_coords, ext_draw_size, ext_draw_size); } if(_lv_area_is_point_on(&obj_coords, &p_trans, 0)) { @@ -518,7 +518,7 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data) data->point.y = disp->ver_res - data->point.y - 1; } if(disp->rotation == LV_DISPLAY_ROTATION_90 || disp->rotation == LV_DISPLAY_ROTATION_270) { - lv_coord_t tmp = data->point.y; + int32_t tmp = data->point.y; data->point.y = data->point.x; data->point.x = disp->ver_res - tmp - 1; } @@ -944,8 +944,8 @@ static void indev_button_proc(lv_indev_t * i, lv_indev_data_t * data) return; } - lv_coord_t x = i->btn_points[data->btn_id].x; - lv_coord_t y = i->btn_points[data->btn_id].y; + int32_t x = i->btn_points[data->btn_id].x; + int32_t y = i->btn_points[data->btn_id].y; if(LV_INDEV_STATE_RELEASED != data->state) { if(data->state == LV_INDEV_STATE_PRESSED) { diff --git a/src/indev/lv_indev_scroll.c b/src/indev/lv_indev_scroll.c index f564e0e22..b645565fa 100644 --- a/src/indev/lv_indev_scroll.c +++ b/src/indev/lv_indev_scroll.c @@ -24,13 +24,13 @@ **********************/ static lv_obj_t * find_scroll_obj(lv_indev_t * indev); static void init_scroll_limits(lv_indev_t * indev); -static lv_coord_t find_snap_point_x(const lv_obj_t * obj, lv_coord_t min, lv_coord_t max, lv_coord_t ofs); -static lv_coord_t find_snap_point_y(const lv_obj_t * obj, lv_coord_t min, lv_coord_t max, lv_coord_t ofs); -static void scroll_limit_diff(lv_indev_t * indev, lv_coord_t * diff_x, lv_coord_t * diff_y); -static lv_coord_t scroll_throw_predict_y(lv_indev_t * indev); -static lv_coord_t scroll_throw_predict_x(lv_indev_t * indev); -static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_t scroll_start, lv_coord_t scroll_end, - lv_dir_t dir); +static int32_t find_snap_point_x(const lv_obj_t * obj, int32_t min, int32_t max, int32_t ofs); +static int32_t find_snap_point_y(const lv_obj_t * obj, int32_t min, int32_t max, int32_t ofs); +static void scroll_limit_diff(lv_indev_t * indev, int32_t * diff_x, int32_t * diff_y); +static int32_t scroll_throw_predict_y(lv_indev_t * indev); +static int32_t scroll_throw_predict_x(lv_indev_t * indev); +static int32_t elastic_diff(lv_obj_t * scroll_obj, int32_t diff, int32_t scroll_start, int32_t scroll_end, + lv_dir_t dir); /********************** * STATIC VARIABLES @@ -85,16 +85,16 @@ void _lv_indev_scroll_handler(lv_indev_t * indev) } - lv_coord_t diff_x = 0; - lv_coord_t diff_y = 0; + int32_t diff_x = 0; + int32_t diff_y = 0; if(indev->pointer.scroll_dir == LV_DIR_HOR) { - lv_coord_t sr = lv_obj_get_scroll_right(scroll_obj); - lv_coord_t sl = lv_obj_get_scroll_left(scroll_obj); + int32_t sr = lv_obj_get_scroll_right(scroll_obj); + int32_t sl = lv_obj_get_scroll_left(scroll_obj); diff_x = elastic_diff(scroll_obj, indev->pointer.vect.x, sl, sr, LV_DIR_HOR); } else { - lv_coord_t st = lv_obj_get_scroll_top(scroll_obj); - lv_coord_t sb = lv_obj_get_scroll_bottom(scroll_obj); + int32_t st = lv_obj_get_scroll_top(scroll_obj); + int32_t sb = lv_obj_get_scroll_bottom(scroll_obj); diff_y = elastic_diff(scroll_obj, indev->pointer.vect.y, st, sb, LV_DIR_VER); } @@ -121,7 +121,7 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev) if(indev->pointer.scroll_dir == LV_DIR_NONE) return; lv_indev_t * indev_act = lv_indev_active(); - lv_coord_t scroll_throw = indev_act->scroll_throw; + int32_t scroll_throw = indev_act->scroll_throw; if(lv_obj_has_flag(scroll_obj, LV_OBJ_FLAG_SCROLL_MOMENTUM) == false) { indev->pointer.scroll_throw_vect.y = 0; @@ -138,8 +138,8 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev) indev->pointer.scroll_throw_vect.y = indev->pointer.scroll_throw_vect.y * (100 - scroll_throw) / 100; - lv_coord_t sb = lv_obj_get_scroll_bottom(scroll_obj); - lv_coord_t st = lv_obj_get_scroll_top(scroll_obj); + int32_t sb = lv_obj_get_scroll_bottom(scroll_obj); + int32_t st = lv_obj_get_scroll_top(scroll_obj); indev->pointer.scroll_throw_vect.y = elastic_diff(scroll_obj, indev->pointer.scroll_throw_vect.y, st, sb, LV_DIR_VER); @@ -149,10 +149,10 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev) } /*With snapping find the nearest snap point and scroll there*/ else { - lv_coord_t diff_y = scroll_throw_predict_y(indev); + int32_t diff_y = scroll_throw_predict_y(indev); indev->pointer.scroll_throw_vect.y = 0; scroll_limit_diff(indev, NULL, &diff_y); - lv_coord_t y = find_snap_point_y(scroll_obj, LV_COORD_MIN, LV_COORD_MAX, diff_y); + int32_t y = find_snap_point_y(scroll_obj, LV_COORD_MIN, LV_COORD_MAX, diff_y); lv_obj_scroll_by(scroll_obj, 0, diff_y + y, LV_ANIM_ON); if(indev->reset_query) return; } @@ -164,8 +164,8 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev) indev->pointer.scroll_throw_vect.x = indev->pointer.scroll_throw_vect.x * (100 - scroll_throw) / 100; - lv_coord_t sl = lv_obj_get_scroll_left(scroll_obj); - lv_coord_t sr = lv_obj_get_scroll_right(scroll_obj); + int32_t sl = lv_obj_get_scroll_left(scroll_obj); + int32_t sr = lv_obj_get_scroll_right(scroll_obj); indev->pointer.scroll_throw_vect.x = elastic_diff(scroll_obj, indev->pointer.scroll_throw_vect.x, sl, sr, LV_DIR_HOR); @@ -175,10 +175,10 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev) } /*With snapping find the nearest snap point and scroll there*/ else { - lv_coord_t diff_x = scroll_throw_predict_x(indev); + int32_t diff_x = scroll_throw_predict_x(indev); indev->pointer.scroll_throw_vect.x = 0; scroll_limit_diff(indev, &diff_x, NULL); - lv_coord_t x = find_snap_point_x(scroll_obj, LV_COORD_MIN, LV_COORD_MAX, diff_x); + int32_t x = find_snap_point_x(scroll_obj, LV_COORD_MIN, LV_COORD_MAX, diff_x); lv_obj_scroll_by(scroll_obj, x + diff_x, 0, LV_ANIM_ON); if(indev->reset_query) return; } @@ -189,8 +189,8 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev) /*Revert if scrolled in*/ /*If vertically scrollable and not controlled by snap*/ if(align_y == LV_SCROLL_SNAP_NONE) { - lv_coord_t st = lv_obj_get_scroll_top(scroll_obj); - lv_coord_t sb = lv_obj_get_scroll_bottom(scroll_obj); + int32_t st = lv_obj_get_scroll_top(scroll_obj); + int32_t sb = lv_obj_get_scroll_bottom(scroll_obj); if(st > 0 || sb > 0) { if(st < 0) { lv_obj_scroll_by(scroll_obj, 0, st, LV_ANIM_ON); @@ -205,8 +205,8 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev) /*If horizontally scrollable and not controlled by snap*/ if(align_x == LV_SCROLL_SNAP_NONE) { - lv_coord_t sl = lv_obj_get_scroll_left(scroll_obj); - lv_coord_t sr = lv_obj_get_scroll_right(scroll_obj); + int32_t sl = lv_obj_get_scroll_left(scroll_obj); + int32_t sr = lv_obj_get_scroll_right(scroll_obj); if(sl > 0 || sr > 0) { if(sl < 0) { lv_obj_scroll_by(scroll_obj, sl, 0, LV_ANIM_ON); @@ -233,10 +233,10 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev) * @param dir `LV_DIR_VER` or `LV_DIR_HOR` * @return the difference compared to the current position when the throw would be finished */ -lv_coord_t lv_indev_scroll_throw_predict(lv_indev_t * indev, lv_dir_t dir) +int32_t lv_indev_scroll_throw_predict(lv_indev_t * indev, lv_dir_t dir) { if(indev == NULL) return 0; - lv_coord_t v; + int32_t v; switch(dir) { case LV_DIR_VER: v = indev->pointer.scroll_throw_vect_ori.y; @@ -248,8 +248,8 @@ lv_coord_t lv_indev_scroll_throw_predict(lv_indev_t * indev, lv_dir_t dir) return 0; } - lv_coord_t scroll_throw = indev->scroll_throw; - lv_coord_t sum = 0; + int32_t scroll_throw = indev->scroll_throw; + int32_t sum = 0; while(v) { sum += v; v = v * (100 - scroll_throw) / 100; @@ -273,7 +273,7 @@ static lv_obj_t * find_scroll_obj(lv_indev_t * indev) lv_obj_t * obj_candidate = NULL; lv_dir_t dir_candidate = LV_DIR_NONE; lv_indev_t * indev_act = lv_indev_active(); - lv_coord_t scroll_limit = indev_act->scroll_limit; + int32_t scroll_limit = indev_act->scroll_limit; /*Go until find a scrollable object in the current direction *More precisely: @@ -344,10 +344,10 @@ static lv_obj_t * find_scroll_obj(lv_indev_t * indev) if((scroll_dir & LV_DIR_BOTTOM) == 0) down_en = false; /*The object is scrollable to a direction if its content overflow in that direction.*/ - lv_coord_t st = lv_obj_get_scroll_top(obj_act); - lv_coord_t sb = lv_obj_get_scroll_bottom(obj_act); - lv_coord_t sl = lv_obj_get_scroll_left(obj_act); - lv_coord_t sr = lv_obj_get_scroll_right(obj_act); + int32_t st = lv_obj_get_scroll_top(obj_act); + int32_t sb = lv_obj_get_scroll_bottom(obj_act); + int32_t sl = lv_obj_get_scroll_left(obj_act); + int32_t sr = lv_obj_get_scroll_right(obj_act); /*If this object is scrollable into the current scroll direction then save it as a candidate. *It's important only to be scrollable on the current axis (hor/ver) because if the scroll @@ -419,7 +419,7 @@ static void init_scroll_limits(lv_indev_t * indev) indev->pointer.scroll_area.y2 = find_snap_point_y(obj, LV_COORD_MIN, obj->coords.y2, 0); break; case LV_SCROLL_SNAP_CENTER: { - lv_coord_t y_mid = obj->coords.y1 + lv_area_get_height(&obj->coords) / 2; + int32_t y_mid = obj->coords.y1 + lv_area_get_height(&obj->coords) / 2; indev->pointer.scroll_area.y1 = find_snap_point_y(obj, y_mid + 1, LV_COORD_MAX, 0); indev->pointer.scroll_area.y2 = find_snap_point_y(obj, LV_COORD_MIN, y_mid - 1, 0); break; @@ -440,7 +440,7 @@ static void init_scroll_limits(lv_indev_t * indev) indev->pointer.scroll_area.x2 = find_snap_point_x(obj, LV_COORD_MIN, obj->coords.x2, 0); break; case LV_SCROLL_SNAP_CENTER: { - lv_coord_t x_mid = obj->coords.x1 + lv_area_get_width(&obj->coords) / 2; + int32_t x_mid = obj->coords.x1 + lv_area_get_width(&obj->coords) / 2; indev->pointer.scroll_area.x1 = find_snap_point_x(obj, x_mid + 1, LV_COORD_MAX, 0); indev->pointer.scroll_area.x2 = find_snap_point_x(obj, LV_COORD_MIN, x_mid - 1, 0); break; @@ -468,15 +468,15 @@ static void init_scroll_limits(lv_indev_t * indev) * what if children are already moved by this value * @return the distance of the snap point. */ -static lv_coord_t find_snap_point_x(const lv_obj_t * obj, lv_coord_t min, lv_coord_t max, lv_coord_t ofs) +static int32_t find_snap_point_x(const lv_obj_t * obj, int32_t min, int32_t max, int32_t ofs) { lv_scroll_snap_t align = lv_obj_get_scroll_snap_x(obj); if(align == LV_SCROLL_SNAP_NONE) return 0; - lv_coord_t dist = LV_COORD_MAX; + int32_t dist = LV_COORD_MAX; - lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + int32_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); uint32_t i; uint32_t child_cnt = lv_obj_get_child_cnt(obj); @@ -484,8 +484,8 @@ static lv_coord_t find_snap_point_x(const lv_obj_t * obj, lv_coord_t min, lv_coo lv_obj_t * child = obj->spec_attr->children[i]; if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue; if(lv_obj_has_flag(child, LV_OBJ_FLAG_SNAPPABLE)) { - lv_coord_t x_child = 0; - lv_coord_t x_parent = 0; + int32_t x_child = 0; + int32_t x_parent = 0; switch(align) { case LV_SCROLL_SNAP_START: x_child = child->coords.x1; @@ -505,7 +505,7 @@ static lv_coord_t find_snap_point_x(const lv_obj_t * obj, lv_coord_t min, lv_coo x_child += ofs; if(x_child >= min && x_child <= max) { - lv_coord_t x = x_child - x_parent; + int32_t x = x_child - x_parent; if(LV_ABS(x) < LV_ABS(dist)) dist = x; } } @@ -523,15 +523,15 @@ static lv_coord_t find_snap_point_x(const lv_obj_t * obj, lv_coord_t min, lv_coo * what if children are already moved by this value * @return the distance of the snap point. */ -static lv_coord_t find_snap_point_y(const lv_obj_t * obj, lv_coord_t min, lv_coord_t max, lv_coord_t ofs) +static int32_t find_snap_point_y(const lv_obj_t * obj, int32_t min, int32_t max, int32_t ofs) { lv_scroll_snap_t align = lv_obj_get_scroll_snap_y(obj); if(align == LV_SCROLL_SNAP_NONE) return 0; - lv_coord_t dist = LV_COORD_MAX; + int32_t dist = LV_COORD_MAX; - lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + int32_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); uint32_t i; uint32_t child_cnt = lv_obj_get_child_cnt(obj); @@ -539,8 +539,8 @@ static lv_coord_t find_snap_point_y(const lv_obj_t * obj, lv_coord_t min, lv_coo lv_obj_t * child = obj->spec_attr->children[i]; if(lv_obj_has_flag_any(child, LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) continue; if(lv_obj_has_flag(child, LV_OBJ_FLAG_SNAPPABLE)) { - lv_coord_t y_child = 0; - lv_coord_t y_parent = 0; + int32_t y_child = 0; + int32_t y_parent = 0; switch(align) { case LV_SCROLL_SNAP_START: y_child = child->coords.y1; @@ -560,7 +560,7 @@ static lv_coord_t find_snap_point_y(const lv_obj_t * obj, lv_coord_t min, lv_coo y_child += ofs; if(y_child >= min && y_child <= max) { - lv_coord_t y = y_child - y_parent; + int32_t y = y_child - y_parent; if(LV_ABS(y) < LV_ABS(dist)) dist = y; } } @@ -569,7 +569,7 @@ static lv_coord_t find_snap_point_y(const lv_obj_t * obj, lv_coord_t min, lv_coo return dist == LV_COORD_MAX ? 0 : -dist; } -static void scroll_limit_diff(lv_indev_t * indev, lv_coord_t * diff_x, lv_coord_t * diff_y) +static void scroll_limit_diff(lv_indev_t * indev, int32_t * diff_x, int32_t * diff_y) { if(diff_y) { if(indev->pointer.scroll_sum.y + *diff_y < indev->pointer.scroll_area.y1) { @@ -594,13 +594,13 @@ static void scroll_limit_diff(lv_indev_t * indev, lv_coord_t * diff_x, lv_coord_ -static lv_coord_t scroll_throw_predict_y(lv_indev_t * indev) +static int32_t scroll_throw_predict_y(lv_indev_t * indev) { - lv_coord_t y = indev->pointer.scroll_throw_vect.y; - lv_coord_t move = 0; + int32_t y = indev->pointer.scroll_throw_vect.y; + int32_t move = 0; lv_indev_t * indev_act = lv_indev_active(); - lv_coord_t scroll_throw = indev_act->scroll_throw; + int32_t scroll_throw = indev_act->scroll_throw; while(y) { move += y; @@ -610,13 +610,13 @@ static lv_coord_t scroll_throw_predict_y(lv_indev_t * indev) } -static lv_coord_t scroll_throw_predict_x(lv_indev_t * indev) +static int32_t scroll_throw_predict_x(lv_indev_t * indev) { - lv_coord_t x = indev->pointer.scroll_throw_vect.x; - lv_coord_t move = 0; + int32_t x = indev->pointer.scroll_throw_vect.x; + int32_t move = 0; lv_indev_t * indev_act = lv_indev_active(); - lv_coord_t scroll_throw = indev_act->scroll_throw; + int32_t scroll_throw = indev_act->scroll_throw; while(x) { move += x; @@ -625,8 +625,8 @@ static lv_coord_t scroll_throw_predict_x(lv_indev_t * indev) return move; } -static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_t scroll_start, lv_coord_t scroll_end, - lv_dir_t dir) +static int32_t elastic_diff(lv_obj_t * scroll_obj, int32_t diff, int32_t scroll_start, int32_t scroll_end, + lv_dir_t dir) { if(lv_obj_has_flag(scroll_obj, LV_OBJ_FLAG_SCROLL_ELASTIC)) { /*If there is snapping in the current direction don't use the elastic factor because @@ -635,12 +635,12 @@ static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_ snap = dir == LV_DIR_HOR ? lv_obj_get_scroll_snap_x(scroll_obj) : lv_obj_get_scroll_snap_y(scroll_obj); lv_obj_t * act_obj = lv_indev_get_active_obj(); - lv_coord_t snap_point = 0; - lv_coord_t act_obj_point = 0; + int32_t snap_point = 0; + int32_t act_obj_point = 0; if(dir == LV_DIR_HOR) { - lv_coord_t pad_left = lv_obj_get_style_pad_left(scroll_obj, LV_PART_MAIN); - lv_coord_t pad_right = lv_obj_get_style_pad_right(scroll_obj, LV_PART_MAIN); + int32_t pad_left = lv_obj_get_style_pad_left(scroll_obj, LV_PART_MAIN); + int32_t pad_right = lv_obj_get_style_pad_right(scroll_obj, LV_PART_MAIN); switch(snap) { case LV_SCROLL_SNAP_CENTER: @@ -658,8 +658,8 @@ static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_ } } else { - lv_coord_t pad_top = lv_obj_get_style_pad_top(scroll_obj, LV_PART_MAIN); - lv_coord_t pad_bottom = lv_obj_get_style_pad_bottom(scroll_obj, LV_PART_MAIN); + int32_t pad_top = lv_obj_get_style_pad_top(scroll_obj, LV_PART_MAIN); + int32_t pad_bottom = lv_obj_get_style_pad_bottom(scroll_obj, LV_PART_MAIN); switch(snap) { case LV_SCROLL_SNAP_CENTER: diff --git a/src/indev/lv_indev_scroll.h b/src/indev/lv_indev_scroll.h index 4e933f613..64d1d018b 100644 --- a/src/indev/lv_indev_scroll.h +++ b/src/indev/lv_indev_scroll.h @@ -45,7 +45,7 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev); * @param dir ` LV_DIR_VER` or `LV_DIR_HOR` * @return the difference compared to the current position when the throw would be finished */ -lv_coord_t lv_indev_scroll_throw_predict(lv_indev_t * indev, lv_dir_t dir); +int32_t lv_indev_scroll_throw_predict(lv_indev_t * indev, lv_dir_t dir); /** * Get the distance of the nearest snap point diff --git a/src/layouts/flex/lv_flex.c b/src/layouts/flex/lv_flex.c index daaf8ba24..35754759e 100644 --- a/src/layouts/flex/lv_flex.c +++ b/src/layouts/flex/lv_flex.c @@ -32,17 +32,17 @@ typedef struct { typedef struct { lv_obj_t * item; - lv_coord_t min_size; - lv_coord_t max_size; - lv_coord_t final_size; + int32_t min_size; + int32_t max_size; + int32_t final_size; uint32_t grow_value; uint32_t clamped : 1; } grow_dsc_t; typedef struct { - lv_coord_t track_cross_size; - lv_coord_t track_main_size; /*For all items*/ - lv_coord_t track_fix_main_size; /*For non grow items*/ + int32_t track_cross_size; + int32_t track_main_size; /*For all items*/ + int32_t track_fix_main_size; /*For non grow items*/ uint32_t item_cnt; grow_dsc_t * grow_dsc; uint32_t grow_item_cnt; @@ -58,15 +58,15 @@ typedef struct { * STATIC PROTOTYPES **********************/ static void flex_update(lv_obj_t * cont, void * user_data); -static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id, lv_coord_t max_main_size, - lv_coord_t item_gap, track_t * t); -static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, int32_t item_last_id, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t max_main_size, lv_coord_t item_gap, track_t * t); -static void place_content(lv_flex_align_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt, - lv_coord_t * start_pos, lv_coord_t * gap); +static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id, int32_t max_main_size, + int32_t item_gap, track_t * t); +static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, int32_t item_last_id, int32_t abs_x, + int32_t abs_y, int32_t max_main_size, int32_t item_gap, track_t * t); +static void place_content(lv_flex_align_t place, int32_t max_size, int32_t content_size, int32_t item_cnt, + int32_t * start_pos, int32_t * gap); static lv_obj_t * get_next_item(lv_obj_t * cont, bool rev, int32_t * item_id); -static lv_coord_t lv_obj_get_width_with_margin(const lv_obj_t * obj); -static lv_coord_t lv_obj_get_height_with_margin(const lv_obj_t * obj); +static int32_t lv_obj_get_width_with_margin(const lv_obj_t * obj); +static int32_t lv_obj_get_height_with_margin(const lv_obj_t * obj); /********************** * GLOBAL VARIABLES @@ -140,21 +140,21 @@ static void flex_update(lv_obj_t * cont, void * user_data) f.track_place = lv_obj_get_style_flex_track_place(cont, LV_PART_MAIN); bool rtl = lv_obj_get_style_base_dir(cont, LV_PART_MAIN) == LV_BASE_DIR_RTL; - lv_coord_t track_gap = !f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont, - LV_PART_MAIN); - lv_coord_t item_gap = f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont, - LV_PART_MAIN); - lv_coord_t max_main_size = (f.row ? lv_obj_get_content_width(cont) : lv_obj_get_content_height(cont)); - lv_coord_t abs_y = cont->coords.y1 + lv_obj_get_style_space_top(cont, - LV_PART_MAIN) - lv_obj_get_scroll_y(cont); - lv_coord_t abs_x = cont->coords.x1 + lv_obj_get_style_space_left(cont, - LV_PART_MAIN) - lv_obj_get_scroll_x(cont); + int32_t track_gap = !f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont, + LV_PART_MAIN); + int32_t item_gap = f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont, + LV_PART_MAIN); + int32_t max_main_size = (f.row ? lv_obj_get_content_width(cont) : lv_obj_get_content_height(cont)); + int32_t abs_y = cont->coords.y1 + lv_obj_get_style_space_top(cont, + LV_PART_MAIN) - lv_obj_get_scroll_y(cont); + int32_t abs_x = cont->coords.x1 + lv_obj_get_style_space_left(cont, + LV_PART_MAIN) - lv_obj_get_scroll_x(cont); lv_flex_align_t track_cross_place = f.track_place; - lv_coord_t * cross_pos = (f.row ? &abs_y : &abs_x); + int32_t * cross_pos = (f.row ? &abs_y : &abs_x); - lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); - lv_coord_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); + int32_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); + int32_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); /*Content sized objects should squeeze the gap between the children, therefore any alignment will look like `START`*/ if((f.row && h_set == LV_SIZE_CONTENT && cont->h_layout == 0) || @@ -167,8 +167,8 @@ static void flex_update(lv_obj_t * cont, void * user_data) else if(track_cross_place == LV_FLEX_ALIGN_END) track_cross_place = LV_FLEX_ALIGN_START; } - lv_coord_t total_track_cross_size = 0; - lv_coord_t gap = 0; + int32_t total_track_cross_size = 0; + int32_t gap = 0; uint32_t track_cnt = 0; int32_t track_first_item; int32_t next_track_first_item; @@ -188,7 +188,7 @@ static void flex_update(lv_obj_t * cont, void * user_data) if(track_cnt) total_track_cross_size -= track_gap; /*No gap after the last track*/ /*Place the tracks to get the start position*/ - lv_coord_t max_cross_size = (f.row ? lv_obj_get_content_height(cont) : lv_obj_get_content_width(cont)); + int32_t max_cross_size = (f.row ? lv_obj_get_content_height(cont) : lv_obj_get_content_width(cont)); place_content(track_cross_place, max_cross_size, total_track_cross_size, track_cnt, cross_pos, &gap); } @@ -232,19 +232,19 @@ static void flex_update(lv_obj_t * cont, void * user_data) /** * Find the last item of a track */ -static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id, lv_coord_t max_main_size, - lv_coord_t item_gap, track_t * t) +static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id, int32_t max_main_size, + int32_t item_gap, track_t * t) { - lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); - lv_coord_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); + int32_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); + int32_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); /*Can't wrap if the size is auto (i.e. the size depends on the children)*/ if(f->wrap && ((f->row && w_set == LV_SIZE_CONTENT) || (!f->row && h_set == LV_SIZE_CONTENT))) { f->wrap = false; } - lv_coord_t(*get_main_size)(const lv_obj_t *) = (f->row ? lv_obj_get_width_with_margin : lv_obj_get_height_with_margin); - lv_coord_t(*get_cross_size)(const lv_obj_t *) = (!f->row ? lv_obj_get_width_with_margin : - lv_obj_get_height_with_margin); + int32_t(*get_main_size)(const lv_obj_t *) = (f->row ? lv_obj_get_width_with_margin : lv_obj_get_height_with_margin); + int32_t(*get_cross_size)(const lv_obj_t *) = (!f->row ? lv_obj_get_width_with_margin : + lv_obj_get_height_with_margin); t->track_main_size = 0; t->track_fix_main_size = 0; @@ -280,7 +280,7 @@ static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id } } else { - lv_coord_t item_size = get_main_size(item); + int32_t item_size = get_main_size(item); if(f->wrap && t->track_fix_main_size + item_size > max_main_size) break; t->track_fix_main_size += item_size + item_gap; } @@ -317,14 +317,14 @@ static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id /** * Position the children in the same track */ -static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, int32_t item_last_id, lv_coord_t abs_x, - lv_coord_t abs_y, lv_coord_t max_main_size, lv_coord_t item_gap, track_t * t) +static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, int32_t item_last_id, int32_t abs_x, + int32_t abs_y, int32_t max_main_size, int32_t item_gap, track_t * t) { - void (*area_set_main_size)(lv_area_t *, lv_coord_t) = (f->row ? lv_area_set_width : lv_area_set_height); - lv_coord_t (*area_get_main_size)(const lv_area_t *) = (f->row ? lv_area_get_width : lv_area_get_height); - lv_coord_t (*area_get_cross_size)(const lv_area_t *) = (!f->row ? lv_area_get_width : lv_area_get_height); + void (*area_set_main_size)(lv_area_t *, int32_t) = (f->row ? lv_area_set_width : lv_area_set_height); + int32_t (*area_get_main_size)(const lv_area_t *) = (f->row ? lv_area_get_width : lv_area_get_height); + int32_t (*area_get_cross_size)(const lv_area_t *) = (!f->row ? lv_area_get_width : lv_area_get_height); - typedef lv_coord_t (*margin_func_t)(const struct _lv_obj_t *, uint32_t); + typedef int32_t (*margin_func_t)(const struct _lv_obj_t *, uint32_t); margin_func_t get_margin_main_start = (f->row ? lv_obj_get_style_margin_left : lv_obj_get_style_margin_top); margin_func_t get_margin_main_end = (f->row ? lv_obj_get_style_margin_right : lv_obj_get_style_margin_bottom); margin_func_t get_margin_cross_start = (!f->row ? lv_obj_get_style_margin_left : lv_obj_get_style_margin_top); @@ -335,8 +335,8 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i bool grow_reiterate = true; while(grow_reiterate && t->grow_item_cnt) { grow_reiterate = false; - lv_coord_t grow_value_sum = 0; - lv_coord_t grow_max_size = t->track_main_size - t->track_fix_main_size; + int32_t grow_value_sum = 0; + int32_t grow_max_size = t->track_main_size - t->track_fix_main_size; for(i = 0; i < t->grow_item_cnt; i++) { if(t->grow_dsc[i].clamped == 0) { grow_value_sum += t->grow_dsc[i].grow_value; @@ -345,14 +345,14 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i grow_max_size -= t->grow_dsc[i].final_size; } } - lv_coord_t grow_unit; + int32_t grow_unit; for(i = 0; i < t->grow_item_cnt; i++) { if(t->grow_dsc[i].clamped == 0) { LV_ASSERT(grow_value_sum != 0); grow_unit = grow_max_size / grow_value_sum; - lv_coord_t size = grow_unit * t->grow_dsc[i].grow_value; - lv_coord_t size_clamp = LV_CLAMP(t->grow_dsc[i].min_size, size, t->grow_dsc[i].max_size); + int32_t size = grow_unit * t->grow_dsc[i].grow_value; + int32_t size_clamp = LV_CLAMP(t->grow_dsc[i].min_size, size, t->grow_dsc[i].max_size); if(size_clamp != size) { t->grow_dsc[i].clamped = 1; @@ -368,9 +368,9 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i bool rtl = lv_obj_get_style_base_dir(cont, LV_PART_MAIN) == LV_BASE_DIR_RTL; - lv_coord_t main_pos = 0; + int32_t main_pos = 0; - lv_coord_t place_gap = 0; + int32_t place_gap = 0; place_content(f->main_place, max_main_size, t->track_main_size, t->item_cnt, &main_pos, &place_gap); if(f->row && rtl) main_pos += lv_obj_get_content_width(cont); @@ -381,9 +381,9 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i item = get_next_item(cont, f->rev, &item_first_id); continue; } - lv_coord_t grow_size = lv_obj_get_style_flex_grow(item, LV_PART_MAIN); + int32_t grow_size = lv_obj_get_style_flex_grow(item, LV_PART_MAIN); if(grow_size) { - lv_coord_t s = 0; + int32_t s = 0; for(i = 0; i < t->grow_item_cnt; i++) { if(t->grow_dsc[i].item == item) { s = t->grow_dsc[i].final_size; @@ -416,7 +416,7 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i item->h_layout = 0; } - lv_coord_t cross_pos = 0; + int32_t cross_pos = 0; switch(f->cross_place) { case LV_FLEX_ALIGN_CENTER: /*Round up the cross size to avoid rounding error when dividing by 2 @@ -437,15 +437,15 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i /*Handle percentage value of translate*/ - lv_coord_t tr_x = lv_obj_get_style_translate_x(item, LV_PART_MAIN); - lv_coord_t tr_y = lv_obj_get_style_translate_y(item, LV_PART_MAIN); - lv_coord_t w = lv_obj_get_width(item); - lv_coord_t h = lv_obj_get_height(item); + int32_t tr_x = lv_obj_get_style_translate_x(item, LV_PART_MAIN); + int32_t tr_y = lv_obj_get_style_translate_y(item, LV_PART_MAIN); + int32_t w = lv_obj_get_width(item); + int32_t h = lv_obj_get_height(item); if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; if(LV_COORD_IS_PCT(tr_y)) tr_y = (h * LV_COORD_GET_PCT(tr_y)) / 100; - lv_coord_t diff_x = abs_x - item->coords.x1 + tr_x; - lv_coord_t diff_y = abs_y - item->coords.y1 + tr_y; + int32_t diff_x = abs_x - item->coords.x1 + tr_x; + int32_t diff_y = abs_y - item->coords.y1 + tr_y; diff_x += f->row ? main_pos + get_margin_main_start(item, LV_PART_MAIN) : cross_pos; diff_y += f->row ? cross_pos : main_pos + get_margin_main_start(item, LV_PART_MAIN); @@ -471,8 +471,8 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i /** * Tell a start coordinate and gap for a placement type. */ -static void place_content(lv_flex_align_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt, - lv_coord_t * start_pos, lv_coord_t * gap) +static void place_content(lv_flex_align_t place, int32_t max_size, int32_t content_size, int32_t item_cnt, + int32_t * start_pos, int32_t * gap) { if(item_cnt <= 1) { switch(place) { @@ -496,14 +496,14 @@ static void place_content(lv_flex_align_t place, lv_coord_t max_size, lv_coord_t *start_pos += max_size - content_size; break; case LV_FLEX_ALIGN_SPACE_BETWEEN: - *gap = (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt - 1); + *gap = (int32_t)(max_size - content_size) / (int32_t)(item_cnt - 1); break; case LV_FLEX_ALIGN_SPACE_AROUND: - *gap += (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt); + *gap += (int32_t)(max_size - content_size) / (int32_t)(item_cnt); *start_pos += *gap / 2; break; case LV_FLEX_ALIGN_SPACE_EVENLY: - *gap = (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt + 1); + *gap = (int32_t)(max_size - content_size) / (int32_t)(item_cnt + 1); *start_pos += *gap; break; default: @@ -525,14 +525,14 @@ static lv_obj_t * get_next_item(lv_obj_t * cont, bool rev, int32_t * item_id) } } -static lv_coord_t lv_obj_get_width_with_margin(const lv_obj_t * obj) +static int32_t lv_obj_get_width_with_margin(const lv_obj_t * obj) { return lv_obj_get_style_margin_left(obj, LV_PART_MAIN) + lv_obj_get_width(obj) + lv_obj_get_style_margin_right(obj, LV_PART_MAIN); } -static lv_coord_t lv_obj_get_height_with_margin(const lv_obj_t * obj) +static int32_t lv_obj_get_height_with_margin(const lv_obj_t * obj) { return lv_obj_get_style_margin_top(obj, LV_PART_MAIN) + lv_obj_get_height(obj) diff --git a/src/layouts/grid/lv_grid.c b/src/layouts/grid/lv_grid.c index 16578920f..06613dfe1 100644 --- a/src/layouts/grid/lv_grid.c +++ b/src/layouts/grid/lv_grid.c @@ -36,14 +36,14 @@ typedef struct { } item_repos_hint_t; typedef struct { - lv_coord_t * x; - lv_coord_t * y; - lv_coord_t * w; - lv_coord_t * h; + int32_t * x; + int32_t * y; + int32_t * w; + int32_t * h; uint32_t col_num; uint32_t row_num; - lv_coord_t grid_w; - lv_coord_t grid_h; + int32_t grid_w; + int32_t grid_h; } _lv_grid_calc_t; /********************** @@ -59,32 +59,32 @@ static void calc_free(_lv_grid_calc_t * calc); static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c); static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c); static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * hint); -static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, lv_grid_align_t align, lv_coord_t gap, - uint32_t track_num, - lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse); -static uint32_t count_tracks(const lv_coord_t * templ); +static int32_t grid_align(int32_t cont_size, bool auto_size, lv_grid_align_t align, int32_t gap, + uint32_t track_num, + int32_t * size_array, int32_t * pos_array, bool reverse); +static uint32_t count_tracks(const int32_t * templ); -static inline const lv_coord_t * get_col_dsc(lv_obj_t * obj) +static inline const int32_t * get_col_dsc(lv_obj_t * obj) { return lv_obj_get_style_grid_column_dsc_array(obj, 0); } -static inline const lv_coord_t * get_row_dsc(lv_obj_t * obj) +static inline const int32_t * get_row_dsc(lv_obj_t * obj) { return lv_obj_get_style_grid_row_dsc_array(obj, 0); } -static inline lv_coord_t get_col_pos(lv_obj_t * obj) +static inline int32_t get_col_pos(lv_obj_t * obj) { return lv_obj_get_style_grid_cell_column_pos(obj, 0); } -static inline lv_coord_t get_row_pos(lv_obj_t * obj) +static inline int32_t get_row_pos(lv_obj_t * obj) { return lv_obj_get_style_grid_cell_row_pos(obj, 0); } -static inline lv_coord_t get_col_span(lv_obj_t * obj) +static inline int32_t get_col_span(lv_obj_t * obj) { return lv_obj_get_style_grid_cell_column_span(obj, 0); } -static inline lv_coord_t get_row_span(lv_obj_t * obj) +static inline int32_t get_row_span(lv_obj_t * obj) { return lv_obj_get_style_grid_cell_row_span(obj, 0); } @@ -104,12 +104,12 @@ static inline lv_grid_align_t get_grid_row_align(lv_obj_t * obj) { return lv_obj_get_style_grid_row_align(obj, 0); } -static inline lv_coord_t get_margin_hor(lv_obj_t * obj) +static inline int32_t get_margin_hor(lv_obj_t * obj) { return lv_obj_get_style_margin_left(obj, LV_PART_MAIN) + lv_obj_get_style_margin_right(obj, LV_PART_MAIN); } -static inline lv_coord_t get_margin_ver(lv_obj_t * obj) +static inline int32_t get_margin_ver(lv_obj_t * obj) { return lv_obj_get_style_margin_top(obj, LV_PART_MAIN) + lv_obj_get_style_margin_bottom(obj, LV_PART_MAIN); @@ -143,7 +143,7 @@ void lv_grid_init(void) layout_list_def[LV_LAYOUT_GRID].user_data = NULL; } -void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_coord_t row_dsc[]) +void lv_obj_set_grid_dsc_array(lv_obj_t * obj, const int32_t col_dsc[], const int32_t row_dsc[]) { lv_obj_set_style_grid_column_dsc_array(obj, col_dsc, 0); lv_obj_set_style_grid_row_dsc_array(obj, row_dsc, 0); @@ -157,8 +157,8 @@ void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid } -void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t x_align, lv_coord_t col_pos, lv_coord_t col_span, - lv_grid_align_t y_align, lv_coord_t row_pos, lv_coord_t row_span) +void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t x_align, int32_t col_pos, int32_t col_span, + lv_grid_align_t y_align, int32_t row_pos, int32_t row_span) { lv_obj_set_style_grid_cell_column_pos(obj, col_pos, 0); @@ -180,8 +180,8 @@ static void grid_update(lv_obj_t * cont, void * user_data) LV_LOG_INFO("update %p container", (void *)cont); LV_UNUSED(user_data); - // const lv_coord_t * col_templ = get_col_dsc(cont); - // const lv_coord_t * row_templ = get_row_dsc(cont); + // const int32_t * col_templ = get_col_dsc(cont); + // const int32_t * row_templ = get_row_dsc(cont); // if(col_templ == NULL || row_templ == NULL) return; _lv_grid_calc_t c; @@ -192,8 +192,8 @@ static void grid_update(lv_obj_t * cont, void * user_data) /*Calculate the grids absolute x and y coordinates. *It will be used as helper during item repositioning to avoid calculating this value for every children*/ - lv_coord_t pad_left = lv_obj_get_style_space_left(cont, LV_PART_MAIN); - lv_coord_t pad_top = lv_obj_get_style_space_top(cont, LV_PART_MAIN); + int32_t pad_left = lv_obj_get_style_space_left(cont, LV_PART_MAIN); + int32_t pad_top = lv_obj_get_style_space_top(cont, LV_PART_MAIN); hint.grid_abs.x = pad_left + cont->coords.x1 - lv_obj_get_scroll_x(cont); hint.grid_abs.y = pad_top + cont->coords.y1 - lv_obj_get_scroll_y(cont); @@ -204,8 +204,8 @@ static void grid_update(lv_obj_t * cont, void * user_data) } calc_free(&c); - lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); - lv_coord_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); + int32_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); + int32_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); if(w_set == LV_SIZE_CONTENT || h_set == LV_SIZE_CONTENT) { lv_obj_refr_size(cont); } @@ -231,20 +231,20 @@ static void calc(lv_obj_t * cont, _lv_grid_calc_t * calc_out) calc_rows(cont, calc_out); calc_cols(cont, calc_out); - lv_coord_t col_gap = lv_obj_get_style_pad_column(cont, LV_PART_MAIN); - lv_coord_t row_gap = lv_obj_get_style_pad_row(cont, LV_PART_MAIN); + int32_t col_gap = lv_obj_get_style_pad_column(cont, LV_PART_MAIN); + int32_t row_gap = lv_obj_get_style_pad_row(cont, LV_PART_MAIN); bool rev = lv_obj_get_style_base_dir(cont, LV_PART_MAIN) == LV_BASE_DIR_RTL; - lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); - lv_coord_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); + int32_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN); + int32_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN); bool auto_w = w_set == LV_SIZE_CONTENT && !cont->w_layout; - lv_coord_t cont_w = lv_obj_get_content_width(cont); + int32_t cont_w = lv_obj_get_content_width(cont); calc_out->grid_w = grid_align(cont_w, auto_w, get_grid_col_align(cont), col_gap, calc_out->col_num, calc_out->w, calc_out->x, rev); bool auto_h = h_set == LV_SIZE_CONTENT && !cont->h_layout; - lv_coord_t cont_h = lv_obj_get_content_height(cont); + int32_t cont_h = lv_obj_get_content_height(cont); calc_out->grid_h = grid_align(cont_h, auto_h, get_grid_row_align(cont), row_gap, calc_out->row_num, calc_out->h, calc_out->y, false); @@ -266,7 +266,7 @@ static void calc_free(_lv_grid_calc_t * calc) static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c) { - const lv_coord_t * col_templ; + const int32_t * col_templ; col_templ = get_col_dsc(cont); bool subgrid = false; if(col_templ == NULL) { @@ -277,26 +277,26 @@ static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c) return; } - lv_coord_t pos = get_col_pos(cont); - lv_coord_t span = get_col_span(cont); + int32_t pos = get_col_pos(cont); + int32_t span = get_col_span(cont); - lv_coord_t * col_templ_sub = lv_malloc(sizeof(lv_coord_t) * (span + 1)); - lv_memcpy(col_templ_sub, &col_templ[pos], sizeof(lv_coord_t) * span); + int32_t * col_templ_sub = lv_malloc(sizeof(int32_t) * (span + 1)); + lv_memcpy(col_templ_sub, &col_templ[pos], sizeof(int32_t) * span); col_templ_sub[span] = LV_GRID_TEMPLATE_LAST; col_templ = col_templ_sub; subgrid = true; } - lv_coord_t cont_w = lv_obj_get_content_width(cont); + int32_t cont_w = lv_obj_get_content_width(cont); c->col_num = count_tracks(col_templ); - c->x = lv_malloc(sizeof(lv_coord_t) * c->col_num); - c->w = lv_malloc(sizeof(lv_coord_t) * c->col_num); + c->x = lv_malloc(sizeof(int32_t) * c->col_num); + c->w = lv_malloc(sizeof(int32_t) * c->col_num); /*Set sizes for CONTENT cells*/ uint32_t i; for(i = 0; i < c->col_num; i++) { - lv_coord_t size = LV_COORD_MIN; + int32_t size = LV_COORD_MIN; if(IS_CONTENT(col_templ[i])) { /*Check the size of children of this cell*/ uint32_t ci; @@ -317,10 +317,10 @@ static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c) } uint32_t col_fr_cnt = 0; - lv_coord_t grid_w = 0; + int32_t grid_w = 0; for(i = 0; i < c->col_num; i++) { - lv_coord_t x = col_templ[i]; + int32_t x = col_templ[i]; if(IS_FR(x)) { col_fr_cnt += GET_FR(x); } @@ -333,17 +333,17 @@ static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c) } } - lv_coord_t col_gap = lv_obj_get_style_pad_column(cont, LV_PART_MAIN); + int32_t col_gap = lv_obj_get_style_pad_column(cont, LV_PART_MAIN); cont_w -= col_gap * (c->col_num - 1); - lv_coord_t free_w = cont_w - grid_w; + int32_t free_w = cont_w - grid_w; if(free_w < 0) free_w = 0; int32_t last_fr_i = -1; int32_t last_fr_x = 0; for(i = 0; i < c->col_num; i++) { - lv_coord_t x = col_templ[i]; + int32_t x = col_templ[i]; if(IS_FR(x)) { - lv_coord_t f = GET_FR(x); + int32_t f = GET_FR(x); c->w[i] = (free_w * f) / col_fr_cnt; last_fr_i = i; last_fr_x = f; @@ -363,7 +363,7 @@ static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c) static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c) { - const lv_coord_t * row_templ; + const int32_t * row_templ; row_templ = get_row_dsc(cont); bool subgrid = false; if(row_templ == NULL) { @@ -374,23 +374,23 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c) return; } - lv_coord_t pos = get_row_pos(cont); - lv_coord_t span = get_row_span(cont); + int32_t pos = get_row_pos(cont); + int32_t span = get_row_span(cont); - lv_coord_t * row_templ_sub = lv_malloc(sizeof(lv_coord_t) * (span + 1)); - lv_memcpy(row_templ_sub, &row_templ[pos], sizeof(lv_coord_t) * span); + int32_t * row_templ_sub = lv_malloc(sizeof(int32_t) * (span + 1)); + lv_memcpy(row_templ_sub, &row_templ[pos], sizeof(int32_t) * span); row_templ_sub[span] = LV_GRID_TEMPLATE_LAST; row_templ = row_templ_sub; subgrid = true; } c->row_num = count_tracks(row_templ); - c->y = lv_malloc(sizeof(lv_coord_t) * c->row_num); - c->h = lv_malloc(sizeof(lv_coord_t) * c->row_num); + c->y = lv_malloc(sizeof(int32_t) * c->row_num); + c->h = lv_malloc(sizeof(int32_t) * c->row_num); /*Set sizes for CONTENT cells*/ uint32_t i; for(i = 0; i < c->row_num; i++) { - lv_coord_t size = LV_COORD_MIN; + int32_t size = LV_COORD_MIN; if(IS_CONTENT(row_templ[i])) { /*Check the size of children of this cell*/ uint32_t ci; @@ -411,10 +411,10 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c) } uint32_t row_fr_cnt = 0; - lv_coord_t grid_h = 0; + int32_t grid_h = 0; for(i = 0; i < c->row_num; i++) { - lv_coord_t x = row_templ[i]; + int32_t x = row_templ[i]; if(IS_FR(x)) { row_fr_cnt += GET_FR(x); } @@ -428,17 +428,17 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c) } - lv_coord_t row_gap = lv_obj_get_style_pad_row(cont, LV_PART_MAIN); - lv_coord_t cont_h = lv_obj_get_content_height(cont) - row_gap * (c->row_num - 1); - lv_coord_t free_h = cont_h - grid_h; + int32_t row_gap = lv_obj_get_style_pad_row(cont, LV_PART_MAIN); + int32_t cont_h = lv_obj_get_content_height(cont) - row_gap * (c->row_num - 1); + int32_t free_h = cont_h - grid_h; if(free_h < 0) free_h = 0; int32_t last_fr_i = -1; int32_t last_fr_x = 0; for(i = 0; i < c->row_num; i++) { - lv_coord_t x = row_templ[i]; + int32_t x = row_templ[i]; if(IS_FR(x)) { - lv_coord_t f = GET_FR(x); + int32_t f = GET_FR(x); c->h[i] = (free_h * f) / row_fr_cnt; last_fr_i = i; last_fr_x = f; @@ -475,13 +475,13 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * lv_grid_align_t row_align = get_cell_row_align(item); - lv_coord_t col_x1 = c->x[col_pos]; - lv_coord_t col_x2 = c->x[col_pos + col_span - 1] + c->w[col_pos + col_span - 1]; - lv_coord_t col_w = col_x2 - col_x1; + int32_t col_x1 = c->x[col_pos]; + int32_t col_x2 = c->x[col_pos + col_span - 1] + c->w[col_pos + col_span - 1]; + int32_t col_w = col_x2 - col_x1; - lv_coord_t row_y1 = c->y[row_pos]; - lv_coord_t row_y2 = c->y[row_pos + row_span - 1] + c->h[row_pos + row_span - 1]; - lv_coord_t row_h = row_y2 - row_y1; + int32_t row_y1 = c->y[row_pos]; + int32_t row_y2 = c->y[row_pos + row_span - 1] + c->h[row_pos + row_span - 1]; + int32_t row_h = row_y2 - row_y1; /*If the item has RTL base dir switch start and end*/ @@ -490,10 +490,10 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * else if(col_align == LV_GRID_ALIGN_END) col_align = LV_GRID_ALIGN_START; } - lv_coord_t x; - lv_coord_t y; - lv_coord_t item_w = lv_area_get_width(&item->coords); - lv_coord_t item_h = lv_area_get_height(&item->coords); + int32_t x; + int32_t y; + int32_t item_w = lv_area_get_width(&item->coords); + int32_t item_h = lv_area_get_height(&item->coords); switch(col_align) { default: @@ -553,18 +553,18 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * } /*Handle percentage value of translate*/ - lv_coord_t tr_x = lv_obj_get_style_translate_x(item, LV_PART_MAIN); - lv_coord_t tr_y = lv_obj_get_style_translate_y(item, LV_PART_MAIN); - lv_coord_t w = lv_obj_get_width(item); - lv_coord_t h = lv_obj_get_height(item); + int32_t tr_x = lv_obj_get_style_translate_x(item, LV_PART_MAIN); + int32_t tr_y = lv_obj_get_style_translate_y(item, LV_PART_MAIN); + int32_t w = lv_obj_get_width(item); + int32_t h = lv_obj_get_height(item); if(LV_COORD_IS_PCT(tr_x)) tr_x = (w * LV_COORD_GET_PCT(tr_x)) / 100; if(LV_COORD_IS_PCT(tr_y)) tr_y = (h * LV_COORD_GET_PCT(tr_y)) / 100; x += tr_x; y += tr_y; - lv_coord_t diff_x = hint->grid_abs.x + x - item->coords.x1; - lv_coord_t diff_y = hint->grid_abs.y + y - item->coords.y1; + int32_t diff_x = hint->grid_abs.x + x - item->coords.x1; + int32_t diff_y = hint->grid_abs.y + y - item->coords.y1; if(diff_x || diff_y) { lv_obj_invalidate(item); item->coords.x1 += diff_x; @@ -588,11 +588,11 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * * @param pos_array write the positions of the tracks here * @return the total size of the grid */ -static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, lv_grid_align_t align, lv_coord_t gap, - uint32_t track_num, - lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse) +static int32_t grid_align(int32_t cont_size, bool auto_size, lv_grid_align_t align, int32_t gap, + uint32_t track_num, + int32_t * size_array, int32_t * pos_array, bool reverse) { - lv_coord_t grid_size = 0; + int32_t grid_size = 0; uint32_t i; if(auto_size) { @@ -624,14 +624,14 @@ static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, lv_grid_alig break; case LV_GRID_ALIGN_SPACE_BETWEEN: pos_array[0] = 0; - gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num - 1); + gap = (int32_t)(cont_size - grid_size) / (int32_t)(track_num - 1); break; case LV_GRID_ALIGN_SPACE_AROUND: - gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num); + gap = (int32_t)(cont_size - grid_size) / (int32_t)(track_num); pos_array[0] = gap / 2; break; case LV_GRID_ALIGN_SPACE_EVENLY: - gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num + 1); + gap = (int32_t)(cont_size - grid_size) / (int32_t)(track_num + 1); pos_array[0] = gap; break; default: @@ -644,7 +644,7 @@ static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, lv_grid_alig pos_array[i + 1] = pos_array[i] + size_array[i] + gap; } - lv_coord_t total_gird_size = pos_array[track_num - 1] + size_array[track_num - 1] - pos_array[0]; + int32_t total_gird_size = pos_array[track_num - 1] + size_array[track_num - 1] - pos_array[0]; if(reverse) { for(i = 0; i < track_num; i++) { @@ -657,7 +657,7 @@ static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, lv_grid_alig return total_gird_size; } -static uint32_t count_tracks(const lv_coord_t * templ) +static uint32_t count_tracks(const int32_t * templ) { uint32_t i; for(i = 0; templ[i] != LV_GRID_TEMPLATE_LAST; i++); diff --git a/src/layouts/grid/lv_grid.h b/src/layouts/grid/lv_grid.h index 7ee4fab03..1bc04b19d 100644 --- a/src/layouts/grid/lv_grid.h +++ b/src/layouts/grid/lv_grid.h @@ -61,7 +61,7 @@ typedef enum { void lv_grid_init(void); -void lv_obj_set_grid_dsc_array(struct _lv_obj_t * obj, const lv_coord_t col_dsc[], const lv_coord_t row_dsc[]); +void lv_obj_set_grid_dsc_array(struct _lv_obj_t * obj, const int32_t col_dsc[], const int32_t row_dsc[]); void lv_obj_set_grid_align(struct _lv_obj_t * obj, lv_grid_align_t column_align, lv_grid_align_t row_align); @@ -75,13 +75,13 @@ void lv_obj_set_grid_align(struct _lv_obj_t * obj, lv_grid_align_t column_align, * @param row_pos row ID * @param row_span number of rows to take (>= 1) */ -void lv_obj_set_grid_cell(struct _lv_obj_t * obj, lv_grid_align_t column_align, lv_coord_t col_pos, lv_coord_t col_span, - lv_grid_align_t row_align, lv_coord_t row_pos, lv_coord_t row_span); +void lv_obj_set_grid_cell(struct _lv_obj_t * obj, lv_grid_align_t column_align, int32_t col_pos, int32_t col_span, + lv_grid_align_t row_align, int32_t row_pos, int32_t row_span); /** * Just a wrapper to `LV_GRID_FR` for bindings. */ -static inline lv_coord_t lv_grid_fr(uint8_t x) +static inline int32_t lv_grid_fr(uint8_t x) { return LV_GRID_FR(x); } diff --git a/src/libs/barcode/lv_barcode.c b/src/libs/barcode/lv_barcode.c index 858304bd8..7bb96f18f 100644 --- a/src/libs/barcode/lv_barcode.c +++ b/src/libs/barcode/lv_barcode.c @@ -25,7 +25,7 @@ **********************/ static void lv_barcode_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_barcode_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); -static bool lv_barcode_change_buf_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h); +static bool lv_barcode_change_buf_size(lv_obj_t * obj, int32_t w, int32_t h); /********************** * STATIC VARIABLES @@ -115,14 +115,14 @@ lv_result_t lv_barcode_update(lv_obj_t * obj, const char * data) return LV_RESULT_INVALID; } - lv_coord_t barcode_w = code128_encode_gs1(data, out_buf, len); + int32_t barcode_w = code128_encode_gs1(data, out_buf, len); LV_LOG_INFO("barcode width = %d", (int)barcode_w); LV_ASSERT(barcode->scale > 0); uint16_t scale = barcode->scale; - lv_coord_t buf_w = (barcode->direction == LV_DIR_HOR) ? barcode_w * scale : 1; - lv_coord_t buf_h = (barcode->direction == LV_DIR_VER) ? barcode_w * scale : 1; + int32_t buf_w = (barcode->direction == LV_DIR_HOR) ? barcode_w * scale : 1; + int32_t buf_h = (barcode->direction == LV_DIR_VER) ? barcode_w * scale : 1; if(!lv_barcode_change_buf_size(obj, buf_w, buf_h)) { goto failed; @@ -131,7 +131,7 @@ lv_result_t lv_barcode_update(lv_obj_t * obj, const char * data) lv_canvas_set_palette(obj, 0, lv_color_to_32(barcode->dark_color, 0xff)); lv_canvas_set_palette(obj, 1, lv_color_to_32(barcode->light_color, 0xff)); - for(lv_coord_t x = 0; x < barcode_w; x++) { + for(int32_t x = 0; x < barcode_w; x++) { lv_color_t color; color = lv_color_from_int(out_buf[x] ? 0 : 1); for(uint16_t i = 0; i < scale; i++) { @@ -210,7 +210,7 @@ static void lv_barcode_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj img->data = NULL; } -static bool lv_barcode_change_buf_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h) +static bool lv_barcode_change_buf_size(lv_obj_t * obj, int32_t w, int32_t h) { LV_ASSERT_NULL(obj); LV_ASSERT(w > 0); diff --git a/src/libs/bmp/lv_bmp.c b/src/libs/bmp/lv_bmp.c index 4c8e8bad4..eb86bdfa5 100644 --- a/src/libs/bmp/lv_bmp.c +++ b/src/libs/bmp/lv_bmp.c @@ -201,7 +201,7 @@ static lv_result_t decoder_get_area(lv_image_decoder_t * decoder, lv_image_decod return LV_RESULT_INVALID; } else { - lv_coord_t y = (b->px_height - 1) - (decoded_area->y1); /*BMP images are stored upside down*/ + int32_t y = (b->px_height - 1) - (decoded_area->y1); /*BMP images are stored upside down*/ uint32_t p = b->px_offset + b->row_size_bytes * y; p += (decoded_area->x1) * (b->bpp / 8); lv_fs_seek(&b->f, p, LV_FS_SEEK_SET); diff --git a/src/libs/libpng/lv_libpng.c b/src/libs/libpng/lv_libpng.c index a4ec558ff..e1faa56d3 100644 --- a/src/libs/libpng/lv_libpng.c +++ b/src/libs/libpng/lv_libpng.c @@ -105,8 +105,8 @@ static lv_result_t decoder_info(lv_image_decoder_t * decoder, const void * src, header->always_zero = 0; header->cf = LV_COLOR_FORMAT_ARGB8888; /*The width and height are stored in Big endian format so convert them to little endian*/ - header->w = (lv_coord_t)((size[0] & 0xff000000) >> 24) + ((size[0] & 0x00ff0000) >> 8); - header->h = (lv_coord_t)((size[1] & 0xff000000) >> 24) + ((size[1] & 0x00ff0000) >> 8); + header->w = (int32_t)((size[0] & 0xff000000) >> 24) + ((size[0] & 0x00ff0000) >> 8); + header->h = (int32_t)((size[1] & 0xff000000) >> 24) + ((size[1] & 0x00ff0000) >> 8); return LV_RESULT_OK; } diff --git a/src/libs/lodepng/lv_lodepng.c b/src/libs/lodepng/lv_lodepng.c index 104e3e384..0f4c66f79 100644 --- a/src/libs/lodepng/lv_lodepng.c +++ b/src/libs/lodepng/lv_lodepng.c @@ -107,8 +107,8 @@ static lv_result_t decoder_info(struct _lv_image_decoder_t * decoder, const void header->always_zero = 0; header->cf = LV_COLOR_FORMAT_ARGB8888; /*The width and height are stored in Big endian format so convert them to little endian*/ - header->w = (lv_coord_t)((size[0] & 0xff000000) >> 24) + ((size[0] & 0x00ff0000) >> 8); - header->h = (lv_coord_t)((size[1] & 0xff000000) >> 24) + ((size[1] & 0x00ff0000) >> 8); + header->w = (int32_t)((size[0] & 0xff000000) >> 24) + ((size[0] & 0x00ff0000) >> 8); + header->h = (int32_t)((size[1] & 0xff000000) >> 24) + ((size[1] & 0x00ff0000) >> 8); return LV_RESULT_OK; } @@ -129,14 +129,14 @@ static lv_result_t decoder_info(struct _lv_image_decoder_t * decoder, const void header->w = img_dsc->header.w; /*Save the image width*/ } else { - header->w = (lv_coord_t)((size[0] & 0xff000000) >> 24) + ((size[0] & 0x00ff0000) >> 8); + header->w = (int32_t)((size[0] & 0xff000000) >> 24) + ((size[0] & 0x00ff0000) >> 8); } if(img_dsc->header.h) { header->h = img_dsc->header.h; /*Save the color height*/ } else { - header->h = (lv_coord_t)((size[1] & 0xff000000) >> 24) + ((size[1] & 0x00ff0000) >> 8); + header->h = (int32_t)((size[1] & 0xff000000) >> 24) + ((size[1] & 0x00ff0000) >> 8); } return LV_RESULT_OK; diff --git a/src/libs/qrcode/lv_qrcode.c b/src/libs/qrcode/lv_qrcode.c index 538194570..4dca87706 100644 --- a/src/libs/qrcode/lv_qrcode.c +++ b/src/libs/qrcode/lv_qrcode.c @@ -60,7 +60,7 @@ lv_obj_t * lv_qrcode_create(lv_obj_t * parent) return obj; } -void lv_qrcode_set_size(lv_obj_t * obj, lv_coord_t size) +void lv_qrcode_set_size(lv_obj_t * obj, int32_t size) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -145,7 +145,7 @@ lv_result_t lv_qrcode_update(lv_obj_t * obj, const void * data, uint32_t data_le return LV_RESULT_INVALID; } - lv_coord_t obj_w = img_dsc->header.w; + int32_t obj_w = img_dsc->header.w; qr_size = qrcodegen_getSize(qr0); scale = obj_w / qr_size; int scaled = qr_size * scale; diff --git a/src/libs/qrcode/lv_qrcode.h b/src/libs/qrcode/lv_qrcode.h index 7b2df4ef4..703469b0a 100644 --- a/src/libs/qrcode/lv_qrcode.h +++ b/src/libs/qrcode/lv_qrcode.h @@ -49,7 +49,7 @@ lv_obj_t * lv_qrcode_create(lv_obj_t * parent); * @param obj pointer to a QR code object * @param size width and height of the QR code */ -void lv_qrcode_set_size(lv_obj_t * obj, lv_coord_t size); +void lv_qrcode_set_size(lv_obj_t * obj, int32_t size); /** * Set QR code dark color. diff --git a/src/libs/rlottie/lv_rlottie.c b/src/libs/rlottie/lv_rlottie.c index aa51c44f3..9e772f7a2 100644 --- a/src/libs/rlottie/lv_rlottie.c +++ b/src/libs/rlottie/lv_rlottie.c @@ -42,8 +42,8 @@ const lv_obj_class_t lv_rlottie_class = { }; typedef struct { - lv_coord_t width; - lv_coord_t height; + int32_t width; + int32_t height; const char * rlottie_desc; const char * path; } lv_rlottie_create_info_t; @@ -59,7 +59,7 @@ static lv_rlottie_create_info_t create_info; * GLOBAL FUNCTIONS **********************/ -lv_obj_t * lv_rlottie_create_from_file(lv_obj_t * parent, lv_coord_t width, lv_coord_t height, const char * path) +lv_obj_t * lv_rlottie_create_from_file(lv_obj_t * parent, int32_t width, int32_t height, const char * path) { create_info.width = width; create_info.height = height; @@ -73,7 +73,7 @@ lv_obj_t * lv_rlottie_create_from_file(lv_obj_t * parent, lv_coord_t width, lv_c return obj; } -lv_obj_t * lv_rlottie_create_from_raw(lv_obj_t * parent, lv_coord_t width, lv_coord_t height, const char * rlottie_desc) +lv_obj_t * lv_rlottie_create_from_raw(lv_obj_t * parent, int32_t width, int32_t height, const char * rlottie_desc) { create_info.width = width; create_info.height = height; diff --git a/src/libs/rlottie/lv_rlottie.h b/src/libs/rlottie/lv_rlottie.h index 640194acd..0cc7c92ba 100644 --- a/src/libs/rlottie/lv_rlottie.h +++ b/src/libs/rlottie/lv_rlottie.h @@ -54,9 +54,9 @@ extern const lv_obj_class_t lv_rlottie_class; * GLOBAL PROTOTYPES **********************/ -lv_obj_t * lv_rlottie_create_from_file(lv_obj_t * parent, lv_coord_t width, lv_coord_t height, const char * path); +lv_obj_t * lv_rlottie_create_from_file(lv_obj_t * parent, int32_t width, int32_t height, const char * path); -lv_obj_t * lv_rlottie_create_from_raw(lv_obj_t * parent, lv_coord_t width, lv_coord_t height, +lv_obj_t * lv_rlottie_create_from_raw(lv_obj_t * parent, int32_t width, int32_t height, const char * rlottie_desc); void lv_rlottie_set_play_mode(lv_obj_t * rlottie, const lv_rlottie_ctrl_t ctrl); diff --git a/src/libs/tiny_ttf/lv_tiny_ttf.c b/src/libs/tiny_ttf/lv_tiny_ttf.c index 8959b4608..80cd56ed7 100644 --- a/src/libs/tiny_ttf/lv_tiny_ttf.c +++ b/src/libs/tiny_ttf/lv_tiny_ttf.c @@ -174,7 +174,7 @@ static const uint8_t * ttf_get_glyph_bitmap_cb(const lv_font_t * font, uint32_t return buffer; /*Or NULL if not found*/ } -static lv_font_t * lv_tiny_ttf_create(const char * path, const void * data, size_t data_size, lv_coord_t font_size, +static lv_font_t * lv_tiny_ttf_create(const char * path, const void * data, size_t data_size, int32_t font_size, size_t cache_size) { LV_UNUSED(data_size); @@ -233,24 +233,24 @@ static lv_font_t * lv_tiny_ttf_create(const char * path, const void * data, size return out_font; } #if LV_TINY_TTF_FILE_SUPPORT != 0 -lv_font_t * lv_tiny_ttf_create_file_ex(const char * path, lv_coord_t font_size, size_t cache_size) +lv_font_t * lv_tiny_ttf_create_file_ex(const char * path, int32_t font_size, size_t cache_size) { return lv_tiny_ttf_create(path, NULL, 0, font_size, cache_size); } -lv_font_t * lv_tiny_ttf_create_file(const char * path, lv_coord_t font_size) +lv_font_t * lv_tiny_ttf_create_file(const char * path, int32_t font_size) { return lv_tiny_ttf_create(path, NULL, 0, font_size, 0); } #endif -lv_font_t * lv_tiny_ttf_create_data_ex(const void * data, size_t data_size, lv_coord_t font_size, size_t cache_size) +lv_font_t * lv_tiny_ttf_create_data_ex(const void * data, size_t data_size, int32_t font_size, size_t cache_size) { return lv_tiny_ttf_create(NULL, data, data_size, font_size, cache_size); } -lv_font_t * lv_tiny_ttf_create_data(const void * data, size_t data_size, lv_coord_t font_size) +lv_font_t * lv_tiny_ttf_create_data(const void * data, size_t data_size, int32_t font_size) { return lv_tiny_ttf_create(NULL, data, data_size, font_size, 0); } -void lv_tiny_ttf_set_size(lv_font_t * font, lv_coord_t font_size) +void lv_tiny_ttf_set_size(lv_font_t * font, int32_t font_size) { if(font_size <= 0) { LV_LOG_ERROR("invalid font size: %d", font_size); @@ -260,8 +260,8 @@ void lv_tiny_ttf_set_size(lv_font_t * font, lv_coord_t font_size) dsc->scale = stbtt_ScaleForMappingEmToPixels(&dsc->info, font_size); int line_gap = 0; stbtt_GetFontVMetrics(&dsc->info, &dsc->ascent, &dsc->descent, &line_gap); - font->line_height = (lv_coord_t)(dsc->scale * (dsc->ascent - dsc->descent + line_gap)); - font->base_line = (lv_coord_t)(dsc->scale * (line_gap - dsc->descent)); + font->line_height = (int32_t)(dsc->scale * (dsc->ascent - dsc->descent + line_gap)); + font->base_line = (int32_t)(dsc->scale * (line_gap - dsc->descent)); } void lv_tiny_ttf_destroy(lv_font_t * font) { diff --git a/src/libs/tiny_ttf/lv_tiny_ttf.h b/src/libs/tiny_ttf/lv_tiny_ttf.h index 3297e7379..8a1414645 100644 --- a/src/libs/tiny_ttf/lv_tiny_ttf.h +++ b/src/libs/tiny_ttf/lv_tiny_ttf.h @@ -30,20 +30,20 @@ extern "C" { **********************/ #if LV_TINY_TTF_FILE_SUPPORT !=0 /* create a font from the specified file or path with the specified line height.*/ -lv_font_t * lv_tiny_ttf_create_file(const char * path, lv_coord_t font_size); +lv_font_t * lv_tiny_ttf_create_file(const char * path, int32_t font_size); /* create a font from the specified file or path with the specified line height with the specified cache size.*/ -lv_font_t * lv_tiny_ttf_create_file_ex(const char * path, lv_coord_t font_size, size_t cache_size); +lv_font_t * lv_tiny_ttf_create_file_ex(const char * path, int32_t font_size, size_t cache_size); #endif /* create a font from the specified data pointer with the specified line height.*/ -lv_font_t * lv_tiny_ttf_create_data(const void * data, size_t data_size, lv_coord_t font_size); +lv_font_t * lv_tiny_ttf_create_data(const void * data, size_t data_size, int32_t font_size); /* create a font from the specified data pointer with the specified line height and the specified cache size.*/ -lv_font_t * lv_tiny_ttf_create_data_ex(const void * data, size_t data_size, lv_coord_t font_size, size_t cache_size); +lv_font_t * lv_tiny_ttf_create_data_ex(const void * data, size_t data_size, int32_t font_size, size_t cache_size); /* set the size of the font to a new font_size*/ -void lv_tiny_ttf_set_size(lv_font_t * font, lv_coord_t font_size); +void lv_tiny_ttf_set_size(lv_font_t * font, int32_t font_size); /* destroy a font previously created with lv_tiny_ttf_create_xxxx()*/ void lv_tiny_ttf_destroy(lv_font_t * font); diff --git a/src/lv_api_map.h b/src/lv_api_map.h index 5ef29a162..0f763dbf6 100644 --- a/src/lv_api_map.h +++ b/src/lv_api_map.h @@ -44,6 +44,7 @@ extern "C" { /********************** * TYPEDEFS **********************/ +typedef int32_t int32_t; typedef lv_result_t lv_res_t; typedef lv_image_dsc_t lv_img_dsc_t; typedef lv_display_t lv_disp_t; diff --git a/src/misc/lv_area.c b/src/misc/lv_area.c index 3cbd05eb3..c9655ef95 100644 --- a/src/misc/lv_area.c +++ b/src/misc/lv_area.c @@ -47,7 +47,7 @@ static bool lv_point_within_circle(const lv_area_t * area, const lv_point_t * p) * @param x2 right coordinate of the area * @param y2 bottom coordinate of the area */ -void lv_area_set(lv_area_t * area_p, lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2) +void lv_area_set(lv_area_t * area_p, int32_t x1, int32_t y1, int32_t x2, int32_t y2) { area_p->x1 = x1; area_p->y1 = y1; @@ -60,7 +60,7 @@ void lv_area_set(lv_area_t * area_p, lv_coord_t x1, lv_coord_t y1, lv_coord_t x2 * @param area_p pointer to an area * @param w the new width of the area (w == 1 makes x1 == x2) */ -void lv_area_set_width(lv_area_t * area_p, lv_coord_t w) +void lv_area_set_width(lv_area_t * area_p, int32_t w) { area_p->x2 = area_p->x1 + w - 1; } @@ -70,7 +70,7 @@ void lv_area_set_width(lv_area_t * area_p, lv_coord_t w) * @param area_p pointer to an area * @param h the new height of the area (h == 1 makes y1 == y2) */ -void lv_area_set_height(lv_area_t * area_p, lv_coord_t h) +void lv_area_set_height(lv_area_t * area_p, int32_t h) { area_p->y2 = area_p->y1 + h - 1; } @@ -81,10 +81,10 @@ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h) * @param x the new x coordinate of the area * @param y the new y coordinate of the area */ -void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y) +void _lv_area_set_pos(lv_area_t * area_p, int32_t x, int32_t y) { - lv_coord_t w = lv_area_get_width(area_p); - lv_coord_t h = lv_area_get_height(area_p); + int32_t w = lv_area_get_width(area_p); + int32_t h = lv_area_get_height(area_p); area_p->x1 = x; area_p->y1 = y; lv_area_set_width(area_p, w); @@ -105,7 +105,7 @@ uint32_t lv_area_get_size(const lv_area_t * area_p) return size; } -void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra) +void lv_area_increase(lv_area_t * area, int32_t w_extra, int32_t h_extra) { area->x1 -= w_extra; area->x2 += w_extra; @@ -113,7 +113,7 @@ void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra) area->y2 += h_extra; } -void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs) +void lv_area_move(lv_area_t * area, int32_t x_ofs, int32_t y_ofs) { area->x1 += x_ofs; area->x2 += x_ofs; @@ -165,11 +165,11 @@ int8_t _lv_area_diff(lv_area_t res_p[], const lv_area_t * a1_p, const lv_area_t /*Get required information*/ lv_area_t n; - lv_coord_t a1_w = lv_area_get_width(a1_p) - 1; - lv_coord_t a1_h = lv_area_get_height(a1_p) - 1; + int32_t a1_w = lv_area_get_width(a1_p) - 1; + int32_t a1_h = lv_area_get_height(a1_p) - 1; /*Compute top rectangle*/ - lv_coord_t th = a2_p->y1 - a1_p->y1; + int32_t th = a2_p->y1 - a1_p->y1; if(th > 0) { n.x1 = a1_p->x1; n.y1 = a1_p->y1; @@ -179,7 +179,7 @@ int8_t _lv_area_diff(lv_area_t res_p[], const lv_area_t * a1_p, const lv_area_t } /*Compute the bottom rectangle*/ - lv_coord_t bh = a1_h - (a2_p->y2 - a1_p->y1); + int32_t bh = a1_h - (a2_p->y2 - a1_p->y1); if(bh > 0 && a2_p->y2 < a1_p->y2) { n.x1 = a1_p->x1; n.y1 = a2_p->y2; @@ -189,12 +189,12 @@ int8_t _lv_area_diff(lv_area_t res_p[], const lv_area_t * a1_p, const lv_area_t } /*Compute side height*/ - lv_coord_t y1 = a2_p->y1 > a1_p->y1 ? a2_p->y1 : a1_p->y1; - lv_coord_t y2 = a2_p->y2 < a1_p->y2 ? a2_p->y2 : a1_p->y2; - lv_coord_t sh = y2 - y1; + int32_t y1 = a2_p->y1 > a1_p->y1 ? a2_p->y1 : a1_p->y1; + int32_t y2 = a2_p->y2 < a1_p->y2 ? a2_p->y2 : a1_p->y2; + int32_t sh = y2 - y1; /*Compute the left rectangle*/ - lv_coord_t lw = a2_p->x1 - a1_p->x1; + int32_t lw = a2_p->x1 - a1_p->x1; if(lw > 0 && sh > 0) { n.x1 = a1_p->x1; n.y1 = y1; @@ -204,7 +204,7 @@ int8_t _lv_area_diff(lv_area_t res_p[], const lv_area_t * a1_p, const lv_area_t } /*Compute the right rectangle*/ - lv_coord_t rw = a1_w - (a2_p->x2 - a1_p->x1); + int32_t rw = a1_w - (a2_p->x2 - a1_p->x1); if(rw > 0) { n.x1 = a2_p->x2; n.y1 = y1; @@ -238,7 +238,7 @@ void _lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * @param radius radius of area (e.g. for rounded rectangle) * @return false:the point is out of the area */ -bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord_t radius) +bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, int32_t radius) { /*First check the basic area*/ bool is_on_rect = false; @@ -252,9 +252,9 @@ bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coor /*No radius, it is within the rectangle*/ return true; } - lv_coord_t w = lv_area_get_width(a_p) / 2; - lv_coord_t h = lv_area_get_height(a_p) / 2; - lv_coord_t max_radius = LV_MIN(w, h); + int32_t w = lv_area_get_width(a_p) / 2; + int32_t h = lv_area_get_height(a_p) / 2; + int32_t max_radius = LV_MIN(w, h); if(radius > max_radius) radius = max_radius; @@ -321,7 +321,7 @@ bool _lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p) * @param radius radius of `aholder_p` (e.g. for rounded rectangle) * @return true: `ain_p` is fully inside `aholder_p` */ -bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coord_t radius) +bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, int32_t radius) { bool is_in = false; @@ -362,7 +362,7 @@ bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coo * @param radius radius of `aholder_p` (e.g. for rounded rectangle) * @return true: `aout_p` is fully outside `aholder_p` */ -bool _lv_area_is_out(const lv_area_t * aout_p, const lv_area_t * aholder_p, lv_coord_t radius) +bool _lv_area_is_out(const lv_area_t * aout_p, const lv_area_t * aholder_p, int32_t radius) { if(aout_p->x2 < aholder_p->x1 || aout_p->y2 < aholder_p->y1 || aout_p->x1 > aholder_p->x2 || aout_p->y1 > aholder_p->y2) { @@ -405,11 +405,11 @@ bool _lv_area_is_equal(const lv_area_t * a, const lv_area_t * b) * @param align `LV_ALIGN_...` * @param res x/y coordinates where `to_align` align area should be placed */ -void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t align, lv_coord_t ofs_x, lv_coord_t ofs_y) +void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t align, int32_t ofs_x, int32_t ofs_y) { - lv_coord_t x; - lv_coord_t y; + int32_t x; + int32_t y; switch(align) { case LV_ALIGN_CENTER: x = lv_area_get_width(base) / 2 - lv_area_get_width(to_align) / 2; @@ -522,8 +522,8 @@ void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t alig x += base->x1; y += base->y1; - lv_coord_t w = lv_area_get_width(to_align); - lv_coord_t h = lv_area_get_height(to_align); + int32_t w = lv_area_get_width(to_align); + int32_t h = lv_area_get_height(to_align); to_align->x1 = x + ofs_x; to_align->y1 = y + ofs_y; to_align->x2 = to_align->x1 + w - 1; @@ -596,15 +596,15 @@ void lv_point_transform(lv_point_t * p, int32_t angle, int32_t zoom_x, int32_t z static bool lv_point_within_circle(const lv_area_t * area, const lv_point_t * p) { - lv_coord_t r = (area->x2 - area->x1) / 2; + int32_t r = (area->x2 - area->x1) / 2; /*Circle center*/ - lv_coord_t cx = area->x1 + r; - lv_coord_t cy = area->y1 + r; + int32_t cx = area->x1 + r; + int32_t cy = area->y1 + r; /*Simplify the code by moving everything to (0, 0)*/ - lv_coord_t px = p->x - cx; - lv_coord_t py = p->y - cy; + int32_t px = p->x - cx; + int32_t py = p->y - cy; uint32_t r_sqrd = r * r; uint32_t dist = (px * px) + (py * py); diff --git a/src/misc/lv_area.h b/src/misc/lv_area.h index f105ac4a9..fbdddb44b 100644 --- a/src/misc/lv_area.h +++ b/src/misc/lv_area.h @@ -26,14 +26,12 @@ extern "C" { * TYPEDEFS **********************/ -typedef int32_t lv_coord_t; - /** * Represents a point on the screen. */ typedef struct { - lv_coord_t x; - lv_coord_t y; + int32_t x; + int32_t y; } lv_point_t; typedef struct { @@ -43,10 +41,10 @@ typedef struct { /** Represents an area of the screen.*/ typedef struct { - lv_coord_t x1; - lv_coord_t y1; - lv_coord_t x2; - lv_coord_t y2; + int32_t x1; + int32_t y1; + int32_t x2; + int32_t y2; } lv_area_t; /** Alignments*/ @@ -119,7 +117,7 @@ typedef struct { * @param x2 right coordinate of the area * @param y2 bottom coordinate of the area */ -void lv_area_set(lv_area_t * area_p, lv_coord_t x1, lv_coord_t y1, lv_coord_t x2, lv_coord_t y2); +void lv_area_set(lv_area_t * area_p, int32_t x1, int32_t y1, int32_t x2, int32_t y2); /** * Copy an area @@ -139,9 +137,9 @@ inline static void lv_area_copy(lv_area_t * dest, const lv_area_t * src) * @param area_p pointer to an area * @return the width of the area (if x1 == x2 -> width = 1) */ -static inline lv_coord_t lv_area_get_width(const lv_area_t * area_p) +static inline int32_t lv_area_get_width(const lv_area_t * area_p) { - return (lv_coord_t)(area_p->x2 - area_p->x1 + 1); + return (int32_t)(area_p->x2 - area_p->x1 + 1); } /** @@ -149,9 +147,9 @@ static inline lv_coord_t lv_area_get_width(const lv_area_t * area_p) * @param area_p pointer to an area * @return the height of the area (if y1 == y2 -> height = 1) */ -static inline lv_coord_t lv_area_get_height(const lv_area_t * area_p) +static inline int32_t lv_area_get_height(const lv_area_t * area_p) { - return (lv_coord_t)(area_p->y2 - area_p->y1 + 1); + return (int32_t)(area_p->y2 - area_p->y1 + 1); } /** @@ -159,14 +157,14 @@ static inline lv_coord_t lv_area_get_height(const lv_area_t * area_p) * @param area_p pointer to an area * @param w the new width of the area (w == 1 makes x1 == x2) */ -void lv_area_set_width(lv_area_t * area_p, lv_coord_t w); +void lv_area_set_width(lv_area_t * area_p, int32_t w); /** * Set the height of an area * @param area_p pointer to an area * @param h the new height of the area (h == 1 makes y1 == y2) */ -void lv_area_set_height(lv_area_t * area_p, lv_coord_t h); +void lv_area_set_height(lv_area_t * area_p, int32_t h); /** * Set the position of an area (width and height will be kept) @@ -174,7 +172,7 @@ void lv_area_set_height(lv_area_t * area_p, lv_coord_t h); * @param x the new x coordinate of the area * @param y the new y coordinate of the area */ -void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y); +void _lv_area_set_pos(lv_area_t * area_p, int32_t x, int32_t y); /** * Return with area of an area (x * y) @@ -183,9 +181,9 @@ void _lv_area_set_pos(lv_area_t * area_p, lv_coord_t x, lv_coord_t y); */ uint32_t lv_area_get_size(const lv_area_t * area_p); -void lv_area_increase(lv_area_t * area, lv_coord_t w_extra, lv_coord_t h_extra); +void lv_area_increase(lv_area_t * area, int32_t w_extra, int32_t h_extra); -void lv_area_move(lv_area_t * area, lv_coord_t x_ofs, lv_coord_t y_ofs); +void lv_area_move(lv_area_t * area, int32_t x_ofs, int32_t y_ofs); /** * Get the common parts of two areas @@ -220,7 +218,7 @@ void _lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * @param radius radius of area (e.g. for rounded rectangle) * @return false:the point is out of the area */ -bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, lv_coord_t radius); +bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, int32_t radius); /** * Check if two area has common parts @@ -237,7 +235,7 @@ bool _lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p); * @param radius radius of `aholder_p` (e.g. for rounded rectangle) * @return true: `ain_p` is fully inside `aholder_p` */ -bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coord_t radius); +bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, int32_t radius); /** @@ -247,7 +245,7 @@ bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, lv_coo * @param radius radius of `aholder_p` (e.g. for rounded rectangle) * @return true: `aout_p` is fully outside `aholder_p` */ -bool _lv_area_is_out(const lv_area_t * aout_p, const lv_area_t * aholder_p, lv_coord_t radius); +bool _lv_area_is_out(const lv_area_t * aout_p, const lv_area_t * aholder_p, int32_t radius); /** * Check if 2 area is the same @@ -264,7 +262,7 @@ bool _lv_area_is_equal(const lv_area_t * a, const lv_area_t * b); * @param ofs_x X offset * @param ofs_y Y offset */ -void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t align, lv_coord_t ofs_x, lv_coord_t ofs_y); +void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t align, int32_t ofs_x, int32_t ofs_y); void lv_point_transform(lv_point_t * p, int32_t angle, int32_t zoom_x, int32_t zoom_y, const lv_point_t * pivot, bool zoom_first); @@ -308,17 +306,17 @@ LV_EXPORT_CONST_INT(LV_COORD_MAX); LV_EXPORT_CONST_INT(LV_COORD_MIN); /** - * Convert a percentage value to `lv_coord_t`. + * Convert a percentage value to `int32_t`. * Percentage values are stored in special range * @param x the percentage (0..1000) * @return a coordinate that stores the percentage */ -static inline lv_coord_t lv_pct(lv_coord_t x) +static inline int32_t lv_pct(int32_t x) { return LV_PCT(x); } -static inline lv_coord_t lv_pct_to_px(lv_coord_t v, lv_coord_t base) +static inline int32_t lv_pct_to_px(int32_t v, int32_t base) { if(LV_COORD_IS_PCT(v)) { return (LV_COORD_GET_PCT(v) * base) / 100; diff --git a/src/misc/lv_event.h b/src/misc/lv_event.h index bf8f6be69..0902ec30b 100644 --- a/src/misc/lv_event.h +++ b/src/misc/lv_event.h @@ -66,7 +66,7 @@ typedef enum { /** Drawing events*/ LV_EVENT_COVER_CHECK, /**< Check if the object fully covers an area. The event parameter is `lv_cover_check_info_t *`.*/ - LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Get the required extra draw area around the object (e.g. for shadow). The event parameter is `lv_coord_t *` to store the size.*/ + LV_EVENT_REFR_EXT_DRAW_SIZE, /**< Get the required extra draw area around the object (e.g. for shadow). The event parameter is `int32_t *` to store the size.*/ LV_EVENT_DRAW_MAIN_BEGIN, /**< Starting the main drawing phase*/ LV_EVENT_DRAW_MAIN, /**< Perform the main drawing*/ LV_EVENT_DRAW_MAIN_END, /**< Finishing the main drawing phase*/ diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index dd0e5c24b..6215f6697 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -557,13 +557,13 @@ uint8_t _lv_style_prop_lookup_flags(lv_style_prop_t prop); #include "lv_style_gen.h" -static inline void lv_style_set_size(lv_style_t * style, lv_coord_t width, lv_coord_t height) +static inline void lv_style_set_size(lv_style_t * style, int32_t width, int32_t height) { lv_style_set_width(style, width); lv_style_set_height(style, height); } -static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_pad_all(lv_style_t * style, int32_t value) { lv_style_set_pad_left(style, value); lv_style_set_pad_right(style, value); @@ -571,25 +571,25 @@ static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value) lv_style_set_pad_bottom(style, value); } -static inline void lv_style_set_pad_hor(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_pad_hor(lv_style_t * style, int32_t value) { lv_style_set_pad_left(style, value); lv_style_set_pad_right(style, value); } -static inline void lv_style_set_pad_ver(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_pad_ver(lv_style_t * style, int32_t value) { lv_style_set_pad_top(style, value); lv_style_set_pad_bottom(style, value); } -static inline void lv_style_set_pad_gap(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_pad_gap(lv_style_t * style, int32_t value) { lv_style_set_pad_row(style, value); lv_style_set_pad_column(style, value); } -static inline void lv_style_set_transform_scale(lv_style_t * style, lv_coord_t value) +static inline void lv_style_set_transform_scale(lv_style_t * style, int32_t value) { lv_style_set_transform_scale_x(style, value); lv_style_set_transform_scale_y(style, value); diff --git a/src/misc/lv_style_gen.c b/src/misc/lv_style_gen.c index 79b8d6baa..9e70895e4 100644 --- a/src/misc/lv_style_gen.c +++ b/src/misc/lv_style_gen.c @@ -10,7 +10,7 @@ #include "lv_style.h" -void lv_style_set_width(lv_style_t * style, lv_coord_t value) +void lv_style_set_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -20,7 +20,7 @@ void lv_style_set_width(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_WIDTH = LV_STYLE_WIDTH; -void lv_style_set_min_width(lv_style_t * style, lv_coord_t value) +void lv_style_set_min_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -30,7 +30,7 @@ void lv_style_set_min_width(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_MIN_WIDTH = LV_STYLE_MIN_WIDTH; -void lv_style_set_max_width(lv_style_t * style, lv_coord_t value) +void lv_style_set_max_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -40,7 +40,7 @@ void lv_style_set_max_width(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_MAX_WIDTH = LV_STYLE_MAX_WIDTH; -void lv_style_set_height(lv_style_t * style, lv_coord_t value) +void lv_style_set_height(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -50,7 +50,7 @@ void lv_style_set_height(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_HEIGHT = LV_STYLE_HEIGHT; -void lv_style_set_min_height(lv_style_t * style, lv_coord_t value) +void lv_style_set_min_height(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -60,7 +60,7 @@ void lv_style_set_min_height(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_MIN_HEIGHT = LV_STYLE_MIN_HEIGHT; -void lv_style_set_max_height(lv_style_t * style, lv_coord_t value) +void lv_style_set_max_height(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -70,7 +70,7 @@ void lv_style_set_max_height(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_MAX_HEIGHT = LV_STYLE_MAX_HEIGHT; -void lv_style_set_x(lv_style_t * style, lv_coord_t value) +void lv_style_set_x(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -80,7 +80,7 @@ void lv_style_set_x(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_X = LV_STYLE_X; -void lv_style_set_y(lv_style_t * style, lv_coord_t value) +void lv_style_set_y(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -100,7 +100,7 @@ void lv_style_set_align(lv_style_t * style, lv_align_t value) const lv_style_prop_t _lv_style_const_prop_id_ALIGN = LV_STYLE_ALIGN; -void lv_style_set_transform_width(lv_style_t * style, lv_coord_t value) +void lv_style_set_transform_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -110,7 +110,7 @@ void lv_style_set_transform_width(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_WIDTH = LV_STYLE_TRANSFORM_WIDTH; -void lv_style_set_transform_height(lv_style_t * style, lv_coord_t value) +void lv_style_set_transform_height(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -120,7 +120,7 @@ void lv_style_set_transform_height(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_HEIGHT = LV_STYLE_TRANSFORM_HEIGHT; -void lv_style_set_translate_x(lv_style_t * style, lv_coord_t value) +void lv_style_set_translate_x(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -130,7 +130,7 @@ void lv_style_set_translate_x(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_TRANSLATE_X = LV_STYLE_TRANSLATE_X; -void lv_style_set_translate_y(lv_style_t * style, lv_coord_t value) +void lv_style_set_translate_y(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -140,7 +140,7 @@ void lv_style_set_translate_y(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_TRANSLATE_Y = LV_STYLE_TRANSLATE_Y; -void lv_style_set_transform_scale_x(lv_style_t * style, lv_coord_t value) +void lv_style_set_transform_scale_x(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -150,7 +150,7 @@ void lv_style_set_transform_scale_x(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SCALE_X = LV_STYLE_TRANSFORM_SCALE_X; -void lv_style_set_transform_scale_y(lv_style_t * style, lv_coord_t value) +void lv_style_set_transform_scale_y(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -160,7 +160,7 @@ void lv_style_set_transform_scale_y(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SCALE_Y = LV_STYLE_TRANSFORM_SCALE_Y; -void lv_style_set_transform_rotation(lv_style_t * style, lv_coord_t value) +void lv_style_set_transform_rotation(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -170,7 +170,7 @@ void lv_style_set_transform_rotation(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_ROTATION = LV_STYLE_TRANSFORM_ROTATION; -void lv_style_set_transform_pivot_x(lv_style_t * style, lv_coord_t value) +void lv_style_set_transform_pivot_x(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -180,7 +180,7 @@ void lv_style_set_transform_pivot_x(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_PIVOT_X = LV_STYLE_TRANSFORM_PIVOT_X; -void lv_style_set_transform_pivot_y(lv_style_t * style, lv_coord_t value) +void lv_style_set_transform_pivot_y(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -190,7 +190,7 @@ void lv_style_set_transform_pivot_y(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_PIVOT_Y = LV_STYLE_TRANSFORM_PIVOT_Y; -void lv_style_set_pad_top(lv_style_t * style, lv_coord_t value) +void lv_style_set_pad_top(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -200,7 +200,7 @@ void lv_style_set_pad_top(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_PAD_TOP = LV_STYLE_PAD_TOP; -void lv_style_set_pad_bottom(lv_style_t * style, lv_coord_t value) +void lv_style_set_pad_bottom(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -210,7 +210,7 @@ void lv_style_set_pad_bottom(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_PAD_BOTTOM = LV_STYLE_PAD_BOTTOM; -void lv_style_set_pad_left(lv_style_t * style, lv_coord_t value) +void lv_style_set_pad_left(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -220,7 +220,7 @@ void lv_style_set_pad_left(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_PAD_LEFT = LV_STYLE_PAD_LEFT; -void lv_style_set_pad_right(lv_style_t * style, lv_coord_t value) +void lv_style_set_pad_right(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -230,7 +230,7 @@ void lv_style_set_pad_right(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_PAD_RIGHT = LV_STYLE_PAD_RIGHT; -void lv_style_set_pad_row(lv_style_t * style, lv_coord_t value) +void lv_style_set_pad_row(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -240,7 +240,7 @@ void lv_style_set_pad_row(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_PAD_ROW = LV_STYLE_PAD_ROW; -void lv_style_set_pad_column(lv_style_t * style, lv_coord_t value) +void lv_style_set_pad_column(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -250,7 +250,7 @@ void lv_style_set_pad_column(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_PAD_COLUMN = LV_STYLE_PAD_COLUMN; -void lv_style_set_margin_top(lv_style_t * style, lv_coord_t value) +void lv_style_set_margin_top(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -260,7 +260,7 @@ void lv_style_set_margin_top(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_MARGIN_TOP = LV_STYLE_MARGIN_TOP; -void lv_style_set_margin_bottom(lv_style_t * style, lv_coord_t value) +void lv_style_set_margin_bottom(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -270,7 +270,7 @@ void lv_style_set_margin_bottom(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_MARGIN_BOTTOM = LV_STYLE_MARGIN_BOTTOM; -void lv_style_set_margin_left(lv_style_t * style, lv_coord_t value) +void lv_style_set_margin_left(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -280,7 +280,7 @@ void lv_style_set_margin_left(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_MARGIN_LEFT = LV_STYLE_MARGIN_LEFT; -void lv_style_set_margin_right(lv_style_t * style, lv_coord_t value) +void lv_style_set_margin_right(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -330,7 +330,7 @@ void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value) const lv_style_prop_t _lv_style_const_prop_id_BG_GRAD_DIR = LV_STYLE_BG_GRAD_DIR; -void lv_style_set_bg_main_stop(lv_style_t * style, lv_coord_t value) +void lv_style_set_bg_main_stop(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -340,7 +340,7 @@ void lv_style_set_bg_main_stop(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_BG_MAIN_STOP = LV_STYLE_BG_MAIN_STOP; -void lv_style_set_bg_grad_stop(lv_style_t * style, lv_coord_t value) +void lv_style_set_bg_grad_stop(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -450,7 +450,7 @@ void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value) const lv_style_prop_t _lv_style_const_prop_id_BORDER_OPA = LV_STYLE_BORDER_OPA; -void lv_style_set_border_width(lv_style_t * style, lv_coord_t value) +void lv_style_set_border_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -480,7 +480,7 @@ void lv_style_set_border_post(lv_style_t * style, bool value) const lv_style_prop_t _lv_style_const_prop_id_BORDER_POST = LV_STYLE_BORDER_POST; -void lv_style_set_outline_width(lv_style_t * style, lv_coord_t value) +void lv_style_set_outline_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -510,7 +510,7 @@ void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value) const lv_style_prop_t _lv_style_const_prop_id_OUTLINE_OPA = LV_STYLE_OUTLINE_OPA; -void lv_style_set_outline_pad(lv_style_t * style, lv_coord_t value) +void lv_style_set_outline_pad(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -520,7 +520,7 @@ void lv_style_set_outline_pad(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_OUTLINE_PAD = LV_STYLE_OUTLINE_PAD; -void lv_style_set_shadow_width(lv_style_t * style, lv_coord_t value) +void lv_style_set_shadow_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -530,7 +530,7 @@ void lv_style_set_shadow_width(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_SHADOW_WIDTH = LV_STYLE_SHADOW_WIDTH; -void lv_style_set_shadow_offset_x(lv_style_t * style, lv_coord_t value) +void lv_style_set_shadow_offset_x(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -540,7 +540,7 @@ void lv_style_set_shadow_offset_x(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_SHADOW_OFFSET_X = LV_STYLE_SHADOW_OFFSET_X; -void lv_style_set_shadow_offset_y(lv_style_t * style, lv_coord_t value) +void lv_style_set_shadow_offset_y(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -550,7 +550,7 @@ void lv_style_set_shadow_offset_y(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_SHADOW_OFFSET_Y = LV_STYLE_SHADOW_OFFSET_Y; -void lv_style_set_shadow_spread(lv_style_t * style, lv_coord_t value) +void lv_style_set_shadow_spread(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -610,7 +610,7 @@ void lv_style_set_image_recolor_opa(lv_style_t * style, lv_opa_t value) const lv_style_prop_t _lv_style_const_prop_id_IMAGE_RECOLOR_OPA = LV_STYLE_IMAGE_RECOLOR_OPA; -void lv_style_set_line_width(lv_style_t * style, lv_coord_t value) +void lv_style_set_line_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -620,7 +620,7 @@ void lv_style_set_line_width(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_LINE_WIDTH = LV_STYLE_LINE_WIDTH; -void lv_style_set_line_dash_width(lv_style_t * style, lv_coord_t value) +void lv_style_set_line_dash_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -630,7 +630,7 @@ void lv_style_set_line_dash_width(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_LINE_DASH_WIDTH = LV_STYLE_LINE_DASH_WIDTH; -void lv_style_set_line_dash_gap(lv_style_t * style, lv_coord_t value) +void lv_style_set_line_dash_gap(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -670,7 +670,7 @@ void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value) const lv_style_prop_t _lv_style_const_prop_id_LINE_OPA = LV_STYLE_LINE_OPA; -void lv_style_set_arc_width(lv_style_t * style, lv_coord_t value) +void lv_style_set_arc_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -750,7 +750,7 @@ void lv_style_set_text_font(lv_style_t * style, const lv_font_t * value) const lv_style_prop_t _lv_style_const_prop_id_TEXT_FONT = LV_STYLE_TEXT_FONT; -void lv_style_set_text_letter_space(lv_style_t * style, lv_coord_t value) +void lv_style_set_text_letter_space(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -760,7 +760,7 @@ void lv_style_set_text_letter_space(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_TEXT_LETTER_SPACE = LV_STYLE_TEXT_LETTER_SPACE; -void lv_style_set_text_line_space(lv_style_t * style, lv_coord_t value) +void lv_style_set_text_line_space(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -790,7 +790,7 @@ void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value) const lv_style_prop_t _lv_style_const_prop_id_TEXT_ALIGN = LV_STYLE_TEXT_ALIGN; -void lv_style_set_radius(lv_style_t * style, lv_coord_t value) +void lv_style_set_radius(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -970,7 +970,7 @@ void lv_style_set_flex_grow(lv_style_t * style, uint8_t value) const lv_style_prop_t _lv_style_const_prop_id_FLEX_GROW = LV_STYLE_FLEX_GROW; -void lv_style_set_grid_column_dsc_array(lv_style_t * style, const lv_coord_t * value) +void lv_style_set_grid_column_dsc_array(lv_style_t * style, const int32_t * value) { lv_style_value_t v = { .ptr = value @@ -990,7 +990,7 @@ void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value) const lv_style_prop_t _lv_style_const_prop_id_GRID_COLUMN_ALIGN = LV_STYLE_GRID_COLUMN_ALIGN; -void lv_style_set_grid_row_dsc_array(lv_style_t * style, const lv_coord_t * value) +void lv_style_set_grid_row_dsc_array(lv_style_t * style, const int32_t * value) { lv_style_value_t v = { .ptr = value @@ -1010,7 +1010,7 @@ void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value) const lv_style_prop_t _lv_style_const_prop_id_GRID_ROW_ALIGN = LV_STYLE_GRID_ROW_ALIGN; -void lv_style_set_grid_cell_column_pos(lv_style_t * style, lv_coord_t value) +void lv_style_set_grid_cell_column_pos(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -1030,7 +1030,7 @@ void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_grid_align_t value) const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_X_ALIGN = LV_STYLE_GRID_CELL_X_ALIGN; -void lv_style_set_grid_cell_column_span(lv_style_t * style, lv_coord_t value) +void lv_style_set_grid_cell_column_span(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -1040,7 +1040,7 @@ void lv_style_set_grid_cell_column_span(lv_style_t * style, lv_coord_t value) const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_COLUMN_SPAN = LV_STYLE_GRID_CELL_COLUMN_SPAN; -void lv_style_set_grid_cell_row_pos(lv_style_t * style, lv_coord_t value) +void lv_style_set_grid_cell_row_pos(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value @@ -1060,7 +1060,7 @@ void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_grid_align_t value) const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_Y_ALIGN = LV_STYLE_GRID_CELL_Y_ALIGN; -void lv_style_set_grid_cell_row_span(lv_style_t * style, lv_coord_t value) +void lv_style_set_grid_cell_row_span(lv_style_t * style, int32_t value) { lv_style_value_t v = { .num = (int32_t)value diff --git a/src/misc/lv_style_gen.h b/src/misc/lv_style_gen.h index 2af32055b..95c12ee8e 100644 --- a/src/misc/lv_style_gen.h +++ b/src/misc/lv_style_gen.h @@ -10,61 +10,61 @@ #ifndef LV_STYLE_GEN_H #define LV_STYLE_GEN_H -void lv_style_set_width(lv_style_t * style, lv_coord_t value); +void lv_style_set_width(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_WIDTH; -void lv_style_set_min_width(lv_style_t * style, lv_coord_t value); +void lv_style_set_min_width(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_MIN_WIDTH; -void lv_style_set_max_width(lv_style_t * style, lv_coord_t value); +void lv_style_set_max_width(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_MAX_WIDTH; -void lv_style_set_height(lv_style_t * style, lv_coord_t value); +void lv_style_set_height(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_HEIGHT; -void lv_style_set_min_height(lv_style_t * style, lv_coord_t value); +void lv_style_set_min_height(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_MIN_HEIGHT; -void lv_style_set_max_height(lv_style_t * style, lv_coord_t value); +void lv_style_set_max_height(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_MAX_HEIGHT; -void lv_style_set_x(lv_style_t * style, lv_coord_t value); +void lv_style_set_x(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_X; -void lv_style_set_y(lv_style_t * style, lv_coord_t value); +void lv_style_set_y(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_Y; void lv_style_set_align(lv_style_t * style, lv_align_t value); extern const lv_style_prop_t _lv_style_const_prop_id_ALIGN; -void lv_style_set_transform_width(lv_style_t * style, lv_coord_t value); +void lv_style_set_transform_width(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_WIDTH; -void lv_style_set_transform_height(lv_style_t * style, lv_coord_t value); +void lv_style_set_transform_height(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_HEIGHT; -void lv_style_set_translate_x(lv_style_t * style, lv_coord_t value); +void lv_style_set_translate_x(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TRANSLATE_X; -void lv_style_set_translate_y(lv_style_t * style, lv_coord_t value); +void lv_style_set_translate_y(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TRANSLATE_Y; -void lv_style_set_transform_scale_x(lv_style_t * style, lv_coord_t value); +void lv_style_set_transform_scale_x(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SCALE_X; -void lv_style_set_transform_scale_y(lv_style_t * style, lv_coord_t value); +void lv_style_set_transform_scale_y(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SCALE_Y; -void lv_style_set_transform_rotation(lv_style_t * style, lv_coord_t value); +void lv_style_set_transform_rotation(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_ROTATION; -void lv_style_set_transform_pivot_x(lv_style_t * style, lv_coord_t value); +void lv_style_set_transform_pivot_x(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_PIVOT_X; -void lv_style_set_transform_pivot_y(lv_style_t * style, lv_coord_t value); +void lv_style_set_transform_pivot_y(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_PIVOT_Y; -void lv_style_set_pad_top(lv_style_t * style, lv_coord_t value); +void lv_style_set_pad_top(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_PAD_TOP; -void lv_style_set_pad_bottom(lv_style_t * style, lv_coord_t value); +void lv_style_set_pad_bottom(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_PAD_BOTTOM; -void lv_style_set_pad_left(lv_style_t * style, lv_coord_t value); +void lv_style_set_pad_left(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_PAD_LEFT; -void lv_style_set_pad_right(lv_style_t * style, lv_coord_t value); +void lv_style_set_pad_right(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_PAD_RIGHT; -void lv_style_set_pad_row(lv_style_t * style, lv_coord_t value); +void lv_style_set_pad_row(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_PAD_ROW; -void lv_style_set_pad_column(lv_style_t * style, lv_coord_t value); +void lv_style_set_pad_column(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_PAD_COLUMN; -void lv_style_set_margin_top(lv_style_t * style, lv_coord_t value); +void lv_style_set_margin_top(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_MARGIN_TOP; -void lv_style_set_margin_bottom(lv_style_t * style, lv_coord_t value); +void lv_style_set_margin_bottom(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_MARGIN_BOTTOM; -void lv_style_set_margin_left(lv_style_t * style, lv_coord_t value); +void lv_style_set_margin_left(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_MARGIN_LEFT; -void lv_style_set_margin_right(lv_style_t * style, lv_coord_t value); +void lv_style_set_margin_right(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_MARGIN_RIGHT; void lv_style_set_bg_color(lv_style_t * style, lv_color_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BG_COLOR; @@ -74,9 +74,9 @@ void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BG_GRAD_COLOR; void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BG_GRAD_DIR; -void lv_style_set_bg_main_stop(lv_style_t * style, lv_coord_t value); +void lv_style_set_bg_main_stop(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BG_MAIN_STOP; -void lv_style_set_bg_grad_stop(lv_style_t * style, lv_coord_t value); +void lv_style_set_bg_grad_stop(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BG_GRAD_STOP; void lv_style_set_bg_main_opa(lv_style_t * style, lv_opa_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BG_MAIN_OPA; @@ -98,27 +98,27 @@ void lv_style_set_border_color(lv_style_t * style, lv_color_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BORDER_COLOR; void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BORDER_OPA; -void lv_style_set_border_width(lv_style_t * style, lv_coord_t value); +void lv_style_set_border_width(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BORDER_WIDTH; void lv_style_set_border_side(lv_style_t * style, lv_border_side_t value); extern const lv_style_prop_t _lv_style_const_prop_id_BORDER_SIDE; void lv_style_set_border_post(lv_style_t * style, bool value); extern const lv_style_prop_t _lv_style_const_prop_id_BORDER_POST; -void lv_style_set_outline_width(lv_style_t * style, lv_coord_t value); +void lv_style_set_outline_width(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_OUTLINE_WIDTH; void lv_style_set_outline_color(lv_style_t * style, lv_color_t value); extern const lv_style_prop_t _lv_style_const_prop_id_OUTLINE_COLOR; void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value); extern const lv_style_prop_t _lv_style_const_prop_id_OUTLINE_OPA; -void lv_style_set_outline_pad(lv_style_t * style, lv_coord_t value); +void lv_style_set_outline_pad(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_OUTLINE_PAD; -void lv_style_set_shadow_width(lv_style_t * style, lv_coord_t value); +void lv_style_set_shadow_width(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_SHADOW_WIDTH; -void lv_style_set_shadow_offset_x(lv_style_t * style, lv_coord_t value); +void lv_style_set_shadow_offset_x(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_SHADOW_OFFSET_X; -void lv_style_set_shadow_offset_y(lv_style_t * style, lv_coord_t value); +void lv_style_set_shadow_offset_y(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_SHADOW_OFFSET_Y; -void lv_style_set_shadow_spread(lv_style_t * style, lv_coord_t value); +void lv_style_set_shadow_spread(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_SHADOW_SPREAD; void lv_style_set_shadow_color(lv_style_t * style, lv_color_t value); extern const lv_style_prop_t _lv_style_const_prop_id_SHADOW_COLOR; @@ -130,11 +130,11 @@ void lv_style_set_image_recolor(lv_style_t * style, lv_color_t value); extern const lv_style_prop_t _lv_style_const_prop_id_IMAGE_RECOLOR; void lv_style_set_image_recolor_opa(lv_style_t * style, lv_opa_t value); extern const lv_style_prop_t _lv_style_const_prop_id_IMAGE_RECOLOR_OPA; -void lv_style_set_line_width(lv_style_t * style, lv_coord_t value); +void lv_style_set_line_width(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_LINE_WIDTH; -void lv_style_set_line_dash_width(lv_style_t * style, lv_coord_t value); +void lv_style_set_line_dash_width(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_LINE_DASH_WIDTH; -void lv_style_set_line_dash_gap(lv_style_t * style, lv_coord_t value); +void lv_style_set_line_dash_gap(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_LINE_DASH_GAP; void lv_style_set_line_rounded(lv_style_t * style, bool value); extern const lv_style_prop_t _lv_style_const_prop_id_LINE_ROUNDED; @@ -142,7 +142,7 @@ void lv_style_set_line_color(lv_style_t * style, lv_color_t value); extern const lv_style_prop_t _lv_style_const_prop_id_LINE_COLOR; void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value); extern const lv_style_prop_t _lv_style_const_prop_id_LINE_OPA; -void lv_style_set_arc_width(lv_style_t * style, lv_coord_t value); +void lv_style_set_arc_width(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_ARC_WIDTH; void lv_style_set_arc_rounded(lv_style_t * style, bool value); extern const lv_style_prop_t _lv_style_const_prop_id_ARC_ROUNDED; @@ -158,15 +158,15 @@ void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TEXT_OPA; void lv_style_set_text_font(lv_style_t * style, const lv_font_t * value); extern const lv_style_prop_t _lv_style_const_prop_id_TEXT_FONT; -void lv_style_set_text_letter_space(lv_style_t * style, lv_coord_t value); +void lv_style_set_text_letter_space(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TEXT_LETTER_SPACE; -void lv_style_set_text_line_space(lv_style_t * style, lv_coord_t value); +void lv_style_set_text_line_space(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TEXT_LINE_SPACE; void lv_style_set_text_decor(lv_style_t * style, lv_text_decor_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TEXT_DECOR; void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value); extern const lv_style_prop_t _lv_style_const_prop_id_TEXT_ALIGN; -void lv_style_set_radius(lv_style_t * style, lv_coord_t value); +void lv_style_set_radius(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_RADIUS; void lv_style_set_clip_corner(lv_style_t * style, bool value); extern const lv_style_prop_t _lv_style_const_prop_id_CLIP_CORNER; @@ -202,25 +202,25 @@ void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value); extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_TRACK_PLACE; void lv_style_set_flex_grow(lv_style_t * style, uint8_t value); extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_GROW; -void lv_style_set_grid_column_dsc_array(lv_style_t * style, const lv_coord_t * value); +void lv_style_set_grid_column_dsc_array(lv_style_t * style, const int32_t * value); extern const lv_style_prop_t _lv_style_const_prop_id_GRID_COLUMN_DSC_ARRAY; void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value); extern const lv_style_prop_t _lv_style_const_prop_id_GRID_COLUMN_ALIGN; -void lv_style_set_grid_row_dsc_array(lv_style_t * style, const lv_coord_t * value); +void lv_style_set_grid_row_dsc_array(lv_style_t * style, const int32_t * value); extern const lv_style_prop_t _lv_style_const_prop_id_GRID_ROW_DSC_ARRAY; void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value); extern const lv_style_prop_t _lv_style_const_prop_id_GRID_ROW_ALIGN; -void lv_style_set_grid_cell_column_pos(lv_style_t * style, lv_coord_t value); +void lv_style_set_grid_cell_column_pos(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_COLUMN_POS; void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_grid_align_t value); extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_X_ALIGN; -void lv_style_set_grid_cell_column_span(lv_style_t * style, lv_coord_t value); +void lv_style_set_grid_cell_column_span(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_COLUMN_SPAN; -void lv_style_set_grid_cell_row_pos(lv_style_t * style, lv_coord_t value); +void lv_style_set_grid_cell_row_pos(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_POS; void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_grid_align_t value); extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_Y_ALIGN; -void lv_style_set_grid_cell_row_span(lv_style_t * style, lv_coord_t value); +void lv_style_set_grid_cell_row_span(lv_style_t * style, int32_t value); extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_SPAN; #define LV_STYLE_CONST_WIDTH(val) \ diff --git a/src/misc/lv_text.c b/src/misc/lv_text.c index 4355ca2e3..44315a9ee 100644 --- a/src/misc/lv_text.c +++ b/src/misc/lv_text.c @@ -89,8 +89,8 @@ * GLOBAL FUNCTIONS **********************/ -void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, lv_coord_t letter_space, - lv_coord_t line_space, lv_coord_t max_width, lv_text_flag_t flag) +void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, int32_t letter_space, + int32_t line_space, int32_t max_width, lv_text_flag_t flag) { size_res->x = 0; size_res->y = 0; @@ -108,7 +108,7 @@ void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t while(text[line_start] != '\0') { new_line_start += _lv_text_get_next_line(&text[line_start], font, letter_space, max_width, NULL, flag); - if((unsigned long)size_res->y + (unsigned long)letter_height + (unsigned long)line_space > LV_MAX_OF(lv_coord_t)) { + if((unsigned long)size_res->y + (unsigned long)letter_height + (unsigned long)line_space > LV_MAX_OF(int32_t)) { LV_LOG_WARN("integer overflow while calculating text height"); return; } @@ -118,7 +118,7 @@ void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t } /*Calculate the longest line*/ - lv_coord_t act_line_length = lv_text_get_width(&text[line_start], new_line_start - line_start, font, letter_space); + int32_t act_line_length = lv_text_get_width(&text[line_start], new_line_start - line_start, font, letter_space); size_res->x = LV_MAX(act_line_length, size_res->x); line_start = new_line_start; @@ -168,7 +168,7 @@ void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t * @return the index of the first char of the next word (in byte index not letter index. With UTF-8 they are different) */ static uint32_t lv_text_get_next_word(const char * txt, const lv_font_t * font, - lv_coord_t letter_space, lv_coord_t max_width, + int32_t letter_space, int32_t max_width, lv_text_flag_t flag, uint32_t * word_w_ptr, bool force) { if(txt == NULL || txt[0] == '\0') return 0; @@ -179,8 +179,8 @@ static uint32_t lv_text_get_next_word(const char * txt, const lv_font_t * font, uint32_t i = 0, i_next = 0, i_next_next = 0; /*Iterating index into txt*/ uint32_t letter = 0; /*Letter at i*/ uint32_t letter_next = 0; /*Letter at i_next*/ - lv_coord_t letter_w; - lv_coord_t cur_w = 0; /*Pixel Width of transversed string*/ + int32_t letter_w; + int32_t cur_w = 0; /*Pixel Width of transversed string*/ uint32_t word_len = 0; /*Number of characters in the transversed word*/ uint32_t break_index = NO_BREAK_FOUND; /*only used for "long" words*/ uint32_t break_letter_count = 0; /*Number of characters up to the long word break point*/ @@ -272,8 +272,8 @@ static uint32_t lv_text_get_next_word(const char * txt, const lv_font_t * font, } uint32_t _lv_text_get_next_line(const char * txt, const lv_font_t * font, - lv_coord_t letter_space, lv_coord_t max_width, - lv_coord_t * used_width, lv_text_flag_t flag) + int32_t letter_space, int32_t max_width, + int32_t * used_width, lv_text_flag_t flag) { if(used_width) *used_width = 0; @@ -281,7 +281,7 @@ uint32_t _lv_text_get_next_line(const char * txt, const lv_font_t * font, if(txt[0] == '\0') return 0; if(font == NULL) return 0; - lv_coord_t line_w = 0; + int32_t line_w = 0; /*If max_width doesn't matter simply find the new line character *without thinking about word wrapping*/ @@ -334,14 +334,14 @@ uint32_t _lv_text_get_next_line(const char * txt, const lv_font_t * font, return i; } -lv_coord_t lv_text_get_width(const char * txt, uint32_t length, const lv_font_t * font, lv_coord_t letter_space) +int32_t lv_text_get_width(const char * txt, uint32_t length, const lv_font_t * font, int32_t letter_space) { if(txt == NULL) return 0; if(font == NULL) return 0; if(txt[0] == '\0') return 0; uint32_t i = 0; - lv_coord_t width = 0; + int32_t width = 0; if(length != 0) { while(i < length) { @@ -349,7 +349,7 @@ lv_coord_t lv_text_get_width(const char * txt, uint32_t length, const lv_font_t uint32_t letter_next; _lv_text_encoded_letter_next_2(txt, &letter, &letter_next, &i); - lv_coord_t char_width = lv_font_get_glyph_width(font, letter, letter_next); + int32_t char_width = lv_font_get_glyph_width(font, letter, letter_next); if(char_width > 0) { width += char_width; width += letter_space; diff --git a/src/misc/lv_text.h b/src/misc/lv_text.h index 40729e688..65d83cd5e 100644 --- a/src/misc/lv_text.h +++ b/src/misc/lv_text.h @@ -82,8 +82,8 @@ typedef uint8_t lv_text_align_t; * line breaks */ -void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, lv_coord_t letter_space, - lv_coord_t line_space, lv_coord_t max_width, lv_text_flag_t flag); +void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, int32_t letter_space, + int32_t line_space, int32_t max_width, lv_text_flag_t flag); /** * Get the next line of text. Check line length and break chars too. @@ -98,8 +98,8 @@ void lv_text_get_size(lv_point_t * size_res, const char * text, const lv_font_t * @return the index of the first char of the new line (in byte index not letter index. With UTF-8 * they are different) */ -uint32_t _lv_text_get_next_line(const char * txt, const lv_font_t * font, lv_coord_t letter_space, - lv_coord_t max_width, lv_coord_t * used_width, lv_text_flag_t flag); +uint32_t _lv_text_get_next_line(const char * txt, const lv_font_t * font, int32_t letter_space, + int32_t max_width, int32_t * used_width, lv_text_flag_t flag); /** * Give the length of a text with a given font @@ -110,7 +110,7 @@ uint32_t _lv_text_get_next_line(const char * txt, const lv_font_t * font, lv_coo * @param letter_space letter space * @return length of a char_num long text */ -lv_coord_t lv_text_get_width(const char * txt, uint32_t length, const lv_font_t * font, lv_coord_t letter_space); +int32_t lv_text_get_width(const char * txt, uint32_t length, const lv_font_t * font, int32_t letter_space); /** * Insert a string into an other diff --git a/src/others/gridnav/lv_gridnav.c b/src/others/gridnav/lv_gridnav.c index c5a6f9681..4f4ba1a56 100644 --- a/src/others/gridnav/lv_gridnav.c +++ b/src/others/gridnav/lv_gridnav.c @@ -44,8 +44,8 @@ static lv_obj_t * find_chid(lv_obj_t * obj, lv_obj_t * start_child, find_mode_t static lv_obj_t * find_first_focusable(lv_obj_t * obj); static lv_obj_t * find_last_focusable(lv_obj_t * obj); static bool obj_is_focuable(lv_obj_t * obj); -static lv_coord_t get_x_center(lv_obj_t * obj); -static lv_coord_t get_y_center(lv_obj_t * obj); +static int32_t get_x_center(lv_obj_t * obj); +static int32_t get_y_center(lv_obj_t * obj); /********************** * STATIC VARIABLES @@ -149,7 +149,7 @@ static void gridnav_event_cb(lv_event_t * e) if(key == LV_KEY_RIGHT) { if((dsc->ctrl & LV_GRIDNAV_CTRL_SCROLL_FIRST) && lv_obj_has_flag(dsc->focused_obj, LV_OBJ_FLAG_SCROLLABLE) && lv_obj_get_scroll_right(dsc->focused_obj) > 0) { - lv_coord_t d = lv_obj_get_width(dsc->focused_obj) / 4; + int32_t d = lv_obj_get_width(dsc->focused_obj) / 4; if(d <= 0) d = 1; lv_obj_scroll_by_bounded(dsc->focused_obj, -d, 0, LV_ANIM_ON); } @@ -169,7 +169,7 @@ static void gridnav_event_cb(lv_event_t * e) else if(key == LV_KEY_LEFT) { if((dsc->ctrl & LV_GRIDNAV_CTRL_SCROLL_FIRST) && lv_obj_has_flag(dsc->focused_obj, LV_OBJ_FLAG_SCROLLABLE) && lv_obj_get_scroll_left(dsc->focused_obj) > 0) { - lv_coord_t d = lv_obj_get_width(dsc->focused_obj) / 4; + int32_t d = lv_obj_get_width(dsc->focused_obj) / 4; if(d <= 0) d = 1; lv_obj_scroll_by_bounded(dsc->focused_obj, d, 0, LV_ANIM_ON); } @@ -189,7 +189,7 @@ static void gridnav_event_cb(lv_event_t * e) else if(key == LV_KEY_DOWN) { if((dsc->ctrl & LV_GRIDNAV_CTRL_SCROLL_FIRST) && lv_obj_has_flag(dsc->focused_obj, LV_OBJ_FLAG_SCROLLABLE) && lv_obj_get_scroll_bottom(dsc->focused_obj) > 0) { - lv_coord_t d = lv_obj_get_height(dsc->focused_obj) / 4; + int32_t d = lv_obj_get_height(dsc->focused_obj) / 4; if(d <= 0) d = 1; lv_obj_scroll_by_bounded(dsc->focused_obj, 0, -d, LV_ANIM_ON); } @@ -208,7 +208,7 @@ static void gridnav_event_cb(lv_event_t * e) else if(key == LV_KEY_UP) { if((dsc->ctrl & LV_GRIDNAV_CTRL_SCROLL_FIRST) && lv_obj_has_flag(dsc->focused_obj, LV_OBJ_FLAG_SCROLLABLE) && lv_obj_get_scroll_top(dsc->focused_obj) > 0) { - lv_coord_t d = lv_obj_get_height(dsc->focused_obj) / 4; + int32_t d = lv_obj_get_height(dsc->focused_obj) / 4; if(d <= 0) d = 1; lv_obj_scroll_by_bounded(dsc->focused_obj, 0, d, LV_ANIM_ON); } @@ -289,22 +289,22 @@ static void gridnav_event_cb(lv_event_t * e) static lv_obj_t * find_chid(lv_obj_t * obj, lv_obj_t * start_child, find_mode_t mode) { - lv_coord_t x_start = get_x_center(start_child); - lv_coord_t y_start = get_y_center(start_child); + int32_t x_start = get_x_center(start_child); + int32_t y_start = get_y_center(start_child); uint32_t child_cnt = lv_obj_get_child_cnt(obj); lv_obj_t * guess = NULL; - lv_coord_t x_err_guess = LV_COORD_MAX; - lv_coord_t y_err_guess = LV_COORD_MAX; - lv_coord_t h_half = lv_obj_get_height(start_child) / 2; - lv_coord_t h_max = lv_obj_get_height(obj) + lv_obj_get_scroll_top(obj) + lv_obj_get_scroll_bottom(obj); + int32_t x_err_guess = LV_COORD_MAX; + int32_t y_err_guess = LV_COORD_MAX; + int32_t h_half = lv_obj_get_height(start_child) / 2; + int32_t h_max = lv_obj_get_height(obj) + lv_obj_get_scroll_top(obj) + lv_obj_get_scroll_bottom(obj); uint32_t i; for(i = 0; i < child_cnt; i++) { lv_obj_t * child = lv_obj_get_child(obj, i); if(child == start_child) continue; if(obj_is_focuable(child) == false) continue; - lv_coord_t x_err = 0; - lv_coord_t y_err = 0; + int32_t x_err = 0; + int32_t y_err = 0; switch(mode) { case FIND_LEFT: x_err = get_x_center(child) - x_start; @@ -387,12 +387,12 @@ static bool obj_is_focuable(lv_obj_t * obj) else return false; } -static lv_coord_t get_x_center(lv_obj_t * obj) +static int32_t get_x_center(lv_obj_t * obj) { return obj->coords.x1 + lv_area_get_width(&obj->coords) / 2; } -static lv_coord_t get_y_center(lv_obj_t * obj) +static int32_t get_y_center(lv_obj_t * obj) { return obj->coords.y1 + lv_area_get_height(&obj->coords) / 2; } diff --git a/src/others/imgfont/lv_imgfont.c b/src/others/imgfont/lv_imgfont.c index f669db34d..1a38a4c0b 100644 --- a/src/others/imgfont/lv_imgfont.c +++ b/src/others/imgfont/lv_imgfont.c @@ -89,7 +89,7 @@ static const uint8_t * imgfont_get_glyph_bitmap(const lv_font_t * font, uint32_t LV_UNUSED(bitmap_buf); LV_ASSERT_NULL(font); imgfont_dsc_t * dsc = (imgfont_dsc_t *)font->dsc; - lv_coord_t offset_y = 0; + int32_t offset_y = 0; const void * img_src = dsc->path_cb(dsc->font, unicode, 0, &offset_y, dsc->user_data); return img_src; } @@ -103,7 +103,7 @@ static bool imgfont_get_glyph_dsc(const lv_font_t * font, lv_font_glyph_dsc_t * LV_ASSERT_NULL(dsc); if(dsc->path_cb == NULL) return false; - lv_coord_t offset_y = 0; + int32_t offset_y = 0; const void * img_src = dsc->path_cb(dsc->font, unicode, unicode_next, &offset_y, dsc->user_data); if(img_src == NULL) return false; diff --git a/src/others/imgfont/lv_imgfont.h b/src/others/imgfont/lv_imgfont.h index 8c1202bcd..247ce8d39 100644 --- a/src/others/imgfont/lv_imgfont.h +++ b/src/others/imgfont/lv_imgfont.h @@ -28,7 +28,7 @@ extern "C" { /* gets the image path name of this character */ typedef const void * (*lv_imgfont_get_path_cb_t)(const lv_font_t * font, uint32_t unicode, uint32_t unicode_next, - lv_coord_t * offset_y, void * user_data); + int32_t * offset_y, void * user_data); /********************** * GLOBAL PROTOTYPES diff --git a/src/others/monkey/lv_monkey.c b/src/others/monkey/lv_monkey.c index 90d1742d8..23ee48cbc 100644 --- a/src/others/monkey/lv_monkey.c +++ b/src/others/monkey/lv_monkey.c @@ -149,8 +149,8 @@ static void lv_monkey_timer_cb(lv_timer_t * timer) switch(lv_indev_get_type(monkey->indev)) { case LV_INDEV_TYPE_POINTER: - data->point.x = (lv_coord_t)lv_monkey_random(0, LV_HOR_RES - 1); - data->point.y = (lv_coord_t)lv_monkey_random(0, LV_VER_RES - 1); + data->point.x = (int32_t)lv_monkey_random(0, LV_HOR_RES - 1); + data->point.y = (int32_t)lv_monkey_random(0, LV_VER_RES - 1); break; case LV_INDEV_TYPE_ENCODER: data->enc_diff = (int16_t)lv_monkey_random(monkey->config.input_range.min, monkey->config.input_range.max); diff --git a/src/others/snapshot/lv_snapshot.c b/src/others/snapshot/lv_snapshot.c index 8e3d0d190..858d6b4e8 100644 --- a/src/others/snapshot/lv_snapshot.c +++ b/src/others/snapshot/lv_snapshot.c @@ -62,9 +62,9 @@ uint32_t lv_snapshot_buf_size_needed(lv_obj_t * obj, lv_color_format_t cf) lv_obj_update_layout(obj); /*Width and height determine snapshot image size.*/ - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); - lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj); + int32_t w = lv_obj_get_width(obj); + int32_t h = lv_obj_get_height(obj); + int32_t ext_size = _lv_obj_get_ext_draw_size(obj); w += ext_size * 2; h += ext_size * 2; @@ -101,9 +101,9 @@ lv_result_t lv_snapshot_take_to_buf(lv_obj_t * obj, lv_color_format_t cf, lv_ima if(lv_snapshot_buf_size_needed(obj, cf) > buff_size || buff_size == 0) return LV_RESULT_INVALID; /*Width and height determine snapshot image size.*/ - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); - lv_coord_t ext_size = _lv_obj_get_ext_draw_size(obj); + int32_t w = lv_obj_get_width(obj); + int32_t h = lv_obj_get_height(obj); + int32_t ext_size = _lv_obj_get_ext_draw_size(obj); w += ext_size * 2; h += ext_size * 2; diff --git a/src/themes/default/lv_theme_default.c b/src/themes/default/lv_theme_default.c index f641cfbd6..723f37dd4 100644 --- a/src/themes/default/lv_theme_default.c +++ b/src/themes/default/lv_theme_default.c @@ -162,7 +162,7 @@ typedef enum { typedef struct _my_theme_t { lv_theme_t base; disp_size_t disp_size; - lv_coord_t disp_dpi; + int32_t disp_dpi; lv_color_t color_scr; lv_color_t color_text; lv_color_t color_card; @@ -458,7 +458,7 @@ static void style_init(struct _my_theme_t * theme) lv_style_set_line_width(&theme->styles.chart_series, _LV_DPX_CALC(theme->disp_dpi, 3)); lv_style_set_radius(&theme->styles.chart_series, _LV_DPX_CALC(theme->disp_dpi, 3)); - lv_coord_t chart_size = _LV_DPX_CALC(theme->disp_dpi, 8); + int32_t chart_size = _LV_DPX_CALC(theme->disp_dpi, 8); lv_style_set_size(&theme->styles.chart_series, chart_size, chart_size); lv_style_set_pad_column(&theme->styles.chart_series, _LV_DPX_CALC(theme->disp_dpi, 2)); @@ -535,7 +535,7 @@ static void style_init(struct _my_theme_t * theme) lv_style_set_line_width(&theme->styles.meter_marker, _LV_DPX_CALC(theme->disp_dpi, 5)); lv_style_set_line_color(&theme->styles.meter_marker, theme->color_text); - lv_coord_t meter_size = _LV_DPX_CALC(theme->disp_dpi, 20); + int32_t meter_size = _LV_DPX_CALC(theme->disp_dpi, 20); lv_style_set_size(&theme->styles.meter_marker, meter_size, meter_size); meter_size = _LV_DPX_CALC(theme->disp_dpi, 15); @@ -674,8 +674,8 @@ lv_theme_t * lv_theme_default_init(lv_display_t * disp, lv_color_t color_primary struct _my_theme_t * theme = theme_def; lv_display_t * new_disp = disp == NULL ? lv_display_get_default() : disp; - lv_coord_t new_dpi = lv_display_get_dpi(new_disp); - lv_coord_t hor_res = lv_display_get_horizontal_resolution(new_disp); + int32_t new_dpi = lv_display_get_dpi(new_disp); + int32_t hor_res = lv_display_get_horizontal_resolution(new_disp); disp_size_t new_size; if(hor_res <= 320) new_size = DISP_SMALL; diff --git a/src/widgets/animimage/lv_animimage.c b/src/widgets/animimage/lv_animimage.c index 70b1a3e3b..b37b09ba2 100644 --- a/src/widgets/animimage/lv_animimage.c +++ b/src/widgets/animimage/lv_animimage.c @@ -158,7 +158,7 @@ static void lv_animimg_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob static void index_change(lv_obj_t * obj, int32_t index) { - lv_coord_t idx; + int32_t idx; lv_animimg_t * animimg = (lv_animimg_t *)obj; idx = index % animimg->pic_count; diff --git a/src/widgets/arc/lv_arc.c b/src/widgets/arc/lv_arc.c index 7e3f095c9..189e8aa8b 100644 --- a/src/widgets/arc/lv_arc.c +++ b/src/widgets/arc/lv_arc.c @@ -39,11 +39,11 @@ static void lv_arc_draw(lv_event_t * e); static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e); static void inv_arc_area(lv_obj_t * arc, lv_value_precise_t start_angle, lv_value_precise_t end_angle, lv_part_t part); static void inv_knob_area(lv_obj_t * obj); -static void get_center(const lv_obj_t * obj, lv_point_t * center, lv_coord_t * arc_r); +static void get_center(const lv_obj_t * obj, lv_point_t * center, int32_t * arc_r); static lv_value_precise_t get_angle(const lv_obj_t * obj); -static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area); +static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, int32_t r, lv_area_t * knob_area); static void value_update(lv_obj_t * arc); -static lv_coord_t knob_get_extra_size(lv_obj_t * obj); +static int32_t knob_get_extra_size(lv_obj_t * obj); static bool lv_arc_angle_within_bg_bounds(lv_obj_t * obj, const lv_value_precise_t angle, const lv_value_precise_t tolerance_deg); @@ -351,7 +351,7 @@ int32_t lv_arc_get_knob_offset(const lv_obj_t * obj) *====================*/ -void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, lv_coord_t r_offset) +void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, int32_t r_offset) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(obj_to_align); @@ -359,20 +359,20 @@ void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, lv lv_obj_update_layout(obj); lv_point_t center; - lv_coord_t arc_r; + int32_t arc_r; get_center(obj, ¢er, &arc_r); - lv_coord_t indic_width = lv_obj_get_style_arc_width(obj, LV_PART_INDICATOR); - lv_coord_t indic_width_half = indic_width / 2; + int32_t indic_width = lv_obj_get_style_arc_width(obj, LV_PART_INDICATOR); + int32_t indic_width_half = indic_width / 2; arc_r -= indic_width_half; arc_r += r_offset; int32_t angle = (int32_t)get_angle(obj); - lv_coord_t knob_x = (arc_r * lv_trigo_sin(angle + 90)) >> LV_TRIGO_SHIFT; - lv_coord_t knob_y = (arc_r * lv_trigo_sin(angle)) >> LV_TRIGO_SHIFT; + int32_t knob_x = (arc_r * lv_trigo_sin(angle + 90)) >> LV_TRIGO_SHIFT; + int32_t knob_y = (arc_r * lv_trigo_sin(angle)) >> LV_TRIGO_SHIFT; lv_obj_align_to(obj_to_align, obj, LV_ALIGN_CENTER, knob_x, knob_y); } -void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, lv_coord_t r_offset) +void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, int32_t r_offset) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(obj_to_rotate); @@ -380,10 +380,10 @@ void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, lv_obj_update_layout(obj); lv_point_t center; - lv_coord_t arc_r; + int32_t arc_r; get_center(obj, ¢er, &arc_r); - lv_coord_t indic_width = lv_obj_get_style_arc_width(obj, LV_PART_INDICATOR); - lv_coord_t indic_width_half = indic_width / 2; + int32_t indic_width = lv_obj_get_style_arc_width(obj, LV_PART_INDICATOR); + int32_t indic_width_half = indic_width / 2; arc_r -= indic_width_half; arc_r += r_offset; @@ -392,8 +392,8 @@ void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, lv_obj_update_layout(obj); int32_t angle = (int32_t)get_angle(obj); - lv_coord_t pivot_x = obj_to_rotate->coords.x1 - center.x; - lv_coord_t pivot_y = obj_to_rotate->coords.y1 - center.y; + int32_t pivot_x = obj_to_rotate->coords.x1 - center.x; + int32_t pivot_y = obj_to_rotate->coords.y1 - center.y; lv_obj_set_style_transform_pivot_x(obj_to_rotate, -pivot_x, 0); lv_obj_set_style_transform_pivot_y(obj_to_rotate, -pivot_y, 0); lv_obj_set_style_transform_rotation(obj_to_rotate, angle * 10 + 900, 0); @@ -462,7 +462,7 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) /*Make point relative to the arc's center*/ lv_point_t center; - lv_coord_t r; + int32_t r; get_center(obj, ¢er, &r); p.x -= center.x; @@ -470,7 +470,7 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) /*Enter dragging mode if pressed out of the knob*/ if(arc->dragging == false) { - lv_coord_t indic_width = lv_obj_get_style_arc_width(obj, LV_PART_INDICATOR); + int32_t indic_width = lv_obj_get_style_arc_width(obj, LV_PART_INDICATOR); r -= indic_width; /*Add some more sensitive area if there is no advanced git testing. * (Advanced hit testing is more precise)*/ @@ -626,13 +626,13 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_hit_test_info_t * info = lv_event_get_param(e); lv_point_t p; - lv_coord_t r; + int32_t r; get_center(obj, &p, &r); - lv_coord_t ext_click_area = 0; + int32_t ext_click_area = 0; if(obj->spec_attr) ext_click_area = obj->spec_attr->ext_click_pad; - lv_coord_t w = lv_obj_get_style_arc_width(obj, LV_PART_MAIN); + int32_t w = lv_obj_get_style_arc_width(obj, LV_PART_MAIN); r -= w + ext_click_area; lv_area_t a; @@ -648,22 +648,22 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) info->res = _lv_area_is_point_on(&a, info->point, LV_RADIUS_CIRCLE); } else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); - lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); - lv_coord_t bg_pad = LV_MAX4(bg_left, bg_right, bg_top, bg_bottom); - - lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); - lv_coord_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); - lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); - lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); - lv_coord_t knob_pad = LV_MAX4(knob_left, knob_right, knob_top, knob_bottom) + 2; - - lv_coord_t knob_extra_size = knob_pad - bg_pad; + int32_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + int32_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + int32_t bg_pad = LV_MAX4(bg_left, bg_right, bg_top, bg_bottom); + + int32_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); + int32_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); + int32_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); + int32_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); + int32_t knob_pad = LV_MAX4(knob_left, knob_right, knob_top, knob_bottom) + 2; + + int32_t knob_extra_size = knob_pad - bg_pad; knob_extra_size += knob_get_extra_size(obj); - lv_coord_t * s = lv_event_get_param(e); + int32_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_extra_size); } else if(code == LV_EVENT_DRAW_MAIN) { @@ -679,7 +679,7 @@ static void lv_arc_draw(lv_event_t * e) lv_layer_t * layer = lv_event_get_layer(e); lv_point_t center; - lv_coord_t arc_r; + int32_t arc_r; get_center(obj, ¢er, &arc_r); /*Draw the background arc*/ @@ -695,11 +695,11 @@ static void lv_arc_draw(lv_event_t * e) } /*Make the indicator arc smaller or larger according to its greatest padding value*/ - lv_coord_t left_indic = lv_obj_get_style_pad_left(obj, LV_PART_INDICATOR); - lv_coord_t right_indic = lv_obj_get_style_pad_right(obj, LV_PART_INDICATOR); - lv_coord_t top_indic = lv_obj_get_style_pad_top(obj, LV_PART_INDICATOR); - lv_coord_t bottom_indic = lv_obj_get_style_pad_bottom(obj, LV_PART_INDICATOR); - lv_coord_t indic_r = arc_r - LV_MAX4(left_indic, right_indic, top_indic, bottom_indic); + int32_t left_indic = lv_obj_get_style_pad_left(obj, LV_PART_INDICATOR); + int32_t right_indic = lv_obj_get_style_pad_right(obj, LV_PART_INDICATOR); + int32_t top_indic = lv_obj_get_style_pad_top(obj, LV_PART_INDICATOR); + int32_t bottom_indic = lv_obj_get_style_pad_bottom(obj, LV_PART_INDICATOR); + int32_t indic_r = arc_r - LV_MAX4(left_indic, right_indic, top_indic, bottom_indic); if(indic_r > 0) { lv_draw_arc_dsc_init(&arc_dsc); @@ -742,12 +742,12 @@ static void inv_arc_area(lv_obj_t * obj, lv_value_precise_t start_angle, lv_valu if(start_angle > 360) start_angle -= 360; if(end_angle > 360) end_angle -= 360; - lv_coord_t r; + int32_t r; lv_point_t c; get_center(obj, &c, &r); - lv_coord_t w = lv_obj_get_style_arc_width(obj, part); - lv_coord_t rounded = lv_obj_get_style_arc_rounded(obj, part); + int32_t w = lv_obj_get_style_arc_width(obj, part); + int32_t rounded = lv_obj_get_style_arc_rounded(obj, part); lv_area_t inv_area; lv_draw_arc_get_area(c.x, c.y, r, start_angle, end_angle, w, rounded, &inv_area); @@ -758,13 +758,13 @@ static void inv_arc_area(lv_obj_t * obj, lv_value_precise_t start_angle, lv_valu static void inv_knob_area(lv_obj_t * obj) { lv_point_t c; - lv_coord_t r; + int32_t r; get_center(obj, &c, &r); lv_area_t a; get_knob_area(obj, &c, r, &a); - lv_coord_t knob_extra_size = knob_get_extra_size(obj); + int32_t knob_extra_size = knob_get_extra_size(obj); if(knob_extra_size > 0) { lv_area_increase(&a, knob_extra_size, knob_extra_size); @@ -773,15 +773,15 @@ static void inv_knob_area(lv_obj_t * obj) lv_obj_invalidate_area(obj, &a); } -static void get_center(const lv_obj_t * obj, lv_point_t * center, lv_coord_t * arc_r) +static void get_center(const lv_obj_t * obj, lv_point_t * center, int32_t * arc_r) { - lv_coord_t left_bg = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t right_bg = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); - lv_coord_t top_bg = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t bottom_bg = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + int32_t left_bg = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t right_bg = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + int32_t top_bg = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t bottom_bg = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); - lv_coord_t r = (LV_MIN(lv_obj_get_width(obj) - left_bg - right_bg, - lv_obj_get_height(obj) - top_bg - bottom_bg)) / 2; + int32_t r = (LV_MIN(lv_obj_get_width(obj) - left_bg - right_bg, + lv_obj_get_height(obj) - top_bg - bottom_bg)) / 2; center->x = obj->coords.x1 + r + left_bg; center->y = obj->coords.y1 + r + top_bg; @@ -815,21 +815,21 @@ static lv_value_precise_t get_angle(const lv_obj_t * obj) } -static void get_knob_area(lv_obj_t * obj, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area) +static void get_knob_area(lv_obj_t * obj, const lv_point_t * center, int32_t r, lv_area_t * knob_area) { - lv_coord_t indic_width = lv_obj_get_style_arc_width(obj, LV_PART_INDICATOR); - lv_coord_t indic_width_half = indic_width / 2; + int32_t indic_width = lv_obj_get_style_arc_width(obj, LV_PART_INDICATOR); + int32_t indic_width_half = indic_width / 2; r -= indic_width_half; int32_t angle = (int32_t)get_angle(obj); - lv_coord_t knob_offset = lv_arc_get_knob_offset(obj); - lv_coord_t knob_x = (r * lv_trigo_sin(knob_offset + angle + 90)) >> LV_TRIGO_SHIFT; - lv_coord_t knob_y = (r * lv_trigo_sin(knob_offset + angle)) >> LV_TRIGO_SHIFT; + int32_t knob_offset = lv_arc_get_knob_offset(obj); + int32_t knob_x = (r * lv_trigo_sin(knob_offset + angle + 90)) >> LV_TRIGO_SHIFT; + int32_t knob_y = (r * lv_trigo_sin(knob_offset + angle)) >> LV_TRIGO_SHIFT; - lv_coord_t left_knob = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); - lv_coord_t right_knob = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); - lv_coord_t top_knob = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); - lv_coord_t bottom_knob = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); + int32_t left_knob = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); + int32_t right_knob = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); + int32_t top_knob = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); + int32_t bottom_knob = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); knob_area->x1 = center->x + knob_x - left_knob - indic_width_half; knob_area->x2 = center->x + knob_x + right_knob + indic_width_half; @@ -886,15 +886,15 @@ static void value_update(lv_obj_t * obj) arc->last_angle = angle; /*Cache angle for slew rate limiting*/ } -static lv_coord_t knob_get_extra_size(lv_obj_t * obj) +static int32_t knob_get_extra_size(lv_obj_t * obj) { - lv_coord_t knob_shadow_size = 0; + int32_t knob_shadow_size = 0; knob_shadow_size += lv_obj_get_style_shadow_width(obj, LV_PART_KNOB); knob_shadow_size += lv_obj_get_style_shadow_spread(obj, LV_PART_KNOB); knob_shadow_size += LV_ABS(lv_obj_get_style_shadow_offset_x(obj, LV_PART_KNOB)); knob_shadow_size += LV_ABS(lv_obj_get_style_shadow_offset_y(obj, LV_PART_KNOB)); - lv_coord_t knob_outline_size = 0; + int32_t knob_outline_size = 0; knob_outline_size += lv_obj_get_style_outline_width(obj, LV_PART_KNOB); knob_outline_size += lv_obj_get_style_outline_pad(obj, LV_PART_KNOB); diff --git a/src/widgets/arc/lv_arc.h b/src/widgets/arc/lv_arc.h index c63bb0e10..f13e920ff 100644 --- a/src/widgets/arc/lv_arc.h +++ b/src/widgets/arc/lv_arc.h @@ -251,7 +251,7 @@ int32_t lv_arc_get_knob_offset(const lv_obj_t * obj); * @param obj_to_align pointer to an object to align * @param r_offset consider the radius larger with this value (< 0: for smaller radius) */ -void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, lv_coord_t r_offset); +void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, int32_t r_offset); /** * Rotate an object to the current position of the arc (knob) @@ -259,7 +259,7 @@ void lv_arc_align_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_align, lv * @param obj_to_rotate pointer to an object to rotate * @param r_offset consider the radius larger with this value (< 0: for smaller radius) */ -void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, lv_coord_t r_offset); +void lv_arc_rotate_obj_to_angle(const lv_obj_t * obj, lv_obj_t * obj_to_rotate, int32_t r_offset); /********************** * MACROS diff --git a/src/widgets/bar/lv_bar.c b/src/widgets/bar/lv_bar.c index 7157113ab..88d034a25 100644 --- a/src/widgets/bar/lv_bar.c +++ b/src/widgets/bar/lv_bar.c @@ -268,11 +268,11 @@ static void draw_indic(lv_event_t * e) lv_area_t bar_coords; lv_obj_get_coords(obj, &bar_coords); - lv_coord_t transf_w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t transf_h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + int32_t transf_w = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + int32_t transf_h = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); lv_area_increase(&bar_coords, transf_w, transf_h); - lv_coord_t barw = lv_area_get_width(&bar_coords); - lv_coord_t barh = lv_area_get_height(&bar_coords); + int32_t barw = lv_area_get_width(&bar_coords); + int32_t barh = lv_area_get_height(&bar_coords); int32_t range = bar->max_value - bar->min_value; /*Prevent division by 0*/ @@ -284,10 +284,10 @@ static void draw_indic(lv_event_t * e) bool sym = lv_bar_is_symmetrical(obj); /*Calculate the indicator area*/ - lv_coord_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); - lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + int32_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + int32_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); /*Respect padding and minimum width/height too*/ lv_area_copy(&bar->indic_area, &bar_coords); bar->indic_area.x1 += bg_left; @@ -304,16 +304,16 @@ static void draw_indic(lv_event_t * e) bar->indic_area.x2 = bar->indic_area.x1 + LV_BAR_SIZE_MIN; } - lv_coord_t indicw = lv_area_get_width(&bar->indic_area); - lv_coord_t indich = lv_area_get_height(&bar->indic_area); + int32_t indicw = lv_area_get_width(&bar->indic_area); + int32_t indich = lv_area_get_height(&bar->indic_area); /*Calculate the indicator length*/ - lv_coord_t anim_length = hor ? indicw : indich; + int32_t anim_length = hor ? indicw : indich; - lv_coord_t anim_cur_value_x, anim_start_value_x; + int32_t anim_cur_value_x, anim_start_value_x; - lv_coord_t * axis1, * axis2; - lv_coord_t (*indic_length_calc)(const lv_area_t * area); + int32_t * axis1, * axis2; + int32_t (*indic_length_calc)(const lv_area_t * area); if(hor) { axis1 = &bar->indic_area.x1; @@ -327,9 +327,9 @@ static void draw_indic(lv_event_t * e) } if(LV_BAR_IS_ANIMATING(bar->start_value_anim)) { - lv_coord_t anim_start_value_start_x = + int32_t anim_start_value_start_x = (int32_t)((int32_t)anim_length * (bar->start_value_anim.anim_start - bar->min_value)) / range; - lv_coord_t anim_start_value_end_x = + int32_t anim_start_value_end_x = (int32_t)((int32_t)anim_length * (bar->start_value_anim.anim_end - bar->min_value)) / range; anim_start_value_x = (((anim_start_value_end_x - anim_start_value_start_x) * bar->start_value_anim.anim_state) / @@ -342,9 +342,9 @@ static void draw_indic(lv_event_t * e) } if(LV_BAR_IS_ANIMATING(bar->cur_value_anim)) { - lv_coord_t anim_cur_value_start_x = + int32_t anim_cur_value_start_x = (int32_t)((int32_t)anim_length * (bar->cur_value_anim.anim_start - bar->min_value)) / range; - lv_coord_t anim_cur_value_end_x = + int32_t anim_cur_value_end_x = (int32_t)((int32_t)anim_length * (bar->cur_value_anim.anim_end - bar->min_value)) / range; anim_cur_value_x = anim_cur_value_start_x + (((anim_cur_value_end_x - anim_cur_value_start_x) * @@ -365,7 +365,7 @@ static void draw_indic(lv_event_t * e) if(reversed) { /*Swap axes*/ - lv_coord_t * tmp; + int32_t * tmp; tmp = axis1; axis1 = axis2; axis2 = tmp; @@ -384,12 +384,12 @@ static void draw_indic(lv_event_t * e) } if(sym) { - lv_coord_t zero, shift; + int32_t zero, shift; shift = (-bar->min_value * anim_length) / range; if(hor) { - lv_coord_t * left = reversed ? axis2 : axis1; - lv_coord_t * right = reversed ? axis1 : axis2; + int32_t * left = reversed ? axis2 : axis1; + int32_t * right = reversed ? axis1 : axis2; if(reversed) zero = *axis1 - shift + 1; else @@ -405,8 +405,8 @@ static void draw_indic(lv_event_t * e) } } else { - lv_coord_t * top = reversed ? axis2 : axis1; - lv_coord_t * bottom = reversed ? axis1 : axis2; + int32_t * top = reversed ? axis2 : axis1; + int32_t * bottom = reversed ? axis1 : axis2; if(reversed) zero = *axis2 + shift; else @@ -436,11 +436,11 @@ static void draw_indic(lv_event_t * e) lv_draw_rect_dsc_init(&draw_rect_dsc); lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &draw_rect_dsc); - lv_coord_t bg_radius = lv_obj_get_style_radius(obj, LV_PART_MAIN); - lv_coord_t short_side = LV_MIN(barw, barh); + int32_t bg_radius = lv_obj_get_style_radius(obj, LV_PART_MAIN); + int32_t short_side = LV_MIN(barw, barh); if(bg_radius > short_side >> 1) bg_radius = short_side >> 1; - lv_coord_t indic_radius = draw_rect_dsc.radius; + int32_t indic_radius = draw_rect_dsc.radius; short_side = LV_MIN(indicw, indich); if(indic_radius > short_side >> 1) indic_radius = short_side >> 1; @@ -489,20 +489,20 @@ static void lv_bar_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t indic_size; + int32_t indic_size; indic_size = lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR); /*Bg size is handled by lv_obj*/ - lv_coord_t * s = lv_event_get_param(e); + int32_t * s = lv_event_get_param(e); *s = LV_MAX(*s, indic_size); /*Calculate the indicator area*/ - lv_coord_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); - lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + int32_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + int32_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); - lv_coord_t pad = LV_MIN4(bg_left, bg_right, bg_top, bg_bottom); + int32_t pad = LV_MIN4(bg_left, bg_right, bg_top, bg_bottom); if(pad < 0) { *s = LV_MAX(*s, -pad); } diff --git a/src/widgets/buttonmatrix/lv_buttonmatrix.c b/src/widgets/buttonmatrix/lv_buttonmatrix.c index 4f6a27b3e..0f6cdca59 100644 --- a/src/widgets/buttonmatrix/lv_buttonmatrix.c +++ b/src/widgets/buttonmatrix/lv_buttonmatrix.c @@ -108,16 +108,16 @@ void lv_buttonmatrix_set_map(lv_obj_t * obj, const char * map[]) lv_base_dir_t base_dir = lv_obj_get_style_base_dir(obj, LV_PART_MAIN); /*Set size and positions of the buttons*/ - lv_coord_t sleft = lv_obj_get_style_space_left(obj, LV_PART_MAIN); - lv_coord_t stop = lv_obj_get_style_space_top(obj, LV_PART_MAIN); - lv_coord_t prow = lv_obj_get_style_pad_row(obj, LV_PART_MAIN); - lv_coord_t pcol = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); + int32_t sleft = lv_obj_get_style_space_left(obj, LV_PART_MAIN); + int32_t stop = lv_obj_get_style_space_top(obj, LV_PART_MAIN); + int32_t prow = lv_obj_get_style_pad_row(obj, LV_PART_MAIN); + int32_t pcol = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); - lv_coord_t max_w = lv_obj_get_content_width(obj); - lv_coord_t max_h = lv_obj_get_content_height(obj); + int32_t max_w = lv_obj_get_content_width(obj); + int32_t max_h = lv_obj_get_content_height(obj); /*Calculate the position of each row*/ - lv_coord_t max_h_no_gap = max_h - (prow * (btnm->row_cnt - 1)); + int32_t max_h_no_gap = max_h - (prow * (btnm->row_cnt - 1)); /*Count the units and the buttons in a line *(A button can be 1,2,3... unit wide)*/ @@ -142,11 +142,11 @@ void lv_buttonmatrix_set_map(lv_obj_t * obj, const char * map[]) continue; } - lv_coord_t row_y1 = stop + (max_h_no_gap * row) / btnm->row_cnt + row * prow; - lv_coord_t row_y2 = stop + (max_h_no_gap * (row + 1)) / btnm->row_cnt + row * prow - 1; + int32_t row_y1 = stop + (max_h_no_gap * row) / btnm->row_cnt + row * prow; + int32_t row_y2 = stop + (max_h_no_gap * (row + 1)) / btnm->row_cnt + row * prow - 1; /*Set the button size and positions*/ - lv_coord_t max_w_no_gap = max_w - (pcol * (btn_cnt - 1)); + int32_t max_w_no_gap = max_w - (pcol * (btn_cnt - 1)); if(max_w_no_gap < 0) max_w_no_gap = 0; uint32_t row_unit_cnt = 0; /*The current unit position in the row*/ @@ -154,12 +154,12 @@ void lv_buttonmatrix_set_map(lv_obj_t * obj, const char * map[]) for(btn = 0; btn < btn_cnt; btn++, btn_tot_i++, txt_tot_i++) { uint32_t btn_u = get_button_width(btnm->ctrl_bits[btn_tot_i]); - lv_coord_t btn_x1 = (max_w_no_gap * row_unit_cnt) / unit_cnt + btn * pcol; - lv_coord_t btn_x2 = (max_w_no_gap * (row_unit_cnt + btn_u)) / unit_cnt + btn * pcol - 1; + int32_t btn_x1 = (max_w_no_gap * row_unit_cnt) / unit_cnt + btn * pcol; + int32_t btn_x2 = (max_w_no_gap * (row_unit_cnt + btn_u)) / unit_cnt + btn * pcol - 1; /*If RTL start from the right*/ if(base_dir == LV_BASE_DIR_RTL) { - lv_coord_t tmp = btn_x1; + int32_t tmp = btn_x1; btn_x1 = btn_x2; btn_x2 = tmp; @@ -407,7 +407,7 @@ static void lv_buttonmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { if(has_popovers_in_top_row(obj)) { /*reserve one row worth of extra space to account for popovers in the top row*/ - lv_coord_t s = btnm->row_cnt > 0 ? lv_obj_get_content_height(obj) / btnm->row_cnt : 0; + int32_t s = btnm->row_cnt > 0 ? lv_obj_get_content_height(obj) / btnm->row_cnt : 0; lv_event_set_ext_draw_size(e, s); } } @@ -592,7 +592,7 @@ static void lv_buttonmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e } } else if(c == LV_KEY_DOWN) { - lv_coord_t col_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); + int32_t col_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); /*Find the area below the current*/ if(btnm->btn_id_sel == LV_BUTTONMATRIX_BUTTON_NONE) { btnm->btn_id_sel = 0; @@ -606,7 +606,7 @@ static void lv_buttonmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e } else { uint32_t area_below; - lv_coord_t pr_center = + int32_t pr_center = btnm->button_areas[btnm->btn_id_sel].x1 + (lv_area_get_width(&btnm->button_areas[btnm->btn_id_sel]) >> 1); for(area_below = btnm->btn_id_sel; area_below < btnm->btn_cnt; area_below++) { @@ -623,7 +623,7 @@ static void lv_buttonmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e } } else if(c == LV_KEY_UP) { - lv_coord_t col_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); + int32_t col_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); /*Find the area below the current*/ if(btnm->btn_id_sel == LV_BUTTONMATRIX_BUTTON_NONE) { btnm->btn_id_sel = 0; @@ -637,7 +637,7 @@ static void lv_buttonmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e } else { int16_t area_above; - lv_coord_t pr_center = + int32_t pr_center = btnm->button_areas[btnm->btn_id_sel].x1 + (lv_area_get_width(&btnm->button_areas[btnm->btn_id_sel]) >> 1); for(area_above = btnm->btn_id_sel; area_above >= 0; area_above--) { @@ -694,10 +694,10 @@ static void draw_main(lv_event_t * e) obj->skip_trans = 0; obj->state = state_ori; - lv_coord_t ptop = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); - lv_coord_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t pright = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + int32_t ptop = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + int32_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t pright = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); #if LV_USE_ARABIC_PERSIAN_CHARS char txt_ap[256]; @@ -763,7 +763,7 @@ static void draw_main(lv_event_t * e) if(btn_area.y2 == obj->coords.y2 - pbottom) draw_rect_dsc_act.border_side &= ~LV_BORDER_SIDE_BOTTOM; } - lv_coord_t btn_height = lv_area_get_height(&btn_area); + int32_t btn_height = lv_area_get_height(&btn_area); if((btn_state & LV_STATE_PRESSED) && (btnm->ctrl_bits[btn_i] & LV_BUTTONMATRIX_CTRL_POPOVER)) { /*Push up the upper boundary of the btn area to create the popover*/ @@ -775,8 +775,8 @@ static void draw_main(lv_event_t * e) /*Calculate the size of the text*/ const lv_font_t * font = draw_label_dsc_act.font; - lv_coord_t letter_space = draw_label_dsc_act.letter_space; - lv_coord_t line_space = draw_label_dsc_act.line_space; + int32_t letter_space = draw_label_dsc_act.letter_space; + int32_t line_space = draw_label_dsc_act.line_space; const char * txt = btnm->map_p[txt_i]; #if LV_USE_ARABIC_PERSIAN_CHARS @@ -925,14 +925,14 @@ static uint32_t get_button_from_point(lv_obj_t * obj, lv_point_t * p) uint32_t i; lv_obj_get_coords(obj, &obj_cords); - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); - lv_coord_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t pright = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); - lv_coord_t ptop = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); - lv_coord_t prow = lv_obj_get_style_pad_row(obj, LV_PART_MAIN); - lv_coord_t pcol = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); + int32_t w = lv_obj_get_width(obj); + int32_t h = lv_obj_get_height(obj); + int32_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t pright = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + int32_t ptop = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + int32_t prow = lv_obj_get_style_pad_row(obj, LV_PART_MAIN); + int32_t pcol = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); /*Get the half gap. Button look larger with this value. (+1 for rounding error)*/ prow = (prow / 2) + 1 + (prow & 1); @@ -985,11 +985,11 @@ static void invalidate_button_area(const lv_obj_t * obj, uint32_t btn_idx) /*The buttons might have outline and shadow so make the invalidation larger with the gaps between the buttons. *It assumes that the outline or shadow is smaller than the gaps*/ - lv_coord_t row_gap = lv_obj_get_style_pad_row(obj, LV_PART_MAIN); - lv_coord_t col_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); + int32_t row_gap = lv_obj_get_style_pad_row(obj, LV_PART_MAIN); + int32_t col_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); /*Be sure to have a minimal extra space if row/col_gap is small*/ - lv_coord_t dpi = lv_display_get_dpi(lv_obj_get_disp(obj)); + int32_t dpi = lv_display_get_dpi(lv_obj_get_disp(obj)); row_gap = LV_MAX(row_gap, dpi / 10); col_gap = LV_MAX(col_gap, dpi / 10); diff --git a/src/widgets/calendar/lv_calendar_header_arrow.c b/src/widgets/calendar/lv_calendar_header_arrow.c index 95710f216..4949016f8 100644 --- a/src/widgets/calendar/lv_calendar_header_arrow.c +++ b/src/widgets/calendar/lv_calendar_header_arrow.c @@ -77,7 +77,7 @@ static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_obj_set_style_bg_image_src(mo_prev, LV_SYMBOL_LEFT, 0); lv_obj_set_height(mo_prev, lv_pct(100)); lv_obj_update_layout(mo_prev); - lv_coord_t btn_size = lv_obj_get_height(mo_prev); + int32_t btn_size = lv_obj_get_height(mo_prev); lv_obj_set_width(mo_prev, btn_size); lv_obj_add_event(mo_prev, month_event_cb, LV_EVENT_CLICKED, NULL); diff --git a/src/widgets/canvas/lv_canvas.c b/src/widgets/canvas/lv_canvas.c index c83712980..5a0ce4354 100644 --- a/src/widgets/canvas/lv_canvas.c +++ b/src/widgets/canvas/lv_canvas.c @@ -63,7 +63,7 @@ lv_obj_t * lv_canvas_create(lv_obj_t * parent) * Setter functions *====================*/ -void lv_canvas_set_buffer(lv_obj_t * obj, void * buf, lv_coord_t w, lv_coord_t h, lv_color_format_t cf) +void lv_canvas_set_buffer(lv_obj_t * obj, void * buf, int32_t w, int32_t h, lv_color_format_t cf) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(buf); @@ -83,7 +83,7 @@ void lv_canvas_set_buffer(lv_obj_t * obj, void * buf, lv_coord_t w, lv_coord_t h lv_cache_unlock(); } -void lv_canvas_set_px(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa) +void lv_canvas_set_px(lv_obj_t * obj, int32_t x, int32_t y, lv_color_t color, lv_opa_t opa) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -152,7 +152,7 @@ void lv_canvas_set_palette(lv_obj_t * obj, uint8_t id, lv_color32_t c) * Getter functions *====================*/ -lv_color32_t lv_canvas_get_px(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) +lv_color32_t lv_canvas_get_px(lv_obj_t * obj, int32_t x, int32_t y) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -211,14 +211,14 @@ lv_image_dsc_t * lv_canvas_get_image(lv_obj_t * obj) * Other functions *====================*/ -void lv_canvas_copy_buf(lv_obj_t * obj, const void * to_copy, lv_coord_t x, lv_coord_t y, lv_coord_t w, lv_coord_t h) +void lv_canvas_copy_buf(lv_obj_t * obj, const void * to_copy, int32_t x, int32_t y, int32_t w, int32_t h) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(to_copy); lv_canvas_t * canvas = (lv_canvas_t *)obj; - if(x + w - 1 >= (lv_coord_t)canvas->dsc.header.w || y + h - 1 >= (lv_coord_t)canvas->dsc.header.h) { + if(x + w - 1 >= (int32_t)canvas->dsc.header.w || y + h - 1 >= (int32_t)canvas->dsc.header.h) { LV_LOG_WARN("x or y out of the canvas"); return; } @@ -226,7 +226,7 @@ void lv_canvas_copy_buf(lv_obj_t * obj, const void * to_copy, lv_coord_t x, lv_c uint32_t px_size = lv_color_format_get_size(canvas->dsc.header.cf) >> 3; uint32_t px = canvas->dsc.header.w * y * px_size + x * px_size; uint8_t * to_copy8 = (uint8_t *)to_copy; - lv_coord_t i; + int32_t i; for(i = 0; i < h; i++) { lv_memcpy((void *)&canvas->dsc.data[px], to_copy8, w * px_size); px += canvas->dsc.header.w * px_size; diff --git a/src/widgets/canvas/lv_canvas.h b/src/widgets/canvas/lv_canvas.h index 250ed5eac..c63bf98b4 100644 --- a/src/widgets/canvas/lv_canvas.h +++ b/src/widgets/canvas/lv_canvas.h @@ -62,9 +62,9 @@ lv_obj_t * lv_canvas_create(lv_obj_t * parent); * @param h height of the canvas * @param cf color format. `LV_IMAGE_CF_...` */ -void lv_canvas_set_buffer(lv_obj_t * canvas, void * buf, lv_coord_t w, lv_coord_t h, lv_color_format_t cf); +void lv_canvas_set_buffer(lv_obj_t * canvas, void * buf, int32_t w, int32_t h, lv_color_format_t cf); -void lv_canvas_set_px(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_color_t color, lv_opa_t opa); +void lv_canvas_set_px(lv_obj_t * obj, int32_t x, int32_t y, lv_color_t color, lv_opa_t opa); /** * Set the palette color of a canvas with index format. Valid only for `LV_IMAGE_CF_INDEXED1/2/4/8` @@ -83,7 +83,7 @@ void lv_canvas_set_palette(lv_obj_t * canvas, uint8_t id, lv_color32_t c); *====================*/ -lv_color32_t lv_canvas_get_px(lv_obj_t * obj, lv_coord_t x, lv_coord_t y); +lv_color32_t lv_canvas_get_px(lv_obj_t * obj, int32_t x, int32_t y); /** * Get the image of the canvas as a pointer to an `lv_image_dsc_t` variable. @@ -106,8 +106,8 @@ lv_image_dsc_t * lv_canvas_get_image(lv_obj_t * canvas); * @param w width of the buffer to copy * @param h height of the buffer to copy */ -void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, lv_coord_t x, lv_coord_t y, lv_coord_t w, - lv_coord_t h); +void lv_canvas_copy_buf(lv_obj_t * canvas, const void * to_copy, int32_t x, int32_t y, int32_t w, + int32_t h); /** * Fill the canvas with color * @param canvas pointer to a canvas diff --git a/src/widgets/chart/lv_chart.c b/src/widgets/chart/lv_chart.c index b30608529..60175020d 100644 --- a/src/widgets/chart/lv_chart.c +++ b/src/widgets/chart/lv_chart.c @@ -37,9 +37,9 @@ static void draw_series_line(lv_obj_t * obj, lv_layer_t * layer); static void draw_series_bar(lv_obj_t * obj, lv_layer_t * layer); static void draw_series_scatter(lv_obj_t * obj, lv_layer_t * layer); static void draw_cursors(lv_obj_t * obj, lv_layer_t * layer); -static uint32_t get_index_from_x(lv_obj_t * obj, lv_coord_t x); +static uint32_t get_index_from_x(lv_obj_t * obj, int32_t x); static void invalidate_point(lv_obj_t * obj, uint32_t i); -static void new_points_alloc(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t cnt, lv_coord_t ** a); +static void new_points_alloc(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t cnt, int32_t ** a); /********************** * STATIC VARIABLES @@ -125,7 +125,7 @@ void lv_chart_set_point_count(lv_obj_t * obj, uint32_t cnt) lv_chart_refresh(obj); } -void lv_chart_set_range(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t min, lv_coord_t max) +void lv_chart_set_range(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min, int32_t max) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -219,8 +219,8 @@ void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint3 return; } - lv_coord_t w = lv_obj_get_content_width(obj); - lv_coord_t h = lv_obj_get_content_height(obj); + int32_t w = lv_obj_get_content_width(obj); + int32_t h = lv_obj_get_content_height(obj); if(chart->type == LV_CHART_TYPE_LINE) { p_out->x = (w * id) / (chart->point_cnt - 1); @@ -235,7 +235,7 @@ void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint3 /*Gap between the columns on adjacent X ticks*/ int32_t block_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); - lv_coord_t block_w = (w - ((chart->point_cnt - 1) * block_gap)) / chart->point_cnt; + int32_t block_w = (w - ((chart->point_cnt - 1) * block_gap)) / chart->point_cnt; p_out->x = (int32_t)((int32_t)(w - block_w) * id) / (chart->point_cnt - 1); lv_chart_series_t * ser_i = NULL; @@ -248,11 +248,11 @@ void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint3 p_out->x = (int32_t)((int32_t)(w + block_gap) * id) / chart->point_cnt; p_out->x += block_w * ser_idx / ser_cnt; - lv_coord_t col_w = (block_w - (ser_gap * (ser_cnt - 1))) / ser_cnt; + int32_t col_w = (block_w - (ser_gap * (ser_cnt - 1))) / ser_cnt; p_out->x += col_w / 2; } - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); p_out->x += lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; p_out->x -= lv_obj_get_scroll_left(obj); @@ -291,11 +291,11 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_cha if(ser == NULL) return NULL; /* Allocate memory for point_cnt points, handle failure below */ - ser->y_points = lv_malloc(sizeof(lv_coord_t) * chart->point_cnt); + ser->y_points = lv_malloc(sizeof(int32_t) * chart->point_cnt); LV_ASSERT_MALLOC(ser->y_points); if(chart->type == LV_CHART_TYPE_SCATTER) { - ser->x_points = lv_malloc(sizeof(lv_coord_t) * chart->point_cnt); + ser->x_points = lv_malloc(sizeof(int32_t) * chart->point_cnt); LV_ASSERT_MALLOC(ser->x_points); if(NULL == ser->x_points) { lv_free(ser->y_points); @@ -323,8 +323,8 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_cha ser->y_axis_sec = axis & LV_CHART_AXIS_SECONDARY_Y ? 1 : 0; uint32_t i; - const lv_coord_t def = LV_CHART_POINT_NONE; - lv_coord_t * p_tmp = ser->y_points; + const int32_t def = LV_CHART_POINT_NONE; + int32_t * p_tmp = ser->y_points; for(i = 0; i < chart->point_cnt; i++) { *p_tmp = def; p_tmp++; @@ -473,7 +473,7 @@ lv_point_t lv_chart_get_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * curso *====================*/ -void lv_chart_set_all_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t value) +void lv_chart_set_all_value(lv_obj_t * obj, lv_chart_series_t * ser, int32_t value) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(ser); @@ -487,7 +487,7 @@ void lv_chart_set_all_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t lv_chart_refresh(obj); } -void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t value) +void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, int32_t value) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(ser); @@ -499,7 +499,7 @@ void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t invalidate_point(obj, ser->start_point); } -void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t x_value, lv_coord_t y_value) +void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, int32_t x_value, int32_t y_value) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(ser); @@ -517,7 +517,7 @@ void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_ invalidate_point(obj, ser->start_point); } -void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, lv_coord_t value) +void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, int32_t value) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(ser); @@ -528,8 +528,8 @@ void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t invalidate_point(obj, id); } -void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, lv_coord_t x_value, - lv_coord_t y_value) +void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, int32_t x_value, + int32_t y_value) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(ser); @@ -546,7 +546,7 @@ void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t invalidate_point(obj, id); } -void lv_chart_set_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t array[]) +void lv_chart_set_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, int32_t array[]) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(ser); @@ -557,7 +557,7 @@ void lv_chart_set_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_ lv_obj_invalidate(obj); } -void lv_chart_set_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t array[]) +void lv_chart_set_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, int32_t array[]) { LV_ASSERT_OBJ(obj, MY_CLASS); LV_ASSERT_NULL(ser); @@ -568,7 +568,7 @@ void lv_chart_set_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_ lv_obj_invalidate(obj); } -lv_coord_t * lv_chart_get_y_array(const lv_obj_t * obj, lv_chart_series_t * ser) +int32_t * lv_chart_get_y_array(const lv_obj_t * obj, lv_chart_series_t * ser) { LV_UNUSED(obj); LV_ASSERT_OBJ(obj, MY_CLASS); @@ -576,7 +576,7 @@ lv_coord_t * lv_chart_get_y_array(const lv_obj_t * obj, lv_chart_series_t * ser) return ser->y_points; } -lv_coord_t * lv_chart_get_x_array(const lv_obj_t * obj, lv_chart_series_t * ser) +int32_t * lv_chart_get_x_array(const lv_obj_t * obj, lv_chart_series_t * ser) { LV_UNUSED(obj); LV_ASSERT_OBJ(obj, MY_CLASS); @@ -599,8 +599,8 @@ int32_t lv_chart_get_first_point_center_offset(lv_obj_t * obj) lv_obj_update_layout(obj); /*Gap between the columns on ~adjacent X*/ int32_t block_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); - lv_coord_t w = lv_obj_get_content_width(obj); - lv_coord_t block_w = (w + block_gap) / (chart->point_cnt); + int32_t w = lv_obj_get_content_width(obj); + int32_t block_w = (w + block_gap) / (chart->point_cnt); x_ofs += (block_w - block_gap) / 2; } @@ -731,24 +731,24 @@ static void draw_div_lines(lv_obj_t * obj, lv_layer_t * layer) int16_t i; int16_t i_start; int16_t i_end; - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; - lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; - lv_coord_t w = lv_obj_get_content_width(obj); - lv_coord_t h = lv_obj_get_content_height(obj); + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; + int32_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; + int32_t w = lv_obj_get_content_width(obj); + int32_t h = lv_obj_get_content_height(obj); lv_draw_line_dsc_t line_dsc; lv_draw_line_dsc_init(&line_dsc); lv_obj_init_draw_line_dsc(obj, LV_PART_MAIN, &line_dsc); lv_opa_t border_opa = lv_obj_get_style_border_opa(obj, LV_PART_MAIN); - lv_coord_t border_w = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t border_w = lv_obj_get_style_border_width(obj, LV_PART_MAIN); lv_border_side_t border_side = lv_obj_get_style_border_side(obj, LV_PART_MAIN); - lv_coord_t scroll_left = lv_obj_get_scroll_left(obj); - lv_coord_t scroll_top = lv_obj_get_scroll_top(obj); + int32_t scroll_left = lv_obj_get_scroll_left(obj); + int32_t scroll_top = lv_obj_get_scroll_top(obj); if(chart->hdiv_cnt != 0) { - lv_coord_t y_ofs = obj->coords.y1 + pad_top - scroll_top; + int32_t y_ofs = obj->coords.y1 + pad_top - scroll_top; line_dsc.p1_x = obj->coords.x1; line_dsc.p2_x = obj->coords.x2; @@ -770,7 +770,7 @@ static void draw_div_lines(lv_obj_t * obj, lv_layer_t * layer) } if(chart->vdiv_cnt != 0) { - lv_coord_t x_ofs = obj->coords.x1 + pad_left - scroll_left; + int32_t x_ofs = obj->coords.x1 + pad_left - scroll_left; line_dsc.p1_y = obj->coords.y1; line_dsc.p2_y = obj->coords.y2; i_start = 0; @@ -805,13 +805,13 @@ static void draw_series_line(lv_obj_t * obj, lv_layer_t * layer) if(chart->point_cnt < 2) return; uint32_t i; - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; - lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; - lv_coord_t w = lv_obj_get_content_width(obj); - lv_coord_t h = lv_obj_get_content_height(obj); - lv_coord_t x_ofs = obj->coords.x1 + pad_left - lv_obj_get_scroll_left(obj); - lv_coord_t y_ofs = obj->coords.y1 + pad_top - lv_obj_get_scroll_top(obj); + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; + int32_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; + int32_t w = lv_obj_get_content_width(obj); + int32_t h = lv_obj_get_content_height(obj); + int32_t x_ofs = obj->coords.x1 + pad_left - lv_obj_get_scroll_left(obj); + int32_t y_ofs = obj->coords.y1 + pad_top - lv_obj_get_scroll_top(obj); lv_chart_series_t * ser; lv_area_t series_clip_area; @@ -826,8 +826,8 @@ static void draw_series_line(lv_obj_t * obj, lv_layer_t * layer) lv_draw_rect_dsc_init(&point_dsc_default); lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &point_dsc_default); - lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2; - lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2; + int32_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2; + int32_t point_h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2; /*Do not bother with line ending is the point will over it*/ if(LV_MIN(point_w, point_h) > line_dsc.width / 2) line_dsc.raw_end = 1; @@ -844,13 +844,13 @@ static void draw_series_line(lv_obj_t * obj, lv_layer_t * layer) line_dsc.base.id2 = 0; point_dsc_default.base.id2 = 0; - lv_coord_t start_point = chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0; + int32_t start_point = chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0; line_dsc.p1_x = x_ofs; line_dsc.p2_x = x_ofs; - lv_coord_t p_act = start_point; - lv_coord_t p_prev = start_point; + int32_t p_act = start_point; + int32_t p_prev = start_point; int32_t y_tmp = (int32_t)((int32_t)ser->y_points[p_prev] - chart->ymin[ser->y_axis_sec]) * h; y_tmp = y_tmp / (chart->ymax[ser->y_axis_sec] - chart->ymin[ser->y_axis_sec]); line_dsc.p2_y = h - y_tmp + y_ofs; @@ -952,13 +952,13 @@ static void draw_series_scatter(lv_obj_t * obj, lv_layer_t * layer) lv_chart_t * chart = (lv_chart_t *)obj; uint32_t i; - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t w = lv_obj_get_content_width(obj); - lv_coord_t h = lv_obj_get_content_height(obj); - lv_coord_t x_ofs = obj->coords.x1 + pad_left + border_width - lv_obj_get_scroll_left(obj); - lv_coord_t y_ofs = obj->coords.y1 + pad_top + border_width - lv_obj_get_scroll_top(obj); + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t w = lv_obj_get_content_width(obj); + int32_t h = lv_obj_get_content_height(obj); + int32_t x_ofs = obj->coords.x1 + pad_left + border_width - lv_obj_get_scroll_left(obj); + int32_t y_ofs = obj->coords.y1 + pad_top + border_width - lv_obj_get_scroll_top(obj); lv_chart_series_t * ser; lv_draw_line_dsc_t line_dsc; @@ -969,8 +969,8 @@ static void draw_series_scatter(lv_obj_t * obj, lv_layer_t * layer) lv_draw_rect_dsc_init(&point_dsc_default); lv_obj_init_draw_rect_dsc(obj, LV_PART_INDICATOR, &point_dsc_default); - lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2; - lv_coord_t point_h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2; + int32_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR) / 2; + int32_t point_h = lv_obj_get_style_height(obj, LV_PART_INDICATOR) / 2; /*Do not bother with line ending is the point will over it*/ if(LV_MIN(point_w, point_h) > line_dsc.width / 2) line_dsc.raw_end = 1; @@ -982,13 +982,13 @@ static void draw_series_scatter(lv_obj_t * obj, lv_layer_t * layer) line_dsc.color = ser->color; point_dsc_default.bg_color = ser->color; - lv_coord_t start_point = chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0; + int32_t start_point = chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0; line_dsc.p1_x = x_ofs; line_dsc.p2_x = x_ofs; - lv_coord_t p_act = start_point; - lv_coord_t p_prev = start_point; + int32_t p_act = start_point; + int32_t p_prev = start_point; if(ser->y_points[p_act] != LV_CHART_POINT_CNT_DEF) { line_dsc.p2_x = lv_map(ser->x_points[p_act], chart->xmin[ser->x_axis_sec], chart->xmax[ser->x_axis_sec], 0, w); line_dsc.p2_x += x_ofs; @@ -1073,22 +1073,22 @@ static void draw_series_bar(lv_obj_t * obj, lv_layer_t * layer) uint32_t i; lv_area_t col_a; - lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t w = lv_obj_get_content_width(obj); - lv_coord_t h = lv_obj_get_content_height(obj); + int32_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t w = lv_obj_get_content_width(obj); + int32_t h = lv_obj_get_content_height(obj); int32_t y_tmp; lv_chart_series_t * ser; uint32_t ser_cnt = _lv_ll_get_len(&chart->series_ll); int32_t block_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); /*Gap between the column on ~adjacent X*/ - lv_coord_t block_w = (w - ((chart->point_cnt - 1) * block_gap)) / chart->point_cnt; + int32_t block_w = (w - ((chart->point_cnt - 1) * block_gap)) / chart->point_cnt; int32_t ser_gap = lv_obj_get_style_pad_column(obj, LV_PART_ITEMS); /*Gap between the columns on the ~same X*/ - lv_coord_t col_w = (block_w - (ser_cnt - 1) * ser_gap) / ser_cnt; + int32_t col_w = (block_w - (ser_cnt - 1) * ser_gap) / ser_cnt; if(col_w < 1) col_w = 1; - lv_coord_t border_w = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t x_ofs = pad_left - lv_obj_get_scroll_left(obj) + border_w; - lv_coord_t y_ofs = pad_top - lv_obj_get_scroll_top(obj) + border_w; + int32_t border_w = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t x_ofs = pad_left - lv_obj_get_scroll_left(obj) + border_w; + int32_t y_ofs = pad_top - lv_obj_get_scroll_top(obj) + border_w; lv_draw_rect_dsc_t col_dsc; lv_draw_rect_dsc_init(&col_dsc); @@ -1101,7 +1101,7 @@ static void draw_series_bar(lv_obj_t * obj, lv_layer_t * layer) /*Go through all points*/ for(i = 0; i < chart->point_cnt; i++) { - lv_coord_t x_act = (int32_t)((int32_t)(w - block_w) * i) / (chart->point_cnt - 1) + obj->coords.x1 + x_ofs; + int32_t x_act = (int32_t)((int32_t)(w - block_w) * i) / (chart->point_cnt - 1) + obj->coords.x1 + x_ofs; col_dsc.base.id2 = i; col_dsc.base.id1 = 0; @@ -1109,7 +1109,7 @@ static void draw_series_bar(lv_obj_t * obj, lv_layer_t * layer) _LV_LL_READ(&chart->series_ll, ser) { if(ser->hidden) continue; - lv_coord_t start_point = chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0; + int32_t start_point = chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0; col_a.x1 = x_act; col_a.x2 = col_a.x1 + col_w - 1; @@ -1120,7 +1120,7 @@ static void draw_series_bar(lv_obj_t * obj, lv_layer_t * layer) col_dsc.bg_color = ser->color; - lv_coord_t p_act = (start_point + i) % chart->point_cnt; + int32_t p_act = (start_point + i) % chart->point_cnt; y_tmp = (int32_t)((int32_t)ser->y_points[p_act] - chart->ymin[ser->y_axis_sec]) * h; y_tmp = y_tmp / (chart->ymax[ser->y_axis_sec] - chart->ymin[ser->y_axis_sec]); col_a.y1 = h - y_tmp + obj->coords.y1 + y_ofs; @@ -1160,8 +1160,8 @@ static void draw_cursors(lv_obj_t * obj, lv_layer_t * layer) lv_draw_line_dsc_t line_dsc; lv_draw_rect_dsc_t point_dsc_tmp; - lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; - lv_coord_t point_h = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; + int32_t point_w = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; + int32_t point_h = lv_obj_get_style_width(obj, LV_PART_CURSOR) / 2; /*Go through all cursor lines*/ _LV_LL_READ_BACK(&chart->cursor_ll, cursor) { @@ -1170,8 +1170,8 @@ static void draw_cursors(lv_obj_t * obj, lv_layer_t * layer) line_dsc.color = cursor->color; point_dsc_tmp.bg_color = cursor->color; - lv_coord_t cx; - lv_coord_t cy; + int32_t cx; + int32_t cy; if(cursor->pos_set) { cx = cursor->pos.x; cy = cursor->pos.y; @@ -1239,11 +1239,11 @@ static void draw_cursors(lv_obj_t * obj, lv_layer_t * layer) * @param coord the coordination of the point relative to the series area. * @return the found index */ -static uint32_t get_index_from_x(lv_obj_t * obj, lv_coord_t x) +static uint32_t get_index_from_x(lv_obj_t * obj, int32_t x) { lv_chart_t * chart = (lv_chart_t *)obj; - lv_coord_t w = lv_obj_get_content_width(obj); - lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t w = lv_obj_get_content_width(obj); + int32_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); x -= pad_left; if(x < 0) return 0; @@ -1259,8 +1259,8 @@ static void invalidate_point(lv_obj_t * obj, uint32_t i) lv_chart_t * chart = (lv_chart_t *)obj; if(i >= chart->point_cnt) return; - lv_coord_t w = lv_obj_get_content_width(obj); - lv_coord_t scroll_left = lv_obj_get_scroll_left(obj); + int32_t w = lv_obj_get_content_width(obj); + int32_t scroll_left = lv_obj_get_scroll_left(obj); /*In shift mode the whole chart changes so the whole object*/ if(chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT) { @@ -1269,11 +1269,11 @@ static void invalidate_point(lv_obj_t * obj, uint32_t i) } if(chart->type == LV_CHART_TYPE_LINE) { - lv_coord_t bwidth = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t x_ofs = obj->coords.x1 + pleft + bwidth - scroll_left; - lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_ITEMS); - lv_coord_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR); + int32_t bwidth = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t x_ofs = obj->coords.x1 + pleft + bwidth - scroll_left; + int32_t line_width = lv_obj_get_style_line_width(obj, LV_PART_ITEMS); + int32_t point_w = lv_obj_get_style_width(obj, LV_PART_INDICATOR); lv_area_t coords; lv_area_copy(&coords, &obj->coords); @@ -1297,10 +1297,10 @@ static void invalidate_point(lv_obj_t * obj, uint32_t i) /*Gap between the column on ~adjacent X*/ int32_t block_gap = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); - lv_coord_t block_w = (w + block_gap) / chart->point_cnt; + int32_t block_w = (w + block_gap) / chart->point_cnt; - lv_coord_t bwidth = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t x_act; + int32_t bwidth = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t x_act; x_act = (int32_t)((int32_t)(block_w) * i) ; x_act += obj->coords.x1 + bwidth + lv_obj_get_style_pad_left(obj, LV_PART_MAIN); @@ -1316,7 +1316,7 @@ static void invalidate_point(lv_obj_t * obj, uint32_t i) } } -static void new_points_alloc(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t cnt, lv_coord_t ** a) +static void new_points_alloc(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t cnt, int32_t ** a) { if((*a) == NULL) return; @@ -1325,7 +1325,7 @@ static void new_points_alloc(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t c uint32_t i; if(ser->start_point != 0) { - lv_coord_t * new_points = lv_malloc(sizeof(lv_coord_t) * cnt); + int32_t * new_points = lv_malloc(sizeof(int32_t) * cnt); LV_ASSERT_MALLOC(new_points); if(new_points == NULL) return; @@ -1350,7 +1350,7 @@ static void new_points_alloc(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t c (*a) = new_points; } else { - (*a) = lv_realloc((*a), sizeof(lv_coord_t) * cnt); + (*a) = lv_realloc((*a), sizeof(int32_t) * cnt); LV_ASSERT_MALLOC((*a)); if((*a) == NULL) return; /*Initialize the new points*/ diff --git a/src/widgets/chart/lv_chart.h b/src/widgets/chart/lv_chart.h index b4b0812dc..3e7918c9a 100644 --- a/src/widgets/chart/lv_chart.h +++ b/src/widgets/chart/lv_chart.h @@ -83,8 +83,8 @@ typedef uint8_t lv_chart_axis_t; * Descriptor a chart series */ typedef struct { - lv_coord_t * x_points; - lv_coord_t * y_points; + int32_t * x_points; + int32_t * y_points; lv_color_t color; uint32_t start_point; uint32_t hidden : 1; @@ -96,7 +96,7 @@ typedef struct { typedef struct { lv_point_t pos; - lv_coord_t point_id; + int32_t point_id; lv_color_t color; lv_chart_series_t * ser; lv_dir_t dir; @@ -108,11 +108,11 @@ typedef struct { lv_obj_t obj; lv_ll_t series_ll; /**< Linked list for the series (stores lv_chart_series_t)*/ lv_ll_t cursor_ll; /**< Linked list for the cursors (stores lv_chart_cursor_t)*/ - lv_coord_t ymin[2]; - lv_coord_t ymax[2]; - lv_coord_t xmin[2]; - lv_coord_t xmax[2]; - lv_coord_t pressed_point_id; + int32_t ymin[2]; + int32_t ymax[2]; + int32_t xmin[2]; + int32_t xmax[2]; + int32_t pressed_point_id; uint32_t hdiv_cnt; /**< Number of horizontal division lines*/ uint32_t vdiv_cnt; /**< Number of vertical division lines*/ uint32_t point_cnt; /**< Point number in a data line*/ @@ -153,7 +153,7 @@ void lv_chart_set_point_count(lv_obj_t * obj, uint32_t cnt); * @param min minimum value of the y axis * @param max maximum value of the y axis */ -void lv_chart_set_range(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t min, lv_coord_t max); +void lv_chart_set_range(lv_obj_t * obj, lv_chart_axis_t axis, int32_t min, int32_t max); /** * Set update mode of the chart object. Affects @@ -311,7 +311,7 @@ lv_point_t lv_chart_get_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * curso * @param ser pointer to a data series on 'chart' * @param value the new value for all points. `LV_CHART_POINT_NONE` can be used to hide the points. */ -void lv_chart_set_all_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t value); +void lv_chart_set_all_value(lv_obj_t * obj, lv_chart_series_t * ser, int32_t value); /** * Set the next point's Y value according to the update mode policy. @@ -319,7 +319,7 @@ void lv_chart_set_all_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t * @param ser pointer to a data series on 'chart' * @param value the new value of the next data */ -void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t value); +void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, int32_t value); /** * Set the next point's X and Y value according to the update mode policy. @@ -328,7 +328,7 @@ void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t * @param x_value the new X value of the next data * @param y_value the new Y value of the next data */ -void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t x_value, lv_coord_t y_value); +void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, int32_t x_value, int32_t y_value); /** * Set an individual point's y value of a chart's series directly based on its index @@ -337,7 +337,7 @@ void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_ * @param id the index of the x point in the array * @param value value to assign to array point */ -void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, lv_coord_t value); +void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, int32_t value); /** * Set an individual point's x and y value of a chart's series directly based on its index @@ -348,8 +348,8 @@ void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t * @param x_value the new X value of the next data * @param y_value the new Y value of the next data */ -void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, lv_coord_t x_value, - lv_coord_t y_value); +void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id, int32_t x_value, + int32_t y_value); /** * Set an external array for the y data points to use for the chart @@ -358,7 +358,7 @@ void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t * @param ser pointer to a data series on 'chart' * @param array external array of points for chart */ -void lv_chart_set_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t array[]); +void lv_chart_set_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, int32_t array[]); /** * Set an external array for the x data points to use for the chart @@ -367,7 +367,7 @@ void lv_chart_set_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_ * @param ser pointer to a data series on 'chart' * @param array external array of points for chart */ -void lv_chart_set_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t array[]); +void lv_chart_set_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, int32_t array[]); /** * Get the array of y values of a series @@ -375,7 +375,7 @@ void lv_chart_set_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_ * @param ser pointer to a data series on 'chart' * @return the array of values with 'point_count' elements */ -lv_coord_t * lv_chart_get_y_array(const lv_obj_t * obj, lv_chart_series_t * ser); +int32_t * lv_chart_get_y_array(const lv_obj_t * obj, lv_chart_series_t * ser); /** * Get the array of x values of a series @@ -383,7 +383,7 @@ lv_coord_t * lv_chart_get_y_array(const lv_obj_t * obj, lv_chart_series_t * ser) * @param ser pointer to a data series on 'chart' * @return the array of values with 'point_count' elements */ -lv_coord_t * lv_chart_get_x_array(const lv_obj_t * obj, lv_chart_series_t * ser); +int32_t * lv_chart_get_x_array(const lv_obj_t * obj, lv_chart_series_t * ser); /** * Get the index of the currently pressed point. It's the same for every series. diff --git a/src/widgets/checkbox/lv_checkbox.c b/src/widgets/checkbox/lv_checkbox.c index 718921656..e76dbcf91 100644 --- a/src/widgets/checkbox/lv_checkbox.c +++ b/src/widgets/checkbox/lv_checkbox.c @@ -179,18 +179,18 @@ static void lv_checkbox_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_checkbox_t * cb = (lv_checkbox_t *)obj; const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - lv_coord_t font_h = lv_font_get_line_height(font); - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); - lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); + int32_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 letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); lv_point_t txt_size; lv_text_get_size(&txt_size, cb->txt, font, letter_space, line_space, LV_COORD_MAX, LV_TEXT_FLAG_NONE); - lv_coord_t bg_colp = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); - lv_coord_t marker_leftp = lv_obj_get_style_pad_left(obj, LV_PART_INDICATOR); - lv_coord_t marker_rightp = lv_obj_get_style_pad_right(obj, LV_PART_INDICATOR); - lv_coord_t marker_topp = lv_obj_get_style_pad_top(obj, LV_PART_INDICATOR); - lv_coord_t marker_bottomp = lv_obj_get_style_pad_bottom(obj, LV_PART_INDICATOR); + int32_t bg_colp = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); + int32_t marker_leftp = lv_obj_get_style_pad_left(obj, LV_PART_INDICATOR); + int32_t marker_rightp = lv_obj_get_style_pad_right(obj, LV_PART_INDICATOR); + int32_t marker_topp = lv_obj_get_style_pad_top(obj, LV_PART_INDICATOR); + int32_t marker_bottomp = lv_obj_get_style_pad_bottom(obj, LV_PART_INDICATOR); lv_point_t marker_size; marker_size.x = font_h + marker_leftp + marker_rightp; marker_size.y = font_h + marker_topp + marker_bottomp; @@ -199,8 +199,8 @@ static void lv_checkbox_event(const lv_obj_class_t * class_p, lv_event_t * e) p->y = LV_MAX(marker_size.y, txt_size.y); } else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t * s = lv_event_get_param(e); - lv_coord_t m = lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR); + int32_t * s = lv_event_get_param(e); + int32_t m = lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR); *s = LV_MAX(*s, m); } else if(code == LV_EVENT_DRAW_MAIN) { @@ -215,23 +215,23 @@ static void lv_checkbox_draw(lv_event_t * e) lv_layer_t * layer = lv_event_get_layer(e); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - lv_coord_t font_h = lv_font_get_line_height(font); + int32_t font_h = lv_font_get_line_height(font); const bool is_rtl = LV_BASE_DIR_RTL == lv_obj_get_style_base_dir(obj, LV_PART_MAIN); - lv_coord_t bg_border = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t bg_topp = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + bg_border; - lv_coord_t bg_p = is_rtl ? lv_obj_get_style_pad_right(obj, LV_PART_MAIN) : lv_obj_get_style_pad_left(obj, - LV_PART_MAIN) + bg_border; - lv_coord_t bg_colp = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); + int32_t bg_border = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t bg_topp = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + bg_border; + int32_t bg_p = is_rtl ? lv_obj_get_style_pad_right(obj, LV_PART_MAIN) : lv_obj_get_style_pad_left(obj, + LV_PART_MAIN) + bg_border; + int32_t bg_colp = lv_obj_get_style_pad_column(obj, LV_PART_MAIN); - lv_coord_t marker_leftp = lv_obj_get_style_pad_left(obj, LV_PART_INDICATOR); - lv_coord_t marker_rightp = lv_obj_get_style_pad_right(obj, LV_PART_INDICATOR); - lv_coord_t marker_topp = lv_obj_get_style_pad_top(obj, LV_PART_INDICATOR); - lv_coord_t marker_bottomp = lv_obj_get_style_pad_bottom(obj, LV_PART_INDICATOR); + int32_t marker_leftp = lv_obj_get_style_pad_left(obj, LV_PART_INDICATOR); + int32_t marker_rightp = lv_obj_get_style_pad_right(obj, LV_PART_INDICATOR); + int32_t marker_topp = lv_obj_get_style_pad_top(obj, LV_PART_INDICATOR); + int32_t marker_bottomp = lv_obj_get_style_pad_bottom(obj, LV_PART_INDICATOR); - lv_coord_t transf_w = lv_obj_get_style_transform_width(obj, LV_PART_INDICATOR); - lv_coord_t transf_h = lv_obj_get_style_transform_height(obj, LV_PART_INDICATOR); + int32_t transf_w = lv_obj_get_style_transform_width(obj, LV_PART_INDICATOR); + int32_t transf_h = lv_obj_get_style_transform_height(obj, LV_PART_INDICATOR); lv_draw_rect_dsc_t indic_dsc; lv_draw_rect_dsc_init(&indic_dsc); @@ -254,8 +254,8 @@ static void lv_checkbox_draw(lv_event_t * e) lv_draw_rect(layer, &indic_dsc, &marker_area_transf); - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); - lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + int32_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); lv_point_t txt_size; lv_text_get_size(&txt_size, cb->txt, font, letter_space, line_space, LV_COORD_MAX, LV_TEXT_FLAG_NONE); @@ -265,7 +265,7 @@ static void lv_checkbox_draw(lv_event_t * e) lv_obj_init_draw_label_dsc(obj, LV_PART_MAIN, &txt_dsc); txt_dsc.text = cb->txt; - lv_coord_t y_ofs = (lv_area_get_height(&marker_area) - font_h) / 2; + int32_t y_ofs = (lv_area_get_height(&marker_area) - font_h) / 2; lv_area_t txt_area; if(is_rtl) { txt_area.x2 = marker_area.x1 - bg_colp; diff --git a/src/widgets/dropdown/lv_dropdown.c b/src/widgets/dropdown/lv_dropdown.c index 18b48b25e..361bd1e1b 100644 --- a/src/widgets/dropdown/lv_dropdown.c +++ b/src/widgets/dropdown/lv_dropdown.c @@ -53,7 +53,7 @@ static void draw_box_label(lv_obj_t * dropdown_obj, lv_layer_t * layer, uint32_t static lv_result_t btn_release_handler(lv_obj_t * obj); static lv_result_t list_release_handler(lv_obj_t * list_obj); static void list_press_handler(lv_obj_t * page); -static uint32_t get_id_on_point(lv_obj_t * dropdown_obj, lv_coord_t y); +static uint32_t get_id_on_point(lv_obj_t * dropdown_obj, int32_t y); static void position_to_selected(lv_obj_t * obj); static lv_obj_t * get_label(const lv_obj_t * obj); @@ -477,13 +477,13 @@ void lv_dropdown_open(lv_obj_t * dropdown_obj) lv_obj_set_width(dropdown->list, lv_obj_get_width(dropdown_obj)); } - lv_coord_t label_h = lv_obj_get_height(label); - lv_coord_t border_width = lv_obj_get_style_border_width(dropdown->list, LV_PART_MAIN); - lv_coord_t top = lv_obj_get_style_pad_top(dropdown->list, LV_PART_MAIN) + border_width; - lv_coord_t bottom = lv_obj_get_style_pad_bottom(dropdown->list, LV_PART_MAIN) + border_width; + int32_t label_h = lv_obj_get_height(label); + int32_t border_width = lv_obj_get_style_border_width(dropdown->list, LV_PART_MAIN); + int32_t top = lv_obj_get_style_pad_top(dropdown->list, LV_PART_MAIN) + border_width; + int32_t bottom = lv_obj_get_style_pad_bottom(dropdown->list, LV_PART_MAIN) + border_width; - lv_coord_t list_fit_h = label_h + top + bottom; - lv_coord_t list_h = list_fit_h; + int32_t list_fit_h = label_h + top + bottom; + int32_t list_h = list_fit_h; lv_dir_t dir = dropdown->dir; /*No space on the bottom? See if top is better.*/ @@ -526,8 +526,8 @@ void lv_dropdown_open(lv_obj_t * dropdown_obj) lv_obj_update_layout(dropdown->list); if(dropdown->dir == LV_DIR_LEFT || dropdown->dir == LV_DIR_RIGHT) { - lv_coord_t y1 = lv_obj_get_y(dropdown->list); - lv_coord_t y2 = lv_obj_get_y2(dropdown->list); + int32_t y1 = lv_obj_get_y(dropdown->list); + int32_t y2 = lv_obj_get_y2(dropdown->list); if(y2 >= LV_VER_RES) { lv_obj_set_y(dropdown->list, y1 - (y2 - LV_VER_RES) - 1); } @@ -787,10 +787,10 @@ static void draw_main(lv_event_t * e) lv_dropdown_t * dropdown = (lv_dropdown_t *)obj; lv_layer_t * layer = lv_event_get_layer(e); - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; - lv_coord_t right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN) + border_width; - lv_coord_t top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; + int32_t right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN) + border_width; + int32_t top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; lv_draw_label_dsc_t symbol_dsc; lv_draw_label_dsc_init(&symbol_dsc); @@ -811,8 +811,8 @@ static void draw_main(lv_event_t * e) if(dropdown->symbol) { lv_image_src_t symbol_type = lv_image_src_get_type(dropdown->symbol); - lv_coord_t symbol_w; - lv_coord_t symbol_h; + int32_t symbol_w; + int32_t symbol_h; if(symbol_type == LV_IMAGE_SRC_SYMBOL) { lv_point_t size; lv_text_get_size(&size, dropdown->symbol, symbol_dsc.font, symbol_dsc.letter_space, symbol_dsc.line_space, LV_COORD_MAX, @@ -950,8 +950,8 @@ static void draw_box(lv_obj_t * dropdown_obj, lv_layer_t * layer, uint32_t id, l /*Draw a rectangle under the selected item*/ const lv_font_t * font = lv_obj_get_style_text_font(list_obj, LV_PART_SELECTED); - lv_coord_t line_space = lv_obj_get_style_text_line_space(list_obj, LV_PART_SELECTED); - lv_coord_t font_h = lv_font_get_line_height(font); + int32_t line_space = lv_obj_get_style_text_line_space(list_obj, LV_PART_SELECTED); + int32_t font_h = lv_font_get_line_height(font); /*Draw the selected*/ lv_obj_t * label = get_label(dropdown_obj); @@ -996,7 +996,7 @@ static void draw_box_label(lv_obj_t * dropdown_obj, lv_layer_t * layer, uint32_t lv_obj_t * label = get_label(dropdown_obj); if(label == NULL) return; - lv_coord_t font_h = lv_font_get_line_height(label_dsc.font); + int32_t font_h = lv_font_get_line_height(label_dsc.font); lv_area_t area_sel; area_sel.y1 = label->coords.y1; @@ -1108,7 +1108,7 @@ static void list_press_handler(lv_obj_t * list_obj) } } -static uint32_t get_id_on_point(lv_obj_t * dropdown_obj, lv_coord_t y) +static uint32_t get_id_on_point(lv_obj_t * dropdown_obj, int32_t y) { lv_dropdown_t * dropdown = (lv_dropdown_t *)dropdown_obj; lv_obj_t * label = get_label(dropdown_obj); @@ -1116,11 +1116,11 @@ static uint32_t get_id_on_point(lv_obj_t * dropdown_obj, lv_coord_t y) y -= label->coords.y1; const lv_font_t * font = lv_obj_get_style_text_font(label, LV_PART_MAIN); - lv_coord_t font_h = lv_font_get_line_height(font); - lv_coord_t line_space = lv_obj_get_style_text_line_space(label, LV_PART_MAIN); + int32_t font_h = lv_font_get_line_height(font); + int32_t line_space = lv_obj_get_style_text_line_space(label, LV_PART_MAIN); y += line_space / 2; - lv_coord_t h = font_h + line_space; + int32_t h = font_h + line_space; uint32_t opt = y / h; @@ -1142,10 +1142,10 @@ static void position_to_selected(lv_obj_t * dropdown_obj) if(lv_obj_get_height(label) <= lv_obj_get_content_height(dropdown_obj)) return; const lv_font_t * font = lv_obj_get_style_text_font(label, LV_PART_MAIN); - lv_coord_t font_h = lv_font_get_line_height(font); - lv_coord_t line_space = lv_obj_get_style_text_line_space(label, LV_PART_MAIN); - lv_coord_t unit_h = font_h + line_space; - lv_coord_t line_y1 = dropdown->sel_opt_id * unit_h; + int32_t font_h = lv_font_get_line_height(font); + int32_t line_space = lv_obj_get_style_text_line_space(label, LV_PART_MAIN); + int32_t unit_h = font_h + line_space; + int32_t line_y1 = dropdown->sel_opt_id * unit_h; /*Scroll to the selected option*/ lv_obj_scroll_to_y(dropdown->list, line_y1, LV_ANIM_OFF); diff --git a/src/widgets/image/lv_image.c b/src/widgets/image/lv_image.c index 6affb1d0c..039fe2ea3 100644 --- a/src/widgets/image/lv_image.c +++ b/src/widgets/image/lv_image.c @@ -183,8 +183,8 @@ void lv_image_set_src(lv_obj_t * obj, const void * src) if(src_type == LV_IMAGE_SRC_SYMBOL) { /*`lv_image_dsc_get_info` couldn't set the width and height of a font so set it here*/ const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + int32_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); lv_point_t size; lv_text_get_size(&size, src, font, letter_space, line_space, LV_COORD_MAX, LV_TEXT_FLAG_NONE); header.w = size.x; @@ -204,7 +204,7 @@ void lv_image_set_src(lv_obj_t * obj, const void * src) lv_obj_invalidate(obj); } -void lv_image_set_offset_x(lv_obj_t * obj, lv_coord_t x) +void lv_image_set_offset_x(lv_obj_t * obj, int32_t x) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -214,7 +214,7 @@ void lv_image_set_offset_x(lv_obj_t * obj, lv_coord_t x) lv_obj_invalidate(obj); } -void lv_image_set_offset_y(lv_obj_t * obj, lv_coord_t y) +void lv_image_set_offset_y(lv_obj_t * obj, int32_t y) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -239,8 +239,8 @@ void lv_image_set_rotation(lv_obj_t * obj, int32_t angle) } lv_obj_update_layout(obj); /*Be sure the object's size is calculated*/ - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); + int32_t w = lv_obj_get_width(obj); + int32_t h = lv_obj_get_height(obj); lv_area_t a; lv_point_t pivot_px; lv_image_get_pivot(obj, &pivot_px); @@ -268,7 +268,7 @@ void lv_image_set_rotation(lv_obj_t * obj, int32_t angle) lv_obj_invalidate_area(obj, &a); } -void lv_image_set_pivot(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) +void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y) { lv_image_t * img = (lv_image_t *)obj; if(img->pivot.x == x && img->pivot.y == y) return; @@ -281,8 +281,8 @@ void lv_image_set_pivot(lv_obj_t * obj, lv_coord_t x, lv_coord_t y) } lv_obj_update_layout(obj); /*Be sure the object's size is calculated*/ - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); + int32_t w = lv_obj_get_width(obj); + int32_t h = lv_obj_get_height(obj); lv_area_t a; lv_point_t pivot_px; lv_image_get_pivot(obj, &pivot_px); @@ -374,7 +374,7 @@ const void * lv_image_get_src(lv_obj_t * obj) return img->src; } -lv_coord_t lv_image_get_offset_x(lv_obj_t * obj) +int32_t lv_image_get_offset_x(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -383,7 +383,7 @@ lv_coord_t lv_image_get_offset_x(lv_obj_t * obj) return img->offset.x; } -lv_coord_t lv_image_get_offset_y(lv_obj_t * obj) +int32_t lv_image_get_offset_y(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -392,7 +392,7 @@ lv_coord_t lv_image_get_offset_y(lv_obj_t * obj) return img->offset.y; } -lv_coord_t lv_image_get_rotation(lv_obj_t * obj) +int32_t lv_image_get_rotation(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -411,7 +411,7 @@ void lv_image_get_pivot(lv_obj_t * obj, lv_point_t * pivot) pivot->y = lv_pct_to_px(img->pivot.y, img->h); } -lv_coord_t lv_image_get_scale(lv_obj_t * obj) +int32_t lv_image_get_scale(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -420,7 +420,7 @@ lv_coord_t lv_image_get_scale(lv_obj_t * obj) return img->zoom_x; } -lv_coord_t lv_image_get_scale_x(lv_obj_t * obj) +int32_t lv_image_get_scale_x(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -429,7 +429,7 @@ lv_coord_t lv_image_get_scale_x(lv_obj_t * obj) return img->zoom_x; } -lv_coord_t lv_image_get_scale_y(lv_obj_t * obj) +int32_t lv_image_get_scale_y(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -544,13 +544,13 @@ static void lv_image_event(const lv_obj_class_t * class_p, lv_event_t * e) } else 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); /*If the image has angle provide enough room for the rotated corners*/ if(img->rotation || img->zoom_x != LV_SCALE_NONE || img->zoom_y != LV_SCALE_NONE) { lv_area_t a; - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); + int32_t w = lv_obj_get_width(obj); + int32_t h = lv_obj_get_height(obj); _lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->zoom_x, img->zoom_y, &pivot_px); *s = LV_MAX(*s, -a.x1); *s = LV_MAX(*s, -a.y1); @@ -567,8 +567,8 @@ static void lv_image_event(const lv_obj_class_t * class_p, lv_event_t * e) (img->zoom_x != LV_SCALE_NONE || img->zoom_y != LV_SCALE_NONE || img->rotation != 0 || img->pivot.x != img->w / 2 || img->pivot.y != img->h / 2)) { - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); + int32_t w = lv_obj_get_width(obj); + int32_t h = lv_obj_get_height(obj); lv_area_t coords; _lv_image_buf_get_transformed_area(&coords, w, h, img->rotation, img->zoom_x, img->zoom_y, &pivot_px); coords.x1 += obj->coords.x1; @@ -655,14 +655,14 @@ static void draw_image(lv_event_t * e) } else if(code == LV_EVENT_DRAW_MAIN || code == LV_EVENT_DRAW_POST) { - lv_coord_t obj_w = lv_obj_get_width(obj); - lv_coord_t obj_h = lv_obj_get_height(obj); + int32_t obj_w = lv_obj_get_width(obj); + int32_t obj_h = lv_obj_get_height(obj); - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; - lv_coord_t pright = lv_obj_get_style_pad_right(obj, LV_PART_MAIN) + border_width; - lv_coord_t ptop = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; - lv_coord_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN) + border_width; + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; + int32_t pright = lv_obj_get_style_pad_right(obj, LV_PART_MAIN) + border_width; + int32_t ptop = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; + int32_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN) + border_width; lv_point_t bg_pivot; lv_point_t pivot_px; @@ -747,8 +747,8 @@ static void draw_image(lv_event_t * e) layer->clip_area = img_clip_area; lv_area_t coords_tmp; - lv_coord_t offset_x = img->offset.x % img->w; - lv_coord_t offset_y = img->offset.y % img->h; + int32_t offset_x = img->offset.x % img->w; + int32_t offset_y = img->offset.y % img->h; coords_tmp.y1 = img_max_area.y1 + offset_y; if(coords_tmp.y1 > img_max_area.y1) coords_tmp.y1 -= img->h; coords_tmp.y2 = coords_tmp.y1 + img->h - 1; @@ -795,8 +795,8 @@ static void scale_update(lv_obj_t * obj, int32_t zoom_x, int32_t zoom_y) } lv_obj_update_layout(obj); /*Be sure the object's size is calculated*/ - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); + int32_t w = lv_obj_get_width(obj); + int32_t h = lv_obj_get_height(obj); lv_area_t a; lv_point_t pivot_px; lv_image_get_pivot(obj, &pivot_px); diff --git a/src/widgets/image/lv_image.h b/src/widgets/image/lv_image.h index 957d43371..c9723995e 100644 --- a/src/widgets/image/lv_image.h +++ b/src/widgets/image/lv_image.h @@ -41,8 +41,8 @@ typedef struct { lv_obj_t obj; const void * src; /*Image source: Pointer to an array or a file or a symbol*/ lv_point_t offset; - lv_coord_t w; /*Width of the image (Handled by the library)*/ - lv_coord_t h; /*Height of the image (Handled by the library)*/ + int32_t w; /*Width of the image (Handled by the library)*/ + int32_t h; /*Height of the image (Handled by the library)*/ uint32_t rotation; /*rotation angle of the image*/ uint32_t zoom_x; /*256 means no zoom, 512 double size, 128 half size*/ uint32_t zoom_y; /*256 means no zoom, 512 double size, 128 half size*/ @@ -119,7 +119,7 @@ void lv_image_set_src(lv_obj_t * obj, const void * src); * @param obj pointer to an image * @param x the new offset along x axis. */ -void lv_image_set_offset_x(lv_obj_t * obj, lv_coord_t x); +void lv_image_set_offset_x(lv_obj_t * obj, int32_t x); /** * Set an offset for the source of an image. @@ -127,7 +127,7 @@ void lv_image_set_offset_x(lv_obj_t * obj, lv_coord_t x); * @param obj pointer to an image * @param y the new offset along y axis. */ -void lv_image_set_offset_y(lv_obj_t * obj, lv_coord_t y); +void lv_image_set_offset_y(lv_obj_t * obj, int32_t y); /** @@ -147,7 +147,7 @@ void lv_image_set_rotation(lv_obj_t * obj, int32_t angle); * @param x rotation center x of the image * @param y rotation center y of the image */ -void lv_image_set_pivot(lv_obj_t * obj, lv_coord_t x, lv_coord_t y); +void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y); /** * Set pivot similar to get_pivot @@ -229,21 +229,21 @@ const void * lv_image_get_src(lv_obj_t * obj); * @param obj pointer to an image * @return offset X value. */ -lv_coord_t lv_image_get_offset_x(lv_obj_t * obj); +int32_t lv_image_get_offset_x(lv_obj_t * obj); /** * Get the offset's y attribute of the image object. * @param obj pointer to an image * @return offset Y value. */ -lv_coord_t lv_image_get_offset_y(lv_obj_t * obj); +int32_t lv_image_get_offset_y(lv_obj_t * obj); /** * Get the rotation of the image. * @param obj pointer to an image object * @return rotation in 0.1 degrees (0..3600) */ -lv_coord_t lv_image_get_rotation(lv_obj_t * obj); +int32_t lv_image_get_rotation(lv_obj_t * obj); /** * Get the pivot (rotation center) of the image. @@ -258,21 +258,21 @@ void lv_image_get_pivot(lv_obj_t * obj, lv_point_t * pivot); * @param obj pointer to an image object * @return zoom factor (256: no zoom) */ -lv_coord_t lv_image_get_scale(lv_obj_t * obj); +int32_t lv_image_get_scale(lv_obj_t * obj); /** * Get the horizontal zoom factor of the image. * @param obj pointer to an image object * @return zoom factor (256: no zoom) */ -lv_coord_t lv_image_get_scale_x(lv_obj_t * obj); +int32_t lv_image_get_scale_x(lv_obj_t * obj); /** * Get the vertical zoom factor of the image. * @param obj pointer to an image object * @return zoom factor (256: no zoom) */ -lv_coord_t lv_image_get_scale_y(lv_obj_t * obj); +int32_t lv_image_get_scale_y(lv_obj_t * obj); /** * Get whether the transformations (rotate, zoom) are anti-aliased or not diff --git a/src/widgets/imgbtn/lv_imgbtn.c b/src/widgets/imgbtn/lv_imgbtn.c index 3a5721b70..da5b949ea 100644 --- a/src/widgets/imgbtn/lv_imgbtn.c +++ b/src/widgets/imgbtn/lv_imgbtn.c @@ -221,8 +221,8 @@ static void draw_main(lv_event_t * e) /*Simply draw the middle src if no tiled*/ lv_imgbtn_src_info_t * src_info = &imgbtn->src_left[state]; - lv_coord_t tw = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); - lv_coord_t th = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); + int32_t tw = lv_obj_get_style_transform_width(obj, LV_PART_MAIN); + int32_t th = lv_obj_get_style_transform_height(obj, LV_PART_MAIN); lv_area_t coords; lv_area_copy(&coords, &obj->coords); lv_area_increase(&coords, tw, th); @@ -232,8 +232,8 @@ static void draw_main(lv_event_t * e) lv_obj_init_draw_image_dsc(obj, LV_PART_MAIN, &img_dsc); lv_area_t coords_part; - lv_coord_t left_w = 0; - lv_coord_t right_w = 0; + int32_t left_w = 0; + int32_t right_w = 0; if(src_info->img_src) { left_w = src_info->header.w; @@ -267,7 +267,7 @@ static void draw_main(lv_event_t * e) bool comm_res; comm_res = _lv_area_intersect(&clip_area_center, &clip_area_center, &layer->clip_area); if(comm_res) { - lv_coord_t i; + int32_t i; const lv_area_t clip_area_ori = layer->clip_area; layer->clip_area = clip_area_center; @@ -277,7 +277,7 @@ static void draw_main(lv_event_t * e) coords_part.x2 = coords_part.x1 + src_info->header.w - 1; coords_part.y2 = coords_part.y1 + src_info->header.h - 1; - for(i = coords_part.x1; i < (lv_coord_t)(clip_area_center.x2 + src_info->header.w - 1); i += src_info->header.w) { + for(i = coords_part.x1; i < (int32_t)(clip_area_center.x2 + src_info->header.w - 1); i += src_info->header.w) { img_dsc.src = src_info->img_src; lv_draw_image(layer, &img_dsc, &coords_part); coords_part.x1 = coords_part.x2 + 1; diff --git a/src/widgets/label/lv_label.c b/src/widgets/label/lv_label.c index 91c802638..77c75739f 100644 --- a/src/widgets/label/lv_label.c +++ b/src/widgets/label/lv_label.c @@ -53,8 +53,8 @@ static void set_ofs_y_anim(void * obj, int32_t v); static size_t get_text_length(const char * text); static void copy_text_to_label(lv_label_t * label, const char * text); static lv_text_flag_t get_label_flags(lv_label_t * label); -static void calculate_x_coordinate(lv_coord_t * x, const lv_text_align_t align, const char * txt, - uint32_t length, const lv_font_t * font, lv_coord_t letter_space, lv_area_t * txt_coords); +static void calculate_x_coordinate(int32_t * x, const lv_text_align_t align, const char * txt, + uint32_t length, const lv_font_t * font, int32_t letter_space, lv_area_t * txt_coords); /********************** * STATIC VARIABLES @@ -304,17 +304,17 @@ void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t const uint32_t byte_id = _lv_text_encoded_get_byte_id(txt, char_id); /*Search the line of the index letter*/ - const lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); - const lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); + const int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + const int32_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - const lv_coord_t letter_height = lv_font_get_line_height(font); + const int32_t letter_height = lv_font_get_line_height(font); lv_area_t txt_coords; lv_obj_get_content_coords(obj, &txt_coords); - const lv_coord_t max_w = lv_area_get_width(&txt_coords); + const int32_t max_w = lv_area_get_width(&txt_coords); - lv_coord_t y = 0; + int32_t y = 0; uint32_t line_start = 0; uint32_t new_line_start = 0; while(txt[new_line_start] != '\0') { @@ -363,7 +363,7 @@ void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t #endif /*Calculate the x coordinate*/ - lv_coord_t x = lv_text_get_width(bidi_txt, visual_byte_pos, font, letter_space); + int32_t x = lv_text_get_width(bidi_txt, visual_byte_pos, font, letter_space); if(char_id != line_start) x += letter_space; uint32_t length = new_line_start - line_start; @@ -391,12 +391,12 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in) const char * txt = lv_label_get_text(obj); uint32_t line_start = 0; uint32_t new_line_start = 0; - lv_coord_t max_w = lv_area_get_width(&txt_coords); + int32_t max_w = lv_area_get_width(&txt_coords); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - const lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); - const lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); - const lv_coord_t letter_height = lv_font_get_line_height(font); - lv_coord_t y = 0; + const int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + const int32_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); + const int32_t letter_height = lv_font_get_line_height(font); + int32_t y = 0; lv_text_flag_t flag = get_label_flags(label); if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT && !obj->w_layout) flag |= LV_TEXT_FLAG_FIT; @@ -431,7 +431,7 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in) #endif /*Calculate the x coordinate*/ - lv_coord_t x = 0; + int32_t x = 0; const lv_text_align_t align = lv_obj_calculate_style_text_align(obj, LV_PART_MAIN, label->text); uint32_t length = new_line_start - line_start; calculate_x_coordinate(&x, align, bidi_txt, length, font, letter_space, &txt_coords); @@ -447,7 +447,7 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in) uint32_t letter_next; _lv_text_encoded_letter_next_2(bidi_txt, &letter, &letter_next, &i); - lv_coord_t gw = lv_font_get_glyph_width(font, letter, letter_next); + int32_t gw = lv_font_get_glyph_width(font, letter, letter_next); /*Finish if the x position or the last char of the next line is reached*/ if(pos.x < x + gw || i + line_start == new_line_start || txt[i_act + line_start] == '\0') { @@ -492,17 +492,17 @@ bool lv_label_is_char_under_pos(const lv_obj_t * obj, lv_point_t * pos) lv_label_t * label = (lv_label_t *)obj; uint32_t line_start = 0; uint32_t new_line_start = 0; - const lv_coord_t max_w = lv_area_get_width(&txt_coords); + const int32_t max_w = lv_area_get_width(&txt_coords); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - const lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); - const lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); - const lv_coord_t letter_height = lv_font_get_line_height(font); + const int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + const int32_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); + const int32_t letter_height = lv_font_get_line_height(font); lv_text_flag_t flag = get_label_flags(label); if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT && !obj->w_layout) flag |= LV_TEXT_FLAG_FIT; /*Search the line of the index letter*/ - lv_coord_t y = 0; + int32_t y = 0; while(txt[line_start] != '\0') { new_line_start += _lv_text_get_next_line(&txt[line_start], font, letter_space, max_w, NULL, flag); @@ -515,17 +515,17 @@ bool lv_label_is_char_under_pos(const lv_obj_t * obj, lv_point_t * pos) /*Calculate the x coordinate*/ const lv_text_align_t align = lv_obj_calculate_style_text_align(obj, LV_PART_MAIN, label->text); - lv_coord_t x = 0; + int32_t x = 0; if(align == LV_TEXT_ALIGN_CENTER) { - const lv_coord_t line_w = lv_text_get_width(&txt[line_start], new_line_start - line_start, font, letter_space); + const int32_t line_w = lv_text_get_width(&txt[line_start], new_line_start - line_start, font, letter_space); x += lv_area_get_width(&txt_coords) / 2 - line_w / 2; } else if(align == LV_TEXT_ALIGN_RIGHT) { - const lv_coord_t line_w = lv_text_get_width(&txt[line_start], new_line_start - line_start, font, letter_space); + const int32_t line_w = lv_text_get_width(&txt[line_start], new_line_start - line_start, font, letter_space); x += lv_area_get_width(&txt_coords) - line_w; } - lv_coord_t last_x = 0; + int32_t last_x = 0; uint32_t i = line_start; uint32_t i_current = i; uint32_t letter = '\0'; @@ -699,20 +699,20 @@ static void lv_label_event(const lv_obj_class_t * class_p, lv_event_t * e) * To avoid this add some extra draw area. * font_h / 4 is an empirical value. */ const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - const lv_coord_t font_h = lv_font_get_line_height(font); + const int32_t font_h = lv_font_get_line_height(font); lv_event_set_ext_draw_size(e, font_h / 4); } else if(code == LV_EVENT_GET_SELF_SIZE) { lv_label_t * label = (lv_label_t *)obj; if(label->invalid_size_cache) { const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + int32_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); lv_text_flag_t flag = LV_TEXT_FLAG_NONE; if(label->recolor != 0) flag |= LV_TEXT_FLAG_RECOLOR; if(label->expand != 0) flag |= LV_TEXT_FLAG_EXPAND; - lv_coord_t w = lv_obj_get_content_width(obj); + int32_t w = lv_obj_get_content_width(obj); if(lv_obj_get_style_width(obj, LV_PART_MAIN) == LV_SIZE_CONTENT && !obj->w_layout) w = LV_COORD_MAX; else w = lv_obj_get_content_width(obj); @@ -785,7 +785,7 @@ static void draw_main(lv_event_t * e) } if(label->long_mode == LV_LABEL_LONG_WRAP) { - lv_coord_t s = lv_obj_get_scroll_top(obj); + int32_t s = lv_obj_get_scroll_top(obj); lv_area_move(&txt_coords, 0, -s); txt_coords.y2 = obj->coords.y2; } @@ -868,10 +868,10 @@ static void lv_label_refr_text(lv_obj_t * obj) lv_area_t txt_coords; lv_obj_get_content_coords(obj, &txt_coords); - lv_coord_t max_w = lv_area_get_width(&txt_coords); + int32_t max_w = lv_area_get_width(&txt_coords); 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 letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + int32_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_MAIN); /*Calc. the height and longest line*/ lv_point_t size; @@ -1088,7 +1088,7 @@ static void lv_label_refr_text(lv_obj_t * obj) } else { lv_point_t p; - lv_coord_t y_overed; + int32_t y_overed; p.x = lv_area_get_width(&txt_coords) - (lv_font_get_glyph_width(font, '.', '.') + letter_space) * LV_LABEL_DOT_NUM; /*Shrink with dots*/ @@ -1277,15 +1277,15 @@ static lv_text_flag_t get_label_flags(lv_label_t * label) } /* Function created because of this pattern be used in multiple functions */ -static void calculate_x_coordinate(lv_coord_t * x, const lv_text_align_t align, const char * txt, uint32_t length, - const lv_font_t * font, lv_coord_t letter_space, lv_area_t * txt_coords) +static void calculate_x_coordinate(int32_t * x, const lv_text_align_t align, const char * txt, uint32_t length, + const lv_font_t * font, int32_t letter_space, lv_area_t * txt_coords) { if(align == LV_TEXT_ALIGN_CENTER) { - const lv_coord_t line_w = lv_text_get_width(txt, length, font, letter_space); + const int32_t line_w = lv_text_get_width(txt, length, font, letter_space); *x += lv_area_get_width(txt_coords) / 2 - line_w / 2; } else if(align == LV_TEXT_ALIGN_RIGHT) { - const lv_coord_t line_w = lv_text_get_width(txt, length, font, letter_space); + const int32_t line_w = lv_text_get_width(txt, length, font, letter_space); *x += lv_area_get_width(txt_coords) - line_w; } else { diff --git a/src/widgets/line/lv_line.c b/src/widgets/line/lv_line.c index 186891fbd..5139b721e 100644 --- a/src/widgets/line/lv_line.c +++ b/src/widgets/line/lv_line.c @@ -122,7 +122,7 @@ static void lv_line_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_TRACE_OBJ_CREATE("finished"); } -static inline lv_value_precise_t resolve_point_coord(lv_value_precise_t coord, lv_coord_t max) +static inline lv_value_precise_t resolve_point_coord(lv_value_precise_t coord, int32_t max) { if(LV_COORD_IS_PCT((int32_t)coord)) { return LV_CLAMP(0, max * LV_COORD_GET_PCT((int32_t)coord) / 100, max); @@ -147,8 +147,8 @@ static void lv_line_event(const lv_obj_class_t * class_p, lv_event_t * e) if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { /*The corner of the skew lines is out of the intended area*/ - lv_coord_t line_width = lv_obj_get_style_line_width(obj, LV_PART_MAIN); - lv_coord_t * s = lv_event_get_param(e); + int32_t line_width = lv_obj_get_style_line_width(obj, LV_PART_MAIN); + int32_t * s = lv_event_get_param(e); if(*s < line_width) *s = line_width; } else if(code == LV_EVENT_GET_SELF_SIZE) { @@ -157,8 +157,8 @@ static void lv_line_event(const lv_obj_class_t * class_p, lv_event_t * e) if(line->point_num == 0 || line->point_array == NULL) return; lv_point_t * p = lv_event_get_param(e); - lv_coord_t w = 0; - lv_coord_t h = 0; + int32_t w = 0; + int32_t h = 0; uint32_t i; for(i = 0; i < line->point_num; i++) { @@ -182,8 +182,8 @@ static void lv_line_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_area_t area; lv_obj_get_coords(obj, &area); - lv_coord_t x_ofs = area.x1 - lv_obj_get_scroll_x(obj); - lv_coord_t y_ofs = area.y1 - lv_obj_get_scroll_y(obj); + int32_t x_ofs = area.x1 - lv_obj_get_scroll_x(obj); + int32_t y_ofs = area.y1 - lv_obj_get_scroll_y(obj); lv_draw_line_dsc_t line_dsc; lv_draw_line_dsc_init(&line_dsc); @@ -192,8 +192,8 @@ static void lv_line_event(const lv_obj_class_t * class_p, lv_event_t * e) /*Read all points and draw the lines*/ uint32_t i; for(i = 0; i < line->point_num - 1; i++) { - lv_coord_t w = lv_obj_get_width(obj); - lv_coord_t h = lv_obj_get_height(obj); + int32_t w = lv_obj_get_width(obj); + int32_t h = lv_obj_get_height(obj); line_dsc.p1_x = resolve_point_coord(line->point_array[i].x, w) + x_ofs; line_dsc.p1_y = resolve_point_coord(line->point_array[i].y, h); diff --git a/src/widgets/msgbox/lv_msgbox.c b/src/widgets/msgbox/lv_msgbox.c index 680ebfbfa..e2f654d36 100644 --- a/src/widgets/msgbox/lv_msgbox.c +++ b/src/widgets/msgbox/lv_msgbox.c @@ -109,7 +109,7 @@ lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char * lv_obj_t * label = lv_label_create(mbox->close_btn); lv_label_set_text(label, LV_SYMBOL_CLOSE); const lv_font_t * font = lv_obj_get_style_text_font(mbox->close_btn, LV_PART_MAIN); - lv_coord_t close_button_size = lv_font_get_line_height(font) + LV_DPX(10); + int32_t close_button_size = lv_font_get_line_height(font) + LV_DPX(10); lv_obj_set_size(mbox->close_btn, close_button_size, close_button_size); lv_obj_align(label, LV_ALIGN_CENTER, 0, 0); } @@ -138,7 +138,7 @@ lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char * } const lv_font_t * font = lv_obj_get_style_text_font(mbox->buttons, LV_PART_ITEMS); - lv_coord_t btn_h = lv_font_get_line_height(font) + LV_DPI_DEF / 10; + int32_t btn_h = lv_font_get_line_height(font) + LV_DPI_DEF / 10; lv_obj_set_size(mbox->buttons, btn_cnt * (2 * LV_DPI_DEF / 3), btn_h); lv_obj_set_style_max_width(mbox->buttons, lv_pct(100), 0); lv_obj_add_flag(mbox->buttons, LV_OBJ_FLAG_EVENT_BUBBLE); /*To see the event directly on the message box*/ diff --git a/src/widgets/roller/lv_roller.c b/src/widgets/roller/lv_roller.c index fc0a5609b..082752d12 100644 --- a/src/widgets/roller/lv_roller.c +++ b/src/widgets/roller/lv_roller.c @@ -41,7 +41,7 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t animen); static lv_result_t release_handler(lv_obj_t * obj); static void inf_normalize(lv_obj_t * obj_scrl); static lv_obj_t * get_label(const lv_obj_t * obj); -static lv_coord_t get_selected_label_width(const lv_obj_t * obj); +static int32_t get_selected_label_width(const lv_obj_t * obj); static void scroll_anim_ready_cb(lv_anim_t * a); static void set_y_anim(void * obj, int32_t v); static void transform_vect_recursive(lv_obj_t * roller, lv_point_t * vect); @@ -126,7 +126,7 @@ void lv_roller_set_options(lv_obj_t * obj, const char * options, lv_roller_mode_ roller->mode = LV_ROLLER_MODE_INFINITE; const lv_font_t * font = lv_obj_get_style_text_font(obj, 0); - lv_coord_t normal_h = roller->option_cnt * (lv_font_get_line_height(font) + lv_obj_get_style_text_letter_space(obj, 0)); + int32_t normal_h = roller->option_cnt * (lv_font_get_line_height(font) + lv_obj_get_style_text_letter_space(obj, 0)); roller->inf_page_cnt = LV_CLAMP(3, EXTRA_INF_SIZE / normal_h, 15); if(!(roller->inf_page_cnt & 1)) roller->inf_page_cnt++; /*Make it odd*/ LV_LOG_INFO("Using %" LV_PRIu32 " pages to make the roller look infinite", roller->inf_page_cnt); @@ -205,8 +205,8 @@ void lv_roller_set_visible_row_count(lv_obj_t * obj, uint32_t row_cnt) LV_ASSERT_OBJ(obj, MY_CLASS); 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 border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); lv_obj_set_height(obj, (lv_font_get_line_height(font) + line_space) * row_cnt + 2 * border_width); } @@ -447,10 +447,10 @@ static void lv_roller_label_event(const lv_obj_class_t * class_p, lv_event_t * e lv_obj_t * label = lv_event_get_target(e); if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { /*If the selected text has a larger font it needs some extra space to draw it*/ - lv_coord_t * s = lv_event_get_param(e); + int32_t * s = lv_event_get_param(e); lv_obj_t * obj = lv_obj_get_parent(label); - lv_coord_t sel_w = get_selected_label_width(obj); - lv_coord_t label_w = lv_obj_get_width(label); + int32_t sel_w = get_selected_label_width(obj); + int32_t label_w = lv_obj_get_width(label); *s = LV_MAX(*s, sel_w - label_w); } else if(code == LV_EVENT_SIZE_CHANGED) { @@ -500,7 +500,7 @@ static void draw_main(lv_event_t * e) lv_obj_get_width(obj), LV_TEXT_FLAG_EXPAND); /*Move the selected label proportionally with the background label*/ - lv_coord_t roller_h = lv_obj_get_height(obj); + int32_t roller_h = lv_obj_get_height(obj); int32_t label_y_prop = label->coords.y1 - (roller_h / 2 + obj->coords.y1); /*label offset from the middle line of the roller*/ label_y_prop = (label_y_prop * 16384) / lv_obj_get_height( @@ -508,7 +508,7 @@ static void draw_main(lv_event_t * e) /*Apply a correction with different line heights*/ const lv_font_t * normal_label_font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - lv_coord_t corr = (label_dsc.font->line_height - normal_label_font->line_height) / 2; + int32_t corr = (label_dsc.font->line_height - normal_label_font->line_height) / 2; /*Apply the proportional position to the selected text*/ res_p.y -= corr; @@ -516,9 +516,9 @@ static void draw_main(lv_event_t * e) label_sel_y += (label_y_prop * res_p.y) >> 14; label_sel_y -= corr; - lv_coord_t bwidth = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t pright = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + int32_t bwidth = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t pleft = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t pright = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); /*Draw the selected text*/ lv_area_t label_sel_area; @@ -594,10 +594,10 @@ static void get_sel_area(lv_obj_t * obj, lv_area_t * sel_area) const lv_font_t * font_main = lv_obj_get_style_text_font(obj, LV_PART_MAIN); const lv_font_t * font_sel = lv_obj_get_style_text_font(obj, LV_PART_SELECTED); - lv_coord_t font_main_h = lv_font_get_line_height(font_main); - lv_coord_t font_sel_h = lv_font_get_line_height(font_sel); - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); - lv_coord_t d = (font_sel_h + font_main_h) / 2 + line_space; + int32_t font_main_h = lv_font_get_line_height(font_main); + int32_t font_sel_h = lv_font_get_line_height(font_sel); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + int32_t d = (font_sel_h + font_main_h) / 2 + line_space; sel_area->y1 = obj->coords.y1 + lv_obj_get_height(obj) / 2 - d / 2; sel_area->y2 = sel_area->y1 + d; lv_area_t roller_coords; @@ -620,7 +620,7 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) const lv_text_align_t align = lv_obj_calculate_style_text_align(label, LV_PART_MAIN, lv_label_get_text(label)); - lv_coord_t x = 0; + int32_t x = 0; switch(align) { case LV_TEXT_ALIGN_CENTER: x = (lv_obj_get_content_width(obj) - lv_obj_get_width(label)) / 2; @@ -638,9 +638,9 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) lv_obj_set_x(label, x); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - const lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); - const lv_coord_t font_h = lv_font_get_line_height(font); - const lv_coord_t h = lv_obj_get_content_height(obj); + const int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + const int32_t font_h = lv_font_get_line_height(font); + const int32_t h = lv_obj_get_content_height(obj); uint32_t anim_time = lv_obj_get_style_anim_time(obj, LV_PART_MAIN); /*Normally the animation's `end_cb` sets correct position of the roller if infinite. @@ -652,9 +652,9 @@ static void refr_position(lv_obj_t * obj, lv_anim_enable_t anim_en) /* Calculate animation configuration */ lv_roller_t * roller = (lv_roller_t *)obj; int32_t id = roller->sel_opt_id; - const lv_coord_t sel_y1 = id * (font_h + line_space); - const lv_coord_t mid_y1 = h / 2 - font_h / 2; - const lv_coord_t new_y = mid_y1 - sel_y1; + const int32_t sel_y1 = id * (font_h + line_space); + const int32_t mid_y1 = h / 2 - font_h / 2; + const int32_t new_y = mid_y1 - sel_y1; if(anim_en == LV_ANIM_OFF || anim_time == 0) { lv_anim_delete(label, set_y_anim); @@ -722,24 +722,24 @@ static lv_result_t release_handler(lv_obj_t * obj) else { /*If dragged then align the list to have an element in the middle*/ 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_coord_t label_unit = font_h + line_space; - lv_coord_t mid = obj->coords.y1 + (obj->coords.y2 - obj->coords.y1) / 2; + int32_t label_unit = font_h + line_space; + int32_t mid = obj->coords.y1 + (obj->coords.y2 - obj->coords.y1) / 2; lv_point_t p = indev->pointer.scroll_throw_vect_ori; transform_vect_recursive(obj, &p); - lv_coord_t scroll_throw = indev->scroll_throw; - lv_coord_t sum = 0; + int32_t scroll_throw = indev->scroll_throw; + int32_t sum = 0; int32_t v = p.y; while(v) { sum += v; v = v * (100 - scroll_throw) / 100; } - lv_coord_t label_y1 = label->coords.y1 + sum; + int32_t label_y1 = label->coords.y1 + sum; int32_t id = (mid - label_y1) / label_unit; if(id < 0) id = 0; @@ -776,15 +776,15 @@ static void inf_normalize(lv_obj_t * obj) /*Move to the new id*/ 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); - lv_coord_t h = lv_obj_get_content_height(obj); + 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); + int32_t h = lv_obj_get_content_height(obj); lv_obj_t * label = get_label(obj); - lv_coord_t sel_y1 = roller->sel_opt_id * (font_h + line_space); - lv_coord_t mid_y1 = h / 2 - font_h / 2; - lv_coord_t new_y = mid_y1 - sel_y1; + int32_t sel_y1 = roller->sel_opt_id * (font_h + line_space); + int32_t mid_y1 = h / 2 - font_h / 2; + int32_t new_y = mid_y1 - sel_y1; lv_obj_set_y(label, new_y); } } @@ -795,13 +795,13 @@ static lv_obj_t * get_label(const lv_obj_t * obj) } -static lv_coord_t get_selected_label_width(const lv_obj_t * obj) +static int32_t get_selected_label_width(const lv_obj_t * obj) { lv_obj_t * label = get_label(obj); if(label == NULL) return 0; const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_SELECTED); - lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_SELECTED); + int32_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_SELECTED); const char * txt = lv_label_get_text(label); lv_point_t size; lv_text_get_size(&size, txt, font, letter_space, 0, LV_COORD_MAX, LV_TEXT_FLAG_NONE); diff --git a/src/widgets/scale/lv_scale.c b/src/widgets/scale/lv_scale.c index becbdfb2f..b02fa24e0 100644 --- a/src/widgets/scale/lv_scale.c +++ b/src/widgets/scale/lv_scale.c @@ -38,7 +38,7 @@ static void lv_scale_event(const lv_obj_class_t * class_p, lv_event_t * event); static void scale_draw_main(lv_obj_t * obj, lv_event_t * event); static void scale_draw_indicator(lv_obj_t * obj, lv_event_t * event); -static void scale_get_center(const lv_obj_t * obj, lv_point_t * center, lv_coord_t * arc_r); +static void scale_get_center(const lv_obj_t * obj, lv_point_t * center, int32_t * arc_r); static void scale_get_tick_points(lv_obj_t * obj, const uint32_t tick_idx, bool is_major_tick, lv_point_t * tick_point_a, lv_point_t * tick_point_b); static void scale_get_label_coords(lv_obj_t * obj, lv_draw_label_dsc_t * label_dsc, lv_point_t * tick_point, @@ -51,7 +51,7 @@ static void scale_set_arc_properties(lv_obj_t * obj, lv_draw_arc_dsc_t * arc_dsc /* Helpers */ static void scale_find_section_tick_idx(lv_obj_t * obj); static void scale_store_main_line_tick_width_compensation(lv_obj_t * obj, const uint32_t tick_idx, - const bool is_major_tick, const lv_coord_t major_tick_width, const lv_coord_t minor_tick_width); + const bool is_major_tick, const int32_t major_tick_width, const int32_t minor_tick_width); static void scale_store_section_line_tick_width_compensation(lv_obj_t * obj, const bool is_major_tick, lv_draw_label_dsc_t * label_dsc, lv_draw_line_dsc_t * major_tick_dsc, lv_draw_line_dsc_t * minor_tick_dsc, const int32_t tick_value, const uint8_t tick_idx, lv_point_t * tick_point_a); @@ -110,7 +110,7 @@ void lv_scale_set_mode(lv_obj_t * obj, lv_scale_mode_t mode) lv_obj_invalidate(obj); } -void lv_scale_set_total_tick_count(lv_obj_t * obj, lv_coord_t total_tick_count) +void lv_scale_set_total_tick_count(lv_obj_t * obj, int32_t total_tick_count) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_scale_t * scale = (lv_scale_t *)obj; @@ -120,7 +120,7 @@ void lv_scale_set_total_tick_count(lv_obj_t * obj, lv_coord_t total_tick_count) lv_obj_invalidate(obj); } -void lv_scale_set_major_tick_every(lv_obj_t * obj, lv_coord_t major_tick_every) +void lv_scale_set_major_tick_every(lv_obj_t * obj, int32_t major_tick_every) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_scale_t * scale = (lv_scale_t *)obj; @@ -130,7 +130,7 @@ void lv_scale_set_major_tick_every(lv_obj_t * obj, lv_coord_t major_tick_every) lv_obj_invalidate(obj); } -void lv_scale_set_major_tick_length(lv_obj_t * obj, lv_coord_t major_len) +void lv_scale_set_major_tick_length(lv_obj_t * obj, int32_t major_len) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_scale_t * scale = (lv_scale_t *)obj; @@ -140,7 +140,7 @@ void lv_scale_set_major_tick_length(lv_obj_t * obj, lv_coord_t major_len) lv_obj_invalidate(obj); } -void lv_scale_set_minor_tick_length(lv_obj_t * obj, lv_coord_t minor_len) +void lv_scale_set_minor_tick_length(lv_obj_t * obj, int32_t minor_len) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_scale_t * scale = (lv_scale_t *)obj; @@ -160,7 +160,7 @@ void lv_scale_set_label_show(lv_obj_t * obj, bool show_label) lv_obj_invalidate(obj); } -void lv_scale_set_range(lv_obj_t * obj, lv_coord_t min, lv_coord_t max) +void lv_scale_set_range(lv_obj_t * obj, int32_t min, int32_t max) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_scale_t * scale = (lv_scale_t *)obj; @@ -190,7 +190,7 @@ void lv_scale_set_text_src(lv_obj_t * obj, const char * txt_src[]) scale->txt_src = txt_src; scale->custom_label_cnt = 0; if(scale->txt_src) { - lv_coord_t idx; + int32_t idx; for(idx = 0; txt_src[idx]; ++idx) { scale->custom_label_cnt++; } @@ -234,7 +234,7 @@ lv_scale_section_t * lv_scale_add_section(lv_obj_t * obj) return section; } -void lv_scale_section_set_range(lv_scale_section_t * section, lv_coord_t minor_range, lv_coord_t major_range) +void lv_scale_section_set_range(lv_scale_section_t * section, int32_t minor_range, int32_t major_range) { if(NULL == section) return; @@ -471,7 +471,7 @@ static void scale_draw_indicator(lv_obj_t * obj, lv_event_t * event) /* Find the center of the scale */ lv_point_t center_point; - lv_coord_t radius_edge = LV_MIN(lv_area_get_width(&scale_area) / 2U, lv_area_get_height(&scale_area) / 2U); + int32_t radius_edge = LV_MIN(lv_area_get_width(&scale_area) / 2U, lv_area_get_height(&scale_area) / 2U); center_point.x = scale_area.x1 + radius_edge; center_point.y = scale_area.y1 + radius_edge; @@ -591,14 +591,14 @@ static void scale_draw_main(lv_obj_t * obj, lv_event_t * event) lv_obj_init_draw_line_dsc(obj, LV_PART_MAIN, &line_dsc); /* Get style properties so they can be used in the main line drawing */ - const lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - const lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; - const lv_coord_t pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN) + border_width; - const lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; - const lv_coord_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN) + border_width; + const int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + const int32_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; + const int32_t pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN) + border_width; + const int32_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; + const int32_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN) + border_width; - lv_coord_t x_ofs = 0U; - lv_coord_t y_ofs = 0U; + int32_t x_ofs = 0U; + int32_t y_ofs = 0U; if(LV_SCALE_MODE_VERTICAL_LEFT == scale->mode) { x_ofs = obj->coords.x2 + (line_dsc.width / 2U) - pad_right; @@ -664,22 +664,22 @@ static void scale_draw_main(lv_obj_t * obj, lv_event_t * event) if(LV_SCALE_MODE_VERTICAL_LEFT == scale->mode || LV_SCALE_MODE_VERTICAL_RIGHT == scale->mode) { /* Calculate position of the first tick in the section */ main_point_a.x = main_line_point_a.x; - lv_coord_t tmp = (lv_coord_t)(section->first_tick_in_section_width / 2U); + int32_t tmp = (int32_t)(section->first_tick_in_section_width / 2U); main_point_a.y = section->first_tick_in_section.y + tmp; /* Calculate position of the last tick in the section */ main_point_b.x = main_line_point_a.x; - tmp = (lv_coord_t)(section->last_tick_in_section_width / 2U); + tmp = (int32_t)(section->last_tick_in_section_width / 2U); main_point_b.y = section->last_tick_in_section.y - tmp; } else { /* Calculate position of the first tick in the section */ - lv_coord_t tmp = (lv_coord_t)(section->first_tick_in_section_width / 2U); + int32_t tmp = (int32_t)(section->first_tick_in_section_width / 2U); main_point_a.x = section->first_tick_in_section.x - tmp; main_point_a.y = main_line_point_a.y; /* Calculate position of the last tick in the section */ - tmp = (lv_coord_t)(section->last_tick_in_section_width / 2U); + tmp = (int32_t)(section->last_tick_in_section_width / 2U); main_point_b.x = section->last_tick_in_section.x + tmp; main_point_b.y = main_line_point_a.y; } @@ -700,7 +700,7 @@ static void scale_draw_main(lv_obj_t * obj, lv_event_t * event) lv_obj_init_draw_arc_dsc(obj, LV_PART_MAIN, &arc_dsc); lv_point_t arc_center; - lv_coord_t arc_radius; + int32_t arc_radius; scale_get_center(obj, &arc_center, &arc_radius); /* TODO: Add compensation for the width of the first and last tick over the arc */ @@ -723,7 +723,7 @@ static void scale_draw_main(lv_obj_t * obj, lv_event_t * event) lv_obj_init_draw_arc_dsc(obj, LV_PART_MAIN, &main_arc_section_dsc); lv_point_t section_arc_center; - lv_coord_t section_arc_radius; + int32_t section_arc_radius; scale_get_center(obj, §ion_arc_center, §ion_arc_radius); /* TODO: Add compensation for the width of the first and last tick over the arc */ @@ -751,14 +751,14 @@ static void scale_draw_main(lv_obj_t * obj, lv_event_t * event) * @param center pointer to center * @param arc_r pointer to arc radius */ -static void scale_get_center(const lv_obj_t * obj, lv_point_t * center, lv_coord_t * arc_r) +static void scale_get_center(const lv_obj_t * obj, lv_point_t * center, int32_t * arc_r) { - lv_coord_t left_bg = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t right_bg = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); - lv_coord_t top_bg = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t bottom_bg = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + int32_t left_bg = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t right_bg = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + int32_t top_bg = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t bottom_bg = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); - lv_coord_t r = (LV_MIN(lv_obj_get_width(obj) - left_bg - right_bg, lv_obj_get_height(obj) - top_bg - bottom_bg)) / 2U; + int32_t r = (LV_MIN(lv_obj_get_width(obj) - left_bg - right_bg, lv_obj_get_height(obj) - top_bg - bottom_bg)) / 2U; center->x = obj->coords.x1 + r + left_bg; center->y = obj->coords.y1 + r + top_bg; @@ -787,8 +787,8 @@ static void scale_get_tick_points(lv_obj_t * obj, const uint32_t tick_idx, bool lv_draw_line_dsc_init(&main_line_dsc); lv_obj_init_draw_line_dsc(obj, LV_PART_MAIN, &main_line_dsc); - lv_coord_t minor_len = 0; - lv_coord_t major_len = 0; + int32_t minor_len = 0; + int32_t major_len = 0; if(is_major_tick) { major_len = scale->major_len; @@ -801,18 +801,18 @@ static void scale_get_tick_points(lv_obj_t * obj, const uint32_t tick_idx, bool || (LV_SCALE_MODE_HORIZONTAL_BOTTOM == scale->mode || LV_SCALE_MODE_HORIZONTAL_TOP == scale->mode)) { /* Get style properties so they can be used in the tick and label drawing */ - const lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - const lv_coord_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; - const lv_coord_t pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN) + border_width; - const lv_coord_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN) + border_width; - const lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; - const lv_coord_t tick_pad_right = lv_obj_get_style_pad_right(obj, LV_PART_ITEMS); - const lv_coord_t tick_pad_left = lv_obj_get_style_pad_left(obj, LV_PART_ITEMS); - const lv_coord_t tick_pad_top = lv_obj_get_style_pad_top(obj, LV_PART_ITEMS); - const lv_coord_t tick_pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_ITEMS); - - lv_coord_t x_ofs = 0U; - lv_coord_t y_ofs = 0U; + const int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + const int32_t pad_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN) + border_width; + const int32_t pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN) + border_width; + const int32_t pad_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN) + border_width; + const int32_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN) + border_width; + const int32_t tick_pad_right = lv_obj_get_style_pad_right(obj, LV_PART_ITEMS); + const int32_t tick_pad_left = lv_obj_get_style_pad_left(obj, LV_PART_ITEMS); + const int32_t tick_pad_top = lv_obj_get_style_pad_top(obj, LV_PART_ITEMS); + const int32_t tick_pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_ITEMS); + + int32_t x_ofs = 0U; + int32_t y_ofs = 0U; if(LV_SCALE_MODE_VERTICAL_LEFT == scale->mode) { x_ofs = obj->coords.x2 + (main_line_dsc.width / 2U) - pad_right; @@ -843,21 +843,21 @@ static void scale_get_tick_points(lv_obj_t * obj, const uint32_t tick_idx, bool } else { /* Nothing to do */ } - const lv_coord_t tick_length = is_major_tick ? major_len : minor_len; + const int32_t tick_length = is_major_tick ? major_len : minor_len; /* Setup the tick points */ if(LV_SCALE_MODE_VERTICAL_LEFT == scale->mode || LV_SCALE_MODE_VERTICAL_RIGHT == scale->mode) { /* Vertical position starts at y2 of the scale main line, we start at y2 because the ticks are drawn from bottom to top */ - lv_coord_t vertical_position = obj->coords.y2 - (pad_bottom + tick_pad_bottom); + int32_t vertical_position = obj->coords.y2 - (pad_bottom + tick_pad_bottom); if((scale->total_tick_count - 1U) == tick_idx) { vertical_position = y_ofs; } /* Increment the tick offset depending of its index */ else if(0 != tick_idx) { - const lv_coord_t scale_total_height = lv_obj_get_height(obj) - (pad_top + pad_bottom + tick_pad_top + tick_pad_bottom); - lv_coord_t offset = ((lv_coord_t) tick_idx * (lv_coord_t) scale_total_height) / (lv_coord_t)( - scale->total_tick_count - 1); + const int32_t scale_total_height = lv_obj_get_height(obj) - (pad_top + pad_bottom + tick_pad_top + tick_pad_bottom); + int32_t offset = ((int32_t) tick_idx * (int32_t) scale_total_height) / (int32_t)( + scale->total_tick_count - 1); vertical_position -= offset; } else { /* Nothing to do */ } @@ -869,16 +869,16 @@ static void scale_get_tick_points(lv_obj_t * obj, const uint32_t tick_idx, bool } else { /* Horizontal position starts at x1 of the scale main line */ - lv_coord_t horizontal_position = x_ofs; + int32_t horizontal_position = x_ofs; /* Position the last tick at the x2 scale coordinate */ if((scale->total_tick_count - 1U) == tick_idx) { horizontal_position = obj->coords.x2 - (pad_left + tick_pad_left); } /* Increment the tick offset depending of its index */ else if(0U != tick_idx) { - const lv_coord_t scale_total_width = lv_obj_get_width(obj) - (pad_right + pad_left + tick_pad_right + tick_pad_left); - lv_coord_t offset = ((lv_coord_t) tick_idx * (lv_coord_t) scale_total_width) / (lv_coord_t)( - scale->total_tick_count - 1); + const int32_t scale_total_width = lv_obj_get_width(obj) - (pad_right + pad_left + tick_pad_right + tick_pad_left); + int32_t offset = ((int32_t) tick_idx * (int32_t) scale_total_width) / (int32_t)( + scale->total_tick_count - 1); horizontal_position += offset; } else { /* Nothing to do */ } @@ -895,7 +895,7 @@ static void scale_get_tick_points(lv_obj_t * obj, const uint32_t tick_idx, bool /* Find the center of the scale */ lv_point_t center_point; - const lv_coord_t radius_edge = LV_MIN(lv_area_get_width(&scale_area) / 2U, lv_area_get_height(&scale_area) / 2U); + const int32_t radius_edge = LV_MIN(lv_area_get_width(&scale_area) / 2U, lv_area_get_height(&scale_area) / 2U); center_point.x = scale_area.x1 + radius_edge; center_point.y = scale_area.y1 + radius_edge; @@ -905,8 +905,8 @@ static void scale_get_tick_points(lv_obj_t * obj, const uint32_t tick_idx, bool /* Draw a little bit longer lines to be sure the mask will clip them correctly * and to get a better precision. Adding the main line width to the calculation so we don't have gaps * between the arc and the ticks */ - lv_coord_t point_closer_to_arc = 0; - lv_coord_t adjusted_radio_with_tick_len = 0; + int32_t point_closer_to_arc = 0; + int32_t adjusted_radio_with_tick_len = 0; if(LV_SCALE_MODE_ROUND_INNER == scale->mode) { point_closer_to_arc = radius_edge - main_line_dsc.width; adjusted_radio_with_tick_len = point_closer_to_arc - (is_major_tick ? major_len : minor_len); @@ -1002,7 +1002,7 @@ static void scale_set_line_properties(lv_obj_t * obj, lv_draw_line_dsc_t * line_ /* Line width */ res = lv_style_get_prop(section_style, LV_STYLE_LINE_WIDTH, &value); if(res == LV_RESULT_OK) { - line_dsc->width = (lv_coord_t)value.num; + line_dsc->width = (int32_t)value.num; } else { line_dsc->width = lv_obj_get_style_line_width(obj, part); @@ -1051,7 +1051,7 @@ static void scale_set_arc_properties(lv_obj_t * obj, lv_draw_arc_dsc_t * arc_dsc /* Line width */ res = lv_style_get_prop(section_style, LV_STYLE_ARC_WIDTH, &value); if(res == LV_RESULT_OK) { - arc_dsc->width = (lv_coord_t)value.num; + arc_dsc->width = (int32_t)value.num; } else { arc_dsc->width = lv_obj_get_style_line_width(obj, LV_PART_MAIN); @@ -1119,7 +1119,7 @@ static void scale_set_indicator_label_properties(lv_obj_t * obj, lv_draw_label_d /* Text letter space */ res = lv_style_get_prop(indicator_section_style, LV_STYLE_TEXT_LETTER_SPACE, &value); if(res == LV_RESULT_OK) { - label_dsc->letter_space = (lv_coord_t)value.num; + label_dsc->letter_space = (int32_t)value.num; } else { label_dsc->letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_INDICATOR); @@ -1188,7 +1188,7 @@ static void scale_find_section_tick_idx(lv_obj_t * obj) * @param minor_tick_width width of the minor tick */ static void scale_store_main_line_tick_width_compensation(lv_obj_t * obj, const uint32_t tick_idx, - const bool is_major_tick, const lv_coord_t major_tick_width, const lv_coord_t minor_tick_width) + const bool is_major_tick, const int32_t major_tick_width, const int32_t minor_tick_width) { lv_scale_t * scale = (lv_scale_t *)obj; @@ -1279,7 +1279,7 @@ static void scale_store_section_line_tick_width_compensation(lv_obj_t * obj, con } } - lv_coord_t tmp_width = 0; + int32_t tmp_width = 0; if(tick_idx == section->first_tick_idx_in_section) { if(section->first_tick_idx_is_major) { diff --git a/src/widgets/scale/lv_scale.h b/src/widgets/scale/lv_scale.h index 6c72753a5..1cd889d4e 100644 --- a/src/widgets/scale/lv_scale.h +++ b/src/widgets/scale/lv_scale.h @@ -57,14 +57,14 @@ typedef struct { lv_style_t * main_style; lv_style_t * indicator_style; lv_style_t * items_style; - lv_coord_t minor_range; - lv_coord_t major_range; + int32_t minor_range; + int32_t major_range; uint32_t first_tick_idx_in_section; uint32_t last_tick_idx_in_section; uint32_t first_tick_idx_is_major; uint32_t last_tick_idx_is_major; - lv_coord_t first_tick_in_section_width; - lv_coord_t last_tick_in_section_width; + int32_t first_tick_in_section_width; + int32_t last_tick_in_section_width; lv_point_t first_tick_in_section; lv_point_t last_tick_in_section; } lv_scale_section_t; @@ -73,18 +73,18 @@ typedef struct { lv_obj_t obj; lv_ll_t section_ll; /**< Linked list for the sections (stores lv_scale_section_t)*/ const char ** txt_src; - lv_coord_t custom_label_cnt; - lv_coord_t major_len; - lv_coord_t minor_len; - lv_coord_t range_min; - lv_coord_t range_max; + int32_t custom_label_cnt; + int32_t major_len; + int32_t minor_len; + int32_t range_min; + int32_t range_max; uint32_t total_tick_count : 15; uint32_t major_tick_every : 15; lv_scale_mode_t mode; uint32_t label_enabled : 1; uint32_t post_draw : 1; - lv_coord_t last_tick_width; - lv_coord_t first_tick_width; + int32_t last_tick_width; + int32_t first_tick_width; /* Round scale */ uint32_t angle_range; int32_t rotation; @@ -123,14 +123,14 @@ void lv_scale_set_mode(lv_obj_t * obj, lv_scale_mode_t mode); * @param obj pointer the scale object * @param total_tick_count New total tick count */ -void lv_scale_set_total_tick_count(lv_obj_t * obj, lv_coord_t total_tick_count); +void lv_scale_set_total_tick_count(lv_obj_t * obj, int32_t total_tick_count); /** * Sets how often the major tick will be drawn * @param obj pointer the scale object * @param major_tick_every New count for major tick drawing */ -void lv_scale_set_major_tick_every(lv_obj_t * obj, lv_coord_t major_tick_every); +void lv_scale_set_major_tick_every(lv_obj_t * obj, int32_t major_tick_every); /** * Sets label visibility @@ -144,14 +144,14 @@ void lv_scale_set_label_show(lv_obj_t * obj, bool show_label); * @param obj pointer the scale object * @param major_len Major tick length */ -void lv_scale_set_major_tick_length(lv_obj_t * obj, lv_coord_t major_len); +void lv_scale_set_major_tick_length(lv_obj_t * obj, int32_t major_len); /** * Sets major tick length * @param obj pointer the scale object * @param minor_len Minor tick length */ -void lv_scale_set_minor_tick_length(lv_obj_t * obj, lv_coord_t minor_len); +void lv_scale_set_minor_tick_length(lv_obj_t * obj, int32_t minor_len); /** * Set the minimal and maximal values on a scale @@ -159,7 +159,7 @@ void lv_scale_set_minor_tick_length(lv_obj_t * obj, lv_coord_t minor_len); * @param min minimum value of the scale * @param max maximum value of the scale */ -void lv_scale_set_range(lv_obj_t * obj, lv_coord_t min, lv_coord_t max); +void lv_scale_set_range(lv_obj_t * obj, int32_t min, int32_t max); /** * Set properties specific to round scale @@ -196,7 +196,7 @@ lv_scale_section_t * lv_scale_add_section(lv_obj_t * obj); * @param minor_range section new minor range * @param major_range section new major range */ -void lv_scale_section_set_range(lv_scale_section_t * section, lv_coord_t minor_range, lv_coord_t major_range); +void lv_scale_section_set_range(lv_scale_section_t * section, int32_t minor_range, int32_t major_range); /** * Set the style of the part for the given scale section diff --git a/src/widgets/slider/lv_slider.c b/src/widgets/slider/lv_slider.c index d36dd33e1..1d0a82586 100644 --- a/src/widgets/slider/lv_slider.c +++ b/src/widgets/slider/lv_slider.c @@ -36,7 +36,7 @@ **********************/ static void lv_slider_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e); -static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, const lv_coord_t knob_size, const bool hor); +static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, const int32_t knob_size, const bool hor); static void draw_knob(lv_event_t * e); static bool is_slider_horizontal(lv_obj_t * obj); static void drag_start(lv_obj_t * obj); @@ -117,7 +117,7 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e) /*Advanced hit testing: react only on dragging the knob(s)*/ if(code == LV_EVENT_HIT_TEST) { lv_hit_test_info_t * info = lv_event_get_param(e); - lv_coord_t ext_click_area = obj->spec_attr ? obj->spec_attr->ext_click_pad : 0; + int32_t ext_click_area = obj->spec_attr ? obj->spec_attr->ext_click_pad : 0; /*Ordinary slider: was the knob area hit?*/ lv_area_t a; @@ -188,21 +188,21 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_obj_refresh_ext_draw_size(obj); } else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); - lv_coord_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); - lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); - lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); + int32_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); + int32_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); + int32_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); + int32_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); /*The smaller size is the knob diameter*/ - lv_coord_t trans_w = lv_obj_get_style_transform_width(obj, LV_PART_KNOB); - lv_coord_t trans_h = lv_obj_get_style_transform_height(obj, LV_PART_KNOB); - lv_coord_t knob_size = LV_MIN(lv_obj_get_width(obj) + 2 * trans_w, lv_obj_get_height(obj) + 2 * trans_h) >> 1; + int32_t trans_w = lv_obj_get_style_transform_width(obj, LV_PART_KNOB); + int32_t trans_h = lv_obj_get_style_transform_height(obj, LV_PART_KNOB); + int32_t knob_size = LV_MIN(lv_obj_get_width(obj) + 2 * trans_w, lv_obj_get_height(obj) + 2 * trans_h) >> 1; knob_size += LV_MAX(LV_MAX(knob_left, knob_right), LV_MAX(knob_bottom, knob_top)); knob_size += 2; /*For rounding error*/ knob_size += lv_obj_calculate_ext_draw_size(obj, LV_PART_KNOB); /*Indic. size is handled by bar*/ - lv_coord_t * s = lv_event_get_param(e); + int32_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_size); } @@ -240,7 +240,7 @@ static void draw_knob(lv_event_t * e) const bool is_reversed = slider->bar.val_reversed ^ (is_rtl && is_horizontal); lv_area_t knob_area; - lv_coord_t knob_size; + int32_t knob_size; bool is_symmetrical = lv_slider_is_symmetrical(obj); if(is_horizontal) { @@ -290,7 +290,7 @@ static void draw_knob(lv_event_t * e) } } -static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, const lv_coord_t knob_size, const bool hor) +static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, const int32_t knob_size, const bool hor) { if(hor) { knob_area->x1 -= (knob_size >> 1); @@ -305,13 +305,13 @@ static void position_knob(lv_obj_t * obj, lv_area_t * knob_area, const lv_coord_ knob_area->x2 = obj->coords.x2; } - lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); - lv_coord_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); - lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); - lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); + int32_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); + int32_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); + int32_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); + int32_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); - lv_coord_t transf_w = lv_obj_get_style_transform_width(obj, LV_PART_KNOB); - lv_coord_t transf_h = lv_obj_get_style_transform_height(obj, LV_PART_KNOB); + int32_t transf_w = lv_obj_get_style_transform_width(obj, LV_PART_KNOB); + int32_t transf_h = lv_obj_get_style_transform_height(obj, LV_PART_KNOB); /*Apply the paddings on the knob area*/ knob_area->x1 -= knob_left + transf_w; @@ -340,7 +340,7 @@ static void drag_start(lv_obj_t * obj) const bool is_rtl = LV_BASE_DIR_RTL == lv_obj_get_style_base_dir(obj, LV_PART_MAIN); const bool is_horizontal = is_slider_horizontal(obj); const bool is_reversed = slider->bar.val_reversed ^ (is_rtl && is_horizontal); - lv_coord_t dist_left, dist_right; + int32_t dist_left, dist_right; if(is_horizontal) { if((!is_reversed && p.x > slider->right_knob_area.x2) || (is_reversed && p.x < slider->right_knob_area.x1)) { slider->value_to_set = &slider->bar.cur_value; @@ -405,7 +405,7 @@ static void update_knob_pos(lv_obj_t * obj, bool check_drag) bool is_hor = is_slider_horizontal(obj); if(check_drag && !slider->dragging) { - lv_coord_t ofs = is_hor ? (p.x - slider->pressed_point.x) : (p.y - slider->pressed_point.y); + int32_t ofs = is_hor ? (p.x - slider->pressed_point.x) : (p.y - slider->pressed_point.y); /*Stop processing when offset is below scroll_limit*/ if(LV_ABS(ofs) < indev->scroll_limit) { @@ -425,10 +425,10 @@ static void update_knob_pos(lv_obj_t * obj, bool check_drag) const bool is_reversed = slider->bar.val_reversed ^ (is_rtl && is_horizontal); if(is_hor) { - const lv_coord_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - const lv_coord_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); - const lv_coord_t w = lv_obj_get_width(obj); - const lv_coord_t indic_w = w - bg_left - bg_right; + const int32_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + const int32_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + const int32_t w = lv_obj_get_width(obj); + const int32_t indic_w = w - bg_left - bg_right; if(is_reversed) { /*Make the point relative to the indicator*/ @@ -444,10 +444,10 @@ static void update_knob_pos(lv_obj_t * obj, bool check_drag) } } else { - const lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - const lv_coord_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); - const lv_coord_t h = lv_obj_get_height(obj); - const lv_coord_t indic_h = h - bg_bottom - bg_top; + const int32_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + const int32_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + const int32_t h = lv_obj_get_height(obj); + const int32_t indic_h = h - bg_bottom - bg_top; if(is_reversed) { /*Make the point relative to the indicator*/ diff --git a/src/widgets/span/lv_span.c b/src/widgets/span/lv_span.c index ac76162ad..8e48a5b06 100644 --- a/src/widgets/span/lv_span.c +++ b/src/widgets/span/lv_span.c @@ -27,9 +27,9 @@ typedef struct { const char * txt; const lv_font_t * font; uint32_t bytes; - lv_coord_t txt_w; - lv_coord_t line_h; - lv_coord_t letter_space; + int32_t txt_w; + int32_t line_h; + int32_t letter_space; } lv_snippet_t; struct _snippet_stack { @@ -47,7 +47,7 @@ static void draw_main(lv_event_t * e); static void refresh_self_size(lv_obj_t * obj); static const lv_font_t * lv_span_get_style_text_font(lv_obj_t * par, lv_span_t * span); -static lv_coord_t lv_span_get_style_text_letter_space(lv_obj_t * par, lv_span_t * span); +static int32_t lv_span_get_style_text_letter_space(lv_obj_t * par, lv_span_t * span); static lv_color_t lv_span_get_style_text_color(lv_obj_t * par, lv_span_t * span); static lv_opa_t lv_span_get_style_text_opa(lv_obj_t * par, lv_span_t * span); static lv_opa_t lv_span_get_style_text_blend_mode(lv_obj_t * par, lv_span_t * span); @@ -55,15 +55,15 @@ static int32_t lv_span_get_style_text_decor(lv_obj_t * par, lv_span_t * span); static inline void span_text_check(const char ** text); static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer); -static bool lv_text_get_snippet(const char * txt, const lv_font_t * font, lv_coord_t letter_space, - lv_coord_t max_width, lv_text_flag_t flag, lv_coord_t * use_width, +static bool lv_text_get_snippet(const char * txt, const lv_font_t * font, int32_t letter_space, + int32_t max_width, lv_text_flag_t flag, int32_t * use_width, uint32_t * end_ofs); static void lv_snippet_clear(void); static uint32_t lv_get_snippet_cnt(void); static void lv_snippet_push(lv_snippet_t * item); static lv_snippet_t * lv_get_snippet(uint32_t index); -static lv_coord_t convert_indent_pct(lv_obj_t * spans, lv_coord_t width); +static int32_t convert_indent_pct(lv_obj_t * spans, int32_t width); /********************** * STATIC VARIABLES @@ -215,7 +215,7 @@ void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow) lv_obj_invalidate(obj); } -void lv_spangroup_set_indent(lv_obj_t * obj, lv_coord_t indent) +void lv_spangroup_set_indent(lv_obj_t * obj, int32_t indent) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_spangroup_t * spans = (lv_spangroup_t *)obj; @@ -311,7 +311,7 @@ lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t * obj) return spans->overflow; } -lv_coord_t lv_spangroup_get_indent(lv_obj_t * obj) +int32_t lv_spangroup_get_indent(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_spangroup_t * spans = (lv_spangroup_t *)obj; @@ -354,11 +354,11 @@ void lv_spangroup_refr_mode(lv_obj_t * obj) lv_obj_set_width(obj, 100); } if(lv_obj_get_style_height(obj, LV_PART_MAIN) == LV_SIZE_CONTENT) { - lv_coord_t width = lv_obj_get_style_width(obj, LV_PART_MAIN); + int32_t width = lv_obj_get_style_width(obj, LV_PART_MAIN); if(LV_COORD_IS_PCT(width)) { width = 100; } - lv_coord_t height = lv_spangroup_get_expand_height(obj, width); + int32_t height = lv_spangroup_get_expand_height(obj, width); lv_obj_set_content_height(obj, height); } } @@ -366,16 +366,16 @@ void lv_spangroup_refr_mode(lv_obj_t * obj) refresh_self_size(obj); } -lv_coord_t lv_spangroup_get_max_line_h(lv_obj_t * obj) +int32_t lv_spangroup_get_max_line_h(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_spangroup_t * spans = (lv_spangroup_t *)obj; - lv_coord_t max_line_h = 0; + int32_t max_line_h = 0; lv_span_t * cur_span; _LV_LL_READ(&spans->child_ll, cur_span) { const lv_font_t * font = lv_span_get_style_text_font(obj, cur_span); - lv_coord_t line_h = lv_font_get_line_height(font); + int32_t line_h = lv_font_get_line_height(font); if(line_h > max_line_h) { max_line_h = line_h; } @@ -395,7 +395,7 @@ uint32_t lv_spangroup_get_expand_width(lv_obj_t * obj, uint32_t max_width) uint32_t width = LV_COORD_IS_PCT(spans->indent) ? 0 : spans->indent; lv_span_t * cur_span; - lv_coord_t letter_space = 0; + int32_t letter_space = 0; _LV_LL_READ(&spans->child_ll, cur_span) { const lv_font_t * font = lv_span_get_style_text_font(obj, cur_span); letter_space = lv_span_get_style_text_letter_space(obj, cur_span); @@ -416,7 +416,7 @@ uint32_t lv_spangroup_get_expand_width(lv_obj_t * obj, uint32_t max_width) return width - letter_space; } -lv_coord_t lv_spangroup_get_expand_height(lv_obj_t * obj, lv_coord_t width) +int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width) { LV_ASSERT_OBJ(obj, MY_CLASS); lv_spangroup_t * spans = (lv_spangroup_t *)obj; @@ -426,10 +426,10 @@ lv_coord_t lv_spangroup_get_expand_height(lv_obj_t * obj, lv_coord_t width) /* init draw variable */ lv_text_flag_t txt_flag = LV_TEXT_FLAG_NONE; - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); - lv_coord_t max_width = width; - lv_coord_t indent = convert_indent_pct(obj, max_width); - lv_coord_t max_w = max_width - indent; /* first line need minus indent */ + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + int32_t max_width = width; + int32_t indent = convert_indent_pct(obj, max_width); + int32_t max_w = max_width - indent; /* first line need minus indent */ /* coords of draw span-txt */ lv_point_t txt_pos; @@ -448,7 +448,7 @@ lv_coord_t lv_spangroup_get_expand_height(lv_obj_t * obj, lv_coord_t width) /* the loop control how many lines need to draw */ while(cur_span) { int snippet_cnt = 0; - lv_coord_t max_line_h = 0; /* the max height of span-font when a line have a lot of span */ + int32_t max_line_h = 0; /* the max height of span-font when a line have a lot of span */ /* the loop control to find a line and push the relevant span info into stack */ while(1) { @@ -473,7 +473,7 @@ lv_coord_t lv_spangroup_get_expand_height(lv_obj_t * obj, lv_coord_t width) /* get current span text line info */ uint32_t next_ofs = 0; - lv_coord_t use_width = 0; + int32_t use_width = 0; bool isfill = lv_text_get_snippet(&cur_txt[cur_txt_ofs], snippet.font, snippet.letter_space, max_w, txt_flag, &use_width, &next_ofs); @@ -578,13 +578,13 @@ static void lv_spangroup_event(const lv_obj_class_t * class_p, lv_event_t * e) refresh_self_size(obj); } else if(code == LV_EVENT_GET_SELF_SIZE) { - lv_coord_t width = 0; - lv_coord_t height = 0; + int32_t width = 0; + int32_t height = 0; lv_point_t * self_size = lv_event_get_param(e); if(spans->mode == LV_SPAN_MODE_EXPAND) { if(spans->refresh) { - spans->cache_w = (lv_coord_t)lv_spangroup_get_expand_width(obj, 0); + spans->cache_w = (int32_t)lv_spangroup_get_expand_width(obj, 0); spans->cache_h = lv_spangroup_get_max_line_h(obj); spans->refresh = 0; } @@ -626,8 +626,8 @@ static void draw_main(lv_event_t * e) * @return true for txt fill the max_width. */ static bool lv_text_get_snippet(const char * txt, const lv_font_t * font, - lv_coord_t letter_space, lv_coord_t max_width, lv_text_flag_t flag, - lv_coord_t * use_width, uint32_t * end_ofs) + int32_t letter_space, int32_t max_width, lv_text_flag_t flag, + int32_t * use_width, uint32_t * end_ofs) { if(txt == NULL || txt[0] == '\0') { *end_ofs = 0; @@ -635,7 +635,7 @@ static bool lv_text_get_snippet(const char * txt, const lv_font_t * font, return false; } - lv_coord_t real_max_width = max_width; + int32_t real_max_width = max_width; #if !LV_USE_FONT_PLACEHOLDER /* fix incomplete text display when disable the placeholder. */ /* workaround by: https://github.com/lvgl/lvgl/issues/3685 */ @@ -694,16 +694,16 @@ static const lv_font_t * lv_span_get_style_text_font(lv_obj_t * par, lv_span_t * return font; } -static lv_coord_t lv_span_get_style_text_letter_space(lv_obj_t * par, lv_span_t * span) +static int32_t lv_span_get_style_text_letter_space(lv_obj_t * par, lv_span_t * span) { - lv_coord_t letter_space; + int32_t letter_space; lv_style_value_t value; lv_result_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_LETTER_SPACE, &value); if(res != LV_RESULT_OK) { letter_space = lv_obj_get_style_text_letter_space(par, LV_PART_MAIN); } else { - letter_space = (lv_coord_t)value.num; + letter_space = (int32_t)value.num; } return letter_space; } @@ -768,11 +768,11 @@ static inline void span_text_check(const char ** text) } } -static lv_coord_t convert_indent_pct(lv_obj_t * obj, lv_coord_t width) +static int32_t convert_indent_pct(lv_obj_t * obj, int32_t width) { lv_spangroup_t * spans = (lv_spangroup_t *)obj; - lv_coord_t indent = spans->indent; + int32_t indent = spans->indent; if(LV_COORD_IS_PCT(spans->indent)) { if(spans->mode == LV_SPAN_MODE_EXPAND) { indent = 0; @@ -812,10 +812,10 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) /* init draw variable */ lv_text_flag_t txt_flag = LV_TEXT_FLAG_NONE; - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN);; - lv_coord_t max_width = lv_area_get_width(&coords); - lv_coord_t indent = convert_indent_pct(obj, max_width); - lv_coord_t max_w = max_width - indent; /* first line need minus indent */ + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN);; + int32_t max_width = lv_area_get_width(&coords); + int32_t indent = convert_indent_pct(obj, max_width); + int32_t max_w = max_width - indent; /* first line need minus indent */ lv_opa_t obj_opa = lv_obj_get_style_opa_recursive(obj, LV_PART_MAIN); /* coords of draw span-txt */ @@ -838,8 +838,8 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) while(cur_span) { bool is_end_line = false; bool ellipsis_valid = false; - lv_coord_t max_line_h = 0; /* the max height of span-font when a line have a lot of span */ - lv_coord_t max_baseline = 0; /*baseline of the highest span*/ + int32_t max_line_h = 0; /* the max height of span-font when a line have a lot of span */ + int32_t max_baseline = 0; /*baseline of the highest span*/ lv_snippet_clear(); /* the loop control to find a line and push the relevant span info into stack */ @@ -865,7 +865,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) /* get current span text line info */ uint32_t next_ofs = 0; - lv_coord_t use_width = 0; + int32_t use_width = 0; bool isfill = lv_text_get_snippet(&cur_txt[cur_txt_ofs], snippet.font, snippet.letter_space, max_w, txt_flag, &use_width, &next_ofs); @@ -914,7 +914,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) /* Whether the current line is the end line and does overflow processing */ { lv_snippet_t * last_snippet = lv_get_snippet(item_cnt - 1); - lv_coord_t next_line_h = last_snippet->line_h; + int32_t next_line_h = last_snippet->line_h; if(last_snippet->txt[last_snippet->bytes] == '\0') { next_line_h = 0; lv_span_t * next_span = _lv_ll_get_next(&spans->child_ll, last_snippet->span); @@ -941,8 +941,8 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) /* align deal with */ lv_text_align_t align = lv_obj_get_style_text_align(obj, LV_PART_MAIN); if(align == LV_TEXT_ALIGN_CENTER || align == LV_TEXT_ALIGN_RIGHT) { - lv_coord_t align_ofs = 0; - lv_coord_t txts_w = is_first_line ? indent : 0; + int32_t align_ofs = 0; + int32_t txts_w = is_first_line ? indent : 0; uint32_t i; for(i = 0; i < item_cnt; i++) { lv_snippet_t * pinfo = lv_get_snippet(i); @@ -983,7 +983,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) dot_letter_w = lv_font_get_glyph_width(pinfo->font, '.', '.'); dot_width = dot_letter_w * 3; } - lv_coord_t ellipsis_width = coords.x1 + max_width - dot_width; + int32_t ellipsis_width = coords.x1 + max_width - dot_width; uint32_t j = 0; while(j < txt_bytes) { diff --git a/src/widgets/span/lv_span.h b/src/widgets/span/lv_span.h index fbb0e4916..99fd1cc3f 100644 --- a/src/widgets/span/lv_span.h +++ b/src/widgets/span/lv_span.h @@ -64,9 +64,9 @@ typedef struct { typedef struct { lv_obj_t obj; int32_t lines; - lv_coord_t indent; /* first line indent */ - lv_coord_t cache_w; /* the cache automatically calculates the width */ - lv_coord_t cache_h; /* similar cache_w */ + int32_t indent; /* first line indent */ + int32_t cache_w; /* the cache automatically calculates the width */ + int32_t cache_h; /* similar cache_w */ lv_ll_t child_ll; uint32_t mode : 2; /* details see lv_span_mode_t */ uint32_t overflow : 1; /* details see lv_span_overflow_t */ @@ -141,7 +141,7 @@ void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow); * @param obj pointer to a spangroup object. * @param indent The first line indentation */ -void lv_spangroup_set_indent(lv_obj_t * obj, lv_coord_t indent); +void lv_spangroup_set_indent(lv_obj_t * obj, int32_t indent); /** * Set the mode of the spangroup. @@ -201,7 +201,7 @@ lv_span_overflow_t lv_spangroup_get_overflow(lv_obj_t * obj); * @param obj pointer to a spangroup object. * @return the indent value. */ -lv_coord_t lv_spangroup_get_indent(lv_obj_t * obj); +int32_t lv_spangroup_get_indent(lv_obj_t * obj); /** * get the mode of the spangroup. @@ -220,7 +220,7 @@ int32_t lv_spangroup_get_max_lines(lv_obj_t * obj); * get max line height of all span in the spangroup. * @param obj pointer to a spangroup object. */ -lv_coord_t lv_spangroup_get_max_line_h(lv_obj_t * obj); +int32_t lv_spangroup_get_max_line_h(lv_obj_t * obj); /** * get the text content width when all span of spangroup on a line. @@ -237,7 +237,7 @@ uint32_t lv_spangroup_get_expand_width(lv_obj_t * obj, uint32_t max_width); * @param width the width of the span group. */ -lv_coord_t lv_spangroup_get_expand_height(lv_obj_t * obj, lv_coord_t width); +int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width); /*===================== diff --git a/src/widgets/switch/lv_switch.c b/src/widgets/switch/lv_switch.c index b7b690653..b06eec621 100644 --- a/src/widgets/switch/lv_switch.c +++ b/src/widgets/switch/lv_switch.c @@ -120,17 +120,17 @@ static void lv_switch_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_obj_t * obj = lv_event_get_target(e); if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { - lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); - lv_coord_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); - lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); - lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); + int32_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); + int32_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); + int32_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); + int32_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); /*The smaller size is the knob diameter*/ - lv_coord_t knob_size = LV_MAX4(knob_left, knob_right, knob_bottom, knob_top); + int32_t knob_size = LV_MAX4(knob_left, knob_right, knob_bottom, knob_top); knob_size += _LV_SWITCH_KNOB_EXT_AREA_CORRECTION; knob_size += lv_obj_calculate_ext_draw_size(obj, LV_PART_KNOB); - lv_coord_t * s = lv_event_get_param(e); + int32_t * s = lv_event_get_param(e); *s = LV_MAX(*s, knob_size); *s = LV_MAX(*s, lv_obj_calculate_ext_draw_size(obj, LV_PART_INDICATOR)); } @@ -161,9 +161,9 @@ static void draw_main(lv_event_t * e) lv_draw_rect(layer, &draw_indic_dsc, &indic_area); /*Draw the knob*/ - lv_coord_t anim_value_x = 0; - lv_coord_t knob_size = lv_obj_get_height(obj); - lv_coord_t anim_length = lv_area_get_width(&obj->coords) - knob_size; + int32_t anim_value_x = 0; + int32_t knob_size = lv_obj_get_height(obj); + int32_t anim_length = lv_area_get_width(&obj->coords) - knob_size; if(LV_SWITCH_IS_ANIMATING(sw)) { /* Use the animation's coordinate */ @@ -184,10 +184,10 @@ static void draw_main(lv_event_t * e) knob_area.x1 += anim_value_x; knob_area.x2 = knob_area.x1 + (knob_size > 0 ? knob_size - 1 : 0); - lv_coord_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); - lv_coord_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); - lv_coord_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); - lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); + int32_t knob_left = lv_obj_get_style_pad_left(obj, LV_PART_KNOB); + int32_t knob_right = lv_obj_get_style_pad_right(obj, LV_PART_KNOB); + int32_t knob_top = lv_obj_get_style_pad_top(obj, LV_PART_KNOB); + int32_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); /*Apply the paddings on the knob area*/ knob_area.x1 -= knob_left; diff --git a/src/widgets/table/lv_table.c b/src/widgets/table/lv_table.c index 3b4d48429..5bf161ddb 100644 --- a/src/widgets/table/lv_table.c +++ b/src/widgets/table/lv_table.c @@ -34,9 +34,9 @@ static void lv_table_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) static void lv_table_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_table_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_main(lv_event_t * e); -static lv_coord_t get_row_height(lv_obj_t * obj, uint32_t row_id, const lv_font_t * font, - lv_coord_t letter_space, lv_coord_t line_space, - lv_coord_t cell_left, lv_coord_t cell_right, lv_coord_t cell_top, lv_coord_t cell_bottom); +static int32_t get_row_height(lv_obj_t * obj, uint32_t row_id, const lv_font_t * font, + int32_t letter_space, int32_t line_space, + int32_t cell_left, int32_t cell_right, int32_t cell_top, int32_t cell_bottom); static void refr_size_form_row(lv_obj_t * obj, uint32_t start_row); static void refr_cell_size(lv_obj_t * obj, uint32_t row, uint32_t col); static lv_result_t get_pressed_cell(lv_obj_t * obj, uint32_t * row, uint32_t * col); @@ -280,7 +280,7 @@ void lv_table_set_col_cnt(lv_obj_t * obj, uint32_t col_cnt) refr_size_form_row(obj, 0) ; } -void lv_table_set_col_width(lv_obj_t * obj, uint32_t col_id, lv_coord_t w) +void lv_table_set_col_width(lv_obj_t * obj, uint32_t col_id, int32_t w) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -377,7 +377,7 @@ uint32_t lv_table_get_col_cnt(lv_obj_t * obj) return table->col_cnt; } -lv_coord_t lv_table_get_col_width(lv_obj_t * obj, uint32_t col) +int32_t lv_table_get_col_width(lv_obj_t * obj, uint32_t col) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -474,10 +474,10 @@ static void lv_table_event(const lv_obj_class_t * class_p, lv_event_t * e) else if(code == LV_EVENT_GET_SELF_SIZE) { lv_point_t * p = lv_event_get_param(e); uint32_t i; - lv_coord_t w = 0; + int32_t w = 0; for(i = 0; i < table->col_cnt; i++) w += table->col_w[i]; - lv_coord_t h = 0; + int32_t h = 0; for(i = 0; i < table->row_cnt; i++) h += table->row_h[i]; p->x = w - 1; @@ -590,11 +590,11 @@ static void draw_main(lv_event_t * e) lv_point_t txt_size; lv_area_t cell_area; - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); - lv_coord_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); - lv_coord_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t bg_top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t bg_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_MAIN); + int32_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t bg_right = lv_obj_get_style_pad_right(obj, LV_PART_MAIN); lv_state_t state_ori = obj->state; obj->state = LV_STATE_DEFAULT; @@ -618,12 +618,12 @@ static void draw_main(lv_event_t * e) cell_area.y2 = obj->coords.y1 + bg_top - 1 - lv_obj_get_scroll_y(obj) + border_width; cell_area.x1 = 0; cell_area.x2 = 0; - lv_coord_t scroll_x = lv_obj_get_scroll_x(obj) ; + int32_t scroll_x = lv_obj_get_scroll_x(obj) ; bool rtl = lv_obj_get_style_base_dir(obj, LV_PART_MAIN) == LV_BASE_DIR_RTL; /*Handle custom drawer*/ for(row = 0; row < table->row_cnt; row++) { - lv_coord_t h_row = table->row_h[row]; + int32_t h_row = table->row_h[row]; cell_area.y1 = cell_area.y2 + 1; cell_area.y2 = cell_area.y1 + h_row - 1; @@ -654,7 +654,7 @@ static void draw_main(lv_event_t * e) lv_table_cell_ctrl_t merge_ctrl = (lv_table_cell_ctrl_t) next_cell_data[0]; if(merge_ctrl & LV_TABLE_CELL_CTRL_MERGE_RIGHT) { - lv_coord_t offset = table->col_w[col + col_merge + 1]; + int32_t offset = table->col_w[col + col_merge + 1]; if(rtl) cell_area.x1 -= offset; else cell_area.x2 += offset; @@ -720,10 +720,10 @@ static void draw_main(lv_event_t * e) lv_draw_rect(layer, &rect_dsc_act, &cell_area_border); if(table->cell_data[cell]) { - const lv_coord_t cell_left = lv_obj_get_style_pad_left(obj, LV_PART_ITEMS); - const lv_coord_t cell_right = lv_obj_get_style_pad_right(obj, LV_PART_ITEMS); - const lv_coord_t cell_top = lv_obj_get_style_pad_top(obj, LV_PART_ITEMS); - const lv_coord_t cell_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_ITEMS); + const int32_t cell_left = lv_obj_get_style_pad_left(obj, LV_PART_ITEMS); + const int32_t cell_right = lv_obj_get_style_pad_right(obj, LV_PART_ITEMS); + const int32_t cell_top = lv_obj_get_style_pad_top(obj, LV_PART_ITEMS); + const int32_t cell_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_ITEMS); lv_text_flag_t txt_flags = LV_TEXT_FLAG_NONE; lv_area_t txt_area; @@ -768,23 +768,23 @@ static void draw_main(lv_event_t * e) /* Refreshes size of the table starting from @start_row row */ static void refr_size_form_row(lv_obj_t * obj, uint32_t start_row) { - const lv_coord_t cell_pad_left = lv_obj_get_style_pad_left(obj, LV_PART_ITEMS); - const lv_coord_t cell_pad_right = lv_obj_get_style_pad_right(obj, LV_PART_ITEMS); - const lv_coord_t cell_pad_top = lv_obj_get_style_pad_top(obj, LV_PART_ITEMS); - const lv_coord_t cell_pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_ITEMS); + const int32_t cell_pad_left = lv_obj_get_style_pad_left(obj, LV_PART_ITEMS); + const int32_t cell_pad_right = lv_obj_get_style_pad_right(obj, LV_PART_ITEMS); + const int32_t cell_pad_top = lv_obj_get_style_pad_top(obj, LV_PART_ITEMS); + const int32_t cell_pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_ITEMS); - lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_ITEMS); - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_ITEMS); + int32_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_ITEMS); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_ITEMS); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_ITEMS); - const lv_coord_t minh = lv_obj_get_style_min_height(obj, LV_PART_ITEMS); - const lv_coord_t maxh = lv_obj_get_style_max_height(obj, LV_PART_ITEMS); + const int32_t minh = lv_obj_get_style_min_height(obj, LV_PART_ITEMS); + const int32_t maxh = lv_obj_get_style_max_height(obj, LV_PART_ITEMS); lv_table_t * table = (lv_table_t *)obj; uint32_t i; for(i = start_row; i < table->row_cnt; i++) { - lv_coord_t calculated_height = get_row_height(obj, i, font, letter_space, line_space, - cell_pad_left, cell_pad_right, cell_pad_top, cell_pad_bottom); + int32_t calculated_height = get_row_height(obj, i, font, letter_space, line_space, + cell_pad_left, cell_pad_right, cell_pad_top, cell_pad_bottom); table->row_h[i] = LV_CLAMP(minh, calculated_height, maxh); } @@ -795,23 +795,23 @@ static void refr_size_form_row(lv_obj_t * obj, uint32_t start_row) static void refr_cell_size(lv_obj_t * obj, uint32_t row, uint32_t col) { - const lv_coord_t cell_pad_left = lv_obj_get_style_pad_left(obj, LV_PART_ITEMS); - const lv_coord_t cell_pad_right = lv_obj_get_style_pad_right(obj, LV_PART_ITEMS); - const lv_coord_t cell_pad_top = lv_obj_get_style_pad_top(obj, LV_PART_ITEMS); - const lv_coord_t cell_pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_ITEMS); + const int32_t cell_pad_left = lv_obj_get_style_pad_left(obj, LV_PART_ITEMS); + const int32_t cell_pad_right = lv_obj_get_style_pad_right(obj, LV_PART_ITEMS); + const int32_t cell_pad_top = lv_obj_get_style_pad_top(obj, LV_PART_ITEMS); + const int32_t cell_pad_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_ITEMS); - lv_coord_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_ITEMS); - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_ITEMS); + int32_t letter_space = lv_obj_get_style_text_letter_space(obj, LV_PART_ITEMS); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_ITEMS); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_ITEMS); - const lv_coord_t minh = lv_obj_get_style_min_height(obj, LV_PART_ITEMS); - const lv_coord_t maxh = lv_obj_get_style_max_height(obj, LV_PART_ITEMS); + const int32_t minh = lv_obj_get_style_min_height(obj, LV_PART_ITEMS); + const int32_t maxh = lv_obj_get_style_max_height(obj, LV_PART_ITEMS); lv_table_t * table = (lv_table_t *)obj; - lv_coord_t calculated_height = get_row_height(obj, row, font, letter_space, line_space, - cell_pad_left, cell_pad_right, cell_pad_top, cell_pad_bottom); + int32_t calculated_height = get_row_height(obj, row, font, letter_space, line_space, + cell_pad_left, cell_pad_right, cell_pad_top, cell_pad_bottom); - lv_coord_t prev_row_size = table->row_h[row]; + int32_t prev_row_size = table->row_h[row]; table->row_h[row] = LV_CLAMP(minh, calculated_height, maxh); /*If the row height haven't changed invalidate only this cell*/ @@ -827,13 +827,13 @@ static void refr_cell_size(lv_obj_t * obj, uint32_t row, uint32_t col) } } -static lv_coord_t get_row_height(lv_obj_t * obj, uint32_t row_id, const lv_font_t * font, - lv_coord_t letter_space, lv_coord_t line_space, - lv_coord_t cell_left, lv_coord_t cell_right, lv_coord_t cell_top, lv_coord_t cell_bottom) +static int32_t get_row_height(lv_obj_t * obj, uint32_t row_id, const lv_font_t * font, + int32_t letter_space, int32_t line_space, + int32_t cell_left, int32_t cell_right, int32_t cell_top, int32_t cell_bottom) { lv_table_t * table = (lv_table_t *)obj; - lv_coord_t h_max = lv_font_get_line_height(font) + cell_top + cell_bottom; + int32_t h_max = lv_font_get_line_height(font) + cell_top + cell_bottom; /* Calculate the cell_data index where to start */ uint32_t row_start = row_id * table->col_cnt; @@ -847,7 +847,7 @@ static lv_coord_t get_row_height(lv_obj_t * obj, uint32_t row_id, const lv_font_ continue; } - lv_coord_t txt_w = table->col_w[col]; + int32_t txt_w = table->col_w[col]; /* Traverse the current row from the first until the penultimate column. * Increment the text width if the cell has the LV_TABLE_CELL_CTRL_MERGE_RIGHT control, @@ -906,9 +906,9 @@ static lv_result_t get_pressed_cell(lv_obj_t * obj, uint32_t * row, uint32_t * c lv_point_t p; lv_indev_get_point(lv_indev_active(), &p); - lv_coord_t tmp; + int32_t tmp; if(col) { - lv_coord_t x = p.x + lv_obj_get_scroll_x(obj); + int32_t x = p.x + lv_obj_get_scroll_x(obj); if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) == LV_BASE_DIR_RTL) { x = obj->coords.x2 - lv_obj_get_style_pad_right(obj, LV_PART_MAIN) - x; @@ -927,7 +927,7 @@ static lv_result_t get_pressed_cell(lv_obj_t * obj, uint32_t * row, uint32_t * c } if(row) { - lv_coord_t y = p.y + lv_obj_get_scroll_y(obj);; + int32_t y = p.y + lv_obj_get_scroll_y(obj);; y -= obj->coords.y1; y -= lv_obj_get_style_pad_top(obj, LV_PART_MAIN); @@ -982,7 +982,7 @@ static void get_cell_area(lv_obj_t * obj, uint32_t row, uint32_t col, lv_area_t bool rtl = lv_obj_get_style_base_dir(obj, LV_PART_MAIN) == LV_BASE_DIR_RTL; if(rtl) { area->x1 += lv_obj_get_scroll_x(obj); - lv_coord_t w = lv_obj_get_width(obj); + int32_t w = lv_obj_get_width(obj); area->x2 = w - area->x1 - lv_obj_get_style_pad_right(obj, 0); area->x1 = area->x2 - table->col_w[col]; } diff --git a/src/widgets/table/lv_table.h b/src/widgets/table/lv_table.h index cb5b9fbd2..d74c697d2 100644 --- a/src/widgets/table/lv_table.h +++ b/src/widgets/table/lv_table.h @@ -55,8 +55,8 @@ typedef struct { uint32_t col_cnt; uint32_t row_cnt; char ** cell_data; - lv_coord_t * row_h; - lv_coord_t * col_w; + int32_t * row_h; + int32_t * col_w; uint32_t col_act; uint32_t row_act; } lv_table_t; @@ -119,7 +119,7 @@ void lv_table_set_col_cnt(lv_obj_t * obj, uint32_t col_cnt); * @param col_id id of the column [0 .. LV_TABLE_COL_MAX -1] * @param w width of the column */ -void lv_table_set_col_width(lv_obj_t * obj, uint32_t col_id, lv_coord_t w); +void lv_table_set_col_width(lv_obj_t * obj, uint32_t col_id, int32_t w); /** * Add control bits to the cell. @@ -173,7 +173,7 @@ uint32_t lv_table_get_col_cnt(lv_obj_t * obj); * @param col id of the column [0 .. LV_TABLE_COL_MAX -1] * @return width of the column */ -lv_coord_t lv_table_get_col_width(lv_obj_t * obj, uint32_t col); +int32_t lv_table_get_col_width(lv_obj_t * obj, uint32_t col); /** * Get whether a cell has the control bits diff --git a/src/widgets/tabview/lv_tabview.c b/src/widgets/tabview/lv_tabview.c index b6fac70d4..2c293fafd 100644 --- a/src/widgets/tabview/lv_tabview.c +++ b/src/widgets/tabview/lv_tabview.c @@ -46,7 +46,7 @@ const lv_obj_class_t lv_tabview_class = { typedef struct { lv_dir_t tab_pos; - lv_coord_t tab_size; + int32_t tab_size; } lv_tabview_create_info_t; // only used in lv_obj_class_create_obj, no affect multiple instances @@ -60,7 +60,7 @@ static lv_tabview_create_info_t create_info; * GLOBAL FUNCTIONS **********************/ -lv_obj_t * lv_tabview_create(lv_obj_t * parent, lv_dir_t tab_pos, lv_coord_t tab_size) +lv_obj_t * lv_tabview_create(lv_obj_t * parent, lv_dir_t tab_pos, int32_t tab_size) { LV_LOG_INFO("begin"); create_info.tab_pos = tab_pos; @@ -156,8 +156,8 @@ void lv_tabview_set_active(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en if(cont == NULL) return; if((tabview->tab_pos & LV_DIR_VER) != 0) { - lv_coord_t gap = lv_obj_get_style_pad_column(cont, LV_PART_MAIN); - lv_coord_t w = lv_obj_get_content_width(cont); + int32_t gap = lv_obj_get_style_pad_column(cont, LV_PART_MAIN); + int32_t w = lv_obj_get_content_width(cont); if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) != LV_BASE_DIR_RTL) { lv_obj_scroll_to_x(cont, id * (gap + w), anim_en); } @@ -167,8 +167,8 @@ void lv_tabview_set_active(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en } } else { - lv_coord_t gap = lv_obj_get_style_pad_row(cont, LV_PART_MAIN); - lv_coord_t h = lv_obj_get_content_height(cont); + int32_t gap = lv_obj_get_style_pad_row(cont, LV_PART_MAIN); + int32_t h = lv_obj_get_content_height(cont); lv_obj_scroll_to_y(cont, id * (gap + h), anim_en); } @@ -337,12 +337,12 @@ static void cont_scroll_end_event_cb(lv_event_t * e) int32_t t; if((tv_obj->tab_pos & LV_DIR_VER) != 0) { - lv_coord_t w = lv_obj_get_content_width(cont); + int32_t w = lv_obj_get_content_width(cont); if(lv_obj_get_style_base_dir(tv, LV_PART_MAIN) == LV_BASE_DIR_RTL) t = -(p.x - w / 2) / w; else t = (p.x + w / 2) / w; } else { - lv_coord_t h = lv_obj_get_content_height(cont); + int32_t h = lv_obj_get_content_height(cont); t = (p.y + h / 2) / h; } diff --git a/src/widgets/tabview/lv_tabview.h b/src/widgets/tabview/lv_tabview.h index 9fbf75532..38d010bca 100644 --- a/src/widgets/tabview/lv_tabview.h +++ b/src/widgets/tabview/lv_tabview.h @@ -38,7 +38,7 @@ extern const lv_obj_class_t lv_tabview_class; /********************** * GLOBAL PROTOTYPES **********************/ -lv_obj_t * lv_tabview_create(lv_obj_t * parent, lv_dir_t tab_pos, lv_coord_t tab_size); +lv_obj_t * lv_tabview_create(lv_obj_t * parent, lv_dir_t tab_pos, int32_t tab_size); lv_obj_t * lv_tabview_add_tab(lv_obj_t * tv, const char * name); diff --git a/src/widgets/textarea/lv_textarea.c b/src/widgets/textarea/lv_textarea.c index bd3849092..643e07ae4 100644 --- a/src/widgets/textarea/lv_textarea.c +++ b/src/widgets/textarea/lv_textarea.c @@ -367,12 +367,12 @@ void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos) /*The text area needs to have it's final size to see if the cursor is out of the area or not*/ /*Check the top*/ - lv_coord_t font_h = lv_font_get_line_height(font); + int32_t font_h = lv_font_get_line_height(font); if(cur_pos.y < lv_obj_get_scroll_top(obj)) { lv_obj_scroll_to_y(obj, cur_pos.y, LV_ANIM_ON); } /*Check the bottom*/ - lv_coord_t h = lv_obj_get_content_height(obj); + int32_t h = lv_obj_get_content_height(obj); if(cur_pos.y + font_h - lv_obj_get_scroll_top(obj) > h) { lv_obj_scroll_to_y(obj, cur_pos.y - h + font_h, LV_ANIM_ON); } @@ -382,7 +382,7 @@ void lv_textarea_set_cursor_pos(lv_obj_t * obj, int32_t pos) lv_obj_scroll_to_x(obj, cur_pos.x, LV_ANIM_ON); } /*Check the right*/ - lv_coord_t w = lv_obj_get_content_width(obj); + int32_t w = lv_obj_get_content_width(obj); if(cur_pos.x + font_h - lv_obj_get_scroll_left(obj) > w) { lv_obj_scroll_to_x(obj, cur_pos.x - w + font_h, LV_ANIM_ON); } @@ -470,8 +470,8 @@ void lv_textarea_set_one_line(lv_obj_t * obj, bool en) if(ta->one_line == en) return; ta->one_line = en ? 1U : 0U; - lv_coord_t width = en ? LV_SIZE_CONTENT : lv_pct(100); - lv_coord_t min_width_value = en ? lv_pct(100) : 0; + int32_t width = en ? LV_SIZE_CONTENT : lv_pct(100); + int32_t min_width_value = en ? lv_pct(100) : 0; lv_obj_set_width(ta->label, width); lv_obj_set_style_min_width(ta->label, min_width_value, 0); @@ -767,9 +767,9 @@ void lv_textarea_cursor_down(lv_obj_t * obj) /*Increment the y with one line and keep the valid x*/ - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - lv_coord_t font_h = lv_font_get_line_height(font); + int32_t font_h = lv_font_get_line_height(font); pos.y += font_h + line_space + 1; pos.x = ta->cursor.valid_x; @@ -778,7 +778,7 @@ void lv_textarea_cursor_down(lv_obj_t * obj) /*Get the letter index on the new cursor position and set it*/ uint32_t new_cur_pos = lv_label_get_letter_on(ta->label, &pos); - lv_coord_t cur_valid_x_tmp = ta->cursor.valid_x; /*Cursor position set overwrites the valid position*/ + int32_t cur_valid_x_tmp = ta->cursor.valid_x; /*Cursor position set overwrites the valid position*/ lv_textarea_set_cursor_pos(obj, new_cur_pos); ta->cursor.valid_x = cur_valid_x_tmp; } @@ -795,15 +795,15 @@ void lv_textarea_cursor_up(lv_obj_t * obj) lv_label_get_letter_pos(ta->label, lv_textarea_get_cursor_pos(obj), &pos); /*Decrement the y with one line and keep the valid x*/ - lv_coord_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); const lv_font_t * font = lv_obj_get_style_text_font(obj, LV_PART_MAIN); - lv_coord_t font_h = lv_font_get_line_height(font); + int32_t font_h = lv_font_get_line_height(font); pos.y -= font_h + line_space - 1; pos.x = ta->cursor.valid_x; /*Get the letter index on the new cursor position and set it*/ uint32_t new_cur_pos = lv_label_get_letter_on(ta->label, &pos); - lv_coord_t cur_valid_x_tmp = ta->cursor.valid_x; /*Cursor position set overwrites the valid position*/ + int32_t cur_valid_x_tmp = ta->cursor.valid_x; /*Cursor position set overwrites the valid position*/ lv_textarea_set_cursor_pos(obj, new_cur_pos); ta->cursor.valid_x = cur_valid_x_tmp; } @@ -1065,7 +1065,7 @@ static void refr_cursor_area(lv_obj_t * obj) lv_textarea_t * ta = (lv_textarea_t *)obj; 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); + int32_t line_space = lv_obj_get_style_text_line_space(obj, LV_PART_MAIN); uint32_t cur_pos = lv_textarea_get_cursor_pos(obj); const char * txt = lv_label_get_text(ta->label); @@ -1074,13 +1074,13 @@ static void refr_cursor_area(lv_obj_t * obj) uint32_t letter = _lv_text_encoded_next(&txt[byte_pos], NULL); /* Letter height and width */ - const lv_coord_t letter_h = lv_font_get_line_height(font); + const int32_t letter_h = lv_font_get_line_height(font); /*Set letter_w (set not 0 on non printable but valid chars)*/ uint32_t letter_space = letter; if(is_valid_but_non_printable_char(letter)) { letter_space = ' '; } - lv_coord_t letter_w = lv_font_get_glyph_width(font, letter_space, IGNORE_KERNING); + int32_t letter_w = lv_font_get_glyph_width(font, letter_space, IGNORE_KERNING); lv_point_t letter_pos; lv_label_get_letter_pos(ta->label, cur_pos, &letter_pos); @@ -1110,11 +1110,11 @@ static void refr_cursor_area(lv_obj_t * obj) ta->cursor.txt_byte_pos = byte_pos; /*Calculate the cursor according to its type*/ - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_CURSOR); - lv_coord_t top = lv_obj_get_style_pad_top(obj, LV_PART_CURSOR) + border_width; - lv_coord_t bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_CURSOR) + border_width; - lv_coord_t left = lv_obj_get_style_pad_left(obj, LV_PART_CURSOR) + border_width; - lv_coord_t right = lv_obj_get_style_pad_right(obj, LV_PART_CURSOR) + border_width; + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_CURSOR); + int32_t top = lv_obj_get_style_pad_top(obj, LV_PART_CURSOR) + border_width; + int32_t bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_CURSOR) + border_width; + int32_t left = lv_obj_get_style_pad_left(obj, LV_PART_CURSOR) + border_width; + int32_t right = lv_obj_get_style_pad_right(obj, LV_PART_CURSOR) + border_width; lv_area_t cur_area; cur_area.x1 = letter_pos.x - left; @@ -1169,7 +1169,7 @@ static void update_cursor_position_on_click(lv_event_t * e) const lv_event_code_t code = lv_event_get_code(e); - lv_coord_t label_width = lv_obj_get_width(ta->label); + int32_t label_width = lv_obj_get_width(ta->label); uint32_t char_id_at_click = 0; #if LV_LABEL_TEXT_SELECTION @@ -1294,9 +1294,9 @@ static void draw_placeholder(lv_event_t * e) if(ta->one_line) ph_dsc.flag |= LV_TEXT_FLAG_EXPAND; - lv_coord_t left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); - lv_coord_t top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); + int32_t left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); + int32_t top = lv_obj_get_style_pad_top(obj, LV_PART_MAIN); + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_MAIN); lv_area_t ph_coords; lv_area_copy(&ph_coords, &obj->coords); lv_area_move(&ph_coords, left + border_width, top + border_width); @@ -1330,9 +1330,9 @@ static void draw_cursor(lv_event_t * e) lv_draw_rect(layer, &cur_dsc, &cur_area); - lv_coord_t border_width = lv_obj_get_style_border_width(obj, LV_PART_CURSOR); - lv_coord_t left = lv_obj_get_style_pad_left(obj, LV_PART_CURSOR) + border_width; - lv_coord_t top = lv_obj_get_style_pad_top(obj, LV_PART_CURSOR) + border_width; + int32_t border_width = lv_obj_get_style_border_width(obj, LV_PART_CURSOR); + int32_t left = lv_obj_get_style_pad_left(obj, LV_PART_CURSOR) + border_width; + int32_t top = lv_obj_get_style_pad_top(obj, LV_PART_CURSOR) + border_width; char letter_buf[8] = {0}; lv_memcpy(letter_buf, &txt[ta->cursor.txt_byte_pos], _lv_text_encoded_size(&txt[ta->cursor.txt_byte_pos])); diff --git a/src/widgets/textarea/lv_textarea.h b/src/widgets/textarea/lv_textarea.h index bb2a11b6e..38ea77519 100644 --- a/src/widgets/textarea/lv_textarea.h +++ b/src/widgets/textarea/lv_textarea.h @@ -44,7 +44,7 @@ typedef struct { uint32_t max_length; /*The max. number of characters. 0: no limit*/ uint32_t pwd_show_time; /*Time to show characters in password mode before change them to '*'*/ struct { - lv_coord_t valid_x; /*Used when stepping up/down to a shorter line. + int32_t valid_x; /*Used when stepping up/down to a shorter line. *(Used by the library)*/ uint32_t pos; /*The current cursor position *(0: before 1st letter; 1: before 2nd letter ...)*/ diff --git a/src/widgets/tileview/lv_tileview.c b/src/widgets/tileview/lv_tileview.c index 557fa34f1..704169f7f 100644 --- a/src/widgets/tileview/lv_tileview.c +++ b/src/widgets/tileview/lv_tileview.c @@ -84,8 +84,8 @@ lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, l void lv_obj_set_tile(lv_obj_t * obj, lv_obj_t * tile_obj, lv_anim_enable_t anim_en) { - lv_coord_t tx = lv_obj_get_x(tile_obj); - lv_coord_t ty = lv_obj_get_y(tile_obj); + int32_t tx = lv_obj_get_x(tile_obj); + int32_t ty = lv_obj_get_y(tile_obj); lv_tileview_tile_t * tile = (lv_tileview_tile_t *)tile_obj; lv_tileview_t * tv = (lv_tileview_t *) obj; @@ -99,17 +99,17 @@ void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim { lv_obj_update_layout(tv); - lv_coord_t w = lv_obj_get_content_width(tv); - lv_coord_t h = lv_obj_get_content_height(tv); + int32_t w = lv_obj_get_content_width(tv); + int32_t h = lv_obj_get_content_height(tv); - lv_coord_t tx = col_id * w; - lv_coord_t ty = row_id * h; + int32_t tx = col_id * w; + int32_t ty = row_id * h; uint32_t i; for(i = 0; i < lv_obj_get_child_cnt(tv); i++) { lv_obj_t * tile_obj = lv_obj_get_child(tv, i); - lv_coord_t x = lv_obj_get_x(tile_obj); - lv_coord_t y = lv_obj_get_y(tile_obj); + int32_t x = lv_obj_get_x(tile_obj); + int32_t y = lv_obj_get_y(tile_obj); if(x == tx && y == ty) { lv_obj_set_tile(tv, tile_obj, anim_en); return; @@ -160,23 +160,23 @@ static void tileview_event_cb(lv_event_t * e) return; } - lv_coord_t w = lv_obj_get_content_width(obj); - lv_coord_t h = lv_obj_get_content_height(obj); + int32_t w = lv_obj_get_content_width(obj); + int32_t h = lv_obj_get_content_height(obj); lv_point_t scroll_end; lv_obj_get_scroll_end(obj, &scroll_end); - lv_coord_t left = scroll_end.x; - lv_coord_t top = scroll_end.y; + int32_t left = scroll_end.x; + int32_t top = scroll_end.y; - lv_coord_t tx = ((left + (w / 2)) / w) * w; - lv_coord_t ty = ((top + (h / 2)) / h) * h; + int32_t tx = ((left + (w / 2)) / w) * w; + int32_t ty = ((top + (h / 2)) / h) * h; lv_dir_t dir = LV_DIR_ALL; uint32_t i; for(i = 0; i < lv_obj_get_child_cnt(obj); i++) { lv_obj_t * tile_obj = lv_obj_get_child(obj, i); - lv_coord_t x = lv_obj_get_x(tile_obj); - lv_coord_t y = lv_obj_get_y(tile_obj); + int32_t x = lv_obj_get_x(tile_obj); + int32_t y = lv_obj_get_y(tile_obj); if(x == tx && y == ty) { lv_tileview_tile_t * tile = (lv_tileview_tile_t *)tile_obj; tv->tile_act = (lv_obj_t *)tile; diff --git a/src/widgets/win/lv_win.c b/src/widgets/win/lv_win.c index bdc5a1de3..7a830601b 100644 --- a/src/widgets/win/lv_win.c +++ b/src/widgets/win/lv_win.c @@ -60,7 +60,7 @@ lv_obj_t * lv_win_add_title(lv_obj_t * win, const char * txt) return title; } -lv_obj_t * lv_win_add_button(lv_obj_t * win, const void * icon, lv_coord_t btn_w) +lv_obj_t * lv_win_add_button(lv_obj_t * win, const void * icon, int32_t btn_w) { lv_obj_t * header = lv_win_get_header(win); lv_obj_t * btn = lv_button_create(header); diff --git a/src/widgets/win/lv_win.h b/src/widgets/win/lv_win.h index b47e9306b..bcebed841 100644 --- a/src/widgets/win/lv_win.h +++ b/src/widgets/win/lv_win.h @@ -36,7 +36,7 @@ lv_obj_t * lv_win_create(lv_obj_t * parent); lv_obj_t * lv_win_add_title(lv_obj_t * win, const char * txt); -lv_obj_t * lv_win_add_button(lv_obj_t * win, const void * icon, lv_coord_t btn_w); +lv_obj_t * lv_win_add_button(lv_obj_t * win, const void * icon, int32_t btn_w); lv_obj_t * lv_win_get_header(lv_obj_t * win); lv_obj_t * lv_win_get_content(lv_obj_t * win); |