diff options
Diffstat (limited to 'src')
421 files changed, 9083 insertions, 5360 deletions
diff --git a/src/core/lv_global.h b/src/core/lv_global.h index b720e70d9..424e19129 100644 --- a/src/core/lv_global.h +++ b/src/core/lv_global.h @@ -32,7 +32,7 @@ extern "C" { #include "../stdlib/builtin/lv_tlsf.h" #if LV_USE_FONT_COMPRESSED -#include "../font/lv_font_fmt_txt.h" +#include "../font/lv_font_fmt_txt_private.h" #endif #include "../tick/lv_tick.h" @@ -40,6 +40,17 @@ extern "C" { #include "../misc/lv_types.h" +#include "../misc/lv_timer_private.h" +#include "../misc/lv_anim_private.h" +#include "../tick/lv_tick_private.h" +#include "../draw/lv_draw_buf_private.h" +#include "../draw/lv_draw_private.h" +#include "../draw/sw/lv_draw_sw_private.h" +#include "../draw/sw/lv_draw_sw_mask_private.h" +#include "../stdlib/builtin/lv_tlsf_private.h" +#include "../others/sysmon/lv_sysmon_private.h" +#include "../layouts/lv_layout_private.h" + /********************* * DEFINES *********************/ @@ -54,18 +65,18 @@ struct _snippet_stack; #endif #if LV_USE_FREETYPE -struct _lv_freetype_context_t; +struct lv_freetype_context_t; #endif #if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN -struct _lv_profiler_builtin_ctx_t; +struct lv_profiler_builtin_ctx_t; #endif #if LV_USE_NUTTX -struct _lv_nuttx_ctx_t; +struct lv_nuttx_ctx_t; #endif -typedef struct _lv_global_t { +typedef struct lv_global_t { bool inited; bool deinit_in_progress; /**< Can be used e.g. in the LV_EVENT_DELETE to deinit the drivers too */ @@ -115,7 +126,7 @@ typedef struct _lv_global_t { lv_draw_sw_shadow_cache_t sw_shadow_cache; #endif #if LV_DRAW_SW_COMPLEX - _lv_draw_sw_mask_radius_circle_dsc_arr_t sw_circle_cache; + lv_draw_sw_mask_radius_circle_dsc_arr_t sw_circle_cache; #endif #if LV_USE_LOG @@ -171,7 +182,7 @@ typedef struct _lv_global_t { #endif #if LV_USE_FREETYPE - struct _lv_freetype_context_t * ft_context; + struct lv_freetype_context_t * ft_context; #endif #if LV_USE_FONT_COMPRESSED @@ -183,7 +194,7 @@ typedef struct _lv_global_t { #endif #if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN - struct _lv_profiler_builtin_ctx_t * profiler_context; + struct lv_profiler_builtin_ctx_t * profiler_context; #endif #if LV_USE_FILE_EXPLORER != 0 @@ -204,7 +215,7 @@ typedef struct _lv_global_t { #endif #if LV_USE_NUTTX - struct _lv_nuttx_ctx_t * nuttx_ctx; + struct lv_nuttx_ctx_t * nuttx_ctx; #endif #if LV_USE_OS != LV_OS_NONE diff --git a/src/core/lv_group.c b/src/core/lv_group.c index b2c8209da..15ab1ce9b 100644 --- a/src/core/lv_group.c +++ b/src/core/lv_group.c @@ -6,8 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_group.h" -#include "../core/lv_obj.h" +#include "lv_group_private.h" +#include "../core/lv_obj_private.h" #include "../core/lv_global.h" #include "../indev/lv_indev.h" #include "../misc/lv_types.h" @@ -42,22 +42,22 @@ static lv_indev_t * get_indev(const lv_group_t * g); * GLOBAL FUNCTIONS **********************/ -void _lv_group_init(void) +void lv_group_init(void) { - _lv_ll_init(group_ll_p, sizeof(lv_group_t)); + lv_ll_init(group_ll_p, sizeof(lv_group_t)); } -void _lv_group_deinit(void) +void lv_group_deinit(void) { - _lv_ll_clear(group_ll_p); + lv_ll_clear(group_ll_p); } lv_group_t * lv_group_create(void) { - lv_group_t * group = _lv_ll_ins_head(group_ll_p); + lv_group_t * group = lv_ll_ins_head(group_ll_p); LV_ASSERT_MALLOC(group); if(group == NULL) return NULL; - _lv_ll_init(&group->obj_ll, sizeof(lv_obj_t *)); + lv_ll_init(&group->obj_ll, sizeof(lv_obj_t *)); group->obj_focus = NULL; group->frozen = 0; @@ -82,7 +82,7 @@ void lv_group_delete(lv_group_t * group) /*Remove the objects from the group*/ lv_obj_t ** obj; - _LV_LL_READ(&group->obj_ll, obj) { + LV_LL_READ(&group->obj_ll, obj) { if((*obj)->spec_attr)(*obj)->spec_attr->group_p = NULL; } @@ -98,8 +98,8 @@ void lv_group_delete(lv_group_t * group) /*If the group is the default group, set the default group as NULL*/ if(group == lv_group_get_default()) lv_group_set_default(NULL); - _lv_ll_clear(&(group->obj_ll)); - _lv_ll_remove(group_ll_p, group); + lv_ll_clear(&(group->obj_ll)); + lv_ll_remove(group_ll_p, group); lv_free(group); } @@ -125,14 +125,14 @@ void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj) if(obj->spec_attr == NULL) lv_obj_allocate_spec_attr(obj); obj->spec_attr->group_p = group; - lv_obj_t ** next = _lv_ll_ins_tail(&group->obj_ll); + lv_obj_t ** next = lv_ll_ins_tail(&group->obj_ll); LV_ASSERT_MALLOC(next); if(next == NULL) return; *next = obj; /*If the head and the tail is equal then there is only one object in the linked list. *In this case automatically activate it*/ - if(_lv_ll_get_head(&group->obj_ll) == next) { + if(lv_ll_get_head(&group->obj_ll) == next) { lv_group_refocus(group); } @@ -148,7 +148,7 @@ void lv_group_swap_obj(lv_obj_t * obj1, lv_obj_t * obj2) /*Do not add the object twice*/ lv_obj_t ** obj_i; - _LV_LL_READ(&g1->obj_ll, obj_i) { + LV_LL_READ(&g1->obj_ll, obj_i) { if((*obj_i) == obj1)(*obj_i) = obj2; else if((*obj_i) == obj2)(*obj_i) = obj1; } @@ -171,7 +171,7 @@ void lv_group_remove_obj(lv_obj_t * obj) if(g->frozen) g->frozen = 0; /*If this is the only object in the group then focus to nothing.*/ - if(_lv_ll_get_head(&g->obj_ll) == g->obj_focus && _lv_ll_get_tail(&g->obj_ll) == g->obj_focus) { + if(lv_ll_get_head(&g->obj_ll) == g->obj_focus && lv_ll_get_tail(&g->obj_ll) == g->obj_focus) { lv_obj_send_event(*g->obj_focus, LV_EVENT_DEFOCUSED, get_indev(g)); } /*If there more objects in the group then focus to the next/prev object*/ @@ -189,9 +189,9 @@ void lv_group_remove_obj(lv_obj_t * obj) /*Search the object and remove it from its group*/ lv_obj_t ** i; - _LV_LL_READ(&g->obj_ll, i) { + LV_LL_READ(&g->obj_ll, i) { if(*i == obj) { - _lv_ll_remove(&g->obj_ll, i); + lv_ll_remove(&g->obj_ll, i); lv_free(i); if(obj->spec_attr) obj->spec_attr->group_p = NULL; break; @@ -213,11 +213,11 @@ void lv_group_remove_all_objs(lv_group_t * group) /*Remove the objects from the group*/ lv_obj_t ** obj; - _LV_LL_READ(&group->obj_ll, obj) { + LV_LL_READ(&group->obj_ll, obj) { if((*obj)->spec_attr)(*obj)->spec_attr->group_p = NULL; } - _lv_ll_clear(&(group->obj_ll)); + lv_ll_clear(&(group->obj_ll)); } void lv_group_focus_obj(lv_obj_t * obj) @@ -232,7 +232,7 @@ void lv_group_focus_obj(lv_obj_t * obj) lv_group_set_editing(g, false); lv_obj_t ** i; - _LV_LL_READ(&g->obj_ll, i) { + LV_LL_READ(&g->obj_ll, i) { if(*i == obj) { if(g->obj_focus != NULL && obj != *g->obj_focus) { /*Do not defocus if the same object needs to be focused again*/ lv_result_t res = lv_obj_send_event(*g->obj_focus, LV_EVENT_DEFOCUSED, get_indev(g)); @@ -257,7 +257,7 @@ void lv_group_focus_next(lv_group_t * group) { LV_ASSERT_NULL(group); - bool focus_changed = focus_next_core(group, _lv_ll_get_head, _lv_ll_get_next); + bool focus_changed = focus_next_core(group, lv_ll_get_head, lv_ll_get_next); if(group->edge_cb) { if(!focus_changed) group->edge_cb(group, true); @@ -268,7 +268,7 @@ void lv_group_focus_prev(lv_group_t * group) { LV_ASSERT_NULL(group); - bool focus_changed = focus_next_core(group, _lv_ll_get_tail, _lv_ll_get_prev); + bool focus_changed = focus_next_core(group, lv_ll_get_tail, lv_ll_get_prev); if(group->edge_cb) { if(!focus_changed) group->edge_cb(group, false); @@ -374,12 +374,12 @@ bool lv_group_get_wrap(lv_group_t * group) uint32_t lv_group_get_obj_count(lv_group_t * group) { LV_ASSERT_NULL(group); - return _lv_ll_get_len(&group->obj_ll); + return lv_ll_get_len(&group->obj_ll); } uint32_t lv_group_get_count(void) { - return _lv_ll_get_len(group_ll_p); + return lv_ll_get_len(group_ll_p); } lv_group_t * lv_group_by_index(uint32_t index) @@ -387,7 +387,7 @@ lv_group_t * lv_group_by_index(uint32_t index) uint32_t len = 0; void * node; - for(node = _lv_ll_get_tail(group_ll_p); node != NULL; node = _lv_ll_get_prev(group_ll_p, node)) { + for(node = lv_ll_get_tail(group_ll_p); node != NULL; node = lv_ll_get_prev(group_ll_p, node)) { if(len == index) { return (lv_group_t *) node; } diff --git a/src/core/lv_group.h b/src/core/lv_group.h index feab5acb2..2163c995c 100644 --- a/src/core/lv_group.h +++ b/src/core/lv_group.h @@ -22,7 +22,7 @@ extern "C" { * DEFINES *********************/ /*Predefined keys to control the focused object via lv_group_send(group, c)*/ -enum _lv_key_t { +typedef enum { LV_KEY_UP = 17, /*0x11*/ LV_KEY_DOWN = 18, /*0x12*/ LV_KEY_RIGHT = 19, /*0x13*/ @@ -35,7 +35,7 @@ enum _lv_key_t { LV_KEY_PREV = 11, /*0x0B, '*/ LV_KEY_HOME = 2, /*0x02, STX*/ LV_KEY_END = 3, /*0x03, ETX*/ -}; +} lv_key_t; /********************** * TYPEDEFS @@ -44,29 +44,6 @@ enum _lv_key_t { typedef void (*lv_group_focus_cb_t)(lv_group_t *); typedef void (*lv_group_edge_cb_t)(lv_group_t *, bool); -/** - * Groups can be used to logically hold objects so that they can be individually focused. - * They are NOT for laying out objects on a screen (try layouts for that). - */ -struct _lv_group_t { - lv_ll_t obj_ll; /**< Linked list to store the objects in the group*/ - lv_obj_t ** obj_focus; /**< The object in focus*/ - - lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/ - lv_group_edge_cb_t edge_cb; /**< A function to call when an edge is reached, no more focus - targets are available in this direction (to allow edge feedback - like a sound or a scroll bounce) */ - - void * user_data; - - uint8_t frozen : 1; /**< 1: can't focus to new object*/ - uint8_t editing : 1; /**< 1: Edit mode, 0: Navigate mode*/ - uint8_t refocus_policy : 1; /**< 1: Focus prev if focused on deletion. 0: Focus next if focused on - deletion.*/ - uint8_t wrap : 1; /**< 1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end - of list.*/ -}; - typedef enum { LV_GROUP_REFOCUS_POLICY_NEXT = 0, LV_GROUP_REFOCUS_POLICY_PREV = 1 @@ -77,18 +54,6 @@ typedef enum { **********************/ /** - * Init the group module - * @remarks Internal function, do not call directly. - */ -void _lv_group_init(void); - -/** - * Deinit the group module - * @remarks Internal function, do not call directly. - */ -void _lv_group_deinit(void); - -/** * Create a new object group * @return pointer to the new object group */ diff --git a/src/core/lv_group_private.h b/src/core/lv_group_private.h new file mode 100644 index 000000000..33b7640c7 --- /dev/null +++ b/src/core/lv_group_private.h @@ -0,0 +1,75 @@ +/** + * @file lv_group_private.h + * + */ + +#ifndef LV_GROUP_PRIVATE_H +#define LV_GROUP_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_group.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Groups can be used to logically hold objects so that they can be individually focused. + * They are NOT for laying out objects on a screen (try layouts for that). + */ +struct lv_group_t { + lv_ll_t obj_ll; /**< Linked list to store the objects in the group*/ + lv_obj_t ** obj_focus; /**< The object in focus*/ + + lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/ + lv_group_edge_cb_t edge_cb; /**< A function to call when an edge is reached, no more focus + targets are available in this direction (to allow edge feedback + like a sound or a scroll bounce) */ + + void * user_data; + + uint8_t frozen : 1; /**< 1: can't focus to new object*/ + uint8_t editing : 1; /**< 1: Edit mode, 0: Navigate mode*/ + uint8_t refocus_policy : 1; /**< 1: Focus prev if focused on deletion. 0: Focus next if focused on + deletion.*/ + uint8_t wrap : 1; /**< 1: Focus next/prev can wrap at end of list. 0: Focus next/prev stops at end + of list.*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Init the group module + * @remarks Internal function, do not call directly. + */ +void lv_group_init(void); + +/** + * Deinit the group module + * @remarks Internal function, do not call directly. + */ +void lv_group_deinit(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_GROUP_PRIVATE_H*/ diff --git a/src/core/lv_obj.c b/src/core/lv_obj.c index bcc152523..ff4e087d1 100644 --- a/src/core/lv_obj.c +++ b/src/core/lv_obj.c @@ -6,7 +6,12 @@ /********************* * INCLUDES *********************/ -#include "lv_obj.h" +#include "../misc/lv_event_private.h" +#include "../misc/lv_area_private.h" +#include "lv_obj_style_private.h" +#include "lv_obj_event_private.h" +#include "lv_obj_class_private.h" +#include "lv_obj_private.h" #include "../indev/lv_indev.h" #include "../indev/lv_indev_private.h" #include "lv_refr.h" @@ -20,6 +25,7 @@ #include "../misc/lv_types.h" #include "../tick/lv_tick.h" #include "../stdlib/lv_string.h" +#include "lv_obj_draw_private.h" /********************* * DEFINES @@ -140,7 +146,7 @@ static const lv_property_ops_t properties[] = { }, { .id = LV_PROPERTY_OBJ_EXT_DRAW_SIZE, - .getter = _lv_obj_get_ext_draw_size, + .getter = lv_obj_get_ext_draw_size, }, { .id = LV_PROPERTY_OBJ_EVENT_COUNT, @@ -372,7 +378,7 @@ void lv_obj_allocate_spec_attr(lv_obj_t * obj) LV_ASSERT_OBJ(obj, MY_CLASS); if(obj->spec_attr == NULL) { - obj->spec_attr = lv_malloc_zeroed(sizeof(_lv_obj_spec_attr_t)); + obj->spec_attr = lv_malloc_zeroed(sizeof(lv_obj_spec_attr_t)); LV_ASSERT_MALLOC(obj->spec_attr); if(obj->spec_attr == NULL) return; @@ -456,6 +462,16 @@ lv_obj_t * lv_obj_get_child_by_id(const lv_obj_t * obj, void * id) } #endif +void lv_obj_set_user_data(lv_obj_t * obj, void * user_data) +{ + obj->user_data = user_data; +} + +void * lv_obj_get_user_data(lv_obj_t * obj) +{ + return obj->user_data; +} + /********************** * STATIC FUNCTIONS **********************/ @@ -499,7 +515,7 @@ static void lv_obj_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) { LV_UNUSED(class_p); - _lv_event_mark_deleted(obj); + lv_event_mark_deleted(obj); /*Remove all style*/ lv_obj_enable_style_refresh(false); /*No need to refresh the style because the object will be deleted*/ @@ -550,7 +566,7 @@ static void lv_obj_draw(lv_event_t * e) lv_area_copy(&coords, &obj->coords); lv_area_increase(&coords, w, h); - if(_lv_area_is_in(info->area, &coords, r) == false) { + if(lv_area_is_in(info->area, &coords, r) == false) { info->res = LV_COVER_RES_NOT_COVER; return; } @@ -881,9 +897,9 @@ static void update_obj_state(lv_obj_t * obj, lv_state_t new_state) lv_state_t prev_state = obj->state; - _lv_style_state_cmp_t cmp_res = _lv_obj_style_state_compare(obj, prev_state, new_state); + lv_style_state_cmp_t cmp_res = lv_obj_style_state_compare(obj, prev_state, new_state); /*If there is no difference in styles there is nothing else to do*/ - if(cmp_res == _LV_STYLE_STATE_CMP_SAME) { + if(cmp_res == LV_STYLE_STATE_CMP_SAME) { obj->state = new_state; return; } @@ -892,12 +908,12 @@ static void update_obj_state(lv_obj_t * obj, lv_state_t new_state) lv_obj_invalidate(obj); obj->state = new_state; - _lv_obj_update_layer_type(obj); - _lv_obj_style_transition_dsc_t * ts = lv_malloc_zeroed(sizeof(_lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX); + lv_obj_update_layer_type(obj); + lv_obj_style_transition_dsc_t * ts = lv_malloc_zeroed(sizeof(lv_obj_style_transition_dsc_t) * STYLE_TRANSITION_MAX); uint32_t tsi = 0; uint32_t i; for(i = 0; i < obj->style_cnt && tsi < STYLE_TRANSITION_MAX; i++) { - _lv_obj_style_t * obj_style = &obj->styles[i]; + lv_obj_style_t * obj_style = &obj->styles[i]; lv_state_t state_act = lv_obj_style_get_selector_state(obj->styles[i].selector); lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector); if(state_act & (~new_state)) continue; /*Skip unrelated styles*/ @@ -933,19 +949,19 @@ static void update_obj_state(lv_obj_t * obj, lv_state_t new_state) for(i = 0; i < tsi; i++) { lv_part_t part_act = lv_obj_style_get_selector_part(ts[i].selector); - _lv_obj_style_create_transition(obj, part_act, prev_state, new_state, &ts[i]); + lv_obj_style_create_transition(obj, part_act, prev_state, new_state, &ts[i]); } lv_free(ts); - if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_REDRAW) { + if(cmp_res == LV_STYLE_STATE_CMP_DIFF_REDRAW) { /*Invalidation is not enough, e.g. layer type needs to be updated too*/ lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY); } - else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_LAYOUT) { + else if(cmp_res == LV_STYLE_STATE_CMP_DIFF_LAYOUT) { lv_obj_refresh_style(obj, LV_PART_ANY, LV_STYLE_PROP_ANY); } - else if(cmp_res == _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) { + else if(cmp_res == LV_STYLE_STATE_CMP_DIFF_DRAW_PAD) { lv_obj_invalidate(obj); lv_obj_refresh_ext_draw_size(obj); } diff --git a/src/core/lv_obj.h b/src/core/lv_obj.h index b7a2e234d..9d9eac9a0 100644 --- a/src/core/lv_obj.h +++ b/src/core/lv_obj.h @@ -43,7 +43,7 @@ extern "C" { * Possible states of a widget. * OR-ed values are possible */ -enum _lv_state_t { +enum { LV_STATE_DEFAULT = 0x0000, LV_STATE_CHECKED = 0x0001, LV_STATE_FOCUSED = 0x0002, @@ -68,7 +68,7 @@ enum _lv_state_t { * Not all parts are used by every widget */ -enum _lv_part_t { +enum { LV_PART_MAIN = 0x000000, /**< A background like rectangle*/ LV_PART_SCROLLBAR = 0x010000, /**< The scrollbar(s)*/ LV_PART_INDICATOR = 0x020000, /**< Indicator, e.g. for slider, bar, switch, or the tick box of the checkbox*/ @@ -125,7 +125,7 @@ typedef enum { LV_OBJ_FLAG_USER_2 = (1L << 28), /**< Custom flag, free to use by user*/ LV_OBJ_FLAG_USER_3 = (1L << 29), /**< Custom flag, free to use by user*/ LV_OBJ_FLAG_USER_4 = (1L << 30), /**< Custom flag, free to use by user*/ -} _lv_obj_flag_t; +} lv_obj_flag_t; #if LV_USE_OBJ_PROPERTY enum { @@ -217,54 +217,6 @@ enum { */ LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_obj_class; -/** - * Special, rarely used attributes. - * They are allocated automatically if any elements is set. - */ -typedef struct { - lv_obj_t ** children; /**< Store the pointer of the children in an array.*/ - lv_group_t * group_p; - lv_event_list_t event_list; - - lv_point_t scroll; /**< The current X/Y scroll offset*/ - - int32_t ext_click_pad; /**< Extra click padding in all direction*/ - int32_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/ - - uint16_t child_cnt; /**< Number of children*/ - uint16_t scrollbar_mode : 2; /**< How to display scrollbars, see `lv_scrollbar_mode_t`*/ - uint16_t scroll_snap_x : 2; /**< Where to align the snappable children horizontally, see `lv_scroll_snap_t`*/ - uint16_t scroll_snap_y : 2; /**< Where to align the snappable children vertically*/ - uint16_t scroll_dir : 4; /**< The allowed scroll direction(s), see `lv_dir_t`*/ - uint16_t layer_type : 2; /**< Cache the layer type here. Element of @lv_intermediate_layer_type_t */ -} _lv_obj_spec_attr_t; - -struct _lv_obj_t { - const lv_obj_class_t * class_p; - lv_obj_t * parent; - _lv_obj_spec_attr_t * spec_attr; - _lv_obj_style_t * styles; -#if LV_OBJ_STYLE_CACHE - uint32_t style_main_prop_is_set; - uint32_t style_other_prop_is_set; -#endif - void * user_data; -#if LV_USE_OBJ_ID - void * id; -#endif - lv_area_t coords; - lv_obj_flag_t flags; - lv_state_t state; - uint16_t layout_inv : 1; - uint16_t readjust_scroll_after_layout : 1; - uint16_t scr_layout_inv : 1; - uint16_t skip_trans : 1; - uint16_t style_cnt : 6; - uint16_t h_layout : 1; - uint16_t w_layout : 1; - uint16_t is_deleting : 1; -}; - /********************** * GLOBAL PROTOTYPES **********************/ @@ -331,10 +283,7 @@ void lv_obj_set_state(lv_obj_t * obj, lv_state_t state, bool v); * @param obj pointer to an object * @param user_data pointer to the new user_data. */ -static inline void lv_obj_set_user_data(lv_obj_t * obj, void * user_data) -{ - obj->user_data = user_data; -} +void lv_obj_set_user_data(lv_obj_t * obj, void * user_data); /*======================= * Getter functions @@ -383,10 +332,7 @@ lv_group_t * lv_obj_get_group(const lv_obj_t * obj); * @param obj pointer to an object * @return the pointer to the user_data of the object */ -static inline void * lv_obj_get_user_data(lv_obj_t * obj) -{ - return obj->user_data; -} +void * lv_obj_get_user_data(lv_obj_t * obj); /*======================= * Other functions diff --git a/src/core/lv_obj_class.c b/src/core/lv_obj_class.c index a3e9b2bd2..cb5a396b0 100644 --- a/src/core/lv_obj_class.c +++ b/src/core/lv_obj_class.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_obj.h" +#include "lv_obj_class_private.h" +#include "lv_obj_private.h" #include "../themes/lv_theme.h" #include "../display/lv_display.h" #include "../display/lv_display_private.h" @@ -132,7 +133,7 @@ void lv_obj_class_init_obj(lv_obj_t * obj) } } -void _lv_obj_destruct(lv_obj_t * obj) +void lv_obj_destruct(lv_obj_t * obj) { if(obj->class_p->destructor_cb) obj->class_p->destructor_cb(obj->class_p, obj); @@ -141,7 +142,7 @@ void _lv_obj_destruct(lv_obj_t * obj) obj->class_p = obj->class_p->base_class; /*Call the base class's destructor too*/ - _lv_obj_destruct(obj); + lv_obj_destruct(obj); } } diff --git a/src/core/lv_obj_class.h b/src/core/lv_obj_class.h index 09f157f94..4c3bdcb24 100644 --- a/src/core/lv_obj_class.h +++ b/src/core/lv_obj_class.h @@ -43,42 +43,6 @@ typedef enum { } lv_obj_class_theme_inheritable_t; typedef void (*lv_obj_class_event_cb_t)(lv_obj_class_t * class_p, lv_event_t * e); -/** - * Describe the common methods of every object. - * Similar to a C++ class. - */ -struct _lv_obj_class_t { - const lv_obj_class_t * base_class; - /*class_p is the final class while obj->class_p is the class currently being [de]constructed.*/ - void (*constructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj); - void (*destructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj); - - /*class_p is the class in which event is being processed.*/ - void (*event_cb)(const lv_obj_class_t * class_p, lv_event_t * e); /**< Widget type specific event function*/ - -#if LV_USE_OBJ_PROPERTY - uint32_t prop_index_start; - uint32_t prop_index_end; - const lv_property_ops_t * properties; - uint32_t properties_count; - -#if LV_USE_OBJ_PROPERTY_NAME - /* An array of property ID and name */ - const lv_property_name_t * property_names; - uint32_t names_count; -#endif -#endif - - void * user_data; - const char * name; - 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; - uint32_t theme_inheritable : 1; /**< Value from ::lv_obj_class_theme_inheritable_t*/ -}; - /********************** * GLOBAL PROTOTYPES **********************/ @@ -93,8 +57,6 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa void lv_obj_class_init_obj(lv_obj_t * obj); -void _lv_obj_destruct(lv_obj_t * obj); - bool lv_obj_is_editable(lv_obj_t * obj); bool lv_obj_is_group_def(lv_obj_t * obj); diff --git a/src/core/lv_obj_class_private.h b/src/core/lv_obj_class_private.h new file mode 100644 index 000000000..464813fb6 --- /dev/null +++ b/src/core/lv_obj_class_private.h @@ -0,0 +1,78 @@ +/** + * @file lv_obj_class_private.h + * + */ + +#ifndef LV_OBJ_CLASS_PRIVATE_H +#define LV_OBJ_CLASS_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_obj_class.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Describe the common methods of every object. + * Similar to a C++ class. + */ +struct lv_obj_class_t { + const lv_obj_class_t * base_class; + /*class_p is the final class while obj->class_p is the class currently being [de]constructed.*/ + void (*constructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj); + void (*destructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj); + + /*class_p is the class in which event is being processed.*/ + void (*event_cb)(const lv_obj_class_t * class_p, lv_event_t * e); /**< Widget type specific event function*/ + +#if LV_USE_OBJ_PROPERTY + uint32_t prop_index_start; + uint32_t prop_index_end; + const lv_property_ops_t * properties; + uint32_t properties_count; + +#if LV_USE_OBJ_PROPERTY_NAME + /* An array of property ID and name */ + const lv_property_name_t * property_names; + uint32_t names_count; +#endif +#endif + + void * user_data; + const char * name; + 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; + uint32_t theme_inheritable : 1; /**< Value from ::lv_obj_class_theme_inheritable_t*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +void lv_obj_destruct(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_CLASS_PRIVATE_H*/ diff --git a/src/core/lv_obj_draw.c b/src/core/lv_obj_draw.c index 91be29380..4a11ddaac 100644 --- a/src/core/lv_obj_draw.c +++ b/src/core/lv_obj_draw.c @@ -6,8 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_obj_draw.h" -#include "lv_obj.h" +#include "lv_obj_draw_private.h" +#include "lv_obj_private.h" +#include "lv_obj_style.h" #include "../display/lv_display.h" #include "../indev/lv_indev.h" #include "../stdlib/lv_string.h" @@ -288,7 +289,7 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj) { LV_ASSERT_OBJ(obj, MY_CLASS); - int32_t s_old = _lv_obj_get_ext_draw_size(obj); + 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); @@ -306,13 +307,13 @@ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj) if(s_new != s_old) lv_obj_invalidate(obj); } -int32_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; } -lv_layer_type_t _lv_obj_get_layer_type(const lv_obj_t * obj) +lv_layer_type_t lv_obj_get_layer_type(const lv_obj_t * obj) { if(obj->spec_attr) return (lv_layer_type_t)obj->spec_attr->layer_type; diff --git a/src/core/lv_obj_draw.h b/src/core/lv_obj_draw.h index 73b76c18a..7e0c26363 100644 --- a/src/core/lv_obj_draw.h +++ b/src/core/lv_obj_draw.h @@ -98,15 +98,6 @@ int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part); */ void lv_obj_refresh_ext_draw_size(lv_obj_t * obj); -/** - * Get the extended draw area of an object. - * @param obj pointer to an object - * @return the size extended draw area around the real coordinates - */ -int32_t _lv_obj_get_ext_draw_size(const lv_obj_t * obj); - -lv_layer_type_t _lv_obj_get_layer_type(const lv_obj_t * obj); - /********************** * MACROS **********************/ diff --git a/src/core/lv_obj_draw_private.h b/src/core/lv_obj_draw_private.h new file mode 100644 index 000000000..36c8bff96 --- /dev/null +++ b/src/core/lv_obj_draw_private.h @@ -0,0 +1,48 @@ +/** + * @file lv_obj_draw_private.h + * + */ + +#ifndef LV_OBJ_DRAW_PRIVATE_H +#define LV_OBJ_DRAW_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_obj_draw.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Get the extended draw area of an object. + * @param obj pointer to an object + * @return the size extended draw area around the real coordinates + */ +int32_t lv_obj_get_ext_draw_size(const lv_obj_t * obj); + +lv_layer_type_t lv_obj_get_layer_type(const lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_DRAW_PRIVATE_H*/ diff --git a/src/core/lv_obj_event.c b/src/core/lv_obj_event.c index 82b83883d..3831feeb5 100644 --- a/src/core/lv_obj_event.c +++ b/src/core/lv_obj_event.c @@ -6,7 +6,10 @@ /********************* * INCLUDES *********************/ -#include "lv_obj.h" +#include "../misc/lv_event_private.h" +#include "lv_obj_event_private.h" +#include "lv_obj_class_private.h" +#include "lv_obj_private.h" #include "../indev/lv_indev.h" #include "../indev/lv_indev_private.h" @@ -58,13 +61,13 @@ lv_result_t lv_obj_send_event(lv_obj_t * obj, lv_event_code_t event_code, void * e.stop_bubbling = 0; e.stop_processing = 0; - _lv_event_push(&e); + lv_event_push(&e); /*Send the event*/ lv_result_t res = event_send_core(&e); /*Remove this element from the list*/ - _lv_event_pop(&e); + lv_event_pop(&e); return res; } diff --git a/src/core/lv_obj_event.h b/src/core/lv_obj_event.h index f5b406be1..2035f1765 100644 --- a/src/core/lv_obj_event.h +++ b/src/core/lv_obj_event.h @@ -25,18 +25,6 @@ extern "C" { * TYPEDEFS **********************/ -/** - * Used as the event parameter of ::LV_EVENT_HIT_TEST to check if an `point` can click the object or not. - * `res` should be set like this: - * - If already set to `false` another event wants that point non clickable. If you want to respect it leave it as `false` or set `true` to overwrite it. - * - If already set `true` and `point` shouldn't be clickable set to `false` - * - If already set to `true` you agree that `point` can click the object leave it as `true` - */ -typedef struct { - const lv_point_t * point; /**< A point relative to screen to check if it can click the object or not*/ - bool res; /**< true: `point` can click the object; false: it cannot*/ -} lv_hit_test_info_t; - /** Cover check results.*/ typedef enum { LV_COVER_RES_COVER = 0, @@ -44,16 +32,6 @@ typedef enum { LV_COVER_RES_MASKED = 2, } lv_cover_res_t; -/** - * Used as the event parameter of ::LV_EVENT_COVER_CHECK to check if an area is covered by the object or not. - * In the event use `const lv_area_t * area = lv_event_get_cover_area(e)` to get the area to check - * and `lv_event_set_cover_res(e, res)` to set the result. - */ -typedef struct { - lv_cover_res_t res; - const lv_area_t * area; -} lv_cover_check_info_t; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/core/lv_obj_event_private.h b/src/core/lv_obj_event_private.h new file mode 100644 index 000000000..731d33248 --- /dev/null +++ b/src/core/lv_obj_event_private.h @@ -0,0 +1,62 @@ +/** + * @file lv_obj_event_private.h + * + */ + +#ifndef LV_OBJ_EVENT_PRIVATE_H +#define LV_OBJ_EVENT_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_obj_event.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Used as the event parameter of ::LV_EVENT_HIT_TEST to check if an `point` can click the object or not. + * `res` should be set like this: + * - If already set to `false` another event wants that point non clickable. If you want to respect it leave it as `false` or set `true` to overwrite it. + * - If already set `true` and `point` shouldn't be clickable set to `false` + * - If already set to `true` you agree that `point` can click the object leave it as `true` + */ +struct lv_hit_test_info_t { + const lv_point_t * point; /**< A point relative to screen to check if it can click the object or not*/ + bool res; /**< true: `point` can click the object; false: it cannot*/ +}; + +/** + * Used as the event parameter of ::LV_EVENT_COVER_CHECK to check if an area is covered by the object or not. + * In the event use `const lv_area_t * area = lv_event_get_cover_area(e)` to get the area to check + * and `lv_event_set_cover_res(e, res)` to set the result. + */ +struct lv_cover_check_info_t { + lv_cover_res_t res; + const lv_area_t * area; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_EVENT_PRIVATE_H*/ diff --git a/src/core/lv_obj_id_builtin.c b/src/core/lv_obj_id_builtin.c index 5512cf74c..7a0494a72 100644 --- a/src/core/lv_obj_id_builtin.c +++ b/src/core/lv_obj_id_builtin.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_obj.h" +#include "lv_obj_class_private.h" +#include "lv_obj_private.h" #include "lv_global.h" #include "../osal/lv_os.h" #include "../stdlib/lv_sprintf.h" @@ -92,7 +93,7 @@ const char * lv_obj_stringify_id(lv_obj_t * obj, char * buf, uint32_t len) name = obj->class_p->name; if(name == NULL) name = "nameless"; - lv_snprintf(buf, len, "%s%" LV_PRId32 "", name, (uint32_t)(lv_uintptr_t)obj->id); + lv_snprintf(buf, len, "%s%" LV_PRIu32 "", name, (uint32_t)(lv_uintptr_t)obj->id); return buf; } diff --git a/src/core/lv_obj_pos.c b/src/core/lv_obj_pos.c index 0e8ecaa52..0a3b00041 100644 --- a/src/core/lv_obj_pos.c +++ b/src/core/lv_obj_pos.c @@ -6,10 +6,14 @@ /********************* * INCLUDES *********************/ -#include "lv_obj.h" +#include "../misc/lv_area_private.h" +#include "../layouts/lv_layout_private.h" +#include "lv_obj_event_private.h" +#include "lv_obj_draw_private.h" +#include "lv_obj_private.h" #include "../display/lv_display.h" #include "../display/lv_display_private.h" -#include "lv_refr.h" +#include "lv_refr_private.h" #include "../core/lv_global.h" /********************* @@ -54,12 +58,12 @@ void lv_obj_set_x(lv_obj_t * obj, int32_t x) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_result_t res_x; + lv_style_res_t res_x; lv_style_value_t v_x; res_x = lv_obj_get_local_style_prop(obj, LV_STYLE_X, &v_x, 0); - if((res_x == LV_RESULT_OK && v_x.num != x) || res_x == LV_RESULT_INVALID) { + if((res_x == LV_STYLE_RES_FOUND && v_x.num != x) || res_x == LV_STYLE_RES_NOT_FOUND) { lv_obj_set_style_x(obj, x, 0); } } @@ -68,12 +72,12 @@ void lv_obj_set_y(lv_obj_t * obj, int32_t y) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_result_t res_y; + lv_style_res_t res_y; lv_style_value_t v_y; res_y = lv_obj_get_local_style_prop(obj, LV_STYLE_Y, &v_y, 0); - if((res_y == LV_RESULT_OK && v_y.num != y) || res_y == LV_RESULT_INVALID) { + if((res_y == LV_STYLE_RES_FOUND && v_y.num != y) || res_y == LV_STYLE_RES_NOT_FOUND) { lv_obj_set_style_y(obj, y, 0); } } @@ -170,7 +174,7 @@ bool lv_obj_refr_size(lv_obj_t * obj) /*If the object is already out of the parent and its position is changes *surely the scrollbars also changes so invalidate them*/ - bool on1 = _lv_area_is_in(&ori, &parent_fit_area, 0); + bool on1 = lv_area_is_in(&ori, &parent_fit_area, 0); if(!on1) lv_obj_scrollbar_invalidate(parent); /*Set the length and height @@ -196,7 +200,7 @@ bool lv_obj_refr_size(lv_obj_t * obj) /*If the object was out of the parent invalidate the new scrollbar area too. *If it wasn't out of the parent but out now, also invalidate the scrollbars*/ - bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0); + bool on2 = lv_area_is_in(&obj->coords, &parent_fit_area, 0); if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent); lv_obj_refresh_ext_draw_size(obj); @@ -215,12 +219,12 @@ void lv_obj_set_size(lv_obj_t * obj, int32_t w, int32_t h) void lv_obj_set_width(lv_obj_t * obj, int32_t w) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_result_t res_w; + lv_style_res_t res_w; lv_style_value_t v_w; res_w = lv_obj_get_local_style_prop(obj, LV_STYLE_WIDTH, &v_w, 0); - if((res_w == LV_RESULT_OK && v_w.num != w) || res_w == LV_RESULT_INVALID) { + if((res_w == LV_STYLE_RES_FOUND && v_w.num != w) || res_w == LV_STYLE_RES_NOT_FOUND) { lv_obj_set_style_width(obj, w, 0); } } @@ -228,12 +232,12 @@ void lv_obj_set_width(lv_obj_t * obj, int32_t w) void lv_obj_set_height(lv_obj_t * obj, int32_t h) { LV_ASSERT_OBJ(obj, MY_CLASS); - lv_result_t res_h; + lv_style_res_t res_h; lv_style_value_t v_h; res_h = lv_obj_get_local_style_prop(obj, LV_STYLE_HEIGHT, &v_h, 0); - if((res_h == LV_RESULT_OK && v_h.num != h) || res_h == LV_RESULT_INVALID) { + if((res_h == LV_STYLE_RES_FOUND && v_h.num != h) || res_h == LV_STYLE_RES_NOT_FOUND) { lv_obj_set_style_height(obj, h, 0); } } @@ -450,6 +454,9 @@ void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, in x = lv_obj_get_width(base); y = lv_obj_get_height(base) - lv_obj_get_height(obj); break; + + case LV_ALIGN_DEFAULT: + break; } if(LV_COORD_IS_PCT(x_ofs)) x_ofs = (lv_obj_get_width(base) * LV_COORD_GET_PCT(x_ofs)) / 100; @@ -721,7 +728,7 @@ void lv_obj_move_to(lv_obj_t * obj, int32_t x, int32_t y) /*If the object is already out of the parent and its position is changes *surely the scrollbars also changes so invalidate them*/ - on1 = _lv_area_is_in(&ori, &parent_fit_area, 0); + on1 = lv_area_is_in(&ori, &parent_fit_area, 0); if(!on1) lv_obj_scrollbar_invalidate(parent); } @@ -741,7 +748,7 @@ void lv_obj_move_to(lv_obj_t * obj, int32_t x, int32_t y) /*If the object was out of the parent invalidate the new scrollbar area too. *If it wasn't out of the parent but out now, also invalidate the scrollbars*/ if(parent) { - bool on2 = _lv_area_is_in(&obj->coords, &parent_fit_area, 0); + bool on2 = lv_area_is_in(&obj->coords, &parent_fit_area, 0); if(on1 || (!on1 && on2)) lv_obj_scrollbar_invalidate(parent); } } @@ -771,7 +778,7 @@ void lv_obj_transform_point_array(const lv_obj_t * obj, lv_point_t points[], siz lv_obj_point_transform_flag_t flags) { if(obj) { - lv_layer_type_t layer_type = _lv_obj_get_layer_type(obj); + lv_layer_type_t layer_type = lv_obj_get_layer_type(obj); bool do_tranf = layer_type == LV_LAYER_TYPE_TRANSFORM; bool recursive = flags & LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE; bool inverse = flags & LV_OBJ_POINT_TRANSFORM_FLAG_INVERSE; @@ -820,7 +827,7 @@ void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area) lv_area_increase(&area_tmp, 5, 5); } - _lv_inv_area(lv_obj_get_display(obj), &area_tmp); + lv_inv_area(lv_obj_get_display(obj), &area_tmp); } void lv_obj_invalidate(const lv_obj_t * obj) @@ -829,7 +836,7 @@ void lv_obj_invalidate(const lv_obj_t * obj) /*Truncate the area to the object*/ lv_area_t obj_coords; - int32_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; @@ -856,12 +863,12 @@ 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; - int32_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); /*The area is not on the object*/ - if(!_lv_area_intersect(area, area, &obj_coords)) return false; + if(!lv_area_intersect(area, area, &obj_coords)) return false; lv_obj_get_transformed_area(obj, area, LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE); @@ -874,12 +881,12 @@ 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)) { - int32_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); } lv_obj_get_transformed_area(parent, &parent_coords, LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE); - if(!_lv_area_intersect(area, area, &parent_coords)) return false; + if(!lv_area_intersect(area, area, &parent_coords)) return false; parent = lv_obj_get_parent(parent); } @@ -892,7 +899,7 @@ bool lv_obj_is_visible(const lv_obj_t * obj) LV_ASSERT_OBJ(obj, MY_CLASS); lv_area_t obj_coords; - int32_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; @@ -924,7 +931,7 @@ bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point) lv_area_t a; lv_obj_get_click_area(obj, &a); - bool res = _lv_area_is_point_on(&a, point, 0); + bool res = lv_area_is_point_on(&a, point, 0); if(res == false) return false; if(lv_obj_has_flag(obj, LV_OBJ_FLAG_ADV_HITTEST)) { @@ -952,6 +959,11 @@ int32_t lv_clamp_height(int32_t height, int32_t min_height, int32_t max_height, return LV_CLAMP(min_height, height, max_height); } +void lv_obj_center(lv_obj_t * obj) +{ + lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0); +} + /********************** * STATIC FUNCTIONS **********************/ @@ -1118,7 +1130,7 @@ static void layout_update_core(lv_obj_t * obj) lv_obj_refr_pos(obj); if(child_cnt > 0) { - _lv_layout_apply(obj); + lv_layout_apply(obj); } } diff --git a/src/core/lv_obj_pos.h b/src/core/lv_obj_pos.h index 3c7234fec..584f0b7e8 100644 --- a/src/core/lv_obj_pos.h +++ b/src/core/lv_obj_pos.h @@ -195,10 +195,7 @@ void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, in * @param obj pointer to an object to align * @note if the parent size changes `obj` needs to be aligned manually again */ -static inline void lv_obj_center(lv_obj_t * obj) -{ - lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0); -} +void lv_obj_center(lv_obj_t * obj); /** * Copy the coordinates of an object to an area diff --git a/src/core/lv_obj_private.h b/src/core/lv_obj_private.h new file mode 100644 index 000000000..931454e78 --- /dev/null +++ b/src/core/lv_obj_private.h @@ -0,0 +1,88 @@ +/** + * @file lv_obj_private.h + * + */ + +#ifndef LV_OBJ_PRIVATE_H +#define LV_OBJ_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_obj.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Special, rarely used attributes. + * They are allocated automatically if any elements is set. + */ +struct lv_obj_spec_attr_t { + lv_obj_t ** children; /**< Store the pointer of the children in an array.*/ + lv_group_t * group_p; + lv_event_list_t event_list; + + lv_point_t scroll; /**< The current X/Y scroll offset*/ + + int32_t ext_click_pad; /**< Extra click padding in all direction*/ + int32_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/ + + uint16_t child_cnt; /**< Number of children*/ + uint16_t scrollbar_mode : 2; /**< How to display scrollbars, see `lv_scrollbar_mode_t`*/ + uint16_t scroll_snap_x : 2; /**< Where to align the snappable children horizontally, see `lv_scroll_snap_t`*/ + uint16_t scroll_snap_y : 2; /**< Where to align the snappable children vertically*/ + uint16_t scroll_dir : 4; /**< The allowed scroll direction(s), see `lv_dir_t`*/ + uint16_t layer_type : 2; /**< Cache the layer type here. Element of @lv_intermediate_layer_type_t */ +}; + +struct lv_obj_t { + const lv_obj_class_t * class_p; + lv_obj_t * parent; + lv_obj_spec_attr_t * spec_attr; + lv_obj_style_t * styles; +#if LV_OBJ_STYLE_CACHE + uint32_t style_main_prop_is_set; + uint32_t style_other_prop_is_set; +#endif + void * user_data; +#if LV_USE_OBJ_ID + void * id; +#endif + lv_area_t coords; + lv_obj_flag_t flags; + lv_state_t state; + uint16_t layout_inv : 1; + uint16_t readjust_scroll_after_layout : 1; + uint16_t scr_layout_inv : 1; + uint16_t skip_trans : 1; + uint16_t style_cnt : 6; + uint16_t h_layout : 1; + uint16_t w_layout : 1; + uint16_t is_deleting : 1; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_PRIVATE_H*/ diff --git a/src/core/lv_obj_property.c b/src/core/lv_obj_property.c index 4c24de997..54088e685 100644 --- a/src/core/lv_obj_property.c +++ b/src/core/lv_obj_property.c @@ -10,6 +10,8 @@ #include "../stdlib/lv_string.h" #include "../misc/lv_utils.h" #include "lv_obj_property.h" +#include "lv_obj_private.h" +#include "lv_obj_class_private.h" #if LV_USE_OBJ_PROPERTY diff --git a/src/core/lv_obj_property.h b/src/core/lv_obj_property.h index 92dc88724..0d3a7eadb 100644 --- a/src/core/lv_obj_property.h +++ b/src/core/lv_obj_property.h @@ -67,11 +67,10 @@ enum { /*Special ID, use it to extend ID and make sure it's unique and compile time determinant*/ LV_PROPERTY_ID_BUILTIN_LAST = 0xffff, /*ID of 0x10000 ~ 0xfffffff is reserved for user*/ - /*Special ID used by lvgl to intercept all setter/getter call.*/ - LV_PROPERTY_ID_ANY = 0x7ffffffe, + LV_PROPERTY_ID_ANY = 0x7ffffffe, /*Special ID used by lvgl to intercept all setter/getter call.*/ }; -struct _lv_property_name_t { +struct lv_property_name_t { const char * name; lv_prop_id_t id; }; diff --git a/src/core/lv_obj_scroll.c b/src/core/lv_obj_scroll.c index b031a7573..727264b4b 100644 --- a/src/core/lv_obj_scroll.c +++ b/src/core/lv_obj_scroll.c @@ -6,11 +6,13 @@ /********************* * INCLUDES *********************/ -#include "lv_obj_scroll.h" -#include "lv_obj.h" +#include "../misc/lv_anim_private.h" +#include "lv_obj_scroll_private.h" +#include "lv_obj_private.h" #include "../indev/lv_indev.h" #include "../indev/lv_indev_scroll.h" #include "../display/lv_display.h" +#include "../misc/lv_area.h" /********************* * DEFINES @@ -350,7 +352,7 @@ void lv_obj_scroll_by(lv_obj_t * obj, int32_t dx, int32_t dy, lv_anim_enable_t a res = lv_obj_send_event(obj, LV_EVENT_SCROLL_BEGIN, NULL); if(res != LV_RESULT_OK) return; - res = _lv_obj_scroll_by_raw(obj, dx, dy); + res = lv_obj_scroll_by_raw(obj, dx, dy); if(res != LV_RESULT_OK) return; res = lv_obj_send_event(obj, LV_EVENT_SCROLL_END, NULL); @@ -408,7 +410,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, int32_t x, int32_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; @@ -452,7 +454,7 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t * if(lv_obj_has_flag(obj, LV_OBJ_FLAG_SCROLLABLE) == false) return; - lv_dir_t sm = lv_obj_get_scrollbar_mode(obj); + lv_scrollbar_mode_t sm = lv_obj_get_scrollbar_mode(obj); if(sm == LV_SCROLLBAR_MODE_OFF) return; /*If there is no indev scrolling this object but `mode==active` return*/ @@ -669,12 +671,12 @@ void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en) static void scroll_x_anim(void * obj, int32_t v) { - _lv_obj_scroll_by_raw(obj, v + lv_obj_get_scroll_x(obj), 0); + lv_obj_scroll_by_raw(obj, v + lv_obj_get_scroll_x(obj), 0); } static void scroll_y_anim(void * obj, int32_t v) { - _lv_obj_scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj)); + lv_obj_scroll_by_raw(obj, 0, v + lv_obj_get_scroll_y(obj)); } static void scroll_end_cb(lv_anim_t * a) @@ -734,6 +736,8 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p act = lv_area_get_height(area_tmp) / 2 + area_tmp->y1 + y_scroll; y_scroll += snap_goal - act; break; + case LV_SCROLL_SNAP_NONE: + break; } int32_t x_scroll = 0; @@ -776,6 +780,8 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p act = lv_area_get_width(area_tmp) / 2 + area_tmp->x1 + x_scroll; x_scroll += snap_goal - act; break; + case LV_SCROLL_SNAP_NONE: + break; } /*Remove any pending scroll animations.*/ diff --git a/src/core/lv_obj_scroll.h b/src/core/lv_obj_scroll.h index 0114a3b65..e0984aedc 100644 --- a/src/core/lv_obj_scroll.h +++ b/src/core/lv_obj_scroll.h @@ -28,32 +28,20 @@ extern "C" { /*Can't include lv_obj.h because it includes this header file*/ /** Scrollbar modes: shows when should the scrollbars be visible*/ -enum _lv_scrollbar_mode_t { +typedef enum { LV_SCROLLBAR_MODE_OFF, /**< Never show scrollbars*/ LV_SCROLLBAR_MODE_ON, /**< Always show scrollbars*/ LV_SCROLLBAR_MODE_ACTIVE, /**< Show scroll bars when object is being scrolled*/ LV_SCROLLBAR_MODE_AUTO, /**< Show scroll bars when the content is large enough to be scrolled*/ -}; - -#ifdef DOXYGEN -typedef _lv_scrollbar_mode_t lv_scrollbar_mode_t; -#else -typedef uint8_t lv_scrollbar_mode_t; -#endif /*DOXYGEN*/ +} lv_scrollbar_mode_t; /** Scroll span align options. Tells where to align the snappable children when scroll stops.*/ -enum _lv_scroll_snap_t { +typedef enum { LV_SCROLL_SNAP_NONE, /**< Do not align, leave where it is*/ LV_SCROLL_SNAP_START, /**< Align to the left/top*/ LV_SCROLL_SNAP_END, /**< Align to the right/bottom*/ LV_SCROLL_SNAP_CENTER /**< Align to the center*/ -}; - -#ifdef DOXYGEN -typedef _lv_scroll_snap_t lv_scroll_snap_t; -#else -typedef uint8_t lv_scroll_snap_t; -#endif /*DOXYGEN*/ +} lv_scroll_snap_t; /********************** * GLOBAL PROTOTYPES @@ -258,17 +246,6 @@ void lv_obj_scroll_to_view(lv_obj_t * obj, lv_anim_enable_t anim_en); void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en); /** - * Low level function to scroll by given x and y coordinates. - * `LV_EVENT_SCROLL` is sent. - * @param obj pointer to an object to scroll - * @param x pixels to scroll horizontally - * @param y pixels to scroll vertically - * @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(lv_obj_t * obj, int32_t x, int32_t y); - -/** * Tell whether an object is being scrolled or not at this moment * @param obj pointer to an object * @return true: `obj` is being scrolled diff --git a/src/core/lv_obj_scroll_private.h b/src/core/lv_obj_scroll_private.h new file mode 100644 index 000000000..9ae6332d4 --- /dev/null +++ b/src/core/lv_obj_scroll_private.h @@ -0,0 +1,50 @@ +/** + * @file lv_obj_scroll_private.h + * + */ + +#ifndef LV_OBJ_SCROLL_PRIVATE_H +#define LV_OBJ_SCROLL_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_obj_scroll.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Low level function to scroll by given x and y coordinates. + * `LV_EVENT_SCROLL` is sent. + * @param obj pointer to an object to scroll + * @param x pixels to scroll horizontally + * @param y pixels to scroll vertically + * @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(lv_obj_t * obj, int32_t x, int32_t y); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_SCROLL_PRIVATE_H*/ diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index 8c944cec0..ee1d5bd17 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -6,7 +6,10 @@ /********************* * INCLUDES *********************/ -#include "lv_obj.h" +#include "../misc/lv_anim_private.h" +#include "lv_obj_style_private.h" +#include "lv_obj_class_private.h" +#include "lv_obj_private.h" #include "../display/lv_display.h" #include "../display/lv_display_private.h" #include "../misc/lv_color.h" @@ -49,7 +52,7 @@ typedef enum { * STATIC PROTOTYPES **********************/ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector); -static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_part_t part); +static lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_part_t part); static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t selector, lv_style_prop_t prop, lv_style_value_t * v); static void report_style_change_core(void * style, lv_obj_t * obj); @@ -78,14 +81,14 @@ static lv_style_res_t get_selector_style_prop(const lv_obj_t * obj, lv_style_sel * GLOBAL FUNCTIONS **********************/ -void _lv_obj_style_init(void) +void lv_obj_style_init(void) { - _lv_ll_init(style_trans_ll_p, sizeof(trans_t)); + lv_ll_init(style_trans_ll_p, sizeof(trans_t)); } -void _lv_obj_style_deinit(void) +void lv_obj_style_deinit(void) { - _lv_ll_clear(style_trans_ll_p); + lv_ll_clear(style_trans_ll_p); if(_style_custom_prop_flag_lookup_table != NULL) { lv_free(_style_custom_prop_flag_lookup_table); _style_custom_prop_flag_lookup_table = NULL; @@ -120,7 +123,7 @@ void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selecto /*Allocate space for the new style and shift the rest of the style to the end*/ obj->style_cnt++; LV_ASSERT(obj->style_cnt != 0); - obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t)); + obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t)); LV_ASSERT_MALLOC(obj->styles); uint32_t j; @@ -128,7 +131,7 @@ void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selecto obj->styles[j] = obj->styles[j - 1]; } - lv_memzero(&obj->styles[i], sizeof(_lv_obj_style_t)); + lv_memzero(&obj->styles[i], sizeof(lv_obj_style_t)); obj->styles[i].style = style; obj->styles[i].selector = selector; @@ -136,8 +139,8 @@ void lv_obj_add_style(lv_obj_t * obj, const lv_style_t * style, lv_style_selecto uint32_t * prop_is_set = part == LV_PART_MAIN ? &obj->style_main_prop_is_set : &obj->style_other_prop_is_set; if(lv_style_is_const(style)) { lv_style_const_prop_t * props = style->values_and_props; - for(i = 0; props[i].prop_ptr; i++) { - (*prop_is_set) |= STYLE_PROP_SHIFTED(*props[i].prop_ptr); + for(i = 0; props[i].prop != LV_STYLE_PROP_INV; i++) { + (*prop_is_set) |= STYLE_PROP_SHIFTED(props[i].prop); } } else { @@ -183,7 +186,7 @@ bool lv_obj_replace_style(lv_obj_t * obj, const lv_style_t * old_style, const lv continue; } - lv_memzero(&obj->styles[i], sizeof(_lv_obj_style_t)); + lv_memzero(&obj->styles[i], sizeof(lv_obj_style_t)); obj->styles[i].style = new_style; obj->styles[i].selector = selector; @@ -237,7 +240,7 @@ void lv_obj_remove_style(lv_obj_t * obj, const lv_style_t * style, lv_style_sele } obj->style_cnt--; - obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t)); + obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t)); deleted = true; /*The style from the current `i` index is removed, so `i` points to the next style. @@ -300,7 +303,7 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style /*Cache the layer type*/ if((part == LV_PART_ANY || part == LV_PART_MAIN) && is_layer_refr) { - _lv_obj_update_layer_type(obj); + lv_obj_update_layer_type(obj); } if(prop == LV_STYLE_PROP_ANY || is_ext_draw) { @@ -409,8 +412,8 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty return res; } -void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state, - const _lv_obj_style_transition_dsc_t * tr_dsc) +void lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state, + const lv_obj_style_transition_dsc_t * tr_dsc) { trans_t * tr; @@ -427,7 +430,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t v1 = lv_obj_get_style_prop(obj, part, tr_dsc->prop); obj->state = new_state; - _lv_obj_style_t * style_trans = get_trans_style(obj, part); + lv_obj_style_t * style_trans = get_trans_style(obj, part); lv_style_set_prop((lv_style_t *)style_trans->style, tr_dsc->prop, v1); /*Be sure `trans_style` has a valid value*/ lv_obj_refresh_style(obj, tr_dsc->selector, tr_dsc->prop); @@ -440,7 +443,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t } } - tr = _lv_ll_ins_head(style_trans_ll_p); + tr = lv_ll_ins_head(style_trans_ll_p); LV_ASSERT_MALLOC(tr); if(tr == NULL) return; tr->start_value = v1; @@ -464,7 +467,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t lv_anim_start(&a); } -lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v) +lv_style_value_t lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v) { if(obj == NULL) return v; const lv_color_filter_dsc_t * f = lv_obj_get_style_color_filter_dsc(obj, part); @@ -475,9 +478,9 @@ lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_ return v; } -_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2) +lv_style_state_cmp_t lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2) { - _lv_style_state_cmp_t res = _LV_STYLE_STATE_CMP_SAME; + lv_style_state_cmp_t res = LV_STYLE_STATE_CMP_SAME; /*Are there any new styles for the new state?*/ uint32_t i; @@ -511,25 +514,25 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t sta else if(lv_style_get_prop(style, LV_STYLE_BORDER_WIDTH, &v)) layout_diff = true; if(layout_diff) { - return _LV_STYLE_STATE_CMP_DIFF_LAYOUT; + return LV_STYLE_STATE_CMP_DIFF_LAYOUT; } /*Check for draw pad changes*/ - if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_HEIGHT, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ROTATION, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_SCALE_X, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_SCALE_Y, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_OPA, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_PAD, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_SHADOW_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OPA, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OFFSET_X, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OFFSET_Y, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_SHADOW_SPREAD, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(lv_style_get_prop(style, LV_STYLE_LINE_WIDTH, &v)) res = _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; - else if(res == _LV_STYLE_STATE_CMP_SAME) res = _LV_STYLE_STATE_CMP_DIFF_REDRAW; + if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_WIDTH, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_HEIGHT, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_ROTATION, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_SCALE_X, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_TRANSFORM_SCALE_Y, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_OPA, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_PAD, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_OUTLINE_WIDTH, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_SHADOW_WIDTH, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OPA, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OFFSET_X, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_SHADOW_OFFSET_Y, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_SHADOW_SPREAD, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(lv_style_get_prop(style, LV_STYLE_LINE_WIDTH, &v)) res = LV_STYLE_STATE_CMP_DIFF_DRAW_PAD; + else if(res == LV_STYLE_STATE_CMP_SAME) res = LV_STYLE_STATE_CMP_DIFF_REDRAW; } } @@ -602,7 +605,7 @@ lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part) return opa_final; } -void _lv_obj_update_layer_type(lv_obj_t * obj) +void lv_obj_update_layer_type(lv_obj_t * obj) { lv_layer_type_t layer_type = calculate_layer_type(obj); if(obj->spec_attr) obj->spec_attr->layer_type = layer_type; @@ -635,7 +638,7 @@ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector obj->style_cnt++; LV_ASSERT(obj->style_cnt != 0); - obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t)); + obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t)); LV_ASSERT_MALLOC(obj->styles); for(i = obj->style_cnt - 1; i > 0 ; i--) { @@ -645,7 +648,7 @@ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector obj->styles[i] = obj->styles[i - 1]; } - lv_memzero(&obj->styles[i], sizeof(_lv_obj_style_t)); + lv_memzero(&obj->styles[i], sizeof(lv_obj_style_t)); obj->styles[i].style = lv_malloc(sizeof(lv_style_t)); lv_style_init((lv_style_t *)obj->styles[i].style); @@ -661,7 +664,7 @@ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector * @param selector OR-ed value of parts and state for which the style should be get * @return pointer to the transition style */ -static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t selector) +static lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t selector) { uint32_t i; for(i = 0; i < obj->style_cnt; i++) { @@ -673,13 +676,13 @@ static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_style_selector_t se obj->style_cnt++; LV_ASSERT(obj->style_cnt != 0); - obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(_lv_obj_style_t)); + obj->styles = lv_realloc(obj->styles, obj->style_cnt * sizeof(lv_obj_style_t)); for(i = obj->style_cnt - 1; i > 0 ; i--) { obj->styles[i] = obj->styles[i - 1]; } - lv_memzero(&obj->styles[0], sizeof(_lv_obj_style_t)); + lv_memzero(&obj->styles[0], sizeof(lv_obj_style_t)); obj->styles[0].style = lv_malloc(sizeof(lv_style_t)); lv_style_init((lv_style_t *)obj->styles[0].style); @@ -692,7 +695,7 @@ static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t se lv_style_value_t * v) { - const uint32_t group = (uint32_t)1 << _lv_style_get_prop_group(prop); + const uint32_t group = (uint32_t)1 << lv_style_get_prop_group(prop); const lv_part_t part = lv_obj_style_get_selector_part(selector); const lv_state_t state = lv_obj_style_get_selector_state(selector); const lv_state_t state_inv = ~state; @@ -701,7 +704,7 @@ static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t se lv_style_res_t found; uint32_t i; for(i = 0; i < obj->style_cnt; i++) { - _lv_obj_style_t * obj_style = &obj->styles[i]; + lv_obj_style_t * obj_style = &obj->styles[i]; if(obj_style->is_trans == false) break; if(skip_trans) continue; @@ -717,7 +720,7 @@ static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t se for(; i < obj->style_cnt; i++) { if((obj->styles[i].style->has_group & group) == 0) continue; - _lv_obj_style_t * obj_style = &obj->styles[i]; + lv_obj_style_t * obj_style = &obj->styles[i]; lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector); if(part_act != part) continue; @@ -785,7 +788,7 @@ static void refresh_children_style(lv_obj_t * obj) /** * Remove the transition from object's part's property. - * - Remove the transition from `_lv_obj_style_trans_ll` and free it + * - Remove the transition from `lv_obj_style_trans_ll` and free it * - Delete pending transitions * @param obj pointer to an object which transition(s) should be removed * @param part a part of object or 0xFF to remove from all parts @@ -797,12 +800,12 @@ static bool trans_delete(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, t trans_t * tr; trans_t * tr_prev; bool removed = false; - tr = _lv_ll_get_tail(style_trans_ll_p); + tr = lv_ll_get_tail(style_trans_ll_p); while(tr != NULL) { if(tr == tr_limit) break; /*'tr' might be deleted, so get the next object while 'tr' is valid*/ - tr_prev = _lv_ll_get_prev(style_trans_ll_p, tr); + tr_prev = lv_ll_get_prev(style_trans_ll_p, tr); if(tr->obj == obj && (part == tr->selector || part == LV_PART_ANY) && (prop == tr->prop || prop == LV_STYLE_PROP_ANY)) { /*Remove any transitioned properties from the trans. style @@ -816,7 +819,7 @@ static bool trans_delete(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop, t /*Free the transition descriptor too*/ lv_anim_delete(tr, NULL); - _lv_ll_remove(style_trans_ll_p, tr); + lv_ll_remove(style_trans_ll_p, tr); lv_free(tr); removed = true; @@ -906,7 +909,7 @@ static void trans_anim_start_cb(lv_anim_t * a) tr->prop = prop_tmp; - _lv_obj_style_t * style_trans = get_trans_style(tr->obj, tr->selector); + lv_obj_style_t * style_trans = get_trans_style(tr->obj, tr->selector); /*Be sure `trans_style` has a valid value*/ lv_style_set_prop((lv_style_t *)style_trans->style, tr->prop, tr->start_value); lv_obj_refresh_style(tr->obj, tr->selector, tr->prop); @@ -924,7 +927,7 @@ static void trans_anim_completed_cb(lv_anim_t * a) *It allows changing it by normal styles*/ bool running = false; trans_t * tr_i; - _LV_LL_READ(style_trans_ll_p, tr_i) { + LV_LL_READ(style_trans_ll_p, tr_i) { if(tr_i != tr && tr_i->obj == tr->obj && tr_i->selector == tr->selector && tr_i->prop == tr->prop) { running = true; break; @@ -935,10 +938,10 @@ static void trans_anim_completed_cb(lv_anim_t * a) uint32_t i; for(i = 0; i < obj->style_cnt; i++) { if(obj->styles[i].is_trans && obj->styles[i].selector == tr->selector) { - _lv_ll_remove(style_trans_ll_p, tr); + lv_ll_remove(style_trans_ll_p, tr); lv_free(tr); - _lv_obj_style_t * obj_style = &obj->styles[i]; + lv_obj_style_t * obj_style = &obj->styles[i]; lv_style_remove_prop((lv_style_t *)obj_style->style, prop); if(lv_style_is_empty(obj->styles[i].style)) { @@ -976,8 +979,8 @@ static void full_cache_refresh(lv_obj_t * obj, lv_part_t part) uint32_t j; if(lv_style_is_const(style)) { lv_style_const_prop_t * props = style->values_and_props; - for(j = 0; props[j].prop_ptr; j++) { - obj->style_main_prop_is_set |= STYLE_PROP_SHIFTED(*props[j].prop_ptr); + for(j = 0; props[j].prop != LV_STYLE_PROP_INV; j++) { + obj->style_main_prop_is_set |= STYLE_PROP_SHIFTED(props[j].prop); } } else { @@ -996,8 +999,8 @@ static void full_cache_refresh(lv_obj_t * obj, lv_part_t part) uint32_t j; if(lv_style_is_const(style)) { lv_style_const_prop_t * props = style->values_and_props; - for(j = 0; props[j].prop_ptr; j++) { - obj->style_other_prop_is_set |= STYLE_PROP_SHIFTED(*props[j].prop_ptr); + for(j = 0; props[j].prop != LV_STYLE_PROP_INV; j++) { + obj->style_other_prop_is_set |= STYLE_PROP_SHIFTED(props[j].prop); } } else { @@ -1029,8 +1032,8 @@ static bool style_has_flag(const lv_style_t * style, uint32_t flag) if(lv_style_is_const(style)) { lv_style_const_prop_t * props = style->values_and_props; uint32_t i; - for(i = 0; props[i].prop_ptr; i++) { - if(lv_style_prop_has_flag(*props[i].prop_ptr, flag)) { + for(i = 0; props[i].prop != LV_STYLE_PROP_INV; i++) { + if(lv_style_prop_has_flag(props[i].prop, flag)) { return true; } } @@ -1063,14 +1066,14 @@ static lv_style_res_t get_selector_style_prop(const lv_obj_t * obj, lv_style_sel if(found == LV_STYLE_RES_FOUND) return LV_STYLE_RES_FOUND; } - extern const uint8_t _lv_style_builtin_prop_flag_lookup_table[]; + extern const uint8_t lv_style_builtin_prop_flag_lookup_table[]; bool inheritable = false; - if(prop < _LV_STYLE_NUM_BUILT_IN_PROPS) { - inheritable = _lv_style_builtin_prop_flag_lookup_table[prop] & LV_STYLE_PROP_FLAG_INHERITABLE; + if(prop < LV_STYLE_NUM_BUILT_IN_PROPS) { + inheritable = lv_style_builtin_prop_flag_lookup_table[prop] & LV_STYLE_PROP_FLAG_INHERITABLE; } else { if(_style_custom_prop_flag_lookup_table != NULL) { - inheritable = _style_custom_prop_flag_lookup_table[prop - _LV_STYLE_NUM_BUILT_IN_PROPS] & + inheritable = _style_custom_prop_flag_lookup_table[prop - LV_STYLE_NUM_BUILT_IN_PROPS] & LV_STYLE_PROP_FLAG_INHERITABLE; } } diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h index c4ac4b141..6e43355b2 100644 --- a/src/core/lv_obj_style.h +++ b/src/core/lv_obj_style.h @@ -24,61 +24,21 @@ extern "C" { /********************** * TYPEDEFS **********************/ -/*Can't include lv_obj.h because it includes this header file*/ - -#ifndef LV_OBJ_H -/// @cond -/** - * Tells Doxygen to ignore a duplicate declaration - */ -typedef uint32_t lv_part_t; -typedef uint16_t lv_state_t; -/// @endcond - -#endif typedef enum { - _LV_STYLE_STATE_CMP_SAME, /*The style properties in the 2 states are identical*/ - _LV_STYLE_STATE_CMP_DIFF_REDRAW, /*The differences can be shown with a simple redraw*/ - _LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /*The differences can be shown with a simple redraw*/ - _LV_STYLE_STATE_CMP_DIFF_LAYOUT, /*The differences can be shown with a simple redraw*/ -} _lv_style_state_cmp_t; + LV_STYLE_STATE_CMP_SAME, /*The style properties in the 2 states are identical*/ + LV_STYLE_STATE_CMP_DIFF_REDRAW, /*The differences can be shown with a simple redraw*/ + LV_STYLE_STATE_CMP_DIFF_DRAW_PAD, /*The differences can be shown with a simple redraw*/ + LV_STYLE_STATE_CMP_DIFF_LAYOUT, /*The differences can be shown with a simple redraw*/ +} lv_style_state_cmp_t; typedef uint32_t lv_style_selector_t; -typedef struct { - const lv_style_t * style; - uint32_t selector : 24; - uint32_t is_local : 1; - uint32_t is_trans : 1; -} _lv_obj_style_t; - -typedef struct { - uint16_t time; - uint16_t delay; - lv_style_selector_t selector; - lv_style_prop_t prop; - lv_anim_path_cb_t path_cb; - void * user_data; -} _lv_obj_style_transition_dsc_t; - /********************** * GLOBAL PROTOTYPES **********************/ /** - * Initialize the object related style manager module. - * Called by LVGL in `lv_init()` - */ -void _lv_obj_style_init(void); - -/** - * Deinitialize the object related style manager module. - * Called by LVGL in `lv_deinit()` - */ -void _lv_obj_style_deinit(void); - -/** * Add a style to an object. * @param obj pointer to an object * @param style pointer to a style to add @@ -187,27 +147,7 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty /** * Used internally for color filtering */ -lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v); - -/** - * Used internally to create a style transition - * @param obj - * @param part - * @param prev_state - * @param new_state - * @param tr - */ -void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, - lv_state_t new_state, const _lv_obj_style_transition_dsc_t * tr); - -/** - * Used internally to compare the appearance of an object in 2 states - * @param obj - * @param state1 - * @param state2 - * @return - */ -_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2); +lv_style_value_t lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v); /** * Fade in an an object and all its children. @@ -351,13 +291,6 @@ static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * o */ lv_opa_t lv_obj_get_style_opa_recursive(const lv_obj_t * obj, lv_part_t part); -/** - * Update the layer type of a widget bayed on its current styles. - * The result will be stored in `obj->spec_attr->layer_type` - * @param obj the object whose layer should be updated - */ -void _lv_obj_update_layer_type(lv_obj_t * obj); - /********************** * MACROS **********************/ diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h index aa9615fc4..77cf53785 100644 --- a/src/core/lv_obj_style_gen.h +++ b/src/core/lv_obj_style_gen.h @@ -17,6 +17,7 @@ extern "C" { #include "../misc/lv_area.h" #include "../misc/lv_style.h" #include "../core/lv_obj_style.h" +#include "../misc/lv_types.h" static inline int32_t lv_obj_get_style_width(const lv_obj_t * obj, lv_part_t part) { @@ -212,7 +213,7 @@ static inline lv_color_t lv_obj_get_style_bg_color(const lv_obj_t * obj, lv_part static inline lv_color_t lv_obj_get_style_bg_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR)); + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR)); return v.color; } @@ -230,7 +231,8 @@ static inline lv_color_t lv_obj_get_style_bg_grad_color(const lv_obj_t * obj, lv static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR)); + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_BG_GRAD_COLOR)); return v.color; } @@ -290,7 +292,8 @@ static inline lv_color_t lv_obj_get_style_bg_image_recolor(const lv_obj_t * obj, static inline lv_color_t lv_obj_get_style_bg_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR)); + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_BG_IMAGE_RECOLOR)); return v.color; } @@ -314,7 +317,8 @@ static inline lv_color_t lv_obj_get_style_border_color(const lv_obj_t * obj, lv_ static inline lv_color_t lv_obj_get_style_border_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR)); + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_BORDER_COLOR)); return v.color; } @@ -356,7 +360,8 @@ static inline lv_color_t lv_obj_get_style_outline_color(const lv_obj_t * obj, lv static inline lv_color_t lv_obj_get_style_outline_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR)); + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_OUTLINE_COLOR)); return v.color; } @@ -404,7 +409,8 @@ static inline lv_color_t lv_obj_get_style_shadow_color(const lv_obj_t * obj, lv_ static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR)); + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_SHADOW_COLOR)); return v.color; } @@ -428,7 +434,8 @@ static inline lv_color_t lv_obj_get_style_image_recolor(const lv_obj_t * obj, lv static inline lv_color_t lv_obj_get_style_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR)); + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, + LV_STYLE_IMAGE_RECOLOR)); return v.color; } @@ -470,7 +477,7 @@ static inline lv_color_t lv_obj_get_style_line_color(const lv_obj_t * obj, lv_pa static inline lv_color_t lv_obj_get_style_line_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR)); + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR)); return v.color; } @@ -500,7 +507,7 @@ static inline lv_color_t lv_obj_get_style_arc_color(const lv_obj_t * obj, lv_par static inline lv_color_t lv_obj_get_style_arc_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR)); + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR)); return v.color; } @@ -524,7 +531,7 @@ static inline lv_color_t lv_obj_get_style_text_color(const lv_obj_t * obj, lv_pa static inline lv_color_t lv_obj_get_style_text_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR)); + lv_style_value_t v = lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR)); return v.color; } diff --git a/src/core/lv_obj_style_private.h b/src/core/lv_obj_style_private.h new file mode 100644 index 000000000..7fafc58b1 --- /dev/null +++ b/src/core/lv_obj_style_private.h @@ -0,0 +1,95 @@ +/** + * @file lv_obj_style_private.h + * + */ + +#ifndef LV_OBJ_STYLE_PRIVATE_H +#define LV_OBJ_STYLE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_obj_style.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_obj_style_t { + const lv_style_t * style; + uint32_t selector : 24; + uint32_t is_local : 1; + uint32_t is_trans : 1; +}; + +struct lv_obj_style_transition_dsc_t { + uint16_t time; + uint16_t delay; + lv_style_selector_t selector; + lv_style_prop_t prop; + lv_anim_path_cb_t path_cb; + void * user_data; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the object related style manager module. + * Called by LVGL in `lv_init()` + */ +void lv_obj_style_init(void); + +/** + * Deinitialize the object related style manager module. + * Called by LVGL in `lv_deinit()` + */ +void lv_obj_style_deinit(void); + +/** + * Used internally to create a style transition + * @param obj + * @param part + * @param prev_state + * @param new_state + * @param tr + */ +void lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, + lv_state_t new_state, const lv_obj_style_transition_dsc_t * tr); + +/** + * Used internally to compare the appearance of an object in 2 states + * @param obj + * @param state1 + * @param state2 + * @return + */ +lv_style_state_cmp_t lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2); + +/** + * Update the layer type of a widget bayed on its current styles. + * The result will be stored in `obj->spec_attr->layer_type` + * @param obj the object whose layer should be updated + */ +void lv_obj_update_layer_type(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBJ_STYLE_PRIVATE_H*/ diff --git a/src/core/lv_obj_tree.c b/src/core/lv_obj_tree.c index 7c9de956a..90bf44623 100644 --- a/src/core/lv_obj_tree.c +++ b/src/core/lv_obj_tree.c @@ -6,12 +6,13 @@ /********************* * INCLUDES *********************/ -#include "lv_obj.h" +#include "lv_obj_class_private.h" +#include "lv_obj_private.h" #include "../indev/lv_indev.h" #include "../indev/lv_indev_private.h" #include "../display/lv_display.h" #include "../display/lv_display_private.h" -#include "../misc/lv_anim.h" +#include "../misc/lv_anim_private.h" #include "../misc/lv_async.h" #include "../core/lv_global.h" @@ -308,7 +309,7 @@ lv_display_t * lv_obj_get_display(const lv_obj_t * obj) lv_display_t * d; lv_ll_t * disp_head = disp_ll_p; - _LV_LL_READ(disp_head, d) { + LV_LL_READ(disp_head, d) { uint32_t i; for(i = 0; i < d->screen_cnt; i++) { if(d->screens[i] == scr) return d; @@ -555,7 +556,7 @@ static void obj_delete_core(lv_obj_t * obj) } /*All children deleted. Now clean up the object specific data*/ - _lv_obj_destruct(obj); + lv_obj_destruct(obj); /*Remove the screen for the screen list*/ if(obj->parent == NULL) { diff --git a/src/core/lv_refr.c b/src/core/lv_refr.c index a5cafe4e6..d4962002c 100644 --- a/src/core/lv_refr.c +++ b/src/core/lv_refr.c @@ -6,15 +6,21 @@ /********************* * INCLUDES *********************/ -#include "lv_refr.h" +#include "../misc/lv_area_private.h" +#include "../draw/sw/lv_draw_sw_mask_private.h" +#include "../draw/lv_draw_mask_private.h" +#include "lv_obj_private.h" +#include "lv_obj_event_private.h" +#include "lv_obj_draw_private.h" +#include "lv_refr_private.h" #include "../display/lv_display.h" #include "../display/lv_display_private.h" #include "../tick/lv_tick.h" -#include "../misc/lv_timer.h" +#include "../misc/lv_timer_private.h" #include "../misc/lv_math.h" #include "../misc/lv_profiler.h" #include "../misc/lv_types.h" -#include "../draw/lv_draw.h" +#include "../draw/lv_draw_private.h" #include "../font/lv_font_fmt_txt.h" #include "../stdlib/lv_string.h" #include "lv_global.h" @@ -66,11 +72,11 @@ static void wait_for_flushing(lv_display_t * disp); /** * Initialize the screen refresh subsystem */ -void _lv_refr_init(void) +void lv_refr_init(void) { } -void _lv_refr_deinit(void) +void lv_refr_deinit(void) { } @@ -79,13 +85,13 @@ void lv_refr_now(lv_display_t * disp) lv_anim_refr_now(); if(disp) { - if(disp->refr_timer) _lv_display_refr_timer(disp->refr_timer); + if(disp->refr_timer) lv_display_refr_timer(disp->refr_timer); } else { lv_display_t * d; d = lv_display_get_next(NULL); while(d) { - if(d->refr_timer) _lv_display_refr_timer(d->refr_timer); + if(d->refr_timer) lv_display_refr_timer(d->refr_timer); d = lv_display_get_next(d); } } @@ -99,10 +105,10 @@ 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); - int32_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; + if(!lv_area_intersect(&clip_coords_for_obj, &clip_area_ori, &obj_coords_ext)) return; /*If the object is visible on the current clip area*/ layer->_clip_area = clip_coords_for_obj; @@ -130,7 +136,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj) } lv_area_t clip_coords_for_children; bool refr_children = true; - if(!_lv_area_intersect(&clip_coords_for_children, &clip_area_ori, obj_coords)) { + if(!lv_area_intersect(&clip_coords_for_children, &clip_area_ori, obj_coords)) { refr_children = false; } @@ -183,7 +189,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj) lv_area_t bottom = obj->coords; bottom.y1 = bottom.y2 - rout + 1; - if(_lv_area_intersect(&bottom, &bottom, &clip_area_ori)) { + if(lv_area_intersect(&bottom, &bottom, &clip_area_ori)) { layer_children = lv_draw_layer_create(layer, LV_COLOR_FORMAT_ARGB8888, &bottom); for(i = 0; i < child_cnt; i++) { @@ -204,7 +210,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj) lv_area_t top = obj->coords; top.y2 = top.y1 + rout - 1; - if(_lv_area_intersect(&top, &top, &clip_area_ori)) { + if(lv_area_intersect(&top, &top, &clip_area_ori)) { layer_children = lv_draw_layer_create(layer, LV_COLOR_FORMAT_ARGB8888, &top); for(i = 0; i < child_cnt; i++) { @@ -227,7 +233,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj) lv_area_t mid = obj->coords; mid.y1 += rout; mid.y2 -= rout; - if(_lv_area_intersect(&mid, &mid, &clip_area_ori)) { + if(lv_area_intersect(&mid, &mid, &clip_area_ori)) { layer->_clip_area = mid; for(i = 0; i < child_cnt; i++) { lv_obj_t * child = obj->spec_attr->children[i]; @@ -248,7 +254,7 @@ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj) layer->_clip_area = clip_area_ori; } -void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p) +void lv_inv_area(lv_display_t * disp, const lv_area_t * area_p) { if(!disp) disp = lv_display_get_default(); if(!disp) return; @@ -282,7 +288,7 @@ void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p) lv_area_t com_area; bool suc; - suc = _lv_area_intersect(&com_area, area_p, &scr_area); + suc = lv_area_intersect(&com_area, area_p, &scr_area); if(suc == false) return; /*Out of the screen*/ /*If there were at least 1 invalid area in full refresh mode, redraw the whole screen*/ @@ -299,7 +305,7 @@ void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p) /*Save only if this area is not in one of the saved areas*/ uint16_t i; for(i = 0; i < disp->inv_p; i++) { - if(_lv_area_is_in(&com_area, &disp->inv_areas[i], 0) != false) return; + if(lv_area_is_in(&com_area, &disp->inv_areas[i], 0) != false) return; } /*Save the area*/ @@ -318,7 +324,7 @@ void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p) * Get the display which is being refreshed * @return the display being refreshed */ -lv_display_t * _lv_refr_get_disp_refreshing(void) +lv_display_t * lv_refr_get_disp_refreshing(void) { return disp_refr; } @@ -327,12 +333,12 @@ lv_display_t * _lv_refr_get_disp_refreshing(void) * Get the display which is being refreshed * @return the display being refreshed */ -void _lv_refr_set_disp_refreshing(lv_display_t * disp) +void lv_refr_set_disp_refreshing(lv_display_t * disp) { disp_refr = disp; } -void _lv_display_refr_timer(lv_timer_t * tmr) +void lv_display_refr_timer(lv_timer_t * tmr) { LV_PROFILER_BEGIN; LV_TRACE_REFR("begin"); @@ -397,7 +403,7 @@ void _lv_display_refr_timer(lv_timer_t * tmr) if(disp_refr->inv_area_joined[i]) continue; - lv_area_t * sync_area = _lv_ll_ins_tail(&disp_refr->sync_areas); + lv_area_t * sync_area = lv_ll_ins_tail(&disp_refr->sync_areas); *sync_area = disp_refr->inv_areas[i]; } } @@ -409,7 +415,7 @@ void _lv_display_refr_timer(lv_timer_t * tmr) refr_finish: #if LV_DRAW_SW_COMPLEX == 1 - _lv_draw_sw_mask_cleanup(); + lv_draw_sw_mask_cleanup(); #endif lv_display_send_event(disp_refr, LV_EVENT_REFR_READY, NULL); @@ -442,11 +448,11 @@ static void lv_refr_join_area(void) } /*Check if the areas are on each other*/ - if(_lv_area_is_on(&disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]) == false) { + if(lv_area_is_on(&disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]) == false) { continue; } - _lv_area_join(&joined_area, &disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]); + lv_area_join(&joined_area, &disp_refr->inv_areas[join_in], &disp_refr->inv_areas[join_from]); /*Join two area only if the joined area size is smaller*/ if(lv_area_get_size(&joined_area) < (lv_area_get_size(&disp_refr->inv_areas[join_in]) + @@ -473,7 +479,7 @@ static void refr_sync_areas(void) if(!lv_display_is_double_buffered(disp_refr)) return; /*Do not sync if no sync areas*/ - if(_lv_ll_is_empty(&disp_refr->sync_areas)) return; + if(lv_ll_is_empty(&disp_refr->sync_areas)) return; LV_PROFILER_BEGIN; /*With double buffered direct mode synchronize the rendered areas to the other buffer*/ @@ -499,22 +505,22 @@ static void refr_sync_areas(void) if(disp_refr->inv_area_joined[i]) continue; /*Iterate over sync areas*/ - sync_area = _lv_ll_get_head(&disp_refr->sync_areas); + sync_area = lv_ll_get_head(&disp_refr->sync_areas); while(sync_area != NULL) { /*Get next sync area*/ - next_area = _lv_ll_get_next(&disp_refr->sync_areas, sync_area); + next_area = lv_ll_get_next(&disp_refr->sync_areas, sync_area); /*Remove intersect of redraw area from sync area and get remaining areas*/ - res_c = _lv_area_diff(res, sync_area, &disp_refr->inv_areas[i]); + res_c = lv_area_diff(res, sync_area, &disp_refr->inv_areas[i]); /*New sub areas created after removing intersect*/ if(res_c != -1) { /*Replace old sync area with new areas*/ for(j = 0; j < res_c; j++) { - new_area = _lv_ll_ins_prev(&disp_refr->sync_areas, sync_area); + new_area = lv_ll_ins_prev(&disp_refr->sync_areas, sync_area); *new_area = res[j]; } - _lv_ll_remove(&disp_refr->sync_areas, sync_area); + lv_ll_remove(&disp_refr->sync_areas, sync_area); lv_free(sync_area); } @@ -525,17 +531,17 @@ static void refr_sync_areas(void) lv_area_t disp_area = {0, 0, (int32_t)hor_res - 1, (int32_t)ver_res - 1}; /*Copy sync areas (if any remaining)*/ - for(sync_area = _lv_ll_get_head(&disp_refr->sync_areas); sync_area != NULL; - sync_area = _lv_ll_get_next(&disp_refr->sync_areas, sync_area)) { + for(sync_area = lv_ll_get_head(&disp_refr->sync_areas); sync_area != NULL; + sync_area = lv_ll_get_next(&disp_refr->sync_areas, sync_area)) { /** * @todo Resize SDL window will trigger crash because of sync_area is larger than disp_area */ - _lv_area_intersect(sync_area, sync_area, &disp_area); + lv_area_intersect(sync_area, sync_area, &disp_area); lv_draw_buf_copy(off_screen, sync_area, on_screen, sync_area); } /*Clear sync areas*/ - _lv_ll_clear(&disp_refr->sync_areas); + lv_ll_clear(&disp_refr->sync_areas); LV_PROFILER_END; } @@ -753,9 +759,9 @@ static lv_obj_t * lv_refr_get_top_obj(const lv_area_t * area_p, lv_obj_t * obj) { lv_obj_t * found_p = NULL; - if(_lv_area_is_in(area_p, &obj->coords, 0) == false) return NULL; + if(lv_area_is_in(area_p, &obj->coords, 0) == false) return NULL; if(lv_obj_has_flag(obj, LV_OBJ_FLAG_HIDDEN)) return NULL; - if(_lv_obj_get_layer_type(obj) != LV_LAYER_TYPE_NONE) return NULL; + if(lv_obj_get_layer_type(obj) != LV_LAYER_TYPE_NONE) return NULL; /*If this object is fully cover the draw area then check the children too*/ lv_cover_check_info_t info; @@ -840,7 +846,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_area_t * obj_draw_size_out) { - int32_t ext_draw_size = _lv_obj_get_ext_draw_size(obj); + int32_t ext_draw_size = lv_obj_get_ext_draw_size(obj); lv_obj_get_coords(obj, obj_draw_size_out); lv_area_increase(obj_draw_size_out, ext_draw_size, ext_draw_size); @@ -850,7 +856,7 @@ static lv_result_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_t lv_area_t clip_coords_for_obj; lv_area_t tranf_coords = *obj_draw_size_out; lv_obj_get_transformed_area(obj, &tranf_coords, LV_OBJ_POINT_TRANSFORM_FLAG_NONE); - if(!_lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, &tranf_coords)) { + if(!lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, &tranf_coords)) { return LV_RESULT_INVALID; } @@ -859,7 +865,7 @@ static lv_result_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_t *in order to cover transformed area after transformation.*/ lv_area_t inverse_clip_coords_for_obj = clip_coords_for_obj; lv_obj_get_transformed_area(obj, &inverse_clip_coords_for_obj, LV_OBJ_POINT_TRANSFORM_FLAG_INVERSE); - if(!_lv_area_intersect(&inverse_clip_coords_for_obj, &inverse_clip_coords_for_obj, obj_draw_size_out)) { + if(!lv_area_intersect(&inverse_clip_coords_for_obj, &inverse_clip_coords_for_obj, obj_draw_size_out)) { return LV_RESULT_INVALID; } @@ -868,7 +874,7 @@ static lv_result_t layer_get_area(lv_layer_t * layer, lv_obj_t * obj, lv_layer_t } else if(layer_type == LV_LAYER_TYPE_SIMPLE) { lv_area_t clip_coords_for_obj; - if(!_lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, obj_draw_size_out)) { + if(!lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, obj_draw_size_out)) { return LV_RESULT_INVALID; } *layer_area_out = clip_coords_for_obj; @@ -885,7 +891,7 @@ static bool alpha_test_area_on_obj(lv_obj_t * obj, const lv_area_t * area) { /*Test for alpha by assuming there is no alpha. If it fails, fall back to rendering with alpha*/ /*If the layer area is not fully on the object, it can't fully cover it*/ - if(!_lv_area_is_on(area, &obj->coords)) return true; + if(!lv_area_is_on(area, &obj->coords)) return true; lv_cover_check_info_t info; info.res = LV_COVER_RES_COVER; @@ -972,14 +978,14 @@ static bool refr_check_obj_clip_overflow(lv_layer_t * layer, lv_obj_t * obj) /*Truncate the area to the object*/ lv_area_t obj_coords; - int32_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); lv_obj_get_transformed_area(obj, &obj_coords, LV_OBJ_POINT_TRANSFORM_FLAG_RECURSIVE); lv_area_t clip_coords_for_obj; - if(!_lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, &obj_coords)) { + if(!lv_area_intersect(&clip_coords_for_obj, &layer->_clip_area, &obj_coords)) { return false; } @@ -1004,7 +1010,7 @@ static void refr_obj(lv_layer_t * layer, lv_obj_t * obj) } #endif /* LV_DRAW_TRANSFORM_USE_MATRIX */ - lv_layer_type_t layer_type = _lv_obj_get_layer_type(obj); + lv_layer_type_t layer_type = lv_obj_get_layer_type(obj); if(layer_type == LV_LAYER_TYPE_NONE) { lv_obj_redraw(layer, obj); } diff --git a/src/core/lv_refr.h b/src/core/lv_refr.h index ddfa61c17..6b756edb5 100644 --- a/src/core/lv_refr.h +++ b/src/core/lv_refr.h @@ -42,16 +42,6 @@ extern "C" { **********************/ /** - * Initialize the screen refresh subsystem - */ -void _lv_refr_init(void); - -/** - * Deinitialize the screen refresh subsystem - */ -void _lv_refr_deinit(void); - -/** * Redraw the invalidated areas now. * Normally the redrawing is periodically executed in `lv_timer_handler` but a long blocking process * can prevent the call of `lv_timer_handler`. In this case if the GUI is updated in the process @@ -67,32 +57,6 @@ void lv_refr_now(lv_display_t * disp); */ void lv_obj_redraw(lv_layer_t * layer, lv_obj_t * obj); -/** - * Invalidate an area on display to redraw it - * @param area_p pointer to area which should be invalidated (NULL: delete the invalidated areas) - * @param disp pointer to display where the area should be invalidated (NULL can be used if there is - * only one display) - */ -void _lv_inv_area(lv_display_t * disp, const lv_area_t * area_p); - -/** - * Get the display which is being refreshed - * @return the display being refreshed - */ -lv_display_t * _lv_refr_get_disp_refreshing(void); - -/** - * Set the display which is being refreshed - * @param disp the display being refreshed - */ -void _lv_refr_set_disp_refreshing(lv_display_t * disp); - -/** - * Called periodically to handle the refreshing - * @param timer pointer to the timer itself - */ -void _lv_display_refr_timer(lv_timer_t * timer); - /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/core/lv_refr_private.h b/src/core/lv_refr_private.h new file mode 100644 index 000000000..8f840780b --- /dev/null +++ b/src/core/lv_refr_private.h @@ -0,0 +1,75 @@ +/** + * @file lv_refr_private.h + * + */ + +#ifndef LV_REFR_PRIVATE_H +#define LV_REFR_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_refr.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the screen refresh subsystem + */ +void lv_refr_init(void); + +/** + * Deinitialize the screen refresh subsystem + */ +void lv_refr_deinit(void); + +/** + * Invalidate an area on display to redraw it + * @param area_p pointer to area which should be invalidated (NULL: delete the invalidated areas) + * @param disp pointer to display where the area should be invalidated (NULL can be used if there is + * only one display) + */ +void lv_inv_area(lv_display_t * disp, const lv_area_t * area_p); + +/** + * Get the display which is being refreshed + * @return the display being refreshed + */ +lv_display_t * lv_refr_get_disp_refreshing(void); + +/** + * Set the display which is being refreshed + * @param disp the display being refreshed + */ +void lv_refr_set_disp_refreshing(lv_display_t * disp); + +/** + * Called periodically to handle the refreshing + * @param timer pointer to the timer itself + */ +void lv_display_refr_timer(lv_timer_t * timer); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_REFR_PRIVATE_H*/ diff --git a/src/display/lv_display.c b/src/display/lv_display.c index 3ec8cc7d1..9f264e818 100644 --- a/src/display/lv_display.c +++ b/src/display/lv_display.c @@ -6,9 +6,13 @@ /********************* * INCLUDES *********************/ +#include "../misc/lv_event_private.h" +#include "../misc/lv_anim_private.h" +#include "../draw/lv_draw_private.h" +#include "../core/lv_obj_private.h" #include "lv_display.h" #include "../misc/lv_math.h" -#include "../core/lv_refr.h" +#include "../core/lv_refr_private.h" #include "../display/lv_display_private.h" #include "../stdlib/lv_string.h" #include "../themes/lv_theme.h" @@ -57,7 +61,7 @@ static void disp_event_cb(lv_event_t * e); 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_display_t * disp = lv_ll_ins_head(disp_ll_p); LV_ASSERT_MALLOC(disp); if(!disp) return NULL; @@ -87,13 +91,13 @@ lv_display_t * lv_display_create(int32_t hor_res, int32_t ver_res) disp->inv_en_cnt = 1; disp->last_activity_time = lv_tick_get(); - _lv_ll_init(&disp->sync_areas, sizeof(lv_area_t)); + lv_ll_init(&disp->sync_areas, sizeof(lv_area_t)); lv_display_t * disp_def_tmp = disp_def; disp_def = disp; /*Temporarily change the default screen to create the default screens on the new display*/ /*Create a refresh timer*/ - disp->refr_timer = lv_timer_create(_lv_display_refr_timer, LV_DEF_REFR_PERIOD, disp); + disp->refr_timer = lv_timer_create(lv_display_refr_timer, LV_DEF_REFR_PERIOD, disp); LV_ASSERT_MALLOC(disp->refr_timer); if(disp->refr_timer == NULL) { lv_free(disp); @@ -191,8 +195,8 @@ void lv_display_delete(lv_display_t * disp) lv_obj_delete(disp->screens[0]); } - _lv_ll_clear(&disp->sync_areas); - _lv_ll_remove(disp_ll_p, disp); + lv_ll_clear(&disp->sync_areas); + lv_ll_remove(disp_ll_p, disp); if(disp->refr_timer) lv_timer_delete(disp->refr_timer); if(disp->layer_deinit) disp->layer_deinit(disp, disp->layer_head); @@ -200,7 +204,7 @@ void lv_display_delete(lv_display_t * disp) lv_free(disp); - if(was_default) lv_display_set_default(_lv_ll_get_head(disp_ll_p)); + if(was_default) lv_display_set_default(lv_ll_get_head(disp_ll_p)); } void lv_display_set_default(lv_display_t * disp) @@ -216,9 +220,9 @@ lv_display_t * lv_display_get_default(void) lv_display_t * lv_display_get_next(lv_display_t * disp) { if(disp == NULL) - return _lv_ll_get_head(disp_ll_p); + return lv_ll_get_head(disp_ll_p); else - return _lv_ll_get_next(disp_ll_p, disp); + return lv_ll_get_next(disp_ll_p, disp); } /*--------------------- @@ -570,7 +574,7 @@ lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp) return disp->bottom_layer; } -void lv_screen_load(struct _lv_obj_t * scr) +void lv_screen_load(struct lv_obj_t * scr) { lv_screen_load_anim(scr, LV_SCR_LOAD_ANIM_NONE, 0, 0, false); } @@ -962,6 +966,36 @@ void lv_display_rotate_area(lv_display_t * disp, lv_area_t * area) } } +lv_obj_t * lv_screen_active(void) +{ + return lv_display_get_screen_active(lv_display_get_default()); +} + +lv_obj_t * lv_layer_top(void) +{ + return lv_display_get_layer_top(lv_display_get_default()); +} + +lv_obj_t * lv_layer_sys(void) +{ + return lv_display_get_layer_sys(lv_display_get_default()); +} + +lv_obj_t * lv_layer_bottom(void) +{ + return lv_display_get_layer_bottom(lv_display_get_default()); +} + +int32_t lv_dpx(int32_t n) +{ + return LV_DPX(n); +} + +int32_t lv_display_dpx(const lv_display_t * disp, int32_t n) +{ + return LV_DPX_CALC(lv_display_get_dpi(disp), n); +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/display/lv_display.h b/src/display/lv_display.h index 9ce81552b..e3e7c49f2 100644 --- a/src/display/lv_display.h +++ b/src/display/lv_display.h @@ -374,7 +374,7 @@ lv_obj_t * lv_display_get_layer_bottom(lv_display_t * disp); * Load a screen on the default display * @param scr pointer to a screen */ -void lv_screen_load(struct _lv_obj_t * scr); +void lv_screen_load(struct lv_obj_t * scr); /** * Switch screen with animation @@ -391,37 +391,25 @@ void lv_screen_load_anim(lv_obj_t * scr, lv_screen_load_anim_t anim_type, uint32 * Get the active screen of the default display * @return pointer to the active screen */ -static inline lv_obj_t * lv_screen_active(void) -{ - return lv_display_get_screen_active(lv_display_get_default()); -} +lv_obj_t * lv_screen_active(void); /** * Get the top layer of the default display * @return pointer to the top layer */ -static inline lv_obj_t * lv_layer_top(void) -{ - return lv_display_get_layer_top(lv_display_get_default()); -} +lv_obj_t * lv_layer_top(void); /** * Get the system layer of the default display * @return pointer to the sys layer */ -static inline lv_obj_t * lv_layer_sys(void) -{ - return lv_display_get_layer_sys(lv_display_get_default()); -} +lv_obj_t * lv_layer_sys(void); /** * Get the bottom layer of the default display * @return pointer to the bottom layer */ -static inline lv_obj_t * lv_layer_bottom(void) -{ - return lv_display_get_layer_bottom(lv_display_get_default()); -} +lv_obj_t * lv_layer_bottom(void); /*--------------------- * OTHERS @@ -574,8 +562,8 @@ void lv_display_rotate_area(lv_display_t * disp, lv_area_t * area); * 1 dip is 2 px on a 320 DPI screen * https://stackoverflow.com/questions/2025282/what-is-the-difference-between-px-dip-dp-and-sp */ -#define _LV_DPX_CALC(dpi, n) ((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/ -#define LV_DPX(n) _LV_DPX_CALC(lv_display_get_dpi(NULL), n) +#define LV_DPX_CALC(dpi, n) ((n) == 0 ? 0 :LV_MAX((( (dpi) * (n) + 80) / 160), 1)) /*+80 for rounding*/ +#define LV_DPX(n) LV_DPX_CALC(lv_display_get_dpi(NULL), n) /** * Scale the given number of pixels (a distance or size) relative to a 160 DPI display @@ -585,10 +573,7 @@ void lv_display_rotate_area(lv_display_t * disp, lv_area_t * area); * @param n the number of pixels to scale * @return `n x current_dpi/160` */ -static inline int32_t lv_dpx(int32_t n) -{ - return LV_DPX(n); -} +int32_t lv_dpx(int32_t n); /** * Scale the given number of pixels (a distance or size) relative to a 160 DPI display @@ -599,10 +584,7 @@ static inline int32_t lv_dpx(int32_t n) * @param n the number of pixels to scale * @return `n x current_dpi/160` */ -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); -} +int32_t lv_display_dpx(const lv_display_t * disp, int32_t n); #ifdef __cplusplus } /*extern "C"*/ diff --git a/src/display/lv_display_private.h b/src/display/lv_display_private.h index b9ea9c50c..1fb7f409c 100644 --- a/src/display/lv_display_private.h +++ b/src/display/lv_display_private.h @@ -19,7 +19,7 @@ extern "C" { #include "lv_display.h" #if LV_USE_SYSMON -#include "../others/sysmon/lv_sysmon.h" +#include "../others/sysmon/lv_sysmon_private.h" #endif /********************* @@ -33,7 +33,7 @@ extern "C" { * TYPEDEFS **********************/ -struct _lv_display_t { +struct lv_display_t { /*--------------------- * Resolution diff --git a/src/draw/lv_draw.c b/src/draw/lv_draw.c index 1a72f04dd..777863a8f 100644 --- a/src/draw/lv_draw.c +++ b/src/draw/lv_draw.c @@ -6,11 +6,12 @@ /********************* * INCLUDES *********************/ -#include "lv_draw.h" +#include "../misc/lv_area_private.h" +#include "lv_draw_private.h" #include "sw/lv_draw_sw.h" #include "../display/lv_display_private.h" #include "../core/lv_global.h" -#include "../core/lv_refr.h" +#include "../core/lv_refr_private.h" #include "../stdlib/lv_string.h" /********************* @@ -289,8 +290,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) { - 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()); + 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 && @@ -327,7 +328,7 @@ uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check) lv_draw_task_t * t = t_check->next; while(t) { if((t->state == LV_DRAW_TASK_STATE_QUEUED || t->state == LV_DRAW_TASK_STATE_WAITING) && - _lv_area_is_on(&t_check->area, &t->area)) { + lv_area_is_on(&t_check->area, &t->area)) { cnt++; } @@ -339,7 +340,7 @@ uint32_t lv_draw_get_dependent_count(lv_draw_task_t * t_check) lv_layer_t * lv_draw_layer_create(lv_layer_t * parent_layer, lv_color_format_t color_format, const lv_area_t * area) { - lv_display_t * disp = _lv_refr_get_disp_refreshing(); + lv_display_t * disp = lv_refr_get_disp_refreshing(); lv_layer_t * new_layer = lv_malloc_zeroed(sizeof(lv_layer_t)); LV_ASSERT_MALLOC(new_layer); if(new_layer == NULL) return NULL; @@ -399,6 +400,21 @@ void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y) return lv_draw_buf_goto_xy(layer->draw_buf, x, y); } +lv_draw_task_type_t lv_draw_task_get_type(const lv_draw_task_t * t) +{ + return t->type; +} + +void * lv_draw_task_get_draw_dsc(const lv_draw_task_t * t) +{ + return t->draw_dsc; +} + +void lv_draw_task_get_area(const lv_draw_task_t * t, lv_area_t * area) +{ + *area = t->area; +} + /********************** * STATIC FUNCTIONS **********************/ @@ -418,7 +434,7 @@ static bool is_independent(lv_layer_t * layer, lv_draw_task_t * t_check) while(t && t != t_check) { if(t->state != LV_DRAW_TASK_STATE_READY) { lv_area_t a; - if(_lv_area_intersect(&a, &t->_real_area, &t_check->_real_area)) { + if(lv_area_intersect(&a, &t->_real_area, &t_check->_real_area)) { LV_PROFILER_END; return false; } diff --git a/src/draw/lv_draw.h b/src/draw/lv_draw.h index 6056058d6..b0060ea86 100644 --- a/src/draw/lv_draw.h +++ b/src/draw/lv_draw.h @@ -41,6 +41,7 @@ extern "C" { **********************/ typedef enum { + LV_DRAW_TASK_TYPE_NONE = 0, LV_DRAW_TASK_TYPE_FILL, LV_DRAW_TASK_TYPE_BORDER, LV_DRAW_TASK_TYPE_BOX_SHADOW, @@ -62,102 +63,7 @@ typedef enum { LV_DRAW_TASK_STATE_READY, } lv_draw_task_state_t; -struct _lv_draw_task_t { - lv_draw_task_t * next; - - lv_draw_task_type_t type; - - /** - * The area where to draw - */ - lv_area_t area; - - /** - * The real draw area. E.g. for shadow, outline, or transformed images it's different from `area` - */ - lv_area_t _real_area; - - /** The original area which is updated*/ - lv_area_t clip_area_original; - - /** - * The clip area of the layer is saved here when the draw task is created. - * As the clip area of the layer can be changed as new draw tasks are added its current value needs to be saved. - * Therefore during drawing the layer's clip area shouldn't be used as it might be already changed for other draw tasks. - */ - lv_area_t clip_area; - -#if LV_DRAW_TRANSFORM_USE_MATRIX - /** Transform matrix to be applied when rendering the layer */ - lv_matrix_t matrix; -#endif - - volatile int state; /*int instead of lv_draw_task_state_t to be sure its atomic*/ - - void * draw_dsc; - - /** - * The ID of the draw_unit which should take this task - */ - uint8_t preferred_draw_unit_id; - - /** - * Set to which extent `preferred_draw_unit_id` is good at this task. - * 80: means 20% better (faster) than software rendering - * 100: the default value - * 110: means 10% worse (slower) than software rendering - */ - uint8_t preference_score; - -}; - -typedef struct { - void * user_data; -} lv_draw_mask_t; - -struct _lv_draw_unit_t { - lv_draw_unit_t * next; - - /** - * The target_layer on which drawing should happen - */ - lv_layer_t * target_layer; - - const lv_area_t * clip_area; - - /** - * Called to try to assign a draw task to itself. - * `lv_draw_get_next_available_task` can be used to get an independent draw task. - * A draw task should be assign only if the draw unit can draw it too - * @param draw_unit pointer to the draw unit - * @param layer pointer to a layer on which the draw task should be drawn - * @return >=0: The number of taken draw task: - * 0 means the task has not yet been completed. - * 1 means a new task has been accepted. - * -1: The draw unit wanted to work on a task but couldn't do that - * due to some errors (e.g. out of memory). - * It signals that LVGL should call the dispatcher later again - * to let draw unit try to start the rendering again. - */ - int32_t (*dispatch_cb)(lv_draw_unit_t * draw_unit, lv_layer_t * layer); - - /** - * - * @param draw_unit - * @param task - * @return - */ - int32_t (*evaluate_cb)(lv_draw_unit_t * draw_unit, lv_draw_task_t * task); - - /** - * Called to delete draw unit. - * @param draw_unit - * @return - */ - int32_t (*delete_cb)(lv_draw_unit_t * draw_unit); -}; - -struct _lv_layer_t { +struct lv_layer_t { /** Target draw buffer of the layer*/ lv_draw_buf_t * draw_buf; @@ -202,18 +108,6 @@ typedef struct { void * user_data; } lv_draw_dsc_base_t; -typedef struct { - lv_draw_unit_t * unit_head; - uint32_t used_memory_for_layers_kb; -#if LV_USE_OS - lv_thread_sync_t sync; -#else - int dispatch_req; -#endif - lv_mutex_t circle_cache_mutex; - bool task_running; -} lv_draw_global_info_t; - /********************** * GLOBAL PROTOTYPES **********************/ @@ -322,6 +216,27 @@ void * lv_draw_layer_alloc_buf(lv_layer_t * layer); */ void * lv_draw_layer_go_to_xy(lv_layer_t * layer, int32_t x, int32_t y); +/** + * Get the type of a draw task + * @param t the draw task to get the type of + * @return the draw task type +*/ +lv_draw_task_type_t lv_draw_task_get_type(const lv_draw_task_t * t); + +/** + * Get the draw descriptor of a draw task + * @param t the draw task to get the draw descriptor of + * @return a void pointer to the draw descriptor +*/ +void * lv_draw_task_get_draw_dsc(const lv_draw_task_t * t); + +/** + * Get the draw area of a draw task + * @param t the draw task to get the draw area of + * @param area the destination where the draw area will be stored +*/ +void lv_draw_task_get_area(const lv_draw_task_t * t, lv_area_t * area); + /********************** * GLOBAL VARIABLES **********************/ diff --git a/src/draw/lv_draw_arc.c b/src/draw/lv_draw_arc.c index 634c0429e..670aedec4 100644 --- a/src/draw/lv_draw_arc.c +++ b/src/draw/lv_draw_arc.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "lv_draw_private.h" #include "../core/lv_obj.h" #include "lv_draw_arc.h" #include "../core/lv_obj_event.h" diff --git a/src/draw/lv_draw_buf.c b/src/draw/lv_draw_buf.c index ff080a0bc..d265b0217 100644 --- a/src/draw/lv_draw_buf.c +++ b/src/draw/lv_draw_buf.c @@ -7,10 +7,11 @@ * INCLUDES *********************/ #include "../misc/lv_types.h" -#include "lv_draw_buf.h" +#include "lv_draw_buf_private.h" #include "../stdlib/lv_string.h" #include "../core/lv_global.h" #include "../misc/lv_math.h" +#include "../misc/lv_area_private.h" /********************* * DEFINES @@ -48,7 +49,7 @@ static void draw_buf_get_full_area(const lv_draw_buf_t * draw_buf, lv_area_t * f * GLOBAL FUNCTIONS **********************/ -void _lv_draw_buf_init_handlers(void) +void lv_draw_buf_init_handlers(void) { lv_draw_buf_init_with_default_handlers(&default_handlers); lv_draw_buf_init_with_default_handlers(&font_draw_buf_handlers); @@ -57,10 +58,10 @@ void _lv_draw_buf_init_handlers(void) void lv_draw_buf_init_with_default_handlers(lv_draw_buf_handlers_t * handlers) { - lv_draw_buf_init_handlers(handlers, buf_malloc, buf_free, buf_align, NULL, NULL, width_to_stride); + lv_draw_buf_handlers_init(handlers, buf_malloc, buf_free, buf_align, NULL, NULL, width_to_stride); } -void lv_draw_buf_init_handlers(lv_draw_buf_handlers_t * handlers, +void lv_draw_buf_handlers_init(lv_draw_buf_handlers_t * handlers, lv_draw_buf_malloc_cb buf_malloc_cb, lv_draw_buf_free_cb buf_free_cb, lv_draw_buf_align_cb align_pointer_cb, @@ -171,7 +172,7 @@ void lv_draw_buf_clear(lv_draw_buf_t * draw_buf, const lv_area_t * a) a_draw_buf.y2 = draw_buf->header.h - 1; lv_area_t a_clipped; - if(!_lv_area_intersect(&a_clipped, a, &a_draw_buf)) return; + if(!lv_area_intersect(&a_clipped, a, &a_draw_buf)) return; if(lv_area_get_width(&a_clipped) <= 0) return; if(lv_area_get_height(&a_clipped) <= 0) return; @@ -543,6 +544,49 @@ void lv_draw_buf_set_palette(lv_draw_buf_t * draw_buf, uint8_t index, lv_color32 palette[index] = color; } +bool lv_draw_buf_has_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag) +{ + return draw_buf->header.flags & flag; +} + +void lv_draw_buf_set_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag) +{ + draw_buf->header.flags |= flag; +} + +void lv_draw_buf_clear_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag) +{ + draw_buf->header.flags &= ~flag; +} + +void lv_draw_buf_from_image(lv_draw_buf_t * buf, const lv_image_dsc_t * img) +{ + lv_memcpy(buf, img, sizeof(lv_image_dsc_t)); + buf->unaligned_data = buf->data; +} + +void lv_draw_buf_to_image(const lv_draw_buf_t * buf, lv_image_dsc_t * img) +{ + lv_memcpy((void *)img, buf, sizeof(lv_image_dsc_t)); +} + +void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c) +{ + LV_LOG_WARN("Deprecated API, use lv_draw_buf_set_palette instead."); + lv_draw_buf_set_palette((lv_draw_buf_t *)dsc, id, c); +} + +void lv_image_buf_free(lv_image_dsc_t * dsc) +{ + LV_LOG_WARN("Deprecated API, use lv_draw_buf_destroy instead."); + if(dsc != NULL) { + if(dsc->data != NULL) + lv_free((void *)dsc->data); + + lv_free((void *)dsc); + } +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/draw/lv_draw_buf.h b/src/draw/lv_draw_buf.h index e120ae26a..8c6e98dbe 100644 --- a/src/draw/lv_draw_buf.h +++ b/src/draw/lv_draw_buf.h @@ -43,12 +43,12 @@ typedef struct { * Refine it to suit your needs. */ -#define _LV_DRAW_BUF_STRIDE(w, cf) \ +#define LV_DRAW_BUF_STRIDE(w, cf) \ LV_ROUND_UP(((w) * LV_COLOR_FORMAT_GET_BPP(cf) + 7) / 8, LV_DRAW_BUF_STRIDE_ALIGN) /* Allocate a slightly larger buffer, so we can adjust the start address to meet alignment */ -#define _LV_DRAW_BUF_SIZE(w, h, cf) \ - (_LV_DRAW_BUF_STRIDE(w, cf) * (h) + LV_DRAW_BUF_ALIGN + \ +#define LV_DRAW_BUF_SIZE(w, h, cf) \ + (LV_DRAW_BUF_STRIDE(w, cf) * (h) + LV_DRAW_BUF_ALIGN + \ LV_COLOR_INDEXED_PALETTE_SIZE(cf) * sizeof(lv_color32_t)) /** @@ -58,7 +58,7 @@ typedef struct { * For platform that needs special buffer alignment, call LV_DRAW_BUF_INIT_STATIC. */ #define LV_DRAW_BUF_DEFINE_STATIC(name, _w, _h, _cf) \ - static uint8_t buf_##name[_LV_DRAW_BUF_SIZE(_w, _h, _cf)]; \ + static uint8_t buf_##name[LV_DRAW_BUF_SIZE(_w, _h, _cf)]; \ static lv_draw_buf_t name = { \ .header = { \ .magic = LV_IMAGE_HEADER_MAGIC, \ @@ -66,7 +66,7 @@ typedef struct { .flags = LV_IMAGE_FLAGS_MODIFIABLE, \ .w = (_w), \ .h = (_h), \ - .stride = _LV_DRAW_BUF_STRIDE(_w, _cf), \ + .stride = LV_DRAW_BUF_STRIDE(_w, _cf), \ .reserved_2 = 0, \ }, \ .data_size = sizeof(buf_##name), \ @@ -91,25 +91,11 @@ typedef void (*lv_draw_buf_cache_operation_cb)(const lv_draw_buf_t * draw_buf, c typedef uint32_t (*lv_draw_buf_width_to_stride_cb)(uint32_t w, lv_color_format_t color_format); -typedef struct { - lv_draw_buf_malloc_cb buf_malloc_cb; - lv_draw_buf_free_cb buf_free_cb; - lv_draw_buf_align_cb align_pointer_cb; - lv_draw_buf_cache_operation_cb invalidate_cache_cb; - lv_draw_buf_cache_operation_cb flush_cache_cb; - lv_draw_buf_width_to_stride_cb width_to_stride_cb; -} lv_draw_buf_handlers_t; - /********************** * GLOBAL PROTOTYPES **********************/ /** - * Called internally to initialize the draw_buf_handlers in lv_global - */ -void _lv_draw_buf_init_handlers(void); - -/** * Initialize the draw buffer with the default handlers. * * @param handlers the draw buffer handlers to set @@ -126,7 +112,7 @@ void lv_draw_buf_init_with_default_handlers(lv_draw_buf_handlers_t * handlers); * @param invalidate_cache_cb the callback to invalidate the cache of the buffer * @param width_to_stride_cb the callback to calculate the stride based on the width and color format */ -void lv_draw_buf_init_handlers(lv_draw_buf_handlers_t * handlers, +void lv_draw_buf_handlers_init(lv_draw_buf_handlers_t * handlers, lv_draw_buf_malloc_cb buf_malloc_cb, lv_draw_buf_free_cb buf_free_cb, lv_draw_buf_align_cb align_pointer_cb, @@ -341,36 +327,20 @@ lv_result_t lv_draw_buf_adjust_stride(lv_draw_buf_t * src, uint32_t stride); */ lv_result_t lv_draw_buf_premultiply(lv_draw_buf_t * draw_buf); -static inline bool lv_draw_buf_has_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag) -{ - return draw_buf->header.flags & flag; -} +bool lv_draw_buf_has_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag); -static inline void lv_draw_buf_set_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag) -{ - draw_buf->header.flags |= flag; -} +void lv_draw_buf_set_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag); -static inline void lv_draw_buf_clear_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag) -{ - draw_buf->header.flags &= ~flag; -} +void lv_draw_buf_clear_flag(lv_draw_buf_t * draw_buf, lv_image_flags_t flag); /** * As of now, draw buf share same definition as `lv_image_dsc_t`. * And is interchangeable with `lv_image_dsc_t`. */ -static inline void lv_draw_buf_from_image(lv_draw_buf_t * buf, const lv_image_dsc_t * img) -{ - lv_memcpy(buf, img, sizeof(lv_image_dsc_t)); - buf->unaligned_data = buf->data; -} +void lv_draw_buf_from_image(lv_draw_buf_t * buf, const lv_image_dsc_t * img); -static inline void lv_draw_buf_to_image(const lv_draw_buf_t * buf, lv_image_dsc_t * img) -{ - lv_memcpy((void *)img, buf, sizeof(lv_image_dsc_t)); -} +void lv_draw_buf_to_image(const lv_draw_buf_t * buf, lv_image_dsc_t * img); /** * Set the palette color of an indexed image. Valid only for `LV_COLOR_FORMAT_I1/2/4/8` @@ -387,26 +357,13 @@ void lv_draw_buf_set_palette(lv_draw_buf_t * draw_buf, uint8_t index, lv_color32 /** * @deprecated Use lv_draw_buf_set_palette instead. */ -static inline void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c) -{ - LV_LOG_WARN("Deprecated API, use lv_draw_buf_set_palette instead."); - lv_draw_buf_set_palette((lv_draw_buf_t *)dsc, id, c); -} +void lv_image_buf_set_palette(lv_image_dsc_t * dsc, uint8_t id, lv_color32_t c); /** * @deprecated Use lv_draw_buffer_create/destroy instead. * Free the data pointer and dsc struct of an image. */ -static inline void lv_image_buf_free(lv_image_dsc_t * dsc) -{ - LV_LOG_WARN("Deprecated API, use lv_draw_buf_destroy instead."); - if(dsc != NULL) { - if(dsc->data != NULL) - lv_free((void *)dsc->data); - - lv_free((void *)dsc); - } -} +void lv_image_buf_free(lv_image_dsc_t * dsc); /********************** * MACROS diff --git a/src/draw/lv_draw_buf_private.h b/src/draw/lv_draw_buf_private.h new file mode 100644 index 000000000..051f9ba7c --- /dev/null +++ b/src/draw/lv_draw_buf_private.h @@ -0,0 +1,53 @@ +/** + * @file lv_draw_buf_private.h + * + */ + +#ifndef LV_DRAW_BUF_PRIVATE_H +#define LV_DRAW_BUF_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_buf.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_draw_buf_handlers_t { + lv_draw_buf_malloc_cb buf_malloc_cb; + lv_draw_buf_free_cb buf_free_cb; + lv_draw_buf_align_cb align_pointer_cb; + lv_draw_buf_cache_operation_cb invalidate_cache_cb; + lv_draw_buf_cache_operation_cb flush_cache_cb; + lv_draw_buf_width_to_stride_cb width_to_stride_cb; +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Called internally to initialize the draw_buf_handlers in lv_global + */ +void lv_draw_buf_init_handlers(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_BUF_PRIVATE_H*/ diff --git a/src/draw/lv_draw_image.c b/src/draw/lv_draw_image.c index b4ffb9ad5..f051831e2 100644 --- a/src/draw/lv_draw_image.c +++ b/src/draw/lv_draw_image.c @@ -6,7 +6,10 @@ /********************* * INCLUDES *********************/ -#include "lv_draw_image.h" +#include "../misc/lv_area_private.h" +#include "lv_image_decoder_private.h" +#include "lv_draw_private.h" +#include "lv_draw_image_private.h" #include "../display/lv_display.h" #include "../misc/lv_log.h" #include "../misc/lv_math.h" @@ -69,8 +72,8 @@ void lv_draw_layer(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv t->type = LV_DRAW_TASK_TYPE_LAYER; t->state = LV_DRAW_TASK_STATE_WAITING; - _lv_image_buf_get_transformed_area(&t->_real_area, lv_area_get_width(coords), lv_area_get_height(coords), - dsc->rotation, dsc->scale_x, dsc->scale_y, &dsc->pivot); + lv_image_buf_get_transformed_area(&t->_real_area, lv_area_get_width(coords), lv_area_get_height(coords), + dsc->rotation, dsc->scale_x, dsc->scale_y, &dsc->pivot); lv_area_move(&t->_real_area, coords->x1, coords->y1); lv_layer_t * layer_to_draw = (lv_layer_t *)dsc->src; @@ -102,8 +105,8 @@ void lv_draw_image(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv t->draw_dsc = new_image_dsc; t->type = LV_DRAW_TASK_TYPE_IMAGE; - _lv_image_buf_get_transformed_area(&t->_real_area, lv_area_get_width(coords), lv_area_get_height(coords), - dsc->rotation, dsc->scale_x, dsc->scale_y, &dsc->pivot); + lv_image_buf_get_transformed_area(&t->_real_area, lv_area_get_width(coords), lv_area_get_height(coords), + dsc->rotation, dsc->scale_x, dsc->scale_y, &dsc->pivot); lv_area_move(&t->_real_area, coords->x1, coords->y1); lv_draw_finalize_task_creation(layer, t); @@ -127,8 +130,8 @@ lv_image_src_t lv_image_src_get_type(const void * src) } } -void _lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, - const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb) +void lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, + const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb) { if(draw_core_cb == NULL) { LV_LOG_WARN("draw_core_cb is NULL"); @@ -141,8 +144,8 @@ void _lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_imag int32_t w = lv_area_get_width(coords); int32_t h = lv_area_get_height(coords); - _lv_image_buf_get_transformed_area(&draw_area, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y, - &draw_dsc->pivot); + lv_image_buf_get_transformed_area(&draw_area, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y, + &draw_dsc->pivot); draw_area.x1 += coords->x1; draw_area.y1 += coords->y1; @@ -151,7 +154,7 @@ void _lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_imag } lv_area_t clipped_img_area; - if(!_lv_area_intersect(&clipped_img_area, &draw_area, draw_unit->clip_area)) { + if(!lv_area_intersect(&clipped_img_area, &draw_area, draw_unit->clip_area)) { return; } @@ -167,8 +170,8 @@ void _lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_imag lv_image_decoder_close(&decoder_dsc); } -void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, - const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb) +void lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, + const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb) { if(draw_core_cb == NULL) { LV_LOG_WARN("draw_core_cb is NULL"); @@ -208,7 +211,7 @@ void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image while(tile_area.x1 <= coords->x2) { lv_area_t clipped_img_area; - if(_lv_area_intersect(&clipped_img_area, &tile_area, coords)) { + if(lv_area_intersect(&clipped_img_area, &tile_area, coords)) { img_decode_and_draw(draw_unit, draw_dsc, &decoder_dsc, &relative_decoded_area, &tile_area, &clipped_img_area, draw_core_cb); } @@ -226,8 +229,8 @@ void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image lv_image_decoder_close(&decoder_dsc); } -void _lv_image_buf_get_transformed_area(lv_area_t * res, int32_t w, int32_t h, int32_t angle, - uint16_t scale_x, uint16_t scale_y, const lv_point_t * pivot) +void lv_image_buf_get_transformed_area(lv_area_t * res, int32_t w, int32_t h, int32_t angle, + uint16_t scale_x, uint16_t scale_y, const lv_point_t * pivot) { if(angle == 0 && scale_x == LV_SCALE_NONE && scale_y == LV_SCALE_NONE) { res->x1 = 0; @@ -291,7 +294,7 @@ static void img_decode_and_draw(lv_draw_unit_t * draw_unit, const lv_draw_image_ if(res == LV_RESULT_OK) { /*Limit draw area to the current decoded area and draw the image*/ lv_area_t clipped_img_area_sub; - if(_lv_area_intersect(&clipped_img_area_sub, clipped_img_area, &absolute_decoded_area)) { + if(lv_area_intersect(&clipped_img_area_sub, clipped_img_area, &absolute_decoded_area)) { draw_core_cb(draw_unit, draw_dsc, decoder_dsc, &sup, &absolute_decoded_area, &clipped_img_area_sub); } diff --git a/src/draw/lv_draw_image.h b/src/draw/lv_draw_image.h index fef361aa6..a16f6d055 100644 --- a/src/draw/lv_draw_image.h +++ b/src/draw/lv_draw_image.h @@ -26,17 +26,7 @@ extern "C" { * MACROS **********************/ -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_color_t alpha_color; - const lv_color32_t * palette; - uint32_t palette_size : 9; -} lv_draw_image_sup_t; - -typedef struct _lv_draw_image_dsc_t { +typedef struct lv_draw_image_dsc_t { lv_draw_dsc_base_t base; const void * src; @@ -132,41 +122,6 @@ void lv_draw_layer(lv_layer_t * layer, const lv_draw_image_dsc_t * dsc, const lv */ lv_image_src_t lv_image_src_get_type(const void * src); -/** - * Can be used by draw units to handle the decoding and - * prepare everything for the actual image rendering - * @param draw_unit pointer to a draw unit - * @param draw_dsc the draw descriptor of the image - * @param coords the absolute coordinates of the image - * @param draw_core_cb a callback to perform the actual rendering - */ -void _lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, - const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb); - -/** - * Can be used by draw units for TILED images to handle the decoding and - * prepare everything for the actual image rendering - * @param draw_unit pointer to a draw unit - * @param draw_dsc the draw descriptor of the image - * @param coords the absolute coordinates of the image - * @param draw_core_cb a callback to perform the actual rendering - */ -void _lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, - const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb); - -/** - * Get the area of a rectangle if its rotated and scaled - * @param res store the coordinates here - * @param w width of the rectangle to transform - * @param h height of the rectangle to transform - * @param angle angle of rotation - * @param scale_x zoom in x direction, (256 no zoom) - * @param scale_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, int32_t w, int32_t h, int32_t angle, - uint16_t scale_x, uint16_t scale_y, const lv_point_t * pivot); - #ifdef __cplusplus } /*extern "C"*/ #endif diff --git a/src/draw/lv_draw_image_private.h b/src/draw/lv_draw_image_private.h new file mode 100644 index 000000000..a39ee6164 --- /dev/null +++ b/src/draw/lv_draw_image_private.h @@ -0,0 +1,85 @@ +/** + * @file lv_draw_image_private.h + * + */ + +#ifndef LV_DRAW_IMAGE_PRIVATE_H +#define LV_DRAW_IMAGE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_image.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_draw_image_sup_t { + lv_color_t alpha_color; + const lv_color32_t * palette; + uint32_t palette_size : 9; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Can be used by draw units to handle the decoding and + * prepare everything for the actual image rendering + * @param draw_unit pointer to a draw unit + * @param draw_dsc the draw descriptor of the image + * @param coords the absolute coordinates of the image + * @param draw_core_cb a callback to perform the actual rendering + */ +void lv_draw_image_normal_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, + const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb); + +/** + * Can be used by draw units for TILED images to handle the decoding and + * prepare everything for the actual image rendering + * @param draw_unit pointer to a draw unit + * @param draw_dsc the draw descriptor of the image + * @param coords the absolute coordinates of the image + * @param draw_core_cb a callback to perform the actual rendering + */ +void lv_draw_image_tiled_helper(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * draw_dsc, + const lv_area_t * coords, lv_draw_image_core_cb draw_core_cb); + +/** + * Get the area of a rectangle if its rotated and scaled + * @param res store the coordinates here + * @param w width of the rectangle to transform + * @param h height of the rectangle to transform + * @param angle angle of rotation + * @param scale_x zoom in x direction, (256 no zoom) + * @param scale_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, int32_t w, int32_t h, int32_t angle, + uint16_t scale_x, uint16_t scale_y, const lv_point_t * pivot); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_IMAGE_PRIVATE_H*/ diff --git a/src/draw/lv_draw_label.c b/src/draw/lv_draw_label.c index b6e9aca01..d0162b824 100644 --- a/src/draw/lv_draw_label.c +++ b/src/draw/lv_draw_label.c @@ -6,11 +6,15 @@ /********************* * INCLUDES *********************/ +#include "../misc/lv_area_private.h" +#include "lv_draw_vector_private.h" +#include "lv_draw_rect_private.h" +#include "lv_draw_private.h" #include "../core/lv_obj.h" -#include "lv_draw_label.h" +#include "lv_draw_label_private.h" #include "../misc/lv_math.h" #include "../core/lv_obj_event.h" -#include "../misc/lv_bidi.h" +#include "../misc/lv_bidi_private.h" #include "../misc/lv_text_private.h" #include "../misc/lv_assert.h" #include "../stdlib/lv_mem.h" @@ -150,7 +154,7 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_ int32_t w; lv_area_t clipped_area; - bool clip_ok = _lv_area_intersect(&clipped_area, coords, draw_unit->clip_area); + bool clip_ok = lv_area_intersect(&clipped_area, coords, draw_unit->clip_area); if(!clip_ok) return; lv_text_align_t align = dsc->align; @@ -268,7 +272,7 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_ #if LV_USE_BIDI char * bidi_txt = lv_malloc(line_end - line_start + 1); LV_ASSERT_MALLOC(bidi_txt); - _lv_bidi_process_paragraph(dsc->text + line_start, bidi_txt, line_end - line_start, base_dir, NULL, 0); + lv_bidi_process_paragraph(dsc->text + line_start, bidi_txt, line_end - line_start, base_dir, NULL, 0); #else const char * bidi_txt = dsc->text + line_start; #endif @@ -279,7 +283,7 @@ void lv_draw_label_iterate_characters(lv_draw_unit_t * draw_unit, const lv_draw_ #if LV_USE_BIDI logical_char_pos = lv_text_encoded_get_char_id(dsc->text, line_start); uint32_t t = lv_text_encoded_get_char_id(bidi_txt, i); - logical_char_pos += _lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, base_dir, t, NULL); + logical_char_pos += lv_bidi_get_logical_pos(bidi_txt, NULL, line_end - line_start, base_dir, t, NULL); #else logical_char_pos = lv_text_encoded_get_char_id(dsc->text, line_start + i); #endif @@ -402,8 +406,8 @@ static void draw_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * dsc, letter_coords.y2 = letter_coords.y1 + g.box_h - 1; /*If the letter is completely out of mask don't draw it*/ - if(_lv_area_is_out(&letter_coords, draw_unit->clip_area, 0) && - _lv_area_is_out(dsc->bg_coords, draw_unit->clip_area, 0)) { + if(lv_area_is_out(&letter_coords, draw_unit->clip_area, 0) && + lv_area_is_out(dsc->bg_coords, draw_unit->clip_area, 0)) { LV_PROFILER_END; return; } diff --git a/src/draw/lv_draw_label.h b/src/draw/lv_draw_label.h index f0b962802..bc36bbf5b 100644 --- a/src/draw/lv_draw_label.h +++ b/src/draw/lv_draw_label.h @@ -28,23 +28,6 @@ extern "C" { * TYPEDEFS **********************/ -/** Store some info to speed up drawing of very large texts - * It takes a lot of time to get the first visible character because - * all the previous characters needs to be checked to calculate the positions. - * This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line. - * Therefore the calculations can start from here.*/ -typedef struct _lv_draw_label_hint_t { - /** Index of the line at `y` coordinate*/ - int32_t line_start; - - /** Give the `y` coordinate of the first letter at `line start` index. Relative to the label's coordinates*/ - int32_t y; - - /** The 'y1' coordinate of the label when the hint was saved. - * Used to invalidate the hint if the label has moved too much.*/ - int32_t coord_y; -} lv_draw_label_hint_t; - typedef struct { lv_draw_dsc_base_t base; @@ -72,17 +55,6 @@ typedef struct { lv_draw_label_hint_t * hint; } lv_draw_label_dsc_t; -typedef struct { - void * glyph_data; /*Depends on `format` field, it could be image source or draw buf of bitmap or vector data.*/ - lv_font_glyph_format_t format; - const lv_area_t * letter_coords; - const lv_area_t * bg_coords; - const lv_font_glyph_dsc_t * g; - lv_color_t color; - lv_opa_t opa; - lv_draw_buf_t * _draw_buf; /*a shared draw buf for get_bitmap, do not use it directly, use glyph_data instead*/ -} lv_draw_glyph_dsc_t; - /** * Passed as a parameter to `lv_draw_label_iterate_characters` to * draw the characters one by one diff --git a/src/draw/lv_draw_label_private.h b/src/draw/lv_draw_label_private.h new file mode 100644 index 000000000..03b68d774 --- /dev/null +++ b/src/draw/lv_draw_label_private.h @@ -0,0 +1,68 @@ +/** + * @file lv_draw_label_private.h + * + */ + +#ifndef LV_DRAW_LABEL_PRIVATE_H +#define LV_DRAW_LABEL_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_label.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** Store some info to speed up drawing of very large texts + * It takes a lot of time to get the first visible character because + * all the previous characters needs to be checked to calculate the positions. + * This structure stores an earlier (e.g. at -1000 px) coordinate and the index of that line. + * Therefore the calculations can start from here.*/ +struct lv_draw_label_hint_t { + /** Index of the line at `y` coordinate*/ + int32_t line_start; + + /** Give the `y` coordinate of the first letter at `line start` index. Relative to the label's coordinates*/ + int32_t y; + + /** The 'y1' coordinate of the label when the hint was saved. + * Used to invalidate the hint if the label has moved too much.*/ + int32_t coord_y; +}; + +struct lv_draw_glyph_dsc_t { + void * glyph_data; /*Depends on `format` field, it could be image source or draw buf of bitmap or vector data.*/ + lv_font_glyph_format_t format; + const lv_area_t * letter_coords; + const lv_area_t * bg_coords; + const lv_font_glyph_dsc_t * g; + lv_color_t color; + lv_opa_t opa; + lv_draw_buf_t * _draw_buf; /*a shared draw buf for get_bitmap, do not use it directly, use glyph_data instead*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_LABEL_PRIVATE_H*/ diff --git a/src/draw/lv_draw_line.c b/src/draw/lv_draw_line.c index 694cb2198..51d3040b2 100644 --- a/src/draw/lv_draw_line.c +++ b/src/draw/lv_draw_line.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "lv_draw_private.h" #include "../core/lv_refr.h" #include "../misc/lv_math.h" #include "../misc/lv_types.h" diff --git a/src/draw/lv_draw_mask.c b/src/draw/lv_draw_mask.c index 11cdaf287..e9140da51 100644 --- a/src/draw/lv_draw_mask.c +++ b/src/draw/lv_draw_mask.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_draw_mask.h" +#include "lv_draw_private.h" +#include "lv_draw_mask_private.h" #include "../core/lv_refr.h" #include "../misc/lv_math.h" #include "../misc/lv_types.h" diff --git a/src/draw/lv_draw_mask.h b/src/draw/lv_draw_mask.h index e471b4c37..410c0dbd3 100644 --- a/src/draw/lv_draw_mask.h +++ b/src/draw/lv_draw_mask.h @@ -23,16 +23,6 @@ extern "C" { *********************/ /********************** - * TYPEDEFS - **********************/ -typedef struct { - lv_draw_dsc_base_t base; - - lv_area_t area; - int32_t radius; -} lv_draw_mask_rect_dsc_t; - -/********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/draw/lv_draw_mask_private.h b/src/draw/lv_draw_mask_private.h new file mode 100644 index 000000000..efb282b08 --- /dev/null +++ b/src/draw/lv_draw_mask_private.h @@ -0,0 +1,50 @@ +/** + * @file lv_draw_mask_private.h + * + */ + +#ifndef LV_DRAW_MASK_PRIVATE_H +#define LV_DRAW_MASK_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_mask.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ +struct lv_draw_mask_rect_dsc_t { + lv_draw_dsc_base_t base; + + lv_area_t area; + int32_t radius; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_MASK_PRIVATE_H*/ diff --git a/src/draw/lv_draw_private.h b/src/draw/lv_draw_private.h new file mode 100644 index 000000000..efebd66e1 --- /dev/null +++ b/src/draw/lv_draw_private.h @@ -0,0 +1,146 @@ +/** + * @file lv_draw_private.h + * + */ + +#ifndef LV_DRAW_PRIVATE_H +#define LV_DRAW_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_draw_task_t { + lv_draw_task_t * next; + + lv_draw_task_type_t type; + + /** + * The area where to draw + */ + lv_area_t area; + + /** + * The real draw area. E.g. for shadow, outline, or transformed images it's different from `area` + */ + lv_area_t _real_area; + + /** The original area which is updated*/ + lv_area_t clip_area_original; + + /** + * The clip area of the layer is saved here when the draw task is created. + * As the clip area of the layer can be changed as new draw tasks are added its current value needs to be saved. + * Therefore during drawing the layer's clip area shouldn't be used as it might be already changed for other draw tasks. + */ + lv_area_t clip_area; + +#if LV_DRAW_TRANSFORM_USE_MATRIX + /** Transform matrix to be applied when rendering the layer */ + lv_matrix_t matrix; +#endif + + volatile int state; /*int instead of lv_draw_task_state_t to be sure its atomic*/ + + void * draw_dsc; + + /** + * The ID of the draw_unit which should take this task + */ + uint8_t preferred_draw_unit_id; + + /** + * Set to which extent `preferred_draw_unit_id` is good at this task. + * 80: means 20% better (faster) than software rendering + * 100: the default value + * 110: means 10% worse (slower) than software rendering + */ + uint8_t preference_score; + +}; + +struct lv_draw_mask_t { + void * user_data; +}; + +struct lv_draw_unit_t { + lv_draw_unit_t * next; + + /** + * The target_layer on which drawing should happen + */ + lv_layer_t * target_layer; + + const lv_area_t * clip_area; + + /** + * Called to try to assign a draw task to itself. + * `lv_draw_get_next_available_task` can be used to get an independent draw task. + * A draw task should be assign only if the draw unit can draw it too + * @param draw_unit pointer to the draw unit + * @param layer pointer to a layer on which the draw task should be drawn + * @return >=0: The number of taken draw task: + * 0 means the task has not yet been completed. + * 1 means a new task has been accepted. + * -1: The draw unit wanted to work on a task but couldn't do that + * due to some errors (e.g. out of memory). + * It signals that LVGL should call the dispatcher later again + * to let draw unit try to start the rendering again. + */ + int32_t (*dispatch_cb)(lv_draw_unit_t * draw_unit, lv_layer_t * layer); + + /** + * + * @param draw_unit + * @param task + * @return + */ + int32_t (*evaluate_cb)(lv_draw_unit_t * draw_unit, lv_draw_task_t * task); + + /** + * Called to delete draw unit. + * @param draw_unit + * @return + */ + int32_t (*delete_cb)(lv_draw_unit_t * draw_unit); +}; + +typedef struct { + lv_draw_unit_t * unit_head; + uint32_t used_memory_for_layers_kb; +#if LV_USE_OS + lv_thread_sync_t sync; +#else + int dispatch_req; +#endif + lv_mutex_t circle_cache_mutex; + bool task_running; +} lv_draw_global_info_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_PRIVATE_H*/ diff --git a/src/draw/lv_draw_rect.c b/src/draw/lv_draw_rect.c index 1fe7f8313..96439e320 100644 --- a/src/draw/lv_draw_rect.c +++ b/src/draw/lv_draw_rect.c @@ -6,8 +6,9 @@ /********************* * INCLUDES *********************/ +#include "lv_draw_private.h" #include "../core/lv_obj.h" -#include "lv_draw_rect.h" +#include "lv_draw_rect_private.h" #include "../misc/lv_assert.h" #include "../core/lv_obj_event.h" #include "../stdlib/lv_string.h" diff --git a/src/draw/lv_draw_rect_private.h b/src/draw/lv_draw_rect_private.h new file mode 100644 index 000000000..ad75b5355 --- /dev/null +++ b/src/draw/lv_draw_rect_private.h @@ -0,0 +1,39 @@ +/** + * @file lv_draw_rect_private.h + * + */ + +#ifndef LV_DRAW_RECT_PRIVATE_H +#define LV_DRAW_RECT_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_rect.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_RECT_PRIVATE_H*/ diff --git a/src/draw/lv_draw_triangle.c b/src/draw/lv_draw_triangle.c index fba369abc..8022d966a 100644 --- a/src/draw/lv_draw_triangle.c +++ b/src/draw/lv_draw_triangle.c @@ -6,8 +6,9 @@ /********************* * INCLUDES *********************/ +#include "lv_draw_private.h" #include "../core/lv_obj.h" -#include "lv_draw_triangle.h" +#include "lv_draw_triangle_private.h" #include "../misc/lv_math.h" #include "../stdlib/lv_mem.h" #include "../stdlib/lv_string.h" diff --git a/src/draw/lv_draw_triangle_private.h b/src/draw/lv_draw_triangle_private.h new file mode 100644 index 000000000..7fc8ed5a2 --- /dev/null +++ b/src/draw/lv_draw_triangle_private.h @@ -0,0 +1,43 @@ +/** + * @file lv_draw_triangle_private.h + * + */ + +#ifndef LV_DRAW_TRIANGLE_PRIVATE_H +#define LV_DRAW_TRIANGLE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_triangle.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_TRIANGLE_PRIVATE_H*/ diff --git a/src/draw/lv_draw_vector.c b/src/draw/lv_draw_vector.c index bcf3ced7e..d6d3cdfa7 100644 --- a/src/draw/lv_draw_vector.c +++ b/src/draw/lv_draw_vector.c @@ -4,9 +4,11 @@ */ /********************* -* INCLUDES + * INCLUDES *********************/ -#include "lv_draw_vector.h" +#include "../misc/lv_area_private.h" +#include "lv_draw_private.h" +#include "lv_draw_vector_private.h" #if LV_USE_VECTOR_GRAPHIC @@ -26,7 +28,7 @@ #define MATH_DEGREES(rad) ((rad) * RAD_TO_DEG) /********************* -* DEFINES + * DEFINES *********************/ #ifndef M_PI @@ -44,16 +46,16 @@ } while(0) /********************** -* TYPEDEFS + * TYPEDEFS **********************/ typedef struct { lv_vector_path_t * path; lv_vector_draw_dsc_t dsc; -} _lv_vector_draw_task; +} lv_vector_draw_task; /********************** -* STATIC PROTOTYPES + * STATIC PROTOTYPES **********************/ static void _copy_draw_dsc(lv_vector_draw_dsc_t * dst, const lv_vector_draw_dsc_t * src) @@ -81,7 +83,7 @@ static void _copy_draw_dsc(lv_vector_draw_dsc_t * dst, const lv_vector_draw_dsc_ lv_area_copy(&(dst->scissor_area), &(src->scissor_area)); } /********************** -* GLOBAL FUNCTIONS + * GLOBAL FUNCTIONS **********************/ void lv_matrix_transform_point(const lv_matrix_t * matrix, lv_fpoint_t * point) @@ -109,7 +111,7 @@ lv_vector_path_t * lv_vector_path_create(lv_vector_path_quality_t quality) LV_ASSERT_MALLOC(path); lv_memzero(path, sizeof(lv_vector_path_t)); path->quality = quality; - lv_array_init(&path->ops, 8, sizeof(uint8_t)); + lv_array_init(&path->ops, 8, sizeof(lv_vector_path_op_t)); lv_array_init(&path->points, 8, sizeof(lv_fpoint_t)); return path; } @@ -138,7 +140,7 @@ void lv_vector_path_move_to(lv_vector_path_t * path, const lv_fpoint_t * p) { CHECK_AND_RESIZE_PATH_CONTAINER(path, 1); - uint8_t op = LV_VECTOR_PATH_OP_MOVE_TO; + lv_vector_path_op_t op = LV_VECTOR_PATH_OP_MOVE_TO; lv_array_push_back(&path->ops, &op); lv_array_push_back(&path->points, p); } @@ -152,7 +154,7 @@ void lv_vector_path_line_to(lv_vector_path_t * path, const lv_fpoint_t * p) CHECK_AND_RESIZE_PATH_CONTAINER(path, 1); - uint8_t op = LV_VECTOR_PATH_OP_LINE_TO; + lv_vector_path_op_t op = LV_VECTOR_PATH_OP_LINE_TO; lv_array_push_back(&path->ops, &op); lv_array_push_back(&path->points, p); } @@ -166,7 +168,7 @@ void lv_vector_path_quad_to(lv_vector_path_t * path, const lv_fpoint_t * p1, con CHECK_AND_RESIZE_PATH_CONTAINER(path, 2); - uint8_t op = LV_VECTOR_PATH_OP_QUAD_TO; + lv_vector_path_op_t op = LV_VECTOR_PATH_OP_QUAD_TO; lv_array_push_back(&path->ops, &op); lv_array_push_back(&path->points, p1); lv_array_push_back(&path->points, p2); @@ -182,7 +184,7 @@ void lv_vector_path_cubic_to(lv_vector_path_t * path, const lv_fpoint_t * p1, co CHECK_AND_RESIZE_PATH_CONTAINER(path, 3); - uint8_t op = LV_VECTOR_PATH_OP_CUBIC_TO; + lv_vector_path_op_t op = LV_VECTOR_PATH_OP_CUBIC_TO; lv_array_push_back(&path->ops, &op); lv_array_push_back(&path->points, p1); lv_array_push_back(&path->points, p2); @@ -198,7 +200,7 @@ void lv_vector_path_close(lv_vector_path_t * path) CHECK_AND_RESIZE_PATH_CONTAINER(path, 1); - uint8_t op = LV_VECTOR_PATH_OP_CLOSE; + lv_vector_path_op_t op = LV_VECTOR_PATH_OP_CLOSE; lv_array_push_back(&path->ops, &op); } @@ -500,7 +502,7 @@ void lv_vector_dsc_delete(lv_vector_dsc_t * dsc) { if(dsc->tasks.task_list) { lv_ll_t * task_list = dsc->tasks.task_list; - _lv_vector_for_each_destroy_tasks(task_list, NULL, NULL); + lv_vector_for_each_destroy_tasks(task_list, NULL, NULL); dsc->tasks.task_list = NULL; } lv_array_deinit(&(dsc->current_dsc.stroke_dsc.dash_pattern)); @@ -688,7 +690,7 @@ void lv_vector_dsc_set_stroke_gradient_color_stops(lv_vector_dsc_t * dsc, const void lv_vector_dsc_add_path(lv_vector_dsc_t * dsc, const lv_vector_path_t * path) { lv_area_t rect; - if(!_lv_area_intersect(&rect, &(dsc->layer->_clip_area), &(dsc->current_dsc.scissor_area))) { + if(!lv_area_intersect(&rect, &(dsc->layer->_clip_area), &(dsc->current_dsc.scissor_area))) { return; } @@ -700,11 +702,11 @@ void lv_vector_dsc_add_path(lv_vector_dsc_t * dsc, const lv_vector_path_t * path if(!dsc->tasks.task_list) { dsc->tasks.task_list = lv_malloc(sizeof(lv_ll_t)); LV_ASSERT_MALLOC(dsc->tasks.task_list); - _lv_ll_init(dsc->tasks.task_list, sizeof(_lv_vector_draw_task)); + lv_ll_init(dsc->tasks.task_list, sizeof(lv_vector_draw_task)); } - _lv_vector_draw_task * new_task = (_lv_vector_draw_task *)_lv_ll_ins_tail(dsc->tasks.task_list); - lv_memset(new_task, 0, sizeof(_lv_vector_draw_task)); + lv_vector_draw_task * new_task = (lv_vector_draw_task *)lv_ll_ins_tail(dsc->tasks.task_list); + lv_memset(new_task, 0, sizeof(lv_vector_draw_task)); new_task->path = lv_vector_path_create(0); @@ -716,18 +718,18 @@ void lv_vector_dsc_add_path(lv_vector_dsc_t * dsc, const lv_vector_path_t * path void lv_vector_clear_area(lv_vector_dsc_t * dsc, const lv_area_t * rect) { lv_area_t r; - if(!_lv_area_intersect(&r, &(dsc->layer->_clip_area), &(dsc->current_dsc.scissor_area))) { + if(!lv_area_intersect(&r, &(dsc->layer->_clip_area), &(dsc->current_dsc.scissor_area))) { return; } if(!dsc->tasks.task_list) { dsc->tasks.task_list = lv_malloc(sizeof(lv_ll_t)); LV_ASSERT_MALLOC(dsc->tasks.task_list); - _lv_ll_init(dsc->tasks.task_list, sizeof(_lv_vector_draw_task)); + lv_ll_init(dsc->tasks.task_list, sizeof(lv_vector_draw_task)); } - _lv_vector_draw_task * new_task = (_lv_vector_draw_task *)_lv_ll_ins_tail(dsc->tasks.task_list); - lv_memset(new_task, 0, sizeof(_lv_vector_draw_task)); + lv_vector_draw_task * new_task = (lv_vector_draw_task *)lv_ll_ins_tail(dsc->tasks.task_list); + lv_memset(new_task, 0, sizeof(lv_vector_draw_task)); new_task->dsc.fill_dsc.color = dsc->current_dsc.fill_dsc.color; new_task->dsc.fill_dsc.opa = dsc->current_dsc.fill_dsc.opa; @@ -776,14 +778,14 @@ void lv_vector_dsc_skew(lv_vector_dsc_t * dsc, float skew_x, float skew_y) lv_matrix_skew(&(dsc->current_dsc.matrix), skew_x, skew_y); } -void _lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data) +void lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data) { - _lv_vector_draw_task * task = _lv_ll_get_head(task_list); - _lv_vector_draw_task * next_task = NULL; + lv_vector_draw_task * task = lv_ll_get_head(task_list); + lv_vector_draw_task * next_task = NULL; while(task != NULL) { - next_task = _lv_ll_get_next(task_list, task); - _lv_ll_remove(task_list, task); + next_task = lv_ll_get_next(task_list, task); + lv_ll_remove(task_list, task); if(cb) { cb(data, task->path, &(task->dsc)); diff --git a/src/draw/lv_draw_vector.h b/src/draw/lv_draw_vector.h index 83c66b4f7..06ce53ac5 100644 --- a/src/draw/lv_draw_vector.h +++ b/src/draw/lv_draw_vector.h @@ -26,34 +26,30 @@ extern "C" { /********************** * TYPEDEFS **********************/ -enum { +typedef enum { LV_VECTOR_FILL_NONZERO = 0, LV_VECTOR_FILL_EVENODD, -}; -typedef uint8_t lv_vector_fill_t; +} lv_vector_fill_t; -enum { +typedef enum { LV_VECTOR_STROKE_CAP_BUTT = 0, LV_VECTOR_STROKE_CAP_SQUARE, LV_VECTOR_STROKE_CAP_ROUND, -}; -typedef uint8_t lv_vector_stroke_cap_t; +} lv_vector_stroke_cap_t; -enum { +typedef enum { LV_VECTOR_STROKE_JOIN_MITER = 0, LV_VECTOR_STROKE_JOIN_BEVEL, LV_VECTOR_STROKE_JOIN_ROUND, -}; -typedef uint8_t lv_vector_stroke_join_t; +} lv_vector_stroke_join_t; -enum { +typedef enum { LV_VECTOR_PATH_QUALITY_MEDIUM = 0, /* default*/ LV_VECTOR_PATH_QUALITY_HIGH, LV_VECTOR_PATH_QUALITY_LOW, -}; -typedef uint8_t lv_vector_path_quality_t; +} lv_vector_path_quality_t; -enum { +typedef enum { LV_VECTOR_BLEND_SRC_OVER = 0, LV_VECTOR_BLEND_SRC_IN, LV_VECTOR_BLEND_DST_OVER, @@ -63,105 +59,37 @@ enum { LV_VECTOR_BLEND_NONE, LV_VECTOR_BLEND_ADDITIVE, LV_VECTOR_BLEND_SUBTRACTIVE, -}; -typedef uint8_t lv_vector_blend_t; +} lv_vector_blend_t; -enum { +typedef enum { LV_VECTOR_PATH_OP_MOVE_TO = 0, LV_VECTOR_PATH_OP_LINE_TO, LV_VECTOR_PATH_OP_QUAD_TO, LV_VECTOR_PATH_OP_CUBIC_TO, LV_VECTOR_PATH_OP_CLOSE, -}; -typedef uint8_t lv_vector_path_op_t; +} lv_vector_path_op_t; -enum { +typedef enum { LV_VECTOR_DRAW_STYLE_SOLID = 0, LV_VECTOR_DRAW_STYLE_PATTERN, LV_VECTOR_DRAW_STYLE_GRADIENT, -}; -typedef uint8_t lv_vector_draw_style_t; +} lv_vector_draw_style_t; -enum { +typedef enum { LV_VECTOR_GRADIENT_SPREAD_PAD = 0, LV_VECTOR_GRADIENT_SPREAD_REPEAT, LV_VECTOR_GRADIENT_SPREAD_REFLECT, -}; -typedef uint8_t lv_vector_gradient_spread_t; +} lv_vector_gradient_spread_t; -enum { +typedef enum { LV_VECTOR_GRADIENT_STYLE_LINEAR = 0, LV_VECTOR_GRADIENT_STYLE_RADIAL, -}; -typedef uint8_t lv_vector_gradient_style_t; +} lv_vector_gradient_style_t; -typedef struct { +struct lv_fpoint_t { float x; float y; -} lv_fpoint_t; - -typedef struct { - lv_vector_path_quality_t quality; - lv_array_t ops; - lv_array_t points; -} lv_vector_path_t; - -typedef struct { - lv_vector_gradient_style_t style; - lv_gradient_stop_t stops[LV_GRADIENT_MAX_STOPS]; /**< A gradient stop array */ - uint16_t stops_count; /**< The number of used stops in the array */ - float x1; - float y1; - float x2; - float y2; - float cx; - float cy; - float cr; - lv_vector_gradient_spread_t spread; -} lv_vector_gradient_t; - -typedef struct { - lv_vector_draw_style_t style; - lv_color32_t color; - lv_opa_t opa; - lv_vector_fill_t fill_rule; - lv_draw_image_dsc_t img_dsc; - lv_vector_gradient_t gradient; - lv_matrix_t matrix; -} lv_vector_fill_dsc_t; - -typedef struct { - lv_vector_draw_style_t style; - lv_color32_t color; - lv_opa_t opa; - float width; - lv_array_t dash_pattern; - lv_vector_stroke_cap_t cap; - lv_vector_stroke_join_t join; - uint16_t miter_limit; - lv_vector_gradient_t gradient; - lv_matrix_t matrix; -} lv_vector_stroke_dsc_t; - -typedef struct { - lv_vector_fill_dsc_t fill_dsc; - lv_vector_stroke_dsc_t stroke_dsc; - lv_matrix_t matrix; - lv_vector_blend_t blend_mode; - lv_area_t scissor_area; -} lv_vector_draw_dsc_t; - -typedef struct { - lv_draw_dsc_base_t base; - lv_ll_t * task_list; /*draw task list.*/ -} lv_draw_vector_task_dsc_t; - -typedef struct { - lv_layer_t * layer; - lv_vector_draw_dsc_t current_dsc; - /* private data */ - lv_draw_vector_task_dsc_t tasks; -} lv_vector_dsc_t; +}; /********************** * GLOBAL PROTOTYPES @@ -552,8 +480,6 @@ void lv_draw_vector(lv_vector_dsc_t * dsc); /* Traverser for task list */ typedef void (*vector_draw_task_cb)(void * ctx, const lv_vector_path_t * path, const lv_vector_draw_dsc_t * dsc); -void _lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data); - #endif /* LV_USE_VECTOR_GRAPHIC */ #ifdef __cplusplus diff --git a/src/draw/lv_draw_vector_private.h b/src/draw/lv_draw_vector_private.h new file mode 100644 index 000000000..5257a301e --- /dev/null +++ b/src/draw/lv_draw_vector_private.h @@ -0,0 +1,109 @@ +/** + * @file lv_draw_vector_private.h + * + */ + +#ifndef LV_DRAW_VECTOR_PRIVATE_H +#define LV_DRAW_VECTOR_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_vector.h" + +#if LV_USE_VECTOR_GRAPHIC + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_vector_path_t { + lv_vector_path_quality_t quality; + lv_array_t ops; + lv_array_t points; +}; + +struct lv_vector_gradient_t { + lv_vector_gradient_style_t style; + lv_gradient_stop_t stops[LV_GRADIENT_MAX_STOPS]; /**< A gradient stop array */ + uint16_t stops_count; /**< The number of used stops in the array */ + float x1; + float y1; + float x2; + float y2; + float cx; + float cy; + float cr; + lv_vector_gradient_spread_t spread; +}; + +struct lv_vector_fill_dsc_t { + lv_vector_draw_style_t style; + lv_color32_t color; + lv_opa_t opa; + lv_vector_fill_t fill_rule; + lv_draw_image_dsc_t img_dsc; + lv_vector_gradient_t gradient; + lv_matrix_t matrix; +}; + +struct lv_vector_stroke_dsc_t { + lv_vector_draw_style_t style; + lv_color32_t color; + lv_opa_t opa; + float width; + lv_array_t dash_pattern; + lv_vector_stroke_cap_t cap; + lv_vector_stroke_join_t join; + uint16_t miter_limit; + lv_vector_gradient_t gradient; + lv_matrix_t matrix; +}; + +struct lv_vector_draw_dsc_t { + lv_vector_fill_dsc_t fill_dsc; + lv_vector_stroke_dsc_t stroke_dsc; + lv_matrix_t matrix; + lv_vector_blend_t blend_mode; + lv_area_t scissor_area; +}; + +struct lv_draw_vector_task_dsc_t { + lv_draw_dsc_base_t base; + lv_ll_t * task_list; /*draw task list.*/ +}; + +struct lv_vector_dsc_t { + lv_layer_t * layer; + lv_vector_draw_dsc_t current_dsc; + /* private data */ + lv_draw_vector_task_dsc_t tasks; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +void lv_vector_for_each_destroy_tasks(lv_ll_t * task_list, vector_draw_task_cb cb, void * data); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_VECTOR_GRAPHIC */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_VECTOR_PRIVATE_H*/ diff --git a/src/draw/lv_image_decoder.c b/src/draw/lv_image_decoder.c index 3682ce427..308939dde 100644 --- a/src/draw/lv_image_decoder.c +++ b/src/draw/lv_image_decoder.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_image_decoder.h" +#include "lv_image_decoder_private.h" #include "../misc/lv_assert.h" #include "../draw/lv_draw_image.h" #include "../misc/lv_ll.h" @@ -56,9 +56,9 @@ static lv_result_t try_cache(lv_image_decoder_dsc_t * dsc); /** * Initialize the image decoder module */ -void _lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_count) +void lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_count) { - _lv_ll_init(img_decoder_ll_p, sizeof(lv_image_decoder_t)); + lv_ll_init(img_decoder_ll_p, sizeof(lv_image_decoder_t)); /*Initialize the cache*/ lv_image_cache_init(image_cache_size); @@ -68,12 +68,12 @@ void _lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_cou /** * Deinitialize the image decoder module */ -void _lv_image_decoder_deinit(void) +void lv_image_decoder_deinit(void) { lv_cache_destroy(img_cache_p, NULL); lv_cache_destroy(img_header_cache_p, NULL); - _lv_ll_clear(img_decoder_ll_p); + lv_ll_clear(img_decoder_ll_p); } lv_result_t lv_image_decoder_get_info(const void * src, lv_image_header_t * header) @@ -171,7 +171,7 @@ void lv_image_decoder_close(lv_image_decoder_dsc_t * dsc) lv_image_decoder_t * lv_image_decoder_create(void) { lv_image_decoder_t * decoder; - decoder = _lv_ll_ins_head(img_decoder_ll_p); + decoder = lv_ll_ins_head(img_decoder_ll_p); LV_ASSERT_MALLOC(decoder); if(decoder == NULL) return NULL; @@ -182,16 +182,16 @@ lv_image_decoder_t * lv_image_decoder_create(void) void lv_image_decoder_delete(lv_image_decoder_t * decoder) { - _lv_ll_remove(img_decoder_ll_p, decoder); + lv_ll_remove(img_decoder_ll_p, decoder); lv_free(decoder); } lv_image_decoder_t * lv_image_decoder_get_next(lv_image_decoder_t * decoder) { if(decoder == NULL) - return _lv_ll_get_head(img_decoder_ll_p); + return lv_ll_get_head(img_decoder_ll_p); else - return _lv_ll_get_next(img_decoder_ll_p, decoder); + return lv_ll_get_next(img_decoder_ll_p, decoder); } void lv_image_decoder_set_info_cb(lv_image_decoder_t * decoder, lv_image_decoder_info_f_t info_cb) @@ -336,7 +336,7 @@ static lv_image_decoder_t * image_decoder_get_info(lv_image_decoder_dsc_t * dsc, /*Search the decoders*/ lv_image_decoder_t * decoder_prev = NULL; - _LV_LL_READ(img_decoder_ll_p, decoder) { + LV_LL_READ(img_decoder_ll_p, decoder) { /*Info and Open callbacks are required*/ if(decoder->info_cb && decoder->open_cb) { lv_fs_seek(&dsc->file, 0, LV_FS_SEEK_SET); diff --git a/src/draw/lv_image_decoder.h b/src/draw/lv_image_decoder.h index 411bd2cb1..ad2ffd152 100644 --- a/src/draw/lv_image_decoder.h +++ b/src/draw/lv_image_decoder.h @@ -31,39 +31,12 @@ extern "C" { /** * Source of image.*/ -enum _lv_image_src_t { +typedef enum { LV_IMAGE_SRC_VARIABLE, /** Binary/C variable*/ LV_IMAGE_SRC_FILE, /** File in filesystem*/ LV_IMAGE_SRC_SYMBOL, /** Symbol (@ref lv_symbol_def.h)*/ LV_IMAGE_SRC_UNKNOWN, /** Unknown source*/ -}; - -#ifdef DOXYGEN -typedef _lv_image_src_t lv_image_src_t; -#else -typedef uint8_t lv_image_src_t; -#endif /*DOXYGEN*/ - -/*Decoder function definitions*/ -struct _lv_image_decoder_dsc_t; -typedef struct _lv_image_decoder_dsc_t lv_image_decoder_dsc_t; - -/** - * Image decoder args. - * It determines how to decoder an image, e.g. whether to premultiply the alpha or not. - * It should be passed to lv_img_decoder_open() function. If NULL is provided, default - * args are used. - * - * Default args: - * all field are zero or false. - */ -typedef struct _lv_image_decoder_args_t { - bool stride_align; /*Whether stride should be aligned*/ - bool premultiply; /*Whether image should be premultiplied or not after decoding*/ - bool no_cache; /*When set, decoded image won't be put to cache, and decoder open will also ignore cache.*/ - bool use_indexed; /*Decoded indexed image as is. Convert to ARGB8888 if false.*/ - bool flush_cache; /*Whether to flush the data cache after decoding*/ -} lv_image_decoder_args_t; +} lv_image_src_t; /** * Get info from an image and store in the `header` @@ -103,96 +76,11 @@ typedef lv_result_t (*lv_image_decoder_get_area_cb_t)(lv_image_decoder_t * decod */ typedef void (*lv_image_decoder_close_f_t)(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc); -struct _lv_image_decoder_t { - lv_image_decoder_info_f_t info_cb; - lv_image_decoder_open_f_t open_cb; - lv_image_decoder_get_area_cb_t get_area_cb; - lv_image_decoder_close_f_t close_cb; - - const char * name; - - void * user_data; -}; - -typedef struct _lv_image_decoder_cache_data_t { - lv_cache_slot_size_t slot; - - const void * src; - lv_image_src_t src_type; - - const lv_draw_buf_t * decoded; - const lv_image_decoder_t * decoder; - void * user_data; -} lv_image_cache_data_t; - -typedef struct _lv_image_decoder_header_cache_data_t { - const void * src; - lv_image_src_t src_type; - - lv_image_header_t header; - lv_image_decoder_t * decoder; -} lv_image_header_cache_data_t; - -/**Describe an image decoding session. Stores data about the decoding*/ -struct _lv_image_decoder_dsc_t { - /**The decoder which was able to open the image source*/ - lv_image_decoder_t * decoder; - - /**A copy of parameters of how this image is decoded*/ - lv_image_decoder_args_t args; - - /**The image source. A file path like "S:my_img.png" or pointer to an `lv_image_dsc_t` variable*/ - const void * src; - - /**Type of the source: file or variable. Can be set in `open` function if required*/ - lv_image_src_t src_type; - - lv_fs_file_t file; - - /**Info about the opened image: color format, size, etc. MUST be set in `open` function*/ - lv_image_header_t header; - - /** Pointer to a draw buffer where the image's data (pixels) are stored in a decoded, plain format. - * MUST be set in `open` or `get_area_cb`function*/ - const lv_draw_buf_t * decoded; - - const lv_color32_t * palette; - uint32_t palette_size; - - /** How much time did it take to open the image. [ms] - * If not set `lv_image_cache` will measure and set the time to open*/ - uint32_t time_to_open; - - /**A text to display instead of the image when the image can't be opened. - * Can be set in `open` function or set NULL.*/ - const char * error_msg; - - lv_cache_t * cache; - - /**Point to cache entry information*/ - lv_cache_entry_t * cache_entry; - - /**Store any custom data here is required*/ - void * user_data; -}; - /********************** * GLOBAL PROTOTYPES **********************/ /** - * Initialize the image decoder module - * @param image_cache_size Image cache size in bytes. 0 to disable cache. - * @param image_header_count Number of header cache entries. 0 to disable header cache. - */ -void _lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_count); - -/** - * Deinitialize the image decoder module - */ -void _lv_image_decoder_deinit(void); - -/** * Get information about an image. * Try the created image decoder one by one. Once one is able to get info that info will be used. * @param src the image source. Can be diff --git a/src/draw/lv_image_decoder_private.h b/src/draw/lv_image_decoder_private.h new file mode 100644 index 000000000..1005176a6 --- /dev/null +++ b/src/draw/lv_image_decoder_private.h @@ -0,0 +1,142 @@ +/** + * @file lv_image_decoder_private.h + * + */ + +#ifndef LV_IMAGE_DECODER_PRIVATE_H +#define LV_IMAGE_DECODER_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_image_decoder.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Image decoder args. + * It determines how to decoder an image, e.g. whether to premultiply the alpha or not. + * It should be passed to lv_img_decoder_open() function. If NULL is provided, default + * args are used. + * + * Default args: + * all field are zero or false. + */ +struct lv_image_decoder_args_t { + bool stride_align; /*Whether stride should be aligned*/ + bool premultiply; /*Whether image should be premultiplied or not after decoding*/ + bool no_cache; /*When set, decoded image won't be put to cache, and decoder open will also ignore cache.*/ + bool use_indexed; /*Decoded indexed image as is. Convert to ARGB8888 if false.*/ + bool flush_cache; /*Whether to flush the data cache after decoding*/ +}; + +struct lv_image_decoder_t { + lv_image_decoder_info_f_t info_cb; + lv_image_decoder_open_f_t open_cb; + lv_image_decoder_get_area_cb_t get_area_cb; + lv_image_decoder_close_f_t close_cb; + + const char * name; + + void * user_data; +}; + +struct lv_image_cache_data_t { + lv_cache_slot_size_t slot; + + const void * src; + lv_image_src_t src_type; + + const lv_draw_buf_t * decoded; + const lv_image_decoder_t * decoder; + void * user_data; +}; + +struct lv_image_header_cache_data_t { + const void * src; + lv_image_src_t src_type; + + lv_image_header_t header; + lv_image_decoder_t * decoder; +}; + +/**Describe an image decoding session. Stores data about the decoding*/ +struct lv_image_decoder_dsc_t { + /**The decoder which was able to open the image source*/ + lv_image_decoder_t * decoder; + + /**A copy of parameters of how this image is decoded*/ + lv_image_decoder_args_t args; + + /**The image source. A file path like "S:my_img.png" or pointer to an `lv_image_dsc_t` variable*/ + const void * src; + + /**Type of the source: file or variable. Can be set in `open` function if required*/ + lv_image_src_t src_type; + + lv_fs_file_t file; + + /**Info about the opened image: color format, size, etc. MUST be set in `open` function*/ + lv_image_header_t header; + + /** Pointer to a draw buffer where the image's data (pixels) are stored in a decoded, plain format. + * MUST be set in `open` or `get_area_cb`function*/ + const lv_draw_buf_t * decoded; + + const lv_color32_t * palette; + uint32_t palette_size; + + /** How much time did it take to open the image. [ms] + * If not set `lv_image_cache` will measure and set the time to open*/ + uint32_t time_to_open; + + /**A text to display instead of the image when the image can't be opened. + * Can be set in `open` function or set NULL.*/ + const char * error_msg; + + lv_cache_t * cache; + + /**Point to cache entry information*/ + lv_cache_entry_t * cache_entry; + + /**Store any custom data here is required*/ + void * user_data; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the image decoder module + * @param image_cache_size Image cache size in bytes. 0 to disable cache. + * @param image_header_count Number of header cache entries. 0 to disable header cache. + */ +void lv_image_decoder_init(uint32_t image_cache_size, uint32_t image_header_count); + +/** + * Deinitialize the image decoder module + */ +void lv_image_decoder_deinit(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_IMAGE_DECODER_PRIVATE_H*/ diff --git a/src/draw/lv_image_dsc.h b/src/draw/lv_image_dsc.h index 7b2d9b951..567666a8d 100644 --- a/src/draw/lv_image_dsc.h +++ b/src/draw/lv_image_dsc.h @@ -29,7 +29,7 @@ LV_EXPORT_CONST_INT(LV_IMAGE_HEADER_MAGIC); * TYPEDEFS **********************/ -typedef enum _lv_image_flags_t { +typedef enum lv_image_flags_t { /** * For RGB map of the image data, mark if it's pre-multiplied with alpha. * For indexed image, this bit indicated palette data is pre-multiplied with alpha. diff --git a/src/draw/nxp/pxp/lv_draw_buf_pxp.c b/src/draw/nxp/pxp/lv_draw_buf_pxp.c index d3f99f8b0..e83da1ca3 100644 --- a/src/draw/nxp/pxp/lv_draw_buf_pxp.c +++ b/src/draw/nxp/pxp/lv_draw_buf_pxp.c @@ -16,6 +16,7 @@ #include "lv_draw_pxp.h" #if LV_USE_DRAW_PXP +#include "../../lv_draw_buf_private.h" #include "lv_pxp_cfg.h" #include "lv_pxp_utils.h" diff --git a/src/draw/nxp/pxp/lv_draw_pxp.c b/src/draw/nxp/pxp/lv_draw_pxp.c index 6a4250e00..f5b390f8a 100644 --- a/src/draw/nxp/pxp/lv_draw_pxp.c +++ b/src/draw/nxp/pxp/lv_draw_pxp.c @@ -376,7 +376,7 @@ static void _pxp_execute_drawing(lv_draw_pxp_unit_t * u) lv_draw_buf_t * draw_buf = layer->draw_buf; lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &t->area, draw_unit->clip_area)) + if(!lv_area_intersect(&draw_area, &t->area, draw_unit->clip_area)) return; /*Fully clipped, nothing to do*/ /* Make area relative to the buffer */ @@ -403,7 +403,7 @@ static void _pxp_execute_drawing(lv_draw_pxp_unit_t * u) /*Layers manage it for themselves*/ if(t->type != LV_DRAW_TASK_TYPE_LAYER) { lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area)) + if(!lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area)) return; int32_t idx = 0; @@ -414,7 +414,7 @@ static void _pxp_execute_drawing(lv_draw_pxp_unit_t * u) } lv_draw_rect_dsc_t rect_dsc; lv_draw_rect_dsc_init(&rect_dsc); - rect_dsc.bg_color = lv_palette_main(idx % _LV_PALETTE_LAST); + rect_dsc.bg_color = lv_palette_main(idx % LV_PALETTE_LAST); rect_dsc.border_color = rect_dsc.bg_color; rect_dsc.bg_opa = LV_OPA_10; rect_dsc.border_opa = LV_OPA_80; diff --git a/src/draw/nxp/pxp/lv_draw_pxp_fill.c b/src/draw/nxp/pxp/lv_draw_pxp_fill.c index 60873ede0..c75de3480 100644 --- a/src/draw/nxp/pxp/lv_draw_pxp_fill.c +++ b/src/draw/nxp/pxp/lv_draw_pxp_fill.c @@ -64,7 +64,7 @@ void lv_draw_pxp_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * dsc lv_area_move(&rel_clip_area, -layer->buf_area.x1, -layer->buf_area.y1); lv_area_t blend_area; - if(!_lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area)) + if(!lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area)) return; /*Fully clipped, nothing to do*/ _pxp_fill(draw_buf->data, &blend_area, draw_buf->header.stride, draw_buf->header.cf, dsc); diff --git a/src/draw/nxp/pxp/lv_draw_pxp_img.c b/src/draw/nxp/pxp/lv_draw_pxp_img.c index 6a4e997e1..08c0a8ad6 100644 --- a/src/draw/nxp/pxp/lv_draw_pxp_img.c +++ b/src/draw/nxp/pxp/lv_draw_pxp_img.c @@ -82,7 +82,7 @@ void lv_draw_pxp_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dsc bool has_transform = (dsc->rotation != 0 || dsc->scale_x != LV_SCALE_NONE || dsc->scale_y != LV_SCALE_NONE); if(has_transform) lv_area_copy(&blend_area, &rel_coords); - else if(!_lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area)) + else if(!lv_area_intersect(&blend_area, &rel_coords, &rel_clip_area)) return; /*Fully clipped, nothing to do*/ const uint8_t * src_buf = img_dsc->data; diff --git a/src/draw/nxp/pxp/lv_draw_pxp_layer.c b/src/draw/nxp/pxp/lv_draw_pxp_layer.c index 28245f964..4ee33010d 100644 --- a/src/draw/nxp/pxp/lv_draw_pxp_layer.c +++ b/src/draw/nxp/pxp/lv_draw_pxp_layer.c @@ -81,8 +81,8 @@ void lv_draw_pxp_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * d int32_t w = lv_area_get_width(coords); int32_t h = lv_area_get_height(coords); - _lv_image_buf_get_transformed_area(&area_rot, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y, - &draw_dsc->pivot); + lv_image_buf_get_transformed_area(&area_rot, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y, + &draw_dsc->pivot); area_rot.x1 += coords->x1; area_rot.y1 += coords->y1; @@ -90,7 +90,7 @@ void lv_draw_pxp_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * d area_rot.y2 += coords->y1; } lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &area_rot, draw_unit->clip_area)) return; + if(!lv_area_intersect(&draw_area, &area_rot, draw_unit->clip_area)) return; #endif #if LV_USE_LAYER_DEBUG @@ -119,13 +119,13 @@ void lv_draw_pxp_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * d lv_draw_fill_dsc_t fill_dsc; lv_draw_rect_dsc_init(&fill_dsc); - fill_dsc.color = lv_palette_main(idx % _LV_PALETTE_LAST); + fill_dsc.color = lv_palette_main(idx % LV_PALETTE_LAST); fill_dsc.opa = LV_OPA_10; lv_draw_sw_fill(draw_unit, &fill_dsc, &area_rot); lv_draw_border_dsc_t border_dsc; lv_draw_border_dsc_init(&border_dsc); - border_dsc.color = lv_palette_main(idx % _LV_PALETTE_LAST); + border_dsc.color = lv_palette_main(idx % LV_PALETTE_LAST); border_dsc.opa = LV_OPA_100; border_dsc.width = 2; lv_draw_sw_border(draw_unit, &border_dsc, &area_rot); diff --git a/src/draw/nxp/vglite/lv_draw_buf_vglite.c b/src/draw/nxp/vglite/lv_draw_buf_vglite.c index e97ef7781..ae9b59a5e 100644 --- a/src/draw/nxp/vglite/lv_draw_buf_vglite.c +++ b/src/draw/nxp/vglite/lv_draw_buf_vglite.c @@ -16,6 +16,7 @@ #include "lv_draw_vglite.h" #if LV_USE_DRAW_VGLITE +#include "../../lv_draw_buf_private.h" #include "lv_vglite_buf.h" #include "lv_vglite_utils.h" diff --git a/src/draw/nxp/vglite/lv_draw_vglite.c b/src/draw/nxp/vglite/lv_draw_vglite.c index ba73c2f66..e9d4114b5 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite.c +++ b/src/draw/nxp/vglite/lv_draw_vglite.c @@ -351,7 +351,7 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u) lv_area_copy(&draw_area, &t->area); lv_area_move(&draw_area, -layer->buf_area.x1, -layer->buf_area.y1); - if(!_lv_area_intersect(&draw_area, &draw_area, &clip_area)) + if(!lv_area_intersect(&draw_area, &draw_area, &clip_area)) return; /*Fully clipped, nothing to do*/ /* Invalidate the drawing area */ @@ -399,7 +399,7 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u) /*Layers manage it for themselves*/ if(t->type != LV_DRAW_TASK_TYPE_LAYER) { lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area)) + if(!lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area)) return; int32_t idx = 0; @@ -410,7 +410,7 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u) } lv_draw_rect_dsc_t rect_dsc; lv_draw_rect_dsc_init(&rect_dsc); - rect_dsc.bg_color = lv_palette_main(idx % _LV_PALETTE_LAST); + rect_dsc.bg_color = lv_palette_main(idx % LV_PALETTE_LAST); rect_dsc.border_color = rect_dsc.bg_color; rect_dsc.bg_opa = LV_OPA_10; rect_dsc.border_opa = LV_OPA_80; diff --git a/src/draw/nxp/vglite/lv_draw_vglite_border.c b/src/draw/nxp/vglite/lv_draw_vglite_border.c index b156223df..db762fb61 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_border.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_border.c @@ -91,7 +91,7 @@ void lv_draw_vglite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc_ lv_area_move(&clip_area, -layer->buf_area.x1, -layer->buf_area.y1); lv_area_t clipped_coords; - if(!_lv_area_intersect(&clipped_coords, &inward_coords, &clip_area)) + if(!lv_area_intersect(&clipped_coords, &inward_coords, &clip_area)) return; /*Fully clipped, nothing to do*/ _vglite_draw_border(&inward_coords, &clip_area, dsc); diff --git a/src/draw/nxp/vglite/lv_draw_vglite_fill.c b/src/draw/nxp/vglite/lv_draw_vglite_fill.c index bf066859e..97089ce55 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_fill.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_fill.c @@ -82,7 +82,7 @@ void lv_draw_vglite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * lv_area_move(&clip_area, -layer->buf_area.x1, -layer->buf_area.y1); lv_area_t clipped_coords; - if(!_lv_area_intersect(&clipped_coords, &relative_coords, &clip_area)) + if(!lv_area_intersect(&clipped_coords, &relative_coords, &clip_area)) return; /*Fully clipped, nothing to do*/ /* diff --git a/src/draw/nxp/vglite/lv_draw_vglite_img.c b/src/draw/nxp/vglite/lv_draw_vglite_img.c index 8b2acba76..49fdffaff 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_img.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_img.c @@ -146,7 +146,7 @@ void lv_draw_vglite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * bool has_transform = (dsc->rotation != 0 || dsc->scale_x != LV_SCALE_NONE || dsc->scale_y != LV_SCALE_NONE); if(has_transform) lv_area_copy(&blend_area, &relative_coords); - else if(!_lv_area_intersect(&blend_area, &relative_coords, &clip_area)) + else if(!lv_area_intersect(&blend_area, &relative_coords, &clip_area)) return; /*Fully clipped, nothing to do*/ const void * src_buf = img_dsc->data; diff --git a/src/draw/nxp/vglite/lv_draw_vglite_label.c b/src/draw/nxp/vglite/lv_draw_vglite_label.c index d80ca25b6..102077fe7 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_label.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_label.c @@ -101,7 +101,7 @@ static void _draw_vglite_letter(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t lv_layer_t * layer = draw_unit->target_layer; lv_area_t blend_area; - if(!_lv_area_intersect(&blend_area, glyph_draw_dsc->letter_coords, draw_unit->clip_area)) + if(!lv_area_intersect(&blend_area, glyph_draw_dsc->letter_coords, draw_unit->clip_area)) return; lv_area_move(&blend_area, -layer->buf_area.x1, -layer->buf_area.y1); diff --git a/src/draw/nxp/vglite/lv_draw_vglite_layer.c b/src/draw/nxp/vglite/lv_draw_vglite_layer.c index 65283d0e2..42e85ee26 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_layer.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_layer.c @@ -84,8 +84,8 @@ void lv_draw_vglite_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t int32_t w = lv_area_get_width(coords); int32_t h = lv_area_get_height(coords); - _lv_image_buf_get_transformed_area(&area_rot, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y, - &draw_dsc->pivot); + lv_image_buf_get_transformed_area(&area_rot, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y, + &draw_dsc->pivot); area_rot.x1 += coords->x1; area_rot.y1 += coords->y1; @@ -93,7 +93,7 @@ void lv_draw_vglite_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t area_rot.y2 += coords->y1; } lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &area_rot, draw_unit->clip_area)) return; + if(!lv_area_intersect(&draw_area, &area_rot, draw_unit->clip_area)) return; #endif #if LV_USE_LAYER_DEBUG @@ -122,13 +122,13 @@ void lv_draw_vglite_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t lv_draw_fill_dsc_t fill_dsc; lv_draw_rect_dsc_init(&fill_dsc); - fill_dsc.color = lv_palette_main(idx % _LV_PALETTE_LAST); + fill_dsc.color = lv_palette_main(idx % LV_PALETTE_LAST); fill_dsc.opa = LV_OPA_10; lv_draw_sw_fill(draw_unit, &fill_dsc, &area_rot); lv_draw_border_dsc_t border_dsc; lv_draw_border_dsc_init(&border_dsc); - border_dsc.color = lv_palette_main(idx % _LV_PALETTE_LAST); + border_dsc.color = lv_palette_main(idx % LV_PALETTE_LAST); border_dsc.opa = LV_OPA_100; border_dsc.width = 2; lv_draw_sw_border(draw_unit, &border_dsc, &area_rot); diff --git a/src/draw/nxp/vglite/lv_draw_vglite_line.c b/src/draw/nxp/vglite/lv_draw_vglite_line.c index d458375c5..f70c02b20 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_line.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_line.c @@ -71,7 +71,7 @@ void lv_draw_vglite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * clip_area.y1 = LV_MIN(dsc->p1.y, dsc->p2.y) - dsc->width / 2; clip_area.y2 = LV_MAX(dsc->p1.y, dsc->p2.y) + dsc->width / 2; - if(!_lv_area_intersect(&clip_area, &clip_area, draw_unit->clip_area)) + if(!lv_area_intersect(&clip_area, &clip_area, draw_unit->clip_area)) return; /*Fully clipped, nothing to do*/ lv_area_move(&clip_area, -layer->buf_area.x1, -layer->buf_area.y1); diff --git a/src/draw/nxp/vglite/lv_draw_vglite_triangle.c b/src/draw/nxp/vglite/lv_draw_vglite_triangle.c index 33265a735..4f72f3aff 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_triangle.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_triangle.c @@ -76,7 +76,7 @@ void lv_draw_vglite_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_ lv_area_move(&coords, -layer->buf_area.x1, -layer->buf_area.y1); lv_area_t clipped_coords; - if(!_lv_area_intersect(&clipped_coords, &coords, &clip_area)) + if(!lv_area_intersect(&clipped_coords, &coords, &clip_area)) return; /* Fully clipped, nothing to do */ _vglite_draw_triangle(&coords, &clip_area, dsc); diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d.c b/src/draw/renesas/dave2d/lv_draw_dave2d.c index 79e590912..039b147a7 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d.c @@ -8,6 +8,7 @@ *********************/ #include "lv_draw_dave2d.h" #if LV_USE_DRAW_DAVE2D +#include "../../lv_draw_buf_private.h" /********************* * DEFINES @@ -93,7 +94,7 @@ void lv_draw_dave2d_init(void) draw_dave2d_unit->d2_handle = _d2_handle; draw_dave2d_unit->renderbuffer = _renderbuffer; - _lv_ll_init(&_ll_Dave2D_Tasks, 4); + lv_ll_init(&_ll_Dave2D_Tasks, 4); #if LV_USE_OS lv_thread_init(&draw_dave2d_unit->thread, LV_THREAD_PRIO_HIGH, _dave2d_render_thread_cb, 8 * 1024, draw_dave2d_unit); @@ -351,7 +352,7 @@ static int32_t lv_draw_dave2d_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * if(t == NULL) { #if (0 == D2_RENDER_EACH_OPERATION) - if(false == _lv_ll_is_empty(&_ll_Dave2D_Tasks)) { + if(false == lv_ll_is_empty(&_ll_Dave2D_Tasks)) { ref_count = 0; dave2d_execute_dlist_and_flush(); } @@ -373,7 +374,7 @@ static int32_t lv_draw_dave2d_dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * } lv_draw_task_t ** p_new_list_entry; - p_new_list_entry = _lv_ll_ins_tail(&_ll_Dave2D_Tasks); + p_new_list_entry = lv_ll_ins_tail(&_ll_Dave2D_Tasks); *p_new_list_entry = t; #endif @@ -437,7 +438,7 @@ static void execute_drawing(lv_draw_dave2d_unit_t * u) int32_t x; int32_t y; - _lv_area_intersect(&clipped_area, &t->area, u->base_unit.clip_area); + lv_area_intersect(&clipped_area, &t->area, u->base_unit.clip_area); x = 0 - u->base_unit.target_layer->buf_area.x1; y = 0 - u->base_unit.target_layer->buf_area.y1; @@ -578,11 +579,11 @@ void dave2d_execute_dlist_and_flush(void) result = d2_selectrenderbuffer(_d2_handle, _renderbuffer); LV_ASSERT(D2_OK == result); - while(false == _lv_ll_is_empty(&_ll_Dave2D_Tasks)) { - p_list_entry = _lv_ll_get_tail(&_ll_Dave2D_Tasks); + while(false == lv_ll_is_empty(&_ll_Dave2D_Tasks)) { + p_list_entry = lv_ll_get_tail(&_ll_Dave2D_Tasks); p_list_entry1 = *p_list_entry; p_list_entry1->state = LV_DRAW_TASK_STATE_READY; - _lv_ll_remove(&_ll_Dave2D_Tasks, p_list_entry); + lv_ll_remove(&_ll_Dave2D_Tasks, p_list_entry); lv_free(p_list_entry); } diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d_arc.c b/src/draw/renesas/dave2d/lv_draw_dave2d_arc.c index 18c56c1c8..03775387a 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d_arc.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d_arc.c @@ -16,7 +16,7 @@ void lv_draw_dave2d_arc(lv_draw_dave2d_unit_t * u, const lv_draw_arc_dsc_t * dsc int32_t x; int32_t y; - if(!_lv_area_intersect(&clipped_area, coords, u->base_unit.clip_area)) return; + if(!lv_area_intersect(&clipped_area, coords, u->base_unit.clip_area)) return; x = 0 - u->base_unit.target_layer->buf_area.x1; y = 0 - u->base_unit.target_layer->buf_area.y1; @@ -127,7 +127,7 @@ void lv_draw_dave2d_arc(lv_draw_dave2d_unit_t * u, const lv_draw_arc_dsc_t * dsc arc_area.y1 = arc_centre.y - dsc->radius; } - draw_arc = _lv_area_intersect(&clip_arc, &arc_area, &clipped_area); + draw_arc = lv_area_intersect(&clip_arc, &arc_area, &clipped_area); if(draw_arc) { diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d_border.c b/src/draw/renesas/dave2d/lv_draw_dave2d_border.c index 17137e09e..6033251df 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d_border.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d_border.c @@ -55,7 +55,7 @@ static void dave2d_draw_border_simple(lv_draw_dave2d_unit_t * u, const lv_area_t int32_t y; bool is_common; - is_common = _lv_area_intersect(&clip_area, outer_area, u->base_unit.clip_area); + is_common = lv_area_intersect(&clip_area, outer_area, u->base_unit.clip_area); if(!is_common) return; #if LV_USE_OS @@ -170,7 +170,7 @@ static void dave2d_draw_border_complex(lv_draw_dave2d_unit_t * u, const lv_area_ outer_area = *orig_outer_area; inner_area = *orig_inner_area; - if(!_lv_area_intersect(&draw_area, &outer_area, u->base_unit.clip_area)) return; + if(!lv_area_intersect(&draw_area, &outer_area, u->base_unit.clip_area)) return; #if LV_USE_OS lv_result_t status; @@ -285,7 +285,7 @@ static void dave2d_draw_border_complex(lv_draw_dave2d_unit_t * u, const lv_area_ arc_area.x2 = core_area.x1; arc_area.y2 = core_area.y1; - if(_lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { + if(lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { d2_cliprect(u->d2_handle, (d2_border)clip_arc.x1, (d2_border)clip_arc.y1, (d2_border)clip_arc.x2, (d2_border)clip_arc.y2); result = d2_renderwedge(u->d2_handle, @@ -312,7 +312,7 @@ static void dave2d_draw_border_complex(lv_draw_dave2d_unit_t * u, const lv_area_ arc_area.x2 = core_area.x1; arc_area.y2 = core_area.y2 + rout; - if(_lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { + if(lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { d2_cliprect(u->d2_handle, (d2_border)clip_arc.x1, (d2_border)clip_arc.y1, (d2_border)clip_arc.x2, (d2_border)clip_arc.y2); @@ -348,7 +348,7 @@ static void dave2d_draw_border_complex(lv_draw_dave2d_unit_t * u, const lv_area_ arc_area.x2 = core_area.x2 + rout; arc_area.y2 = core_area.y1; - if(_lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { + if(lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { d2_cliprect(u->d2_handle, (d2_border)clip_arc.x1, (d2_border)clip_arc.y1, (d2_border)clip_arc.x2, (d2_border)clip_arc.y2); @@ -376,7 +376,7 @@ static void dave2d_draw_border_complex(lv_draw_dave2d_unit_t * u, const lv_area_ arc_area.x2 = core_area.x2 + rout; arc_area.y2 = core_area.y2 + rout; - if(_lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { + if(lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { d2_cliprect(u->d2_handle, (d2_border)clip_arc.x1, (d2_border)clip_arc.y1, (d2_border)clip_arc.x2, (d2_border)clip_arc.y2); diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d_fill.c b/src/draw/renesas/dave2d/lv_draw_dave2d_fill.c index 4a29052d7..e2ffcd9fe 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d_fill.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d_fill.c @@ -14,7 +14,7 @@ void lv_draw_dave2d_fill(lv_draw_dave2d_unit_t * u, const lv_draw_fill_dsc_t * d lv_point_t arc_centre; - is_common = _lv_area_intersect(&draw_area, coords, u->base_unit.clip_area); + is_common = lv_area_intersect(&draw_area, coords, u->base_unit.clip_area); if(!is_common) return; #if LV_USE_OS @@ -165,7 +165,7 @@ void lv_draw_dave2d_fill(lv_draw_dave2d_unit_t * u, const lv_draw_fill_dsc_t * d arc_area.x2 = coordinates.x1 + radius; arc_area.y2 = coordinates.y1 + radius; - if(_lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { + if(lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { d2_cliprect(u->d2_handle, (d2_border)clip_arc.x1, (d2_border)clip_arc.y1, (d2_border)clip_arc.x2, (d2_border)clip_arc.y2); @@ -192,7 +192,7 @@ void lv_draw_dave2d_fill(lv_draw_dave2d_unit_t * u, const lv_draw_fill_dsc_t * d arc_area.x2 = coordinates.x2; arc_area.y2 = coordinates.y1 + radius; - if(_lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { + if(lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { d2_cliprect(u->d2_handle, (d2_border)clip_arc.x1, (d2_border)clip_arc.y1, (d2_border)clip_arc.x2, (d2_border)clip_arc.y2); @@ -217,7 +217,7 @@ void lv_draw_dave2d_fill(lv_draw_dave2d_unit_t * u, const lv_draw_fill_dsc_t * d arc_area.x2 = coordinates.x2; arc_area.y2 = coordinates.y2; - if(_lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { + if(lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { d2_cliprect(u->d2_handle, (d2_border)clip_arc.x1, (d2_border)clip_arc.y1, (d2_border)clip_arc.x2, (d2_border)clip_arc.y2); @@ -242,7 +242,7 @@ void lv_draw_dave2d_fill(lv_draw_dave2d_unit_t * u, const lv_draw_fill_dsc_t * d arc_area.x2 = coordinates.x1 + radius; arc_area.y2 = coordinates.y2; - if(_lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { + if(lv_area_intersect(&clip_arc, &arc_area, &draw_area)) { d2_cliprect(u->d2_handle, (d2_border)clip_arc.x1, (d2_border)clip_arc.y1, (d2_border)clip_arc.x2, (d2_border)clip_arc.y2); diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d_image.c b/src/draw/renesas/dave2d/lv_draw_dave2d_image.c index fe5ea459f..dc001151a 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d_image.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d_image.c @@ -40,10 +40,10 @@ void lv_draw_dave2d_image(lv_draw_dave2d_unit_t * draw_unit, const lv_draw_image const lv_area_t * coords) { if(!draw_dsc->tile) { - _lv_draw_image_normal_helper((lv_draw_unit_t *)draw_unit, draw_dsc, coords, img_draw_core); + lv_draw_image_normal_helper((lv_draw_unit_t *)draw_unit, draw_dsc, coords, img_draw_core); } else { - _lv_draw_image_tiled_helper((lv_draw_unit_t *)draw_unit, draw_dsc, coords, img_draw_core); + lv_draw_image_tiled_helper((lv_draw_unit_t *)draw_unit, draw_dsc, coords, img_draw_core); } } diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d_label.c b/src/draw/renesas/dave2d/lv_draw_dave2d_label.c index f2b93b47a..f5760e623 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d_label.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d_label.c @@ -30,7 +30,7 @@ static void lv_draw_dave2d_draw_letter_cb(lv_draw_unit_t * u, lv_draw_glyph_dsc_ letter_coords = *glyph_draw_dsc->letter_coords; bool is_common; - is_common = _lv_area_intersect(&clip_area, glyph_draw_dsc->letter_coords, u->clip_area); + is_common = lv_area_intersect(&clip_area, glyph_draw_dsc->letter_coords, u->clip_area); if(!is_common) return; x = 0 - unit->base_unit.target_layer->buf_area.x1; diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d_line.c b/src/draw/renesas/dave2d/lv_draw_dave2d_line.c index 5bf6811e5..ef188eb4a 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d_line.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d_line.c @@ -20,7 +20,7 @@ void lv_draw_dave2d_line(lv_draw_dave2d_unit_t * u, const lv_draw_line_dsc_t * d clip_line.y2 = LV_MAX(dsc->p1.y, dsc->p2.y) + dsc->width / 2; bool is_common; - is_common = _lv_area_intersect(&clip_line, &clip_line, u->base_unit.clip_area); + is_common = lv_area_intersect(&clip_line, &clip_line, u->base_unit.clip_area); if(!is_common) return; #if LV_USE_OS diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d_mask_rectangle.c b/src/draw/renesas/dave2d/lv_draw_dave2d_mask_rectangle.c index 4010f5010..fe94a9a40 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d_mask_rectangle.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d_mask_rectangle.c @@ -8,7 +8,7 @@ void lv_draw_dave2d_mask_rect(lv_draw_dave2d_unit_t * u, const lv_draw_mask_rect int32_t x; int32_t y; - if(!_lv_area_intersect(&clipped_area, coords, u->base_unit.clip_area)) return; + if(!lv_area_intersect(&clipped_area, coords, u->base_unit.clip_area)) return; x = 0 - u->base_unit.target_layer->buf_area.x1; y = 0 - u->base_unit.target_layer->buf_area.y1; diff --git a/src/draw/renesas/dave2d/lv_draw_dave2d_triangle.c b/src/draw/renesas/dave2d/lv_draw_dave2d_triangle.c index adb652052..502200797 100644 --- a/src/draw/renesas/dave2d/lv_draw_dave2d_triangle.c +++ b/src/draw/renesas/dave2d/lv_draw_dave2d_triangle.c @@ -15,7 +15,7 @@ void lv_draw_dave2d_triangle(lv_draw_dave2d_unit_t * u, const lv_draw_triangle_d tri_area.x2 = LV_MAX3(dsc->p[0].x, dsc->p[1].x, dsc->p[2].x); tri_area.y2 = LV_MAX3(dsc->p[0].y, dsc->p[1].y, dsc->p[2].y); - if(!_lv_area_intersect(&clipped_area, &tri_area, u->base_unit.clip_area)) return; + if(!lv_area_intersect(&clipped_area, &tri_area, u->base_unit.clip_area)) return; #if LV_USE_OS lv_result_t status; diff --git a/src/draw/sdl/lv_draw_sdl.c b/src/draw/sdl/lv_draw_sdl.c index 44826d7be..d72ab67ab 100644 --- a/src/draw/sdl/lv_draw_sdl.c +++ b/src/draw/sdl/lv_draw_sdl.c @@ -6,13 +6,13 @@ /********************* * INCLUDES *********************/ -#include "../lv_draw.h" +#include "../lv_draw_private.h" #if LV_USE_DRAW_SDL #include LV_SDL_INCLUDE_PATH #include <SDL2/SDL_image.h> #include "lv_draw_sdl.h" -#include "../../core/lv_refr.h" +#include "../../core/lv_refr_private.h" #include "../../display/lv_display_private.h" #include "../../stdlib/lv_string.h" #include "../../drivers/sdl/lv_sdl_window.h" @@ -130,7 +130,7 @@ static int32_t dispatch(lv_draw_unit_t * draw_unit, lv_layer_t * layer) t = lv_draw_get_next_available_task(layer, NULL, DRAW_UNIT_ID_SDL); if(t == NULL) return -1; - lv_display_t * disp = _lv_refr_get_disp_refreshing(); + lv_display_t * disp = lv_refr_get_disp_refreshing(); SDL_Texture * texture = layer_get_texture(layer); if(layer != disp->layer_head && texture == NULL) { void * buf = lv_draw_layer_alloc_buf(layer); @@ -184,7 +184,7 @@ static bool draw_to_texture(lv_draw_sdl_unit_t * u, cache_data_t * data) dest_layer._clip_area = task->area; lv_memzero(sdl_render_buf, lv_area_get_size(&dest_layer.buf_area) * 4 + 100); - lv_display_t * disp = _lv_refr_get_disp_refreshing(); + lv_display_t * disp = lv_refr_get_disp_refreshing(); SDL_Texture * texture = NULL; switch(task->type) { @@ -307,7 +307,7 @@ static bool draw_to_texture(lv_draw_sdl_unit_t * u, cache_data_t * data) static void blend_texture_layer(lv_draw_sdl_unit_t * u) { - lv_display_t * disp = _lv_refr_get_disp_refreshing(); + lv_display_t * disp = lv_refr_get_disp_refreshing(); SDL_Renderer * renderer = lv_sdl_window_get_renderer(disp); SDL_Rect clip_rect; @@ -362,7 +362,7 @@ static void draw_from_cached_texture(lv_draw_sdl_unit_t * u) cache_data_t * data_cached = lv_cache_entry_get_data(entry_cached); SDL_Texture * texture = data_cached->texture; - lv_display_t * disp = _lv_refr_get_disp_refreshing(); + lv_display_t * disp = lv_refr_get_disp_refreshing(); SDL_Renderer * renderer = lv_sdl_window_get_renderer(disp); lv_layer_t * dest_layer = u->base_unit.target_layer; diff --git a/src/draw/sw/arm2d/lv_draw_sw_arm2d.h b/src/draw/sw/arm2d/lv_draw_sw_arm2d.h index 3f16382f7..9c09480d4 100644 --- a/src/draw/sw/arm2d/lv_draw_sw_arm2d.h +++ b/src/draw/sw/arm2d/lv_draw_sw_arm2d.h @@ -37,7 +37,7 @@ extern "C" { *********************/ #ifndef LV_DRAW_SW_RGB565_SWAP #define LV_DRAW_SW_RGB565_SWAP(__buf_ptr, __buf_size_px) \ - _lv_draw_sw_rgb565_swap_helium((__buf_ptr), (__buf_size_px)) + lv_draw_sw_rgb565_swap_helium((__buf_ptr), (__buf_size_px)) #endif #ifndef LV_DRAW_SW_IMAGE @@ -49,7 +49,7 @@ extern "C" { __blend_area, \ __draw_unit, \ __draw_dsc) \ - _lv_draw_sw_image_helium( (__transformed), \ + lv_draw_sw_image_helium( (__transformed), \ (__cf), \ (uint8_t *)(__src_buf), \ (__img_coords), \ @@ -61,7 +61,7 @@ extern "C" { #ifndef LV_DRAW_SW_RGB565_RECOLOR #define LV_DRAW_SW_RGB565_RECOLOR(__src_buf, __blend_area, __color, __opa) \ - _lv_draw_sw_image_recolor_rgb565( (__src_buf), \ + lv_draw_sw_image_recolor_rgb565( (__src_buf), \ &(__blend_area), \ (__color), \ (__opa)) @@ -73,7 +73,7 @@ extern "C" { __color, \ __opa, \ __cf) \ - _lv_draw_sw_image_recolor_rgb888( (__src_buf), \ + lv_draw_sw_image_recolor_rgb888( (__src_buf), \ &(__blend_area), \ (__color), \ (__opa), \ @@ -161,14 +161,14 @@ extern void arm_2d_helper_swap_rgb16(uint16_t * phwBuffer, uint32_t wCount); } \ } while(0); -static inline lv_result_t _lv_draw_sw_rgb565_swap_helium(void * buf, uint32_t buf_size_px) +static inline lv_result_t lv_draw_sw_rgb565_swap_helium(void * buf, uint32_t buf_size_px) { arm_2d_helper_swap_rgb16((uint16_t *)buf, buf_size_px); return LV_RESULT_OK; } -static inline lv_result_t _lv_draw_sw_image_helium( - bool is_transform, +static inline lv_result_t lv_draw_sw_image_helium( + bool is_transform, lv_color_format_t src_cf, const uint8_t *src_buf, const lv_area_t * coords, @@ -217,7 +217,7 @@ static inline lv_result_t _lv_draw_sw_image_helium( /* ------------- prepare parameters for arm-2d APIs - BEGIN --------- */ lv_area_t blend_area; - if(!_lv_area_intersect(&blend_area, des_area, draw_unit->clip_area)) { + if(!lv_area_intersect(&blend_area, des_area, draw_unit->clip_area)) { break; } @@ -241,17 +241,17 @@ static inline lv_result_t _lv_draw_sw_image_helium( // des_size.iWidth = (int16_t)des_w; // des_size.iHeight = (int16_t)des_h; // } while(0); -// +// // arm_2d_size_t copy_size = { // .iWidth = MIN(des_size.iWidth, src_size.iWidth), // .iHeight = MIN(des_size.iHeight, src_size.iHeight), // }; -// +// // int32_t des_stride = lv_draw_buf_width_to_stride( -// lv_area_get_width(&layer->buf_area), +// lv_area_get_width(&layer->buf_area), // des_cf); // uint8_t *des_buf_moved = (uint8_t *)lv_draw_layer_go_to_xy( -// layer, +// layer, // blend_area.x1 - layer->buf_area.x1, // blend_area.y1 - layer->buf_area.y1); uint8_t *des_buf = (uint8_t *)lv_draw_layer_go_to_xy(layer, 0, 0); @@ -524,7 +524,7 @@ static inline lv_result_t _lv_draw_sw_image_helium( return result; } -static inline lv_result_t _lv_draw_sw_image_recolor_rgb565( +static inline lv_result_t lv_draw_sw_image_recolor_rgb565( const uint8_t *src_buf, const lv_area_t * blend_area, lv_color_t color, @@ -548,7 +548,7 @@ static inline lv_result_t _lv_draw_sw_image_recolor_rgb565( return LV_RESULT_OK; } -static inline lv_result_t _lv_draw_sw_image_recolor_rgb888( +static inline lv_result_t lv_draw_sw_image_recolor_rgb888( const uint8_t *src_buf, const lv_area_t * blend_area, lv_color_t color, diff --git a/src/draw/sw/blend/arm2d/lv_blend_arm2d.h b/src/draw/sw/blend/arm2d/lv_blend_arm2d.h index 3cd42260b..77b4e2bc1 100644 --- a/src/draw/sw/blend/arm2d/lv_blend_arm2d.h +++ b/src/draw/sw/blend/arm2d/lv_blend_arm2d.h @@ -35,162 +35,162 @@ extern "C" { #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565(dsc) \ - _lv_color_blend_to_rgb565_arm2d(dsc) + lv_color_blend_to_rgb565_arm2d(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA(dsc) \ - _lv_color_blend_to_rgb565_with_opa_arm2d(dsc) + lv_color_blend_to_rgb565_with_opa_arm2d(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK(dsc) \ - _lv_color_blend_to_rgb565_with_mask_arm2d(dsc) + lv_color_blend_to_rgb565_with_mask_arm2d(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(dsc) \ - _lv_color_blend_to_rgb565_mix_mask_opa_arm2d(dsc) + lv_color_blend_to_rgb565_mix_mask_opa_arm2d(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_arm2d(dsc) + lv_rgb565_blend_normal_to_rgb565_arm2d(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_with_opa_arm2d(dsc) + lv_rgb565_blend_normal_to_rgb565_with_opa_arm2d(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_with_mask_arm2d(dsc) + lv_rgb565_blend_normal_to_rgb565_with_mask_arm2d(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc) + lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_arm2d(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_arm2d(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_with_opa_arm2d(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_with_opa_arm2d(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_with_mask_arm2d(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_with_mask_arm2d(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_arm2d(dsc) + lv_argb8888_blend_normal_to_rgb565_arm2d(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_with_opa_arm2d(dsc) + lv_argb8888_blend_normal_to_rgb565_with_opa_arm2d(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_with_mask_arm2d(dsc) + lv_argb8888_blend_normal_to_rgb565_with_mask_arm2d(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc) + lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_arm2d(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_arm2d(dsc, dst_px_size) + lv_color_blend_to_rgb888_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_with_opa_arm2d(dsc, dst_px_size) + lv_color_blend_to_rgb888_with_opa_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_with_mask_arm2d(dsc, dst_px_size) + lv_color_blend_to_rgb888_with_mask_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size) + lv_color_blend_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_arm2d(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_arm2d(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_arm2d(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_arm2d(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_with_opa_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_with_mask_arm2d(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_arm2d(dsc, dst_px_size) #endif /********************** @@ -201,7 +201,7 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ -static inline lv_result_t _lv_color_blend_to_rgb565_arm2d(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t stride = (dsc->dest_stride) / sizeof(uint16_t); @@ -212,7 +212,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_arm2d(_lv_draw_sw_blend_fill return LV_RESULT_OK; } -static inline lv_result_t _lv_color_blend_to_rgb565_with_opa_arm2d(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t stride = (dsc->dest_stride) / sizeof(uint16_t); @@ -224,7 +224,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_with_opa_arm2d(_lv_draw_sw_b return LV_RESULT_OK; } -static inline lv_result_t _lv_color_blend_to_rgb565_with_mask_arm2d(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t stride = (dsc->dest_stride) / sizeof(uint16_t); @@ -237,7 +237,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_with_mask_arm2d(_lv_draw_sw_ return LV_RESULT_OK; } -static inline lv_result_t _lv_color_blend_to_rgb565_mix_mask_opa_arm2d(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t stride = (dsc->dest_stride) / sizeof(uint16_t); @@ -251,7 +251,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_mix_mask_opa_arm2d(_lv_draw_ return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_arm2d(lv_draw_sw_blend_image_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; @@ -265,7 +265,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_arm2d(_lv_draw_sw_bl return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); @@ -279,7 +279,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_opa_arm2d(_lv_d return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_mask_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); @@ -295,7 +295,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_mask_arm2d(_lv_ return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); @@ -318,8 +318,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_arm2d(_ return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { if(src_px_size == 3) { return LV_RESULT_INVALID; @@ -338,8 +338,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_arm2d(_lv_draw_sw_bl return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { if(src_px_size == 3) { return LV_RESULT_INVALID; @@ -371,8 +371,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_opa_arm2d(_lv_d return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_mask_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { if(src_px_size == 3) { return LV_RESULT_INVALID; @@ -406,8 +406,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_mask_arm2d(_lv_ return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { if(src_px_size == 3) { return LV_RESULT_INVALID; @@ -447,7 +447,7 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_arm2d(_ return LV_RESULT_OK; } -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_arm2d(lv_draw_sw_blend_image_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); @@ -487,7 +487,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_arm2d(_lv_draw_sw_ return LV_RESULT_OK; } -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); @@ -548,7 +548,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_opa_arm2d(_lv return LV_RESULT_OK; } -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_mask_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); @@ -611,7 +611,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_mask_arm2d(_l return LV_RESULT_OK; } -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc) { arm_2d_size_t draw_size = {dsc->dest_w, dsc->dest_h}; int16_t des_stride = dsc->dest_stride / sizeof(uint16_t); @@ -674,7 +674,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_arm2d return LV_RESULT_OK; } -static inline lv_result_t _lv_color_blend_to_rgb888_arm2d(_lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) { if(dst_px_size == 3) { return LV_RESULT_INVALID; @@ -689,8 +689,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_arm2d(_lv_draw_sw_blend_fill } -static inline lv_result_t _lv_color_blend_to_rgb888_with_opa_arm2d(_lv_draw_sw_blend_fill_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { return LV_RESULT_INVALID; @@ -706,8 +706,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_with_opa_arm2d(_lv_draw_sw_b return LV_RESULT_OK; } -static inline lv_result_t _lv_color_blend_to_rgb888_with_mask_arm2d(_lv_draw_sw_blend_fill_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { @@ -725,8 +725,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_with_mask_arm2d(_lv_draw_sw_ return LV_RESULT_OK; } -static inline lv_result_t _lv_color_blend_to_rgb888_mix_mask_opa_arm2d(_lv_draw_sw_blend_fill_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { @@ -745,8 +745,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_mix_mask_opa_arm2d(_lv_draw_ return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { @@ -767,8 +767,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_arm2d(_lv_draw_sw_bl } -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { @@ -802,8 +802,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_opa_arm2d(_lv_d return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_mask_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { @@ -838,8 +838,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_mask_arm2d(_lv_ return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { @@ -880,9 +880,9 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_arm2d(_ return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, + uint32_t src_px_size) { if((dst_px_size == 3) || (src_px_size == 3)) { return LV_RESULT_INVALID; @@ -901,8 +901,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_arm2d(_lv_draw_sw_bl return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { if((dst_px_size == 3) || (src_px_size == 3)) { return LV_RESULT_INVALID; @@ -922,8 +922,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_opa_arm2d(_lv_d return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_mask_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { if((dst_px_size == 3) || (src_px_size == 3)) { return LV_RESULT_INVALID; @@ -944,8 +944,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_mask_arm2d(_lv_ return LV_RESULT_OK; } -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { if((dst_px_size == 3) || (src_px_size == 3)) { return LV_RESULT_INVALID; @@ -972,8 +972,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_arm2d(_ return LV_RESULT_OK; } -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { @@ -1003,8 +1003,8 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_arm2d(_lv_draw_sw_ return LV_RESULT_OK; } -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_with_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { return LV_RESULT_INVALID; @@ -1053,8 +1053,8 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_opa_arm2d(_lv return LV_RESULT_OK; } -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_mask_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_with_mask_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { @@ -1092,8 +1092,8 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_mask_arm2d(_l return LV_RESULT_OK; } -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_arm2d(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_arm2d(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { if(dst_px_size == 3) { return LV_RESULT_INVALID; diff --git a/src/draw/sw/blend/helium/lv_blend_helium.h b/src/draw/sw/blend/helium/lv_blend_helium.h index f8964e9d9..69b999efc 100644 --- a/src/draw/sw/blend/helium/lv_blend_helium.h +++ b/src/draw/sw/blend/helium/lv_blend_helium.h @@ -41,242 +41,242 @@ extern "C" { #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565(dsc) \ - _lv_color_blend_to_rgb565_helium(dsc) + lv_color_blend_to_rgb565_helium(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA(dsc) \ - _lv_color_blend_to_rgb565_with_opa_helium(dsc) + lv_color_blend_to_rgb565_with_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK(dsc) \ - _lv_color_blend_to_rgb565_with_mask_helium(dsc) + lv_color_blend_to_rgb565_with_mask_helium(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(dsc) \ - _lv_color_blend_to_rgb565_mix_mask_opa_helium(dsc) + lv_color_blend_to_rgb565_mix_mask_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_helium(dsc) + lv_rgb565_blend_normal_to_rgb565_helium(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_with_opa_helium(dsc) + lv_rgb565_blend_normal_to_rgb565_with_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_with_mask_helium(dsc) + lv_rgb565_blend_normal_to_rgb565_with_mask_helium(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_helium(dsc) + lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_helium(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_helium(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_with_opa_helium(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_with_opa_helium(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_with_mask_helium(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_with_mask_helium(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_helium(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_helium(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_helium(dsc) + lv_argb8888_blend_normal_to_rgb565_helium(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_with_opa_helium(dsc) + lv_argb8888_blend_normal_to_rgb565_with_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_with_mask_helium(dsc) + lv_argb8888_blend_normal_to_rgb565_with_mask_helium(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_helium(dsc) + lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_helium(dsc, dst_px_size) + lv_color_blend_to_rgb888_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_with_opa_helium(dsc, dst_px_size) + lv_color_blend_to_rgb888_with_opa_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_with_mask_helium(dsc, dst_px_size) + lv_color_blend_to_rgb888_with_mask_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size) + lv_color_blend_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_helium(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_with_opa_helium(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_with_opa_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_with_mask_helium(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_with_mask_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_helium(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_helium(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_with_opa_helium(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_with_opa_helium(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_with_mask_helium(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_with_mask_helium(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_helium(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_with_opa_helium(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_with_opa_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_with_mask_helium(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_with_mask_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_helium(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888 #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888(dsc) \ - _lv_color_blend_to_argb8888_helium(dsc) + lv_color_blend_to_argb8888_helium(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA(dsc) \ - _lv_color_blend_to_argb8888_with_opa_helium(dsc) + lv_color_blend_to_argb8888_with_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK(dsc) \ - _lv_color_blend_to_argb8888_with_mask_helium(dsc) + lv_color_blend_to_argb8888_with_mask_helium(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA(dsc) \ - _lv_color_blend_to_argb8888_mix_mask_opa_helium(dsc) + lv_color_blend_to_argb8888_mix_mask_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888(dsc) \ - _lv_rgb565_blend_normal_to_argb8888_helium(dsc) + lv_rgb565_blend_normal_to_argb8888_helium(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc) \ - _lv_rgb565_blend_normal_to_argb8888_with_opa_helium(dsc) + lv_rgb565_blend_normal_to_argb8888_with_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc) \ - _lv_rgb565_blend_normal_to_argb8888_with_mask_helium(dsc) + lv_rgb565_blend_normal_to_argb8888_with_mask_helium(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc) \ - _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_helium(dsc) + lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_argb8888_helium(dsc, src_px_size) + lv_rgb888_blend_normal_to_argb8888_helium(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_argb8888_with_opa_helium(dsc, src_px_size) + lv_rgb888_blend_normal_to_argb8888_with_opa_helium(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_argb8888_with_mask_helium(dsc, src_px_size) + lv_rgb888_blend_normal_to_argb8888_with_mask_helium(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_helium(dsc, src_px_size) + lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_helium(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888(dsc) \ - _lv_argb8888_blend_normal_to_argb8888_helium(dsc) + lv_argb8888_blend_normal_to_argb8888_helium(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc) \ - _lv_argb8888_blend_normal_to_argb8888_with_opa_helium(dsc) + lv_argb8888_blend_normal_to_argb8888_with_opa_helium(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc) \ - _lv_argb8888_blend_normal_to_argb8888_with_mask_helium(dsc) + lv_argb8888_blend_normal_to_argb8888_with_mask_helium(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc) \ - _lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_helium(dsc) + lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_helium(dsc) #endif /********************** @@ -299,7 +299,7 @@ typedef struct { **********************/ extern void lv_color_blend_to_rgb565_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb565_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_helium(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -314,7 +314,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_helium(_lv_draw_sw_blend_fil } extern void lv_color_blend_to_rgb565_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb565_with_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_with_opa_helium(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -329,7 +329,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_with_opa_helium(_lv_draw_sw_ } extern void lv_color_blend_to_rgb565_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb565_with_mask_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_with_mask_helium(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -345,7 +345,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_with_mask_helium(_lv_draw_sw } extern void lv_color_blend_to_rgb565_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb565_mix_mask_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_mix_mask_opa_helium(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -362,7 +362,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_mix_mask_opa_helium(_lv_draw } extern void lv_rgb565_blend_normal_to_rgb565_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -377,7 +377,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_helium(_lv_draw_sw_b } extern void lv_rgb565_blend_normal_to_rgb565_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_with_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -393,7 +393,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_opa_helium(_lv_ } extern void lv_rgb565_blend_normal_to_rgb565_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_with_mask_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -410,7 +410,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_mask_helium(_lv } extern void lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -429,8 +429,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_helium( extern void lv_rgb888_blend_normal_to_rgb565_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -451,8 +451,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_helium(_lv_draw_sw_b extern void lv_rgb888_blend_normal_to_rgb565_with_opa_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_with_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -474,8 +474,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_opa_helium(_lv_ extern void lv_rgb888_blend_normal_to_rgb565_with_mask_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_with_mask_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -498,8 +498,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_mask_helium(_lv extern void lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -522,7 +522,7 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_helium( } extern void lv_argb8888_blend_normal_to_rgb565_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -537,7 +537,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_helium(_lv_draw_sw } extern void lv_argb8888_blend_normal_to_rgb565_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_with_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -553,7 +553,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_opa_helium(_l } extern void lv_argb8888_blend_normal_to_rgb565_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_with_mask_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -570,7 +570,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_mask_helium(_ } extern void lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -589,7 +589,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_heliu extern void lv_color_blend_to_rgb888_helium(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb888_helium(_lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_helium(lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -609,8 +609,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_helium(_lv_draw_sw_blend_fil extern void lv_color_blend_to_rgb888_with_opa_helium(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb888_with_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_with_opa_helium(lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -631,8 +631,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_with_opa_helium(_lv_draw_sw_ extern void lv_color_blend_to_rgb888_with_mask_helium(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb888_with_mask_helium(_lv_draw_sw_blend_fill_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_with_mask_helium(lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -654,8 +654,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_with_mask_helium(_lv_draw_sw extern void lv_color_blend_to_rgb888_mix_mask_opa_helium(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb888_mix_mask_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_mix_mask_opa_helium(lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -678,8 +678,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_mix_mask_opa_helium(_lv_draw extern void lv_rgb565_blend_normal_to_rgb888_helium(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -700,8 +700,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_helium(_lv_draw_sw_b extern void lv_rgb565_blend_normal_to_rgb888_with_opa_helium(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_with_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -723,8 +723,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_opa_helium(_lv_ extern void lv_rgb565_blend_normal_to_rgb888_with_mask_helium(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_with_mask_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -747,8 +747,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_mask_helium(_lv extern void lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_helium(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -774,9 +774,9 @@ extern void lv_rgb888_blend_normal_to_rgb888_helium(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -809,8 +809,8 @@ extern void lv_rgb888_blend_normal_to_rgb888_with_opa_helium(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_with_opa_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_with_opa_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_with_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -844,8 +844,8 @@ extern void lv_rgb888_blend_normal_to_rgb888_with_mask_helium(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_with_mask_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_with_mask_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_with_mask_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -880,8 +880,8 @@ extern void lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_helium(asm_dsc_t * dsc extern void lv_rgb888_blend_normal_to_xrgb8888_mix_mask_opa_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_mix_mask_opa_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -915,8 +915,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_helium( extern void lv_argb8888_blend_normal_to_rgb888_helium(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -937,8 +937,8 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_helium(_lv_draw_sw extern void lv_argb8888_blend_normal_to_rgb888_with_opa_helium(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_with_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -960,8 +960,8 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_opa_helium(_l extern void lv_argb8888_blend_normal_to_rgb888_with_mask_helium(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_with_mask_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -984,8 +984,8 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_mask_helium(_ extern void lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_helium(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1008,7 +1008,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_heliu } extern void lv_color_blend_to_argb8888_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_argb8888_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_argb8888_helium(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1023,7 +1023,7 @@ static inline lv_result_t _lv_color_blend_to_argb8888_helium(_lv_draw_sw_blend_f } extern void lv_color_blend_to_argb8888_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_argb8888_with_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_argb8888_with_opa_helium(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1038,7 +1038,7 @@ static inline lv_result_t _lv_color_blend_to_argb8888_with_opa_helium(_lv_draw_s } extern void lv_color_blend_to_argb8888_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_argb8888_with_mask_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_argb8888_with_mask_helium(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1054,7 +1054,7 @@ static inline lv_result_t _lv_color_blend_to_argb8888_with_mask_helium(_lv_draw_ } extern void lv_color_blend_to_argb8888_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_argb8888_mix_mask_opa_helium(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_argb8888_mix_mask_opa_helium(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1071,7 +1071,7 @@ static inline lv_result_t _lv_color_blend_to_argb8888_mix_mask_opa_helium(_lv_dr } extern void lv_rgb565_blend_normal_to_argb8888_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_argb8888_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1086,7 +1086,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_helium(_lv_draw_sw } extern void lv_rgb565_blend_normal_to_argb8888_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_argb8888_with_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1102,7 +1102,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_opa_helium(_l } extern void lv_rgb565_blend_normal_to_argb8888_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_argb8888_with_mask_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1119,7 +1119,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_mask_helium(_ } extern void lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1138,8 +1138,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_heliu extern void lv_rgb888_blend_normal_to_argb8888_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_argb8888_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1160,8 +1160,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_helium(_lv_draw_sw extern void lv_rgb888_blend_normal_to_argb8888_with_opa_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_argb8888_with_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1183,8 +1183,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_opa_helium(_l extern void lv_rgb888_blend_normal_to_argb8888_with_mask_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_argb8888_with_mask_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1207,8 +1207,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_mask_helium(_ extern void lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_helium(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1231,7 +1231,7 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_heliu } extern void lv_argb8888_blend_normal_to_argb8888_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_argb8888_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1246,7 +1246,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_helium(_lv_draw_ } extern void lv_argb8888_blend_normal_to_argb8888_with_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_argb8888_with_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1262,7 +1262,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_opa_helium( } extern void lv_argb8888_blend_normal_to_argb8888_with_mask_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_mask_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_argb8888_with_mask_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1279,7 +1279,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_mask_helium } extern void lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_helium(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_helium(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_helium(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, diff --git a/src/draw/sw/blend/lv_draw_sw_blend.c b/src/draw/sw/blend/lv_draw_sw_blend.c index c6151cc10..6f48eba64 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend.c +++ b/src/draw/sw/blend/lv_draw_sw_blend.c @@ -6,6 +6,9 @@ /********************* * INCLUDES *********************/ +#include "../../../misc/lv_area_private.h" +#include "lv_draw_sw_blend_private.h" +#include "../../lv_draw_private.h" #include "../lv_draw_sw.h" #if LV_DRAW_SW_SUPPORT_L8 #include "lv_draw_sw_blend_to_l8.h" @@ -57,14 +60,14 @@ void lv_draw_sw_blend(lv_draw_unit_t * draw_unit, const lv_draw_sw_blend_dsc_t * if(blend_dsc->mask_buf && blend_dsc->mask_res == LV_DRAW_SW_MASK_RES_TRANSP) return; lv_area_t blend_area; - if(!_lv_area_intersect(&blend_area, blend_dsc->blend_area, draw_unit->clip_area)) return; + if(!lv_area_intersect(&blend_area, blend_dsc->blend_area, draw_unit->clip_area)) return; LV_PROFILER_BEGIN; lv_layer_t * layer = draw_unit->target_layer; uint32_t layer_stride_byte = layer->draw_buf->header.stride; if(blend_dsc->src_buf == NULL) { - _lv_draw_sw_blend_fill_dsc_t fill_dsc; + lv_draw_sw_blend_fill_dsc_t fill_dsc; fill_dsc.dest_w = lv_area_get_width(&blend_area); fill_dsc.dest_h = lv_area_get_height(&blend_area); fill_dsc.dest_stride = layer_stride_byte; @@ -127,17 +130,17 @@ void lv_draw_sw_blend(lv_draw_unit_t * draw_unit, const lv_draw_sw_blend_dsc_t * } } else { - if(!_lv_area_intersect(&blend_area, &blend_area, blend_dsc->src_area)) { + if(!lv_area_intersect(&blend_area, &blend_area, blend_dsc->src_area)) { LV_PROFILER_END; return; } - if(blend_dsc->mask_area && !_lv_area_intersect(&blend_area, &blend_area, blend_dsc->mask_area)) { + if(blend_dsc->mask_area && !lv_area_intersect(&blend_area, &blend_area, blend_dsc->mask_area)) { LV_PROFILER_END; return; } - _lv_draw_sw_blend_image_dsc_t image_dsc; + lv_draw_sw_blend_image_dsc_t image_dsc; image_dsc.dest_w = lv_area_get_width(&blend_area); image_dsc.dest_h = lv_area_get_height(&blend_area); image_dsc.dest_stride = layer_stride_byte; diff --git a/src/draw/sw/blend/lv_draw_sw_blend.h b/src/draw/sw/blend/lv_draw_sw_blend.h index eada7ba48..1528cacc3 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend.h +++ b/src/draw/sw/blend/lv_draw_sw_blend.h @@ -28,50 +28,6 @@ extern "C" { * TYPEDEFS **********************/ -typedef struct { - const lv_area_t * blend_area; /**< The area with absolute coordinates to draw on `layer->buf` - * will be clipped to `layer->clip_area` */ - const void * src_buf; /**< Pointer to an image to blend. If set `fill_color` is ignored */ - uint32_t src_stride; - lv_color_format_t src_color_format; - const lv_area_t * src_area; - lv_opa_t opa; /**< The overall opacity*/ - lv_color_t color; /**< Fill color*/ - 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*/ - int32_t mask_stride; - lv_blend_mode_t blend_mode; /**< E.g. LV_BLEND_MODE_ADDITIVE*/ -} lv_draw_sw_blend_dsc_t; - -typedef struct { - void * dest_buf; - int32_t dest_w; - int32_t dest_h; - int32_t dest_stride; - const lv_opa_t * mask_buf; - int32_t mask_stride; - lv_color_t color; - lv_opa_t opa; - lv_area_t relative_area; -} _lv_draw_sw_blend_fill_dsc_t; - -typedef struct { - void * dest_buf; - int32_t dest_w; - int32_t dest_h; - int32_t dest_stride; - const lv_opa_t * mask_buf; - int32_t mask_stride; - const void * src_buf; - int32_t src_stride; - lv_color_format_t src_color_format; - lv_opa_t opa; - lv_blend_mode_t blend_mode; - lv_area_t relative_area; /**< The blend area relative to the layer's buffer area. */ - lv_area_t src_area; /**< The original src area. */ -} _lv_draw_sw_blend_image_dsc_t; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/draw/sw/blend/lv_draw_sw_blend_private.h b/src/draw/sw/blend/lv_draw_sw_blend_private.h new file mode 100644 index 000000000..9582049e6 --- /dev/null +++ b/src/draw/sw/blend/lv_draw_sw_blend_private.h @@ -0,0 +1,92 @@ +/** + * @file lv_draw_sw_blend_private.h + * + */ + +#ifndef LV_DRAW_SW_BLEND_PRIVATE_H +#define LV_DRAW_SW_BLEND_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_sw_blend.h" + +#if LV_USE_DRAW_SW + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_draw_sw_blend_dsc_t { + const lv_area_t * blend_area; /**< The area with absolute coordinates to draw on `layer->buf` + * will be clipped to `layer->clip_area` */ + const void * src_buf; /**< Pointer to an image to blend. If set `fill_color` is ignored */ + uint32_t src_stride; + lv_color_format_t src_color_format; + const lv_area_t * src_area; + lv_opa_t opa; /**< The overall opacity*/ + lv_color_t color; /**< Fill color*/ + 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*/ + int32_t mask_stride; + lv_blend_mode_t blend_mode; /**< E.g. LV_BLEND_MODE_ADDITIVE*/ +}; + +struct lv_draw_sw_blend_fill_dsc_t { + void * dest_buf; + int32_t dest_w; + int32_t dest_h; + int32_t dest_stride; + const lv_opa_t * mask_buf; + int32_t mask_stride; + lv_color_t color; + lv_opa_t opa; + lv_area_t relative_area; +}; + +struct lv_draw_sw_blend_image_dsc_t { + void * dest_buf; + int32_t dest_w; + int32_t dest_h; + int32_t dest_stride; + const lv_opa_t * mask_buf; + int32_t mask_stride; + const void * src_buf; + int32_t src_stride; + lv_color_format_t src_color_format; + lv_opa_t opa; + lv_blend_mode_t blend_mode; + lv_area_t relative_area; /**< The blend area relative to the layer's buffer area. */ + lv_area_t src_area; /**< The original src area. */ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_DRAW_SW */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_SW_BLEND_PRIVATE_H*/ diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c b/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c index 81d39de01..9c3194c20 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_al88.c @@ -11,7 +11,7 @@ #if LV_DRAW_SW_SUPPORT_AL88 -#include "lv_draw_sw_blend.h" +#include "lv_draw_sw_blend_private.h" #include "../../../misc/lv_math.h" #include "../../../display/lv_display.h" #include "../../../core/lv_refr.h" @@ -47,28 +47,28 @@ typedef struct { **********************/ #if LV_DRAW_SW_SUPPORT_L8 - static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_I1 - static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); static inline uint8_t /* LV_ATTRIBUTE_FAST_MEM */ get_bit(const uint8_t * buf, int32_t bit_idx); #endif -static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); +static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #if LV_DRAW_SW_SUPPORT_RGB565 - static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_RGB888 -static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size); #endif #if LV_DRAW_SW_SUPPORT_ARGB8888 - static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif static void lv_color_mix_with_alpha_cache_init(lv_color_mix_alpha_cache_t * cache); @@ -194,7 +194,7 @@ static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_16a_16a_mix(lv_color16a_ * GLOBAL FUNCTIONS **********************/ -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_al88(_lv_draw_sw_blend_fill_dsc_t * dsc) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_al88(lv_draw_sw_blend_fill_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -306,7 +306,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_al88(_lv_draw_sw_blend_fill } } -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_al88(_lv_draw_sw_blend_image_dsc_t * dsc) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_al88(lv_draw_sw_blend_image_dsc_t * dsc) { switch(dsc->src_color_format) { #if LV_DRAW_SW_SUPPORT_RGB565 @@ -352,7 +352,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_al88(_lv_draw_sw_blend_imag * STATIC FUNCTIONS **********************/ #if LV_DRAW_SW_SUPPORT_I1 -static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -445,7 +445,7 @@ static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * #endif #if LV_DRAW_SW_SUPPORT_L8 -static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -538,7 +538,7 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * #endif -static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -626,7 +626,7 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t #if LV_DRAW_SW_SUPPORT_RGB565 -static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -721,7 +721,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc #if LV_DRAW_SW_SUPPORT_RGB888 -static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, +static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size) { int32_t w = dsc->dest_w; @@ -823,7 +823,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc #if LV_DRAW_SW_SUPPORT_ARGB8888 -static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_al88.h b/src/draw/sw/blend/lv_draw_sw_blend_to_al88.h index 90edb1dba..b83523b92 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_al88.h +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_al88.h @@ -28,9 +28,9 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_al88(_lv_draw_sw_blend_fill_dsc_t * dsc); +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_al88(lv_draw_sw_blend_fill_dsc_t * dsc); -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_al88(_lv_draw_sw_blend_image_dsc_t * dsc); +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_al88(lv_draw_sw_blend_image_dsc_t * dsc); /********************** * MACROS 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 76d308f85..4bf3ef491 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 @@ -11,7 +11,7 @@ #if LV_DRAW_SW_SUPPORT_ARGB8888 -#include "lv_draw_sw_blend.h" +#include "lv_draw_sw_blend_private.h" #include "../../../misc/lv_math.h" #include "../../../display/lv_display.h" #include "../../../core/lv_refr.h" @@ -47,29 +47,29 @@ typedef struct { **********************/ #if LV_DRAW_SW_SUPPORT_AL88 - static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_I1 - static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); static inline uint8_t /* LV_ATTRIBUTE_FAST_MEM */ get_bit(const uint8_t * buf, int32_t bit_idx); #endif #if LV_DRAW_SW_SUPPORT_L8 - static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_RGB565 - static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_RGB888 -static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size); #endif -static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); +static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_8_32_mix(const uint8_t src, lv_color32_t * dest, uint8_t mix); @@ -206,7 +206,7 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b * GLOBAL FUNCTIONS **********************/ -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_fill_dsc_t * dsc) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_argb8888(lv_draw_sw_blend_fill_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -315,7 +315,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_ } } -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_argb8888(_lv_draw_sw_blend_image_dsc_t * dsc) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_argb8888(lv_draw_sw_blend_image_dsc_t * dsc) { switch(dsc->src_color_format) { #if LV_DRAW_SW_SUPPORT_RGB565 @@ -362,7 +362,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_argb8888(_lv_draw_sw_blend_ **********************/ #if LV_DRAW_SW_SUPPORT_I1 -static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -455,7 +455,7 @@ static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * #endif #if LV_DRAW_SW_SUPPORT_AL88 -static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -551,7 +551,7 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t #if LV_DRAW_SW_SUPPORT_L8 -static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -642,7 +642,7 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * #if LV_DRAW_SW_SUPPORT_RGB565 -static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -741,7 +741,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc #if LV_DRAW_SW_SUPPORT_RGB888 -static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size) +static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size) { int32_t w = dsc->dest_w; @@ -861,7 +861,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc #endif -static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.h b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.h index 964991be6..2046c23f3 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.h +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_argb8888.h @@ -28,9 +28,9 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_argb8888(_lv_draw_sw_blend_fill_dsc_t * dsc); +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_argb8888(lv_draw_sw_blend_fill_dsc_t * dsc); -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_argb8888(_lv_draw_sw_blend_image_dsc_t * dsc); +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_argb8888(lv_draw_sw_blend_image_dsc_t * dsc); /********************** * MACROS diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c b/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c index a50048521..1e056ee66 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_i1.c @@ -9,7 +9,7 @@ #include "lv_draw_sw_blend_to_i1.h" #if LV_USE_DRAW_SW -#include "lv_draw_sw_blend.h" +#include "lv_draw_sw_blend_private.h" #include "../../../misc/lv_math.h" #include "../../../display/lv_display.h" #include "../../../core/lv_refr.h" @@ -36,27 +36,27 @@ * STATIC PROTOTYPES **********************/ -static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); +static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #if LV_DRAW_SW_SUPPORT_L8 - static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_AL88 - static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_RGB565 - static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_RGB888 -static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size); #endif #if LV_DRAW_SW_SUPPORT_ARGB8888 - static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_8_8_mix(const uint8_t src, uint8_t * dest, uint8_t mix); @@ -200,7 +200,7 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b * GLOBAL FUNCTIONS **********************/ -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_i1(_lv_draw_sw_blend_fill_dsc_t * dsc) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_i1(lv_draw_sw_blend_fill_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -306,7 +306,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_i1(_lv_draw_sw_blend_fill_d } } -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_i1(_lv_draw_sw_blend_image_dsc_t * dsc) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_i1(lv_draw_sw_blend_image_dsc_t * dsc) { switch(dsc->src_color_format) { #if LV_DRAW_SW_SUPPORT_RGB565 @@ -352,7 +352,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_i1(_lv_draw_sw_blend_image_ * STATIC FUNCTIONS **********************/ -static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -470,7 +470,7 @@ static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * } #if LV_DRAW_SW_SUPPORT_L8 -static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -583,7 +583,7 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * #endif #if LV_DRAW_SW_SUPPORT_AL88 -static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -697,7 +697,7 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t #endif #if LV_DRAW_SW_SUPPORT_ARGB8888 -static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -811,7 +811,7 @@ static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_d #endif #if LV_DRAW_SW_SUPPORT_RGB888 -static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, +static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size) { int32_t w = dsc->dest_w; @@ -933,7 +933,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc #endif #if LV_DRAW_SW_SUPPORT_RGB565 -static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_i1.h b/src/draw/sw/blend/lv_draw_sw_blend_to_i1.h index efb852e06..ef63bc2f3 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_i1.h +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_i1.h @@ -28,9 +28,9 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_i1(_lv_draw_sw_blend_fill_dsc_t * dsc); +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_i1(lv_draw_sw_blend_fill_dsc_t * dsc); -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_i1(_lv_draw_sw_blend_image_dsc_t * dsc); +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_i1(lv_draw_sw_blend_image_dsc_t * dsc); /********************** * MACROS diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c b/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c index 403299e5f..fa9c0251f 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_l8.c @@ -11,7 +11,7 @@ #if LV_DRAW_SW_SUPPORT_L8 -#include "lv_draw_sw_blend.h" +#include "lv_draw_sw_blend_private.h" #include "../../../misc/lv_math.h" #include "../../../display/lv_display.h" #include "../../../core/lv_refr.h" @@ -39,28 +39,28 @@ **********************/ #if LV_DRAW_SW_SUPPORT_I1 - static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); static inline uint8_t /* LV_ATTRIBUTE_FAST_MEM */ get_bit(const uint8_t * buf, int32_t bit_idx); #endif -static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); +static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #if LV_DRAW_SW_SUPPORT_AL88 - static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_RGB565 - static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_RGB888 -static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size); #endif #if LV_DRAW_SW_SUPPORT_ARGB8888 - static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif static inline void /* LV_ATTRIBUTE_FAST_MEM */ lv_color_8_8_mix(const uint8_t src, uint8_t * dest, uint8_t mix); @@ -178,7 +178,7 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b * GLOBAL FUNCTIONS **********************/ -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_l8(_lv_draw_sw_blend_fill_dsc_t * dsc) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_l8(lv_draw_sw_blend_fill_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -280,7 +280,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_l8(_lv_draw_sw_blend_fill_d } } -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_l8(_lv_draw_sw_blend_image_dsc_t * dsc) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_l8(lv_draw_sw_blend_image_dsc_t * dsc) { switch(dsc->src_color_format) { #if LV_DRAW_SW_SUPPORT_RGB565 @@ -327,7 +327,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_l8(_lv_draw_sw_blend_image_ **********************/ #if LV_DRAW_SW_SUPPORT_I1 -static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -414,7 +414,7 @@ static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * } #endif -static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -496,7 +496,7 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * #if LV_DRAW_SW_SUPPORT_AL88 -static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -584,7 +584,7 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t #if LV_DRAW_SW_SUPPORT_RGB565 -static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -670,7 +670,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc #if LV_DRAW_SW_SUPPORT_RGB888 -static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, +static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size) { int32_t w = dsc->dest_w; @@ -761,7 +761,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc #if LV_DRAW_SW_SUPPORT_ARGB8888 -static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_l8.h b/src/draw/sw/blend/lv_draw_sw_blend_to_l8.h index 71ef1cd12..079218e5a 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_l8.h +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_l8.h @@ -28,9 +28,9 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_l8(_lv_draw_sw_blend_fill_dsc_t * dsc); +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_l8(lv_draw_sw_blend_fill_dsc_t * dsc); -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_l8(_lv_draw_sw_blend_image_dsc_t * dsc); +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_l8(lv_draw_sw_blend_image_dsc_t * dsc); /********************** * MACROS 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 cf1ff8ea0..1fa8c06b2 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 @@ -11,7 +11,7 @@ #if LV_DRAW_SW_SUPPORT_RGB565 -#include "lv_draw_sw_blend.h" +#include "lv_draw_sw_blend_private.h" #include "../../../misc/lv_math.h" #include "../../../display/lv_display.h" #include "../../../core/lv_refr.h" @@ -39,28 +39,28 @@ **********************/ #if LV_DRAW_SW_SUPPORT_AL88 - static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif #if LV_DRAW_SW_SUPPORT_I1 - static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); static inline uint8_t /* LV_ATTRIBUTE_FAST_MEM */ get_bit(const uint8_t * buf, int32_t bit_idx); #endif #if LV_DRAW_SW_SUPPORT_L8 - static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif -static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #if LV_DRAW_SW_SUPPORT_RGB888 -static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size); #endif #if LV_DRAW_SW_SUPPORT_ARGB8888 - static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc); + static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc); #endif static inline uint16_t /* LV_ATTRIBUTE_FAST_MEM */ l8_to_rgb565(const uint8_t c1); @@ -208,7 +208,7 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b * @param mask * @param mask_stride */ -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fill_dsc_t * dsc) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_rgb565(lv_draw_sw_blend_fill_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -359,7 +359,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fi } } -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb565(_lv_draw_sw_blend_image_dsc_t * dsc) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb565(lv_draw_sw_blend_image_dsc_t * dsc) { switch(dsc->src_color_format) { case LV_COLOR_FORMAT_RGB565: @@ -406,7 +406,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb565(_lv_draw_sw_blend_im **********************/ #if LV_DRAW_SW_SUPPORT_I1 -static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -523,7 +523,7 @@ static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * #endif #if LV_DRAW_SW_SUPPORT_AL88 -static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -641,7 +641,7 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t #if LV_DRAW_SW_SUPPORT_L8 -static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -754,7 +754,7 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * #endif -static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -864,7 +864,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc #if LV_DRAW_SW_SUPPORT_RGB888 -static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size) +static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t src_px_size) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -976,7 +976,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc #if LV_DRAW_SW_SUPPORT_ARGB8888 -static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc) +static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.h b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.h index 156428877..d14bfd94d 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.h +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb565.h @@ -28,9 +28,9 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_rgb565(_lv_draw_sw_blend_fill_dsc_t * dsc); +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_rgb565(lv_draw_sw_blend_fill_dsc_t * dsc); -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_rgb565(_lv_draw_sw_blend_image_dsc_t * dsc); +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_rgb565(lv_draw_sw_blend_image_dsc_t * dsc); /********************** * MACROS 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 245730bde..e29e934c1 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 @@ -11,7 +11,7 @@ #if LV_DRAW_SW_SUPPORT_RGB888 -#include "lv_draw_sw_blend.h" +#include "lv_draw_sw_blend_private.h" #include "../../../misc/lv_math.h" #include "../../../display/lv_display.h" #include "../../../core/lv_refr.h" @@ -39,29 +39,29 @@ **********************/ #if LV_DRAW_SW_SUPPORT_AL88 - static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); + static void /* LV_ATTRIBUTE_FAST_MEM */ al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); #endif #if LV_DRAW_SW_SUPPORT_I1 - static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); + static void /* LV_ATTRIBUTE_FAST_MEM */ i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); static inline uint8_t /* LV_ATTRIBUTE_FAST_MEM */ get_bit(const uint8_t * buf, int32_t bit_idx); #endif #if LV_DRAW_SW_SUPPORT_L8 - static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); + static void /* LV_ATTRIBUTE_FAST_MEM */ l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); #endif #if LV_DRAW_SW_SUPPORT_RGB565 - static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); + static void /* LV_ATTRIBUTE_FAST_MEM */ rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); #endif -static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, +static void /* LV_ATTRIBUTE_FAST_MEM */ rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t dest_px_size, uint32_t src_px_size); #if LV_DRAW_SW_SUPPORT_ARGB8888 -static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, +static void /* LV_ATTRIBUTE_FAST_MEM */ argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); #endif @@ -181,7 +181,7 @@ static inline void * /* LV_ATTRIBUTE_FAST_MEM */ drawbuf_next_row(const void * b * GLOBAL FUNCTIONS **********************/ -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dest_px_size) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_rgb888(lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dest_px_size) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -308,7 +308,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fi } } -void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb888(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) +void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb888(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) { switch(dsc->src_color_format) { @@ -356,7 +356,7 @@ void LV_ATTRIBUTE_FAST_MEM lv_draw_sw_blend_image_to_rgb888(_lv_draw_sw_blend_im **********************/ #if LV_DRAW_SW_SUPPORT_I1 -static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) +static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -446,7 +446,7 @@ static void LV_ATTRIBUTE_FAST_MEM i1_image_blend(_lv_draw_sw_blend_image_dsc_t * #endif #if LV_DRAW_SW_SUPPORT_AL88 -static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) +static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -532,7 +532,7 @@ static void LV_ATTRIBUTE_FAST_MEM al88_image_blend(_lv_draw_sw_blend_image_dsc_t #if LV_DRAW_SW_SUPPORT_L8 -static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) +static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -620,7 +620,7 @@ static void LV_ATTRIBUTE_FAST_MEM l8_image_blend(_lv_draw_sw_blend_image_dsc_t * #if LV_DRAW_SW_SUPPORT_RGB565 -static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) +static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; @@ -718,7 +718,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb565_image_blend(_lv_draw_sw_blend_image_dsc #endif -static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t dest_px_size, +static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, const uint8_t dest_px_size, uint32_t src_px_size) { int32_t w = dsc->dest_w * dest_px_size; @@ -818,7 +818,7 @@ static void LV_ATTRIBUTE_FAST_MEM rgb888_image_blend(_lv_draw_sw_blend_image_dsc #if LV_DRAW_SW_SUPPORT_ARGB8888 -static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(_lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) +static void LV_ATTRIBUTE_FAST_MEM argb8888_image_blend(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size) { int32_t w = dsc->dest_w; int32_t h = dsc->dest_h; diff --git a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.h b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.h index 66dc477a6..441c0d3e8 100644 --- a/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.h +++ b/src/draw/sw/blend/lv_draw_sw_blend_to_rgb888.h @@ -28,10 +28,10 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_rgb888(_lv_draw_sw_blend_fill_dsc_t * dsc, +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_color_to_rgb888(lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dest_px_size); -void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_rgb888(_lv_draw_sw_blend_image_dsc_t * dsc, +void /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_blend_image_to_rgb888(lv_draw_sw_blend_image_dsc_t * dsc, uint32_t dest_px_size); /********************** diff --git a/src/draw/sw/blend/neon/lv_blend_neon.h b/src/draw/sw/blend/neon/lv_blend_neon.h index fbe7ea9b4..e94810bfb 100644 --- a/src/draw/sw/blend/neon/lv_blend_neon.h +++ b/src/draw/sw/blend/neon/lv_blend_neon.h @@ -27,242 +27,242 @@ extern "C" { #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565(dsc) \ - _lv_color_blend_to_rgb565_neon(dsc) + lv_color_blend_to_rgb565_neon(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_OPA(dsc) \ - _lv_color_blend_to_rgb565_with_opa_neon(dsc) + lv_color_blend_to_rgb565_with_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_WITH_MASK(dsc) \ - _lv_color_blend_to_rgb565_with_mask_neon(dsc) + lv_color_blend_to_rgb565_with_mask_neon(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB565_MIX_MASK_OPA(dsc) \ - _lv_color_blend_to_rgb565_mix_mask_opa_neon(dsc) + lv_color_blend_to_rgb565_mix_mask_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_neon(dsc) + lv_rgb565_blend_normal_to_rgb565_neon(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_with_opa_neon(dsc) + lv_rgb565_blend_normal_to_rgb565_with_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_with_mask_neon(dsc) + lv_rgb565_blend_normal_to_rgb565_with_mask_neon(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \ - _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(dsc) + lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_neon(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_neon(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_with_opa_neon(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_with_opa_neon(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_with_mask_neon(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_with_mask_neon(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_neon(dsc, src_px_size) + lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_neon(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_neon(dsc) + lv_argb8888_blend_normal_to_rgb565_neon(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_OPA(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_with_opa_neon(dsc) + lv_argb8888_blend_normal_to_rgb565_with_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_WITH_MASK(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_with_mask_neon(dsc) + lv_argb8888_blend_normal_to_rgb565_with_mask_neon(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB565_MIX_MASK_OPA(dsc) \ - _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon(dsc) + lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888 #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_neon(dsc, dst_px_size) + lv_color_blend_to_rgb888_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_with_opa_neon(dsc, dst_px_size) + lv_color_blend_to_rgb888_with_opa_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_with_mask_neon(dsc, dst_px_size) + lv_color_blend_to_rgb888_with_mask_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ - _lv_color_blend_to_rgb888_mix_mask_opa_neon(dsc, dst_px_size) + lv_color_blend_to_rgb888_mix_mask_opa_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_neon(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_with_opa_neon(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_with_opa_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_with_mask_neon(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_with_mask_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ - _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_neon(dsc, dst_px_size) + lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_neon(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_neon(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_with_opa_neon(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_with_opa_neon(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_with_mask_neon(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_with_mask_neon(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size, src_px_size) \ - _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_neon(dsc, dst_px_size, src_px_size) + lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_neon(dsc, dst_px_size, src_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_neon(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_OPA(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_with_opa_neon(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_with_opa_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_WITH_MASK(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_with_mask_neon(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_with_mask_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_RGB888_MIX_MASK_OPA(dsc, dst_px_size) \ - _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_neon(dsc, dst_px_size) + lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_neon(dsc, dst_px_size) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888 #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888(dsc) \ - _lv_color_blend_to_argb8888_neon(dsc) + lv_color_blend_to_argb8888_neon(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_OPA(dsc) \ - _lv_color_blend_to_argb8888_with_opa_neon(dsc) + lv_color_blend_to_argb8888_with_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_WITH_MASK(dsc) \ - _lv_color_blend_to_argb8888_with_mask_neon(dsc) + lv_color_blend_to_argb8888_with_mask_neon(dsc) #endif #ifndef LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA #define LV_DRAW_SW_COLOR_BLEND_TO_ARGB8888_MIX_MASK_OPA(dsc) \ - _lv_color_blend_to_argb8888_mix_mask_opa_neon(dsc) + lv_color_blend_to_argb8888_mix_mask_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888 #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888(dsc) \ - _lv_rgb565_blend_normal_to_argb8888_neon(dsc) + lv_rgb565_blend_normal_to_argb8888_neon(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc) \ - _lv_rgb565_blend_normal_to_argb8888_with_opa_neon(dsc) + lv_rgb565_blend_normal_to_argb8888_with_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc) \ - _lv_rgb565_blend_normal_to_argb8888_with_mask_neon(dsc) + lv_rgb565_blend_normal_to_argb8888_with_mask_neon(dsc) #endif #ifndef LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA #define LV_DRAW_SW_RGB565_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc) \ - _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon(dsc) + lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888 #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_argb8888_neon(dsc, src_px_size) + lv_rgb888_blend_normal_to_argb8888_neon(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_argb8888_with_opa_neon(dsc, src_px_size) + lv_rgb888_blend_normal_to_argb8888_with_opa_neon(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_argb8888_with_mask_neon(dsc, src_px_size) + lv_rgb888_blend_normal_to_argb8888_with_mask_neon(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA #define LV_DRAW_SW_RGB888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc, src_px_size) \ - _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_neon(dsc, src_px_size) + lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_neon(dsc, src_px_size) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888 #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888(dsc) \ - _lv_argb8888_blend_normal_to_argb8888_neon(dsc) + lv_argb8888_blend_normal_to_argb8888_neon(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_OPA(dsc) \ - _lv_argb8888_blend_normal_to_argb8888_with_opa_neon(dsc) + lv_argb8888_blend_normal_to_argb8888_with_opa_neon(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_WITH_MASK(dsc) \ - _lv_argb8888_blend_normal_to_argb8888_with_mask_neon(dsc) + lv_argb8888_blend_normal_to_argb8888_with_mask_neon(dsc) #endif #ifndef LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA #define LV_DRAW_SW_ARGB8888_BLEND_NORMAL_TO_ARGB8888_MIX_MASK_OPA(dsc) \ - _lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_neon(dsc) + lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_neon(dsc) #endif /********************** @@ -285,7 +285,7 @@ typedef struct { **********************/ extern void lv_color_blend_to_rgb565_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb565_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_neon(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -300,7 +300,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_neon(_lv_draw_sw_blend_fill_ } extern void lv_color_blend_to_rgb565_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb565_with_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_with_opa_neon(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -315,7 +315,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_with_opa_neon(_lv_draw_sw_bl } extern void lv_color_blend_to_rgb565_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb565_with_mask_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_with_mask_neon(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -331,7 +331,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_with_mask_neon(_lv_draw_sw_b } extern void lv_color_blend_to_rgb565_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_rgb565_mix_mask_opa_neon(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -348,7 +348,7 @@ static inline lv_result_t _lv_color_blend_to_rgb565_mix_mask_opa_neon(_lv_draw_s } extern void lv_rgb565_blend_normal_to_rgb565_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -363,7 +363,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_neon(_lv_draw_sw_ble } extern void lv_rgb565_blend_normal_to_rgb565_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_with_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -379,7 +379,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_opa_neon(_lv_dr } extern void lv_rgb565_blend_normal_to_rgb565_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_with_mask_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -396,7 +396,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_with_mask_neon(_lv_d } extern void lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -415,8 +415,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb565_mix_mask_opa_neon(_l extern void lv_rgb888_blend_normal_to_rgb565_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -437,8 +437,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_neon(_lv_draw_sw_ble extern void lv_rgb888_blend_normal_to_rgb565_with_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_with_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -460,8 +460,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_opa_neon(_lv_dr extern void lv_rgb888_blend_normal_to_rgb565_with_mask_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_with_mask_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -484,8 +484,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_with_mask_neon(_lv_d extern void lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb565_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -508,7 +508,7 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb565_mix_mask_opa_neon(_l } extern void lv_argb8888_blend_normal_to_rgb565_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -523,7 +523,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_neon(_lv_draw_sw_b } extern void lv_argb8888_blend_normal_to_rgb565_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_with_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -539,7 +539,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_opa_neon(_lv_ } extern void lv_argb8888_blend_normal_to_rgb565_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_with_mask_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -556,7 +556,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_with_mask_neon(_lv } extern void lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -575,7 +575,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb565_mix_mask_opa_neon( extern void lv_color_blend_to_rgb888_neon(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb888_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_neon(lv_draw_sw_blend_fill_dsc_t * dsc, uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -595,8 +595,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_neon(_lv_draw_sw_blend_fill_ extern void lv_color_blend_to_rgb888_with_opa_neon(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb888_with_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_with_opa_neon(lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -617,8 +617,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_with_opa_neon(_lv_draw_sw_bl extern void lv_color_blend_to_rgb888_with_mask_neon(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb888_with_mask_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_with_mask_neon(lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -640,8 +640,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_with_mask_neon(_lv_draw_sw_b extern void lv_color_blend_to_rgb888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_color_blend_to_xrgb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_color_blend_to_rgb888_mix_mask_opa_neon(lv_draw_sw_blend_fill_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -664,8 +664,8 @@ static inline lv_result_t _lv_color_blend_to_rgb888_mix_mask_opa_neon(_lv_draw_s extern void lv_rgb565_blend_normal_to_rgb888_neon(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -686,8 +686,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_neon(_lv_draw_sw_ble extern void lv_rgb565_blend_normal_to_rgb888_with_opa_neon(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_with_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -709,8 +709,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_opa_neon(_lv_dr extern void lv_rgb565_blend_normal_to_rgb888_with_mask_neon(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_with_mask_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -733,8 +733,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_with_mask_neon(_lv_d extern void lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_rgb565_blend_normal_to_xrgb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_rgb565_blend_normal_to_rgb888_mix_mask_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -760,9 +760,9 @@ extern void lv_rgb888_blend_normal_to_rgb888_neon(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -795,8 +795,8 @@ extern void lv_rgb888_blend_normal_to_rgb888_with_opa_neon(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_with_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_with_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_with_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -830,8 +830,8 @@ extern void lv_rgb888_blend_normal_to_rgb888_with_mask_neon(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_with_mask_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_with_mask_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_with_mask_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -866,8 +866,8 @@ extern void lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_rgb888_blend_normal_to_xrgb8888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_rgb888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_xrgb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size, uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size, uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -901,8 +901,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_rgb888_mix_mask_opa_neon(_l extern void lv_argb8888_blend_normal_to_rgb888_neon(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -923,8 +923,8 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_neon(_lv_draw_sw_b extern void lv_argb8888_blend_normal_to_rgb888_with_opa_neon(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_with_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -946,8 +946,8 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_opa_neon(_lv_ extern void lv_argb8888_blend_normal_to_rgb888_with_mask_neon(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_with_mask_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -970,8 +970,8 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_with_mask_neon(_lv extern void lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_argb8888_blend_normal_to_xrgb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t dst_px_size) +static inline lv_result_t lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t dst_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -994,7 +994,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_rgb888_mix_mask_opa_neon( } extern void lv_color_blend_to_argb8888_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_argb8888_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_argb8888_neon(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1009,7 +1009,7 @@ static inline lv_result_t _lv_color_blend_to_argb8888_neon(_lv_draw_sw_blend_fil } extern void lv_color_blend_to_argb8888_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_argb8888_with_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_argb8888_with_opa_neon(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1024,7 +1024,7 @@ static inline lv_result_t _lv_color_blend_to_argb8888_with_opa_neon(_lv_draw_sw_ } extern void lv_color_blend_to_argb8888_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_argb8888_with_mask_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_argb8888_with_mask_neon(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1040,7 +1040,7 @@ static inline lv_result_t _lv_color_blend_to_argb8888_with_mask_neon(_lv_draw_sw } extern void lv_color_blend_to_argb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_color_blend_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_fill_dsc_t * dsc) +static inline lv_result_t lv_color_blend_to_argb8888_mix_mask_opa_neon(lv_draw_sw_blend_fill_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1057,7 +1057,7 @@ static inline lv_result_t _lv_color_blend_to_argb8888_mix_mask_opa_neon(_lv_draw } extern void lv_rgb565_blend_normal_to_argb8888_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_argb8888_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1072,7 +1072,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_neon(_lv_draw_sw_b } extern void lv_rgb565_blend_normal_to_argb8888_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_argb8888_with_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1088,7 +1088,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_opa_neon(_lv_ } extern void lv_rgb565_blend_normal_to_argb8888_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_argb8888_with_mask_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1105,7 +1105,7 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_with_mask_neon(_lv } extern void lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1124,8 +1124,8 @@ static inline lv_result_t _lv_rgb565_blend_normal_to_argb8888_mix_mask_opa_neon( extern void lv_rgb888_blend_normal_to_argb8888_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_argb8888_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1146,8 +1146,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_neon(_lv_draw_sw_b extern void lv_rgb888_blend_normal_to_argb8888_with_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_argb8888_with_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1169,8 +1169,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_opa_neon(_lv_ extern void lv_rgb888_blend_normal_to_argb8888_with_mask_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_argb8888_with_mask_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1193,8 +1193,8 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_with_mask_neon(_lv extern void lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_neon(asm_dsc_t * dsc); extern void lv_xrgb8888_blend_normal_to_argb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc, - uint32_t src_px_size) +static inline lv_result_t lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc, + uint32_t src_px_size) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1217,7 +1217,7 @@ static inline lv_result_t _lv_rgb888_blend_normal_to_argb8888_mix_mask_opa_neon( } extern void lv_argb8888_blend_normal_to_argb8888_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_argb8888_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1232,7 +1232,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_neon(_lv_draw_sw } extern void lv_argb8888_blend_normal_to_argb8888_with_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_argb8888_with_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, @@ -1248,7 +1248,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_opa_neon(_l } extern void lv_argb8888_blend_normal_to_argb8888_with_mask_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_mask_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_argb8888_with_mask_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .dst_buf = dsc->dest_buf, @@ -1265,7 +1265,7 @@ static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_with_mask_neon(_ } extern void lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_neon(asm_dsc_t * dsc); -static inline lv_result_t _lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_neon(_lv_draw_sw_blend_image_dsc_t * dsc) +static inline lv_result_t lv_argb8888_blend_normal_to_argb8888_mix_mask_opa_neon(lv_draw_sw_blend_image_dsc_t * dsc) { asm_dsc_t asm_dsc = { .opa = dsc->opa, diff --git a/src/draw/sw/lv_draw_sw.c b/src/draw/sw/lv_draw_sw.c index ef173efba..9c2040d0b 100644 --- a/src/draw/sw/lv_draw_sw.c +++ b/src/draw/sw/lv_draw_sw.c @@ -6,11 +6,11 @@ /********************* * INCLUDES *********************/ -#include "../lv_draw.h" +#include "../lv_draw_private.h" #if LV_USE_DRAW_SW #include "../../core/lv_refr.h" -#include "lv_draw_sw.h" +#include "lv_draw_sw_private.h" #include "../../display/lv_display_private.h" #include "../../stdlib/lv_string.h" #include "../../core/lv_global.h" @@ -506,7 +506,7 @@ static void execute_drawing(lv_draw_sw_unit_t * u) /*Layers manage it for themselves*/ if(t->type != LV_DRAW_TASK_TYPE_LAYER) { lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area)) return; + if(!lv_area_intersect(&draw_area, &t->area, u->base_unit.clip_area)) return; int32_t idx = 0; lv_draw_unit_t * draw_unit_tmp = _draw_info.unit_head; @@ -516,7 +516,7 @@ static void execute_drawing(lv_draw_sw_unit_t * u) } lv_draw_rect_dsc_t rect_dsc; lv_draw_rect_dsc_init(&rect_dsc); - rect_dsc.bg_color = lv_palette_main(idx % _LV_PALETTE_LAST); + rect_dsc.bg_color = lv_palette_main(idx % LV_PALETTE_LAST); rect_dsc.border_color = rect_dsc.bg_color; rect_dsc.bg_opa = LV_OPA_10; rect_dsc.border_opa = LV_OPA_80; diff --git a/src/draw/sw/lv_draw_sw.h b/src/draw/sw/lv_draw_sw.h index e549ec39b..9e51ea286 100644 --- a/src/draw/sw/lv_draw_sw.h +++ b/src/draw/sw/lv_draw_sw.h @@ -28,30 +28,6 @@ extern "C" { *********************/ /********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_draw_unit_t base_unit; - lv_draw_task_t * task_act; -#if LV_USE_OS - lv_thread_sync_t sync; - lv_thread_t thread; - volatile bool inited; - volatile bool exit_status; -#endif - uint32_t idx; -} lv_draw_sw_unit_t; - -#if LV_DRAW_SW_SHADOW_CACHE_SIZE -typedef struct { - uint8_t cache[LV_DRAW_SW_SHADOW_CACHE_SIZE * LV_DRAW_SW_SHADOW_CACHE_SIZE]; - int32_t cache_size; - int32_t cache_r; -} lv_draw_sw_shadow_cache_t; -#endif - -/********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/draw/sw/lv_draw_sw_arc.c b/src/draw/sw/lv_draw_sw_arc.c index 5db127df5..ec2fb2fd9 100644 --- a/src/draw/sw/lv_draw_sw_arc.c +++ b/src/draw/sw/lv_draw_sw_arc.c @@ -6,6 +6,10 @@ /********************* * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "lv_draw_sw_mask_private.h" +#include "blend/lv_draw_sw_blend_private.h" +#include "../lv_image_decoder_private.h" #include "lv_draw_sw.h" #if LV_USE_DRAW_SW #if LV_DRAW_SW_COMPLEX @@ -14,7 +18,7 @@ #include "../../misc/lv_log.h" #include "../../stdlib/lv_mem.h" #include "../../stdlib/lv_string.h" -#include "../lv_draw.h" +#include "../lv_draw_private.h" 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, int32_t width); @@ -58,7 +62,7 @@ void lv_draw_sw_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * dsc, c lv_area_t area_out = *coords; lv_area_t clipped_area; - if(!_lv_area_intersect(&clipped_area, &area_out, draw_unit->clip_area)) return; + if(!lv_area_intersect(&clipped_area, &area_out, draw_unit->clip_area)) return; /*Draw a full ring*/ if(dsc->img_src == NULL && @@ -246,7 +250,7 @@ static void add_circle(const lv_opa_t * circle_mask, const lv_area_t * blend_are 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)) { + if(lv_area_intersect(&circle_common_area, circle_area, blend_area)) { const lv_opa_t * circle_mask_tmp = circle_mask + width * (circle_common_area.y1 - circle_area->y1); circle_mask_tmp += circle_common_area.x1 - circle_area->x1; diff --git a/src/draw/sw/lv_draw_sw_border.c b/src/draw/sw/lv_draw_sw_border.c index c7f11919d..07eb18c0e 100644 --- a/src/draw/sw/lv_draw_sw_border.c +++ b/src/draw/sw/lv_draw_sw_border.c @@ -6,10 +6,14 @@ /********************* * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "lv_draw_sw_mask_private.h" +#include "../lv_draw_private.h" +#include "../lv_draw_private.h" #include "lv_draw_sw.h" #if LV_USE_DRAW_SW -#include "blend/lv_draw_sw_blend.h" +#include "blend/lv_draw_sw_blend_private.h" #include "../../misc/lv_math.h" #include "../../misc/lv_text_ap.h" #include "../../core/lv_refr.h" @@ -90,7 +94,7 @@ void draw_border_complex(lv_draw_unit_t * draw_unit, const lv_area_t * outer_are /*Get clipped draw area which is the real draw area. *It is always the same or inside `coords`*/ lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, outer_area, draw_unit->clip_area)) return; + if(!lv_area_intersect(&draw_area, outer_area, draw_unit->clip_area)) return; int32_t draw_area_w = lv_area_get_width(&draw_area); lv_draw_sw_blend_dsc_t blend_dsc; diff --git a/src/draw/sw/lv_draw_sw_box_shadow.c b/src/draw/sw/lv_draw_sw_box_shadow.c index 4ccb3b837..f80287566 100644 --- a/src/draw/sw/lv_draw_sw_box_shadow.c +++ b/src/draw/sw/lv_draw_sw_box_shadow.c @@ -6,12 +6,15 @@ /********************* * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "lv_draw_sw_mask_private.h" +#include "../lv_draw_private.h" #include "lv_draw_sw.h" #if LV_USE_DRAW_SW #if LV_DRAW_SW_COMPLEX -#include "blend/lv_draw_sw_blend.h" +#include "blend/lv_draw_sw_blend_private.h" #include "../../core/lv_global.h" #include "../../misc/lv_math.h" #include "../../core/lv_refr.h" @@ -74,7 +77,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ /*Get clipped draw area which is the real draw area. *It is always the same or inside `shadow_area`*/ lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &shadow_area, draw_unit->clip_area)) return; + if(!lv_area_intersect(&draw_area, &shadow_area, draw_unit->clip_area)) return; /*Consider 1 px smaller bg to be sure the edge will be covered by the shadow*/ lv_area_t bg_area; @@ -161,15 +164,15 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_area.x1 = LV_MAX(blend_area.x1, w_half); blend_area.y2 = LV_MIN(blend_area.y2, h_half); - if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && - !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { + if(lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && + !lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { 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); /*Do not mask if out of the bg*/ - if(simple && _lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; + if(simple && lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; else simple_sub = simple; if(w > 0) { blend_dsc.mask_buf = mask_buf; @@ -204,14 +207,14 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_area.x1 = LV_MAX(blend_area.x1, w_half); blend_area.y1 = LV_MAX(blend_area.y1, h_half + 1); - if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && - !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { + if(lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && + !lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { 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); /*Do not mask if out of the bg*/ - if(simple && _lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; + if(simple && lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; else simple_sub = simple; if(w > 0) { @@ -244,14 +247,14 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_area.y2 = shadow_area.y1 + corner_size - 1; blend_area.y2 = LV_MIN(blend_area.y2, h_half); - if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && - !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { + if(lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && + !lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { 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; /*Do not mask if out of the bg*/ - if(simple && _lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; + if(simple && lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; else simple_sub = simple; if(w > 0) { @@ -291,14 +294,14 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_area.y2 = shadow_area.y2; blend_area.y1 = LV_MAX(blend_area.y1, h_half + 1); - if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && - !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { + if(lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && + !lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { 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) { /*Do not mask if out of the bg*/ - if(simple && _lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; + if(simple && lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; else simple_sub = simple; if(!simple_sub) { @@ -315,7 +318,7 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_area.y2 = y; /*Do not mask if out of the bg*/ - if(simple && _lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; + if(simple && lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; else simple_sub = simple; if(!simple_sub) { @@ -346,15 +349,15 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_area.y2 = LV_MAX(blend_area.y2, h_half); blend_area.x1 = LV_MAX(blend_area.x1, w_half); - if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && - !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { + if(lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && + !lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { 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); /*Do not mask if out of the bg*/ - if(simple && _lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; + if(simple && lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; else simple_sub = simple; blend_dsc.mask_buf = simple_sub ? sh_buf_tmp : mask_buf; @@ -403,15 +406,15 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_area.y2 = LV_MAX(blend_area.y2, h_half); blend_area.x2 = LV_MIN(blend_area.x2, w_half - 1); - if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && - !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { + if(lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && + !lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { 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; /*Do not mask if out of the bg*/ - if(simple && _lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; + if(simple && lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; else simple_sub = simple; blend_dsc.mask_buf = simple_sub ? sh_buf_tmp : mask_buf; if(w > 0) { @@ -442,15 +445,15 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_area.x2 = LV_MIN(blend_area.x2, w_half - 1); blend_area.y2 = LV_MIN(blend_area.y2, h_half); - if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && - !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { + if(lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && + !lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { 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; /*Do not mask if out of the bg*/ - if(simple && _lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; + if(simple && lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; else simple_sub = simple; blend_dsc.mask_buf = mask_buf; @@ -487,15 +490,15 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_area.y1 = LV_MAX(blend_area.y1, h_half + 1); blend_area.x2 = LV_MIN(blend_area.x2, w_half - 1); - if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && - !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { + if(lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && + !lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { 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; /*Do not mask if out of the bg*/ - if(simple && _lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; + if(simple && lv_area_is_out(&clip_area_sub, &bg_area, r_bg)) simple_sub = true; else simple_sub = simple; blend_dsc.mask_buf = mask_buf; if(w > 0) { @@ -529,8 +532,8 @@ void lv_draw_sw_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_shadow_ blend_area.y2 = LV_MAX(blend_area.y2, h_half); blend_dsc.mask_buf = mask_buf; - if(_lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && - !_lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { + if(lv_area_intersect(&clip_area_sub, &blend_area, draw_unit->clip_area) && + !lv_area_is_in(&clip_area_sub, &bg_area, r_bg)) { int32_t w = lv_area_get_width(&clip_area_sub); if(w > 0) { blend_area.x1 = clip_area_sub.x1; diff --git a/src/draw/sw/lv_draw_sw_fill.c b/src/draw/sw/lv_draw_sw_fill.c index af111ed62..0aeb55994 100644 --- a/src/draw/sw/lv_draw_sw_fill.c +++ b/src/draw/sw/lv_draw_sw_fill.c @@ -6,11 +6,14 @@ /********************* * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "lv_draw_sw_mask_private.h" +#include "../lv_draw_private.h" #include "lv_draw_sw.h" #if LV_USE_DRAW_SW -#include "blend/lv_draw_sw_blend.h" -#include "lv_draw_sw_gradient.h" +#include "blend/lv_draw_sw_blend_private.h" +#include "lv_draw_sw_gradient_private.h" #include "../../misc/lv_math.h" #include "../../misc/lv_text_ap.h" #include "../../core/lv_refr.h" @@ -50,7 +53,7 @@ void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, lv_draw_fill_dsc_t * dsc, const lv_area_copy(&bg_coords, coords); lv_area_t clipped_coords; - if(!_lv_area_intersect(&clipped_coords, &bg_coords, draw_unit->clip_area)) return; + if(!lv_area_intersect(&clipped_coords, &bg_coords, draw_unit->clip_area)) return; lv_grad_dir_t grad_dir = dsc->grad.dir; lv_color_t bg_color = grad_dir == LV_GRAD_DIR_NONE ? dsc->color : dsc->grad.stops[0].color; @@ -187,6 +190,8 @@ void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, lv_draw_fill_dsc_t * dsc, const preblend = true; break; #endif + default: + break; } /* pre-blend the mask */ if(preblend) { @@ -225,6 +230,8 @@ void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, lv_draw_fill_dsc_t * dsc, const preblend = true; break; #endif + default: + break; } /* pre-blend the mask */ if(preblend) { @@ -270,6 +277,8 @@ void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, lv_draw_fill_dsc_t * dsc, const case LV_GRAD_DIR_CONICAL: blend_dsc.mask_res = transp ? LV_DRAW_SW_MASK_RES_CHANGED : LV_DRAW_SW_MASK_RES_FULL_COVER; blend_dsc.mask_buf = grad_opa_map; + default: + break; } int32_t h_start = LV_MAX(bg_coords.y1 + rout, clipped_coords.y1); @@ -295,6 +304,8 @@ void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, lv_draw_fill_dsc_t * dsc, const lv_gradient_conical_get_line(&dsc->grad, clipped_coords.x1 - bg_coords.x1, h - bg_coords.y1, coords_bg_w, grad); break; #endif + default: + break; } lv_draw_sw_blend(draw_unit, &blend_dsc); } @@ -319,6 +330,8 @@ void lv_draw_sw_fill(lv_draw_unit_t * draw_unit, lv_draw_fill_dsc_t * dsc, const case LV_GRAD_DIR_CONICAL: lv_gradient_conical_cleanup(&dsc->grad); break; + default: + break; } } #endif diff --git a/src/draw/sw/lv_draw_sw_gradient.c b/src/draw/sw/lv_draw_sw_gradient.c index 5fb94f7c8..92627108c 100644 --- a/src/draw/sw/lv_draw_sw_gradient.c +++ b/src/draw/sw/lv_draw_sw_gradient.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_draw_sw_gradient.h" +#include "lv_draw_sw_gradient_private.h" #if LV_USE_DRAW_SW #include "../../misc/lv_types.h" diff --git a/src/draw/sw/lv_draw_sw_gradient.h b/src/draw/sw/lv_draw_sw_gradient.h index 71a803b9d..a0bec58e1 100644 --- a/src/draw/sw/lv_draw_sw_gradient.h +++ b/src/draw/sw/lv_draw_sw_gradient.h @@ -36,12 +36,6 @@ extern "C" { **********************/ typedef lv_color_t lv_grad_color_t; -typedef struct _lv_gradient_cache_t { - lv_color_t * color_map; - lv_opa_t * opa_map; - uint32_t size; -} lv_grad_t; - /********************** * PROTOTYPES **********************/ diff --git a/src/draw/sw/lv_draw_sw_gradient_private.h b/src/draw/sw/lv_draw_sw_gradient_private.h new file mode 100644 index 000000000..7e2f2ab3d --- /dev/null +++ b/src/draw/sw/lv_draw_sw_gradient_private.h @@ -0,0 +1,50 @@ +/** + * @file lv_draw_sw_gradient_private.h + * + */ + +#ifndef LV_DRAW_SW_GRADIENT_PRIVATE_H +#define LV_DRAW_SW_GRADIENT_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_sw_gradient.h" + +#if LV_USE_DRAW_SW + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_grad_t { + lv_color_t * color_map; + lv_opa_t * opa_map; + uint32_t size; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_DRAW_SW */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_SW_GRADIENT_PRIVATE_H*/ diff --git a/src/draw/sw/lv_draw_sw_img.c b/src/draw/sw/lv_draw_sw_img.c index 612d3bf3e..42179a2a2 100644 --- a/src/draw/sw/lv_draw_sw_img.c +++ b/src/draw/sw/lv_draw_sw_img.c @@ -6,13 +6,18 @@ /********************* * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "blend/lv_draw_sw_blend_private.h" +#include "../lv_image_decoder_private.h" +#include "../lv_draw_image_private.h" +#include "../lv_draw_private.h" #include "lv_draw_sw.h" #if LV_USE_DRAW_SW #include "../../display/lv_display.h" #include "../../display/lv_display_private.h" #include "../../misc/lv_log.h" -#include "../../core/lv_refr.h" +#include "../../core/lv_refr_private.h" #include "../../stdlib/lv_mem.h" #include "../../misc/lv_math.h" #include "../../misc/lv_color.h" @@ -28,7 +33,7 @@ /********************* * DEFINES *********************/ -#define MAX_BUF_SIZE (uint32_t) (4 * lv_display_get_horizontal_resolution(_lv_refr_get_disp_refreshing()) * lv_color_format_get_size(lv_display_get_color_format(_lv_refr_get_disp_refreshing()))) +#define MAX_BUF_SIZE (uint32_t) (4 * lv_display_get_horizontal_resolution(lv_refr_get_disp_refreshing()) * lv_color_format_get_size(lv_display_get_color_format(lv_refr_get_disp_refreshing()))) #ifndef LV_DRAW_SW_IMAGE #define LV_DRAW_SW_IMAGE(...) LV_RESULT_INVALID @@ -85,8 +90,8 @@ void lv_draw_sw_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dr int32_t w = lv_area_get_width(coords); int32_t h = lv_area_get_height(coords); - _lv_image_buf_get_transformed_area(&area_rot, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y, - &draw_dsc->pivot); + lv_image_buf_get_transformed_area(&area_rot, w, h, draw_dsc->rotation, draw_dsc->scale_x, draw_dsc->scale_y, + &draw_dsc->pivot); area_rot.x1 += coords->x1; area_rot.y1 += coords->y1; @@ -94,7 +99,7 @@ void lv_draw_sw_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dr area_rot.y2 += coords->y1; } lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &area_rot, draw_unit->clip_area)) return; + if(!lv_area_intersect(&draw_area, &area_rot, draw_unit->clip_area)) return; #endif #if LV_USE_LAYER_DEBUG @@ -123,13 +128,13 @@ void lv_draw_sw_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dr lv_draw_fill_dsc_t fill_dsc; lv_draw_rect_dsc_init(&fill_dsc); - fill_dsc.color = lv_palette_main(idx % _LV_PALETTE_LAST); + fill_dsc.color = lv_palette_main(idx % LV_PALETTE_LAST); fill_dsc.opa = LV_OPA_10; lv_draw_sw_fill(draw_unit, &fill_dsc, &area_rot); lv_draw_border_dsc_t border_dsc; lv_draw_border_dsc_init(&border_dsc); - border_dsc.color = lv_palette_main(idx % _LV_PALETTE_LAST); + border_dsc.color = lv_palette_main(idx % LV_PALETTE_LAST); border_dsc.opa = LV_OPA_100; border_dsc.width = 2; lv_draw_sw_border(draw_unit, &border_dsc, &area_rot); @@ -161,10 +166,10 @@ void lv_draw_sw_image(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * dr const lv_area_t * coords) { if(!draw_dsc->tile) { - _lv_draw_image_normal_helper(draw_unit, draw_dsc, coords, img_draw_core); + lv_draw_image_normal_helper(draw_unit, draw_dsc, coords, img_draw_core); } else { - _lv_draw_image_tiled_helper(draw_unit, draw_dsc, coords, img_draw_core); + lv_draw_image_tiled_helper(draw_unit, draw_dsc, coords, img_draw_core); } } @@ -195,7 +200,7 @@ static void img_draw_core(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t if(!transformed && !masked && cf == LV_COLOR_FORMAT_A8) { lv_area_t clipped_coords; - if(!_lv_area_intersect(&clipped_coords, img_coords, draw_unit->clip_area)) return; + if(!lv_area_intersect(&clipped_coords, img_coords, draw_unit->clip_area)) return; blend_dsc.mask_buf = (lv_opa_t *)src_buf; blend_dsc.mask_area = img_coords; diff --git a/src/draw/sw/lv_draw_sw_letter.c b/src/draw/sw/lv_draw_sw_letter.c index 74d862e39..3dec220d9 100644 --- a/src/draw/sw/lv_draw_sw_letter.c +++ b/src/draw/sw/lv_draw_sw_letter.c @@ -6,6 +6,8 @@ /********************* * INCLUDES *********************/ +#include "blend/lv_draw_sw_blend_private.h" +#include "../lv_draw_label_private.h" #include "lv_draw_sw.h" #if LV_USE_DRAW_SW @@ -15,7 +17,7 @@ #include "../../misc/lv_area.h" #include "../../misc/lv_style.h" #include "../../font/lv_font.h" -#include "../../core/lv_refr.h" +#include "../../core/lv_refr_private.h" #include "../../stdlib/lv_string.h" /********************* diff --git a/src/draw/sw/lv_draw_sw_line.c b/src/draw/sw/lv_draw_sw_line.c index 1dca84538..be3b19103 100644 --- a/src/draw/sw/lv_draw_sw_line.c +++ b/src/draw/sw/lv_draw_sw_line.c @@ -6,13 +6,17 @@ /********************* * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "lv_draw_sw_mask_private.h" +#include "blend/lv_draw_sw_blend_private.h" +#include "../lv_draw_private.h" #include "lv_draw_sw.h" #if LV_USE_DRAW_SW #include "../../misc/lv_math.h" #include "../../misc/lv_types.h" -#include "../../core/lv_refr.h" +#include "../../core/lv_refr_private.h" #include "../../stdlib/lv_string.h" /********************* @@ -57,7 +61,7 @@ void lv_draw_sw_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * dsc) clip_line.y2 = (int32_t)LV_MAX(dsc->p1.y, dsc->p2.y) + dsc->width / 2; bool is_common; - is_common = _lv_area_intersect(&clip_line, &clip_line, draw_unit->clip_area); + is_common = lv_area_intersect(&clip_line, &clip_line, draw_unit->clip_area); if(!is_common) return; LV_PROFILER_BEGIN; @@ -111,7 +115,7 @@ static void LV_ATTRIBUTE_FAST_MEM draw_line_hor(lv_draw_unit_t * draw_unit, cons blend_area.y2 = (int32_t)dsc->p1.y + w_half0; bool is_common; - is_common = _lv_area_intersect(&blend_area, &blend_area, draw_unit->clip_area); + is_common = lv_area_intersect(&blend_area, &blend_area, draw_unit->clip_area); if(!is_common) return; bool dashed = dsc->dash_gap && dsc->dash_width; @@ -186,7 +190,7 @@ static void LV_ATTRIBUTE_FAST_MEM draw_line_ver(lv_draw_unit_t * draw_unit, cons blend_area.y2 = (int32_t)LV_MAX(dsc->p1.y, dsc->p2.y) - 1; bool is_common; - is_common = _lv_area_intersect(&blend_area, &blend_area, draw_unit->clip_area); + is_common = lv_area_intersect(&blend_area, &blend_area, draw_unit->clip_area); if(!is_common) return; bool dashed = dsc->dash_gap && dsc->dash_width; @@ -289,7 +293,7 @@ static void LV_ATTRIBUTE_FAST_MEM draw_line_skew(lv_draw_unit_t * draw_unit, con /*Get the union of `coords` and `clip`*/ /*`clip` is already truncated to the `draw_buf` size *in 'lv_refr_area' function*/ - bool is_common = _lv_area_intersect(&blend_area, &blend_area, draw_unit->clip_area); + bool is_common = lv_area_intersect(&blend_area, &blend_area, draw_unit->clip_area); if(is_common == false) return; lv_draw_sw_mask_line_param_t mask_left_param; @@ -339,7 +343,7 @@ static void LV_ATTRIBUTE_FAST_MEM draw_line_skew(lv_draw_unit_t * draw_unit, con /*Draw the background line by line*/ int32_t h; - uint32_t hor_res = (uint32_t)lv_display_get_horizontal_resolution(_lv_refr_get_disp_refreshing()); + uint32_t hor_res = (uint32_t)lv_display_get_horizontal_resolution(lv_refr_get_disp_refreshing()); 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); diff --git a/src/draw/sw/lv_draw_sw_mask.c b/src/draw/sw/lv_draw_sw_mask.c index 7c44197a1..983413a27 100644 --- a/src/draw/sw/lv_draw_sw_mask.c +++ b/src/draw/sw/lv_draw_sw_mask.c @@ -6,10 +6,11 @@ /********************* * INCLUDES *********************/ +#include "../lv_draw_mask_private.h" #include "../lv_draw.h" #if LV_DRAW_SW_COMPLEX -#include "lv_draw_sw_mask.h" +#include "lv_draw_sw_mask_private.h" #include "../../core/lv_global.h" #include "../../misc/lv_math.h" #include "../../misc/lv_log.h" @@ -60,8 +61,8 @@ static lv_draw_sw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ line_mask_steep(lv_opa_ 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, 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, +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); static inline lv_opa_t /* LV_ATTRIBUTE_FAST_MEM */ mask_mix(lv_opa_t mask_act, lv_opa_t mask_new); @@ -92,7 +93,7 @@ lv_draw_sw_mask_res_t LV_ATTRIBUTE_FAST_MEM lv_draw_sw_mask_apply(void * masks[] int32_t len) { bool changed = false; - _lv_draw_sw_mask_common_dsc_t * dsc; + lv_draw_sw_mask_common_dsc_t * dsc; uint32_t i; for(i = 0; masks[i]; i++) { @@ -109,7 +110,7 @@ lv_draw_sw_mask_res_t LV_ATTRIBUTE_FAST_MEM lv_draw_sw_mask_apply(void * masks[] void lv_draw_sw_mask_free_param(void * p) { lv_mutex_lock(&circle_cache_mutex); - _lv_draw_sw_mask_common_dsc_t * pdsc = p; + lv_draw_sw_mask_common_dsc_t * pdsc = p; if(pdsc->type == LV_DRAW_SW_MASK_TYPE_RADIUS) { lv_draw_sw_mask_radius_param_t * radius_p = (lv_draw_sw_mask_radius_param_t *) p; if(radius_p->circle) { @@ -126,7 +127,7 @@ void lv_draw_sw_mask_free_param(void * p) lv_mutex_unlock(&circle_cache_mutex); } -void _lv_draw_sw_mask_cleanup(void) +void lv_draw_sw_mask_cleanup(void) { uint8_t i; for(i = 0; i < LV_DRAW_SW_CIRCLE_CACHE_SIZE; i++) { @@ -326,7 +327,7 @@ void lv_draw_sw_mask_radius_init(lv_draw_sw_mask_radius_param_t * param, const l } /*If not cached use the free entry with lowest life*/ - _lv_draw_sw_mask_radius_circle_dsc_t * entry = NULL; + lv_draw_sw_mask_radius_circle_dsc_t * entry = NULL; for(i = 0; i < LV_DRAW_SW_CIRCLE_CACHE_SIZE; i++) { if(_circle_cache[i].used_cnt == 0) { if(!entry) entry = &(_circle_cache[i]); @@ -336,7 +337,7 @@ void lv_draw_sw_mask_radius_init(lv_draw_sw_mask_radius_param_t * param, const l /*There is no unused entry. Allocate one temporarily*/ if(!entry) { - entry = lv_malloc_zeroed(sizeof(_lv_draw_sw_mask_radius_circle_dsc_t)); + entry = lv_malloc_zeroed(sizeof(lv_draw_sw_mask_radius_circle_dsc_t)); LV_ASSERT_MALLOC(entry); entry->life = -1; } @@ -1067,7 +1068,7 @@ static void circ_next(lv_point_t * c, int32_t * tmp) c->y++; } -static void circ_calc_aa4(_lv_draw_sw_mask_radius_circle_dsc_t * c, int32_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; @@ -1216,7 +1217,7 @@ static void circ_calc_aa4(_lv_draw_sw_mask_radius_circle_dsc_t * c, int32_t radi lv_free(cir_x); } -static lv_opa_t * get_next_line(_lv_draw_sw_mask_radius_circle_dsc_t * c, int32_t y, int32_t * len, +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]; diff --git a/src/draw/sw/lv_draw_sw_mask.h b/src/draw/sw/lv_draw_sw_mask.h index 17b7dedd7..22a0d6700 100644 --- a/src/draw/sw/lv_draw_sw_mask.h +++ b/src/draw/sw/lv_draw_sw_mask.h @@ -23,42 +23,38 @@ extern "C" { *********************/ #define LV_MASK_ID_INV (-1) #if LV_DRAW_SW_COMPLEX -# define _LV_MASK_MAX_NUM 16 +# define LV_MASK_MAX_NUM 16 #else -# define _LV_MASK_MAX_NUM 1 +# define LV_MASK_MAX_NUM 1 #endif /********************** * TYPEDEFS **********************/ -enum { +typedef enum { LV_DRAW_SW_MASK_RES_TRANSP, LV_DRAW_SW_MASK_RES_FULL_COVER, LV_DRAW_SW_MASK_RES_CHANGED, LV_DRAW_SW_MASK_RES_UNKNOWN -}; - -typedef uint8_t lv_draw_sw_mask_res_t; +} lv_draw_sw_mask_res_t; #if LV_DRAW_SW_COMPLEX -enum { +typedef enum { LV_DRAW_SW_MASK_TYPE_LINE, LV_DRAW_SW_MASK_TYPE_ANGLE, LV_DRAW_SW_MASK_TYPE_RADIUS, LV_DRAW_SW_MASK_TYPE_FADE, LV_DRAW_SW_MASK_TYPE_MAP, -}; - -typedef uint8_t lv_draw_sw_mask_type_t; +} lv_draw_sw_mask_type_t; -enum { +typedef enum { LV_DRAW_SW_MASK_LINE_SIDE_LEFT = 0, LV_DRAW_SW_MASK_LINE_SIDE_RIGHT, LV_DRAW_SW_MASK_LINE_SIDE_TOP, LV_DRAW_SW_MASK_LINE_SIDE_BOTTOM, -}; +} lv_draw_sw_mask_line_side_t; /** * A common callback type for every mask type. @@ -68,116 +64,6 @@ typedef lv_draw_sw_mask_res_t (*lv_draw_sw_mask_xcb_t)(lv_opa_t * mask_buf, int3 int32_t len, void * p); -typedef uint8_t lv_draw_sw_mask_line_side_t; - -typedef struct { - lv_draw_sw_mask_xcb_t cb; - lv_draw_sw_mask_type_t type; -} _lv_draw_sw_mask_common_dsc_t; - -typedef struct { - /*The first element must be the common descriptor*/ - _lv_draw_sw_mask_common_dsc_t dsc; - - struct { - /*First point*/ - lv_point_t p1; - - /*Second point*/ - lv_point_t p2; - - /*Which side to keep?*/ - lv_draw_sw_mask_line_side_t side : 2; - } cfg; - - /*A point of the line*/ - lv_point_t origo; - - /*X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y?*/ - int32_t xy_steep; - - /*Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X?*/ - int32_t yx_steep; - - /*Helper which stores yx_steep for flat lines and xy_steep for steep (non flat) lines*/ - int32_t steep; - - /*Steepness in 1 px in 0..255 range. Used only by flat lines.*/ - int32_t spx; - - /*1: It's a flat line? (Near to horizontal)*/ - uint8_t flat : 1; - - /*Invert the mask. The default is: Keep the left part. - *It is used to select left/right/top/bottom*/ - uint8_t inv: 1; -} lv_draw_sw_mask_line_param_t; - -typedef struct { - /*The first element must be the common descriptor*/ - _lv_draw_sw_mask_common_dsc_t dsc; - - struct { - lv_point_t vertex_p; - int32_t start_angle; - int32_t end_angle; - } cfg; - - lv_draw_sw_mask_line_param_t start_line; - lv_draw_sw_mask_line_param_t end_line; - uint16_t delta_deg; -} lv_draw_sw_mask_angle_param_t; - -typedef struct { - uint8_t * buf; - lv_opa_t * cir_opa; /*Opacity of values on the circumference of an 1/4 circle*/ - uint16_t * x_start_on_y; /*The x coordinate of the circle for each y value*/ - 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*/ - 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]; - -typedef struct { - /*The first element must be the common descriptor*/ - _lv_draw_sw_mask_common_dsc_t dsc; - - struct { - lv_area_t rect; - int32_t radius; - /*Invert the mask. 0: Keep the pixels inside.*/ - uint8_t outer: 1; - } cfg; - - _lv_draw_sw_mask_radius_circle_dsc_t * circle; -} lv_draw_sw_mask_radius_param_t; - -typedef struct { - /*The first element must be the common descriptor*/ - _lv_draw_sw_mask_common_dsc_t dsc; - - struct { - lv_area_t coords; - int32_t y_top; - int32_t y_bottom; - lv_opa_t opa_top; - lv_opa_t opa_bottom; - } cfg; - -} lv_draw_sw_mask_fade_param_t; - -typedef struct _lv_draw_sw_mask_map_param_t { - /*The first element must be the common descriptor*/ - _lv_draw_sw_mask_common_dsc_t dsc; - - struct { - lv_area_t coords; - const lv_opa_t * map; - } cfg; -} lv_draw_sw_mask_map_param_t; - /********************** * GLOBAL PROTOTYPES **********************/ @@ -217,12 +103,6 @@ lv_draw_sw_mask_res_t /* LV_ATTRIBUTE_FAST_MEM */ lv_draw_sw_mask_apply(void * m void lv_draw_sw_mask_free_param(void * p); /** - * Called by LVGL the rendering of a screen is ready to clean up - * the temporal (cache) data of the masks - */ -void _lv_draw_sw_mask_cleanup(void); - -/** *Initialize a line mask from two points. * @param param pointer to a `lv_draw_mask_param_t` to initialize * @param p1x X coordinate of the first point of the line diff --git a/src/draw/sw/lv_draw_sw_mask_private.h b/src/draw/sw/lv_draw_sw_mask_private.h new file mode 100644 index 000000000..a749ac745 --- /dev/null +++ b/src/draw/sw/lv_draw_sw_mask_private.h @@ -0,0 +1,152 @@ +/** + * @file lv_draw_sw_mask_private.h + * + */ + +#ifndef LV_DRAW_SW_MASK_PRIVATE_H +#define LV_DRAW_SW_MASK_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_sw_mask.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + uint8_t * buf; + lv_opa_t * cir_opa; /*Opacity of values on the circumference of an 1/4 circle*/ + uint16_t * x_start_on_y; /*The x coordinate of the circle for each y value*/ + 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*/ + int32_t radius; /*The radius of the entry*/ +} lv_draw_sw_mask_radius_circle_dsc_t; +struct lv_draw_sw_mask_common_dsc_t { + lv_draw_sw_mask_xcb_t cb; + lv_draw_sw_mask_type_t type; +}; + +struct lv_draw_sw_mask_line_param_t { + /*The first element must be the common descriptor*/ + lv_draw_sw_mask_common_dsc_t dsc; + + struct { + /*First point*/ + lv_point_t p1; + + /*Second point*/ + lv_point_t p2; + + /*Which side to keep?*/ + lv_draw_sw_mask_line_side_t side : 2; + } cfg; + + /*A point of the line*/ + lv_point_t origo; + + /*X / (1024*Y) steepness (X is 0..1023 range). What is the change of X in 1024 Y?*/ + int32_t xy_steep; + + /*Y / (1024*X) steepness (Y is 0..1023 range). What is the change of Y in 1024 X?*/ + int32_t yx_steep; + + /*Helper which stores yx_steep for flat lines and xy_steep for steep (non flat) lines*/ + int32_t steep; + + /*Steepness in 1 px in 0..255 range. Used only by flat lines.*/ + int32_t spx; + + /*1: It's a flat line? (Near to horizontal)*/ + uint8_t flat : 1; + + /*Invert the mask. The default is: Keep the left part. + *It is used to select left/right/top/bottom*/ + uint8_t inv: 1; +}; + +struct lv_draw_sw_mask_angle_param_t { + /*The first element must be the common descriptor*/ + lv_draw_sw_mask_common_dsc_t dsc; + + struct { + lv_point_t vertex_p; + int32_t start_angle; + int32_t end_angle; + } cfg; + + lv_draw_sw_mask_line_param_t start_line; + lv_draw_sw_mask_line_param_t end_line; + uint16_t delta_deg; +}; + +struct lv_draw_sw_mask_radius_param_t { + /*The first element must be the common descriptor*/ + lv_draw_sw_mask_common_dsc_t dsc; + + struct { + lv_area_t rect; + int32_t radius; + /*Invert the mask. 0: Keep the pixels inside.*/ + uint8_t outer: 1; + } cfg; + + lv_draw_sw_mask_radius_circle_dsc_t * circle; +}; + +struct lv_draw_sw_mask_fade_param_t { + /*The first element must be the common descriptor*/ + lv_draw_sw_mask_common_dsc_t dsc; + + struct { + lv_area_t coords; + int32_t y_top; + int32_t y_bottom; + lv_opa_t opa_top; + lv_opa_t opa_bottom; + } cfg; + +}; + +struct lv_draw_sw_mask_map_param_t { + /*The first element must be the common descriptor*/ + lv_draw_sw_mask_common_dsc_t dsc; + + struct { + lv_area_t coords; + const lv_opa_t * map; + } cfg; +}; + +typedef lv_draw_sw_mask_radius_circle_dsc_t lv_draw_sw_mask_radius_circle_dsc_arr_t[LV_DRAW_SW_CIRCLE_CACHE_SIZE]; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Called by LVGL the rendering of a screen is ready to clean up + * the temporal (cache) data of the masks + */ +void lv_draw_sw_mask_cleanup(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_SW_MASK_PRIVATE_H*/ diff --git a/src/draw/sw/lv_draw_sw_mask_rect.c b/src/draw/sw/lv_draw_sw_mask_rect.c index 919758cbf..bd28d0d0e 100644 --- a/src/draw/sw/lv_draw_sw_mask_rect.c +++ b/src/draw/sw/lv_draw_sw_mask_rect.c @@ -6,7 +6,9 @@ /********************* * INCLUDES *********************/ -#include "../lv_draw.h" +#include "../../misc/lv_area_private.h" +#include "../lv_draw_mask_private.h" +#include "../lv_draw_private.h" #if LV_USE_DRAW_SW #if LV_DRAW_SW_COMPLEX @@ -15,7 +17,7 @@ #include "../../stdlib/lv_mem.h" #include "../../stdlib/lv_string.h" #include "lv_draw_sw.h" -#include "lv_draw_sw_mask.h" +#include "lv_draw_sw_mask_private.h" /********************* * DEFINES @@ -46,7 +48,7 @@ void lv_draw_sw_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_rect_ds LV_UNUSED(coords); lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &dsc->area, draw_unit->clip_area)) { + if(!lv_area_intersect(&draw_area, &dsc->area, draw_unit->clip_area)) { return; } diff --git a/src/draw/sw/lv_draw_sw_private.h b/src/draw/sw/lv_draw_sw_private.h new file mode 100644 index 000000000..419218851 --- /dev/null +++ b/src/draw/sw/lv_draw_sw_private.h @@ -0,0 +1,67 @@ +/** + * @file lv_draw_sw_private.h + * + */ + +#ifndef LV_DRAW_SW_PRIVATE_H +#define LV_DRAW_SW_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_draw_sw.h" + +#if LV_USE_DRAW_SW + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_draw_sw_unit_t { + lv_draw_unit_t base_unit; + lv_draw_task_t * task_act; +#if LV_USE_OS + lv_thread_sync_t sync; + lv_thread_t thread; + volatile bool inited; + volatile bool exit_status; +#endif + uint32_t idx; +}; + +#if LV_DRAW_SW_SHADOW_CACHE_SIZE +typedef struct { + uint8_t cache[LV_DRAW_SW_SHADOW_CACHE_SIZE * LV_DRAW_SW_SHADOW_CACHE_SIZE]; + int32_t cache_size; + int32_t cache_r; +} lv_draw_sw_shadow_cache_t; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_DRAW_SW */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DRAW_SW_PRIVATE_H*/ diff --git a/src/draw/sw/lv_draw_sw_triangle.c b/src/draw/sw/lv_draw_sw_triangle.c index 311325b3d..4d42c4e3c 100644 --- a/src/draw/sw/lv_draw_sw_triangle.c +++ b/src/draw/sw/lv_draw_sw_triangle.c @@ -6,16 +6,19 @@ /********************* * INCLUDES *********************/ +#include "lv_draw_sw_mask_private.h" +#include "blend/lv_draw_sw_blend_private.h" +#include "../lv_draw_private.h" #include "lv_draw_sw.h" #if LV_USE_DRAW_SW #include "../../misc/lv_math.h" #include "../../stdlib/lv_mem.h" -#include "../../misc/lv_area.h" +#include "../../misc/lv_area_private.h" #include "../../misc/lv_color.h" #include "../../stdlib/lv_string.h" -#include "../lv_draw_triangle.h" -#include "lv_draw_sw_gradient.h" +#include "../lv_draw_triangle_private.h" +#include "lv_draw_sw_gradient_private.h" /********************* * DEFINES @@ -52,7 +55,7 @@ void lv_draw_sw_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle_dsc_ bool is_common; lv_area_t draw_area; - is_common = _lv_area_intersect(&draw_area, &tri_area, draw_unit->clip_area); + is_common = lv_area_intersect(&draw_area, &tri_area, draw_unit->clip_area); if(!is_common) return; lv_point_t p[3]; diff --git a/src/draw/sw/lv_draw_sw_vector.c b/src/draw/sw/lv_draw_sw_vector.c index c7fa11cb0..4b99a47e9 100644 --- a/src/draw/sw/lv_draw_sw_vector.c +++ b/src/draw/sw/lv_draw_sw_vector.c @@ -6,6 +6,9 @@ /********************* * INCLUDES *********************/ +#include "../lv_image_decoder_private.h" +#include "../lv_draw_vector_private.h" +#include "../lv_draw_private.h" #include "lv_draw_sw.h" #if LV_USE_VECTOR_GRAPHIC && LV_USE_THORVG @@ -49,7 +52,7 @@ typedef struct { * MACROS **********************/ -static void _lv_area_to_tvg(_tvg_rect * rect, const lv_area_t * area) +static void lv_area_to_tvg(_tvg_rect * rect, const lv_area_t * area) { rect->x = area->x1; rect->y = area->y1; @@ -57,7 +60,7 @@ static void _lv_area_to_tvg(_tvg_rect * rect, const lv_area_t * area) rect->h = lv_area_get_height(area) - 1; } -static void _lv_color_to_tvg(_tvg_color * color, const lv_color32_t * c, lv_opa_t opa) +static void lv_color_to_tvg(_tvg_color * color, const lv_color32_t * c, lv_opa_t opa) { color->r = c->red; color->g = c->green; @@ -65,7 +68,7 @@ static void _lv_color_to_tvg(_tvg_color * color, const lv_color32_t * c, lv_opa_ color->a = LV_OPA_MIX2(c->alpha, opa); } -static void _lv_matrix_to_tvg(Tvg_Matrix * tm, const lv_matrix_t * m) +static void lv_matrix_to_tvg(Tvg_Matrix * tm, const lv_matrix_t * m) { tm->e11 = m->m[0][0]; tm->e12 = m->m[0][1]; @@ -135,7 +138,7 @@ static void _set_paint_shape(Tvg_Paint * obj, const lv_vector_path_t * p) } } -static Tvg_Stroke_Cap _lv_stroke_cap_to_tvg(lv_vector_stroke_cap_t cap) +static Tvg_Stroke_Cap lv_stroke_cap_to_tvg(lv_vector_stroke_cap_t cap) { switch(cap) { case LV_VECTOR_STROKE_CAP_SQUARE: @@ -149,7 +152,7 @@ static Tvg_Stroke_Cap _lv_stroke_cap_to_tvg(lv_vector_stroke_cap_t cap) } } -static Tvg_Stroke_Join _lv_stroke_join_to_tvg(lv_vector_stroke_join_t join) +static Tvg_Stroke_Join lv_stroke_join_to_tvg(lv_vector_stroke_join_t join) { switch(join) { case LV_VECTOR_STROKE_JOIN_BEVEL: @@ -163,7 +166,7 @@ static Tvg_Stroke_Join _lv_stroke_join_to_tvg(lv_vector_stroke_join_t join) } } -static Tvg_Stroke_Fill _lv_spread_to_tvg(lv_vector_gradient_spread_t sp) +static Tvg_Stroke_Fill lv_spread_to_tvg(lv_vector_gradient_spread_t sp) { switch(sp) { case LV_VECTOR_GRADIENT_SPREAD_PAD: @@ -193,9 +196,9 @@ static void _setup_gradient(Tvg_Gradient * gradient, const lv_vector_gradient_t } tvg_gradient_set_color_stops(gradient, stops, grad->stops_count); - tvg_gradient_set_spread(gradient, _lv_spread_to_tvg(grad->spread)); + tvg_gradient_set_spread(gradient, lv_spread_to_tvg(grad->spread)); Tvg_Matrix mtx; - _lv_matrix_to_tvg(&mtx, matrix); + lv_matrix_to_tvg(&mtx, matrix); tvg_gradient_set_transform(gradient, &mtx); lv_free(stops); } @@ -221,7 +224,7 @@ static void _set_paint_stroke(Tvg_Paint * obj, const lv_vector_stroke_dsc_t * ds { if(dsc->style == LV_VECTOR_DRAW_STYLE_SOLID) { _tvg_color c; - _lv_color_to_tvg(&c, &dsc->color, dsc->opa); + lv_color_to_tvg(&c, &dsc->color, dsc->opa); tvg_shape_set_stroke_color(obj, c.r, c.g, c.b, c.a); } else { /*gradient*/ @@ -230,8 +233,8 @@ static void _set_paint_stroke(Tvg_Paint * obj, const lv_vector_stroke_dsc_t * ds tvg_shape_set_stroke_width(obj, dsc->width); tvg_shape_set_stroke_miterlimit(obj, dsc->miter_limit); - tvg_shape_set_stroke_cap(obj, _lv_stroke_cap_to_tvg(dsc->cap)); - tvg_shape_set_stroke_join(obj, _lv_stroke_join_to_tvg(dsc->join)); + tvg_shape_set_stroke_cap(obj, lv_stroke_cap_to_tvg(dsc->cap)); + tvg_shape_set_stroke_join(obj, lv_stroke_join_to_tvg(dsc->join)); if(!lv_array_is_empty(&dsc->dash_pattern)) { float * dash_array = lv_array_front(&dsc->dash_pattern); @@ -239,7 +242,7 @@ static void _set_paint_stroke(Tvg_Paint * obj, const lv_vector_stroke_dsc_t * ds } } -static Tvg_Fill_Rule _lv_fill_rule_to_tvg(lv_vector_fill_t rule) +static Tvg_Fill_Rule lv_fill_rule_to_tvg(lv_vector_fill_t rule) { switch(rule) { case LV_VECTOR_FILL_NONZERO: @@ -303,7 +306,7 @@ static void _set_paint_fill_pattern(Tvg_Paint * obj, Tvg_Canvas * canvas, const tvg_paint_set_opacity(img, p->opa); Tvg_Matrix mtx; - _lv_matrix_to_tvg(&mtx, m); + lv_matrix_to_tvg(&mtx, m); tvg_paint_set_transform(img, &mtx); tvg_canvas_push(canvas, img); lv_image_decoder_close(&decoder_dsc); @@ -312,11 +315,11 @@ static void _set_paint_fill_pattern(Tvg_Paint * obj, Tvg_Canvas * canvas, const static void _set_paint_fill(Tvg_Paint * obj, Tvg_Canvas * canvas, const lv_vector_fill_dsc_t * dsc, const lv_matrix_t * matrix) { - tvg_shape_set_fill_rule(obj, _lv_fill_rule_to_tvg(dsc->fill_rule)); + tvg_shape_set_fill_rule(obj, lv_fill_rule_to_tvg(dsc->fill_rule)); if(dsc->style == LV_VECTOR_DRAW_STYLE_SOLID) { _tvg_color c; - _lv_color_to_tvg(&c, &dsc->color, dsc->opa); + lv_color_to_tvg(&c, &dsc->color, dsc->opa); tvg_shape_set_fill_color(obj, c.r, c.g, c.b, c.a); } else if(dsc->style == LV_VECTOR_DRAW_STYLE_PATTERN) { @@ -334,7 +337,7 @@ static void _set_paint_fill(Tvg_Paint * obj, Tvg_Canvas * canvas, const lv_vecto } } -static Tvg_Blend_Method _lv_blend_to_tvg(lv_vector_blend_t blend) +static Tvg_Blend_Method lv_blend_to_tvg(lv_vector_blend_t blend) { switch(blend) { case LV_VECTOR_BLEND_SRC_OVER: @@ -359,7 +362,7 @@ static Tvg_Blend_Method _lv_blend_to_tvg(lv_vector_blend_t blend) static void _set_paint_blend_mode(Tvg_Paint * obj, lv_vector_blend_t blend) { - tvg_paint_set_blend_method(obj, _lv_blend_to_tvg(blend)); + tvg_paint_set_blend_method(obj, lv_blend_to_tvg(blend)); } static void _task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vector_draw_dsc_t * dsc) @@ -370,10 +373,10 @@ static void _task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_ve if(!path) { /*clear*/ _tvg_rect rc; - _lv_area_to_tvg(&rc, &dsc->scissor_area); + lv_area_to_tvg(&rc, &dsc->scissor_area); _tvg_color c; - _lv_color_to_tvg(&c, &dsc->fill_dsc.color, dsc->fill_dsc.opa); + lv_color_to_tvg(&c, &dsc->fill_dsc.color, dsc->fill_dsc.opa); Tvg_Matrix mtx = { 1.0f, 0.0f, 0.0f, @@ -386,7 +389,7 @@ static void _task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_ve } else { Tvg_Matrix mtx; - _lv_matrix_to_tvg(&mtx, &dsc->matrix); + lv_matrix_to_tvg(&mtx, &dsc->matrix); _set_paint_matrix(obj, &mtx); _set_paint_shape(obj, path); @@ -430,11 +433,11 @@ void lv_draw_sw_vector(lv_draw_unit_t * draw_unit, const lv_draw_vector_task_dsc tvg_swcanvas_set_target(canvas, buf, stride / 4, width, height, TVG_COLORSPACE_ARGB8888); _tvg_rect rc; - _lv_area_to_tvg(&rc, draw_unit->clip_area); + lv_area_to_tvg(&rc, draw_unit->clip_area); tvg_canvas_set_viewport(canvas, (int32_t)rc.x, (int32_t)rc.y, (int32_t)rc.w, (int32_t)rc.h); lv_ll_t * task_list = dsc->task_list; - _lv_vector_for_each_destroy_tasks(task_list, _task_draw_cb, canvas); + lv_vector_for_each_destroy_tasks(task_list, _task_draw_cb, canvas); if(tvg_canvas_draw(canvas) == TVG_RESULT_SUCCESS) { tvg_canvas_sync(canvas); diff --git a/src/draw/vg_lite/lv_draw_buf_vg_lite.c b/src/draw/vg_lite/lv_draw_buf_vg_lite.c index 65b085ca0..de0b4b90b 100644 --- a/src/draw/vg_lite/lv_draw_buf_vg_lite.c +++ b/src/draw/vg_lite/lv_draw_buf_vg_lite.c @@ -11,6 +11,7 @@ #if LV_USE_DRAW_VG_LITE +#include "../lv_draw_buf_private.h" #include "lv_vg_lite_utils.h" /********************* diff --git a/src/draw/vg_lite/lv_draw_vg_lite.c b/src/draw/vg_lite/lv_draw_vg_lite.c index 6c39a31c7..25346ebf5 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite.c +++ b/src/draw/vg_lite/lv_draw_vg_lite.c @@ -11,7 +11,7 @@ #if LV_USE_DRAW_VG_LITE -#include "../lv_draw.h" +#include "../lv_draw_private.h" #include "lv_draw_vg_lite_type.h" #include "lv_vg_lite_path.h" #include "lv_vg_lite_utils.h" diff --git a/src/draw/vg_lite/lv_draw_vg_lite_arc.c b/src/draw/vg_lite/lv_draw_vg_lite_arc.c index 2948f5c04..68893c0e4 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_arc.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_arc.c @@ -7,6 +7,9 @@ * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "../lv_image_decoder_private.h" +#include "../lv_draw_private.h" #include "lv_draw_vg_lite.h" #if LV_USE_DRAW_VG_LITE @@ -55,7 +58,7 @@ void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * d lv_draw_vg_lite_unit_t * u = (lv_draw_vg_lite_unit_t *)draw_unit; lv_area_t clip_area; - if(!_lv_area_intersect(&clip_area, coords, draw_unit->clip_area)) { + if(!lv_area_intersect(&clip_area, coords, draw_unit->clip_area)) { /*Fully clipped, nothing to do*/ return; } diff --git a/src/draw/vg_lite/lv_draw_vg_lite_border.c b/src/draw/vg_lite/lv_draw_vg_lite_border.c index 924661d5d..ea1368df5 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_border.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_border.c @@ -7,6 +7,8 @@ * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "../lv_draw_private.h" #include "lv_draw_vg_lite.h" #if LV_USE_DRAW_VG_LITE @@ -45,7 +47,7 @@ void lv_draw_vg_lite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc lv_draw_vg_lite_unit_t * u = (lv_draw_vg_lite_unit_t *)draw_unit; lv_area_t clip_area; - if(!_lv_area_intersect(&clip_area, coords, draw_unit->clip_area)) { + if(!lv_area_intersect(&clip_area, coords, draw_unit->clip_area)) { /*Fully clipped, nothing to do*/ return; } diff --git a/src/draw/vg_lite/lv_draw_vg_lite_box_shadow.c b/src/draw/vg_lite/lv_draw_vg_lite_box_shadow.c index 409b95171..cad9500f8 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_box_shadow.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_box_shadow.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" #include "lv_draw_vg_lite.h" #if LV_USE_DRAW_VG_LITE @@ -57,7 +58,7 @@ void lv_draw_vg_lite_box_shadow(lv_draw_unit_t * draw_unit, const lv_draw_box_sh /*Get clipped draw area which is the real draw area. *It is always the same or inside `shadow_area`*/ lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &shadow_area, draw_unit->clip_area)) return; + if(!lv_area_intersect(&draw_area, &shadow_area, draw_unit->clip_area)) return; LV_PROFILER_BEGIN; diff --git a/src/draw/vg_lite/lv_draw_vg_lite_fill.c b/src/draw/vg_lite/lv_draw_vg_lite_fill.c index 5e429f9ff..faef7b23f 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_fill.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_fill.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" #include "lv_draw_vg_lite.h" #if LV_USE_DRAW_VG_LITE @@ -49,7 +50,7 @@ void lv_draw_vg_lite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * lv_draw_vg_lite_unit_t * u = (lv_draw_vg_lite_unit_t *)draw_unit; lv_area_t clip_area; - if(!_lv_area_intersect(&clip_area, coords, draw_unit->clip_area)) { + if(!lv_area_intersect(&clip_area, coords, draw_unit->clip_area)) { /*Fully clipped, nothing to do*/ return; } diff --git a/src/draw/vg_lite/lv_draw_vg_lite_img.c b/src/draw/vg_lite/lv_draw_vg_lite_img.c index 01b5152a4..454198381 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_img.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_img.c @@ -7,6 +7,10 @@ * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "../lv_image_decoder_private.h" +#include "../lv_draw_image_private.h" +#include "../lv_draw_private.h" #include "lv_draw_vg_lite.h" #if LV_USE_DRAW_VG_LITE @@ -50,7 +54,7 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * * so the transformed area needs to be calculated once. */ lv_area_t image_tf_area; - _lv_image_buf_get_transformed_area( + lv_image_buf_get_transformed_area( &image_tf_area, lv_area_get_width(coords), lv_area_get_height(coords), @@ -61,7 +65,7 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * lv_area_move(&image_tf_area, coords->x1, coords->y1); lv_area_t clip_area; - if(!_lv_area_intersect(&clip_area, &image_tf_area, draw_unit->clip_area)) { + if(!lv_area_intersect(&clip_area, &image_tf_area, draw_unit->clip_area)) { /*Fully clipped, nothing to do*/ return; } @@ -99,7 +103,7 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t * LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); /* If clipping is not required, blit directly */ - if(_lv_area_is_in(&image_tf_area, draw_unit->clip_area, false) && dsc->clip_radius <= 0) { + if(lv_area_is_in(&image_tf_area, draw_unit->clip_area, false) && dsc->clip_radius <= 0) { /* The image area is the coordinates relative to the image itself */ lv_area_t src_area = *coords; lv_area_move(&src_area, -coords->x1, -coords->y1); diff --git a/src/draw/vg_lite/lv_draw_vg_lite_label.c b/src/draw/vg_lite/lv_draw_vg_lite_label.c index 970a2fd8c..77e2b54ff 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_label.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_label.c @@ -7,6 +7,9 @@ * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "../../libs/freetype/lv_freetype_private.h" +#include "../lv_draw_label_private.h" #include "lv_draw_vg_lite.h" #include "../../lvgl.h" @@ -139,7 +142,7 @@ static void draw_letter_cb(lv_draw_unit_t * draw_unit, lv_draw_glyph_dsc_t * gly static void draw_letter_bitmap(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_dsc_t * dsc) { lv_area_t clip_area; - if(!_lv_area_intersect(&clip_area, u->base_unit.clip_area, dsc->letter_coords)) { + if(!lv_area_intersect(&clip_area, u->base_unit.clip_area, dsc->letter_coords)) { return; } @@ -163,7 +166,7 @@ static void draw_letter_bitmap(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_d LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); /* If clipping is not required, blit directly */ - if(_lv_area_is_in(&image_area, u->base_unit.clip_area, false)) { + if(lv_area_is_in(&image_area, u->base_unit.clip_area, false)) { /* The image area is the coordinates relative to the image itself */ lv_area_t src_area = image_area; lv_area_move(&src_area, -image_area.x1, -image_area.y1); @@ -232,7 +235,7 @@ static void draw_letter_outline(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_ { /* get clip area */ lv_area_t path_clip_area; - if(!_lv_area_intersect(&path_clip_area, u->base_unit.clip_area, dsc->letter_coords)) { + if(!lv_area_intersect(&path_clip_area, u->base_unit.clip_area, dsc->letter_coords)) { return; } diff --git a/src/draw/vg_lite/lv_draw_vg_lite_layer.c b/src/draw/vg_lite/lv_draw_vg_lite_layer.c index f79f4188f..8f2a17e80 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_layer.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_layer.c @@ -42,7 +42,7 @@ void lv_draw_vg_lite_layer(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t const lv_area_t * coords) { lv_layer_t * layer = (lv_layer_t *)draw_dsc->src; - struct _lv_draw_vg_lite_unit_t * u = (struct _lv_draw_vg_lite_unit_t *)draw_unit; + struct lv_draw_vg_lite_unit_t * u = (struct lv_draw_vg_lite_unit_t *)draw_unit; /*It can happen that nothing was draw on a layer and therefore its buffer is not allocated. *In this case just return. */ diff --git a/src/draw/vg_lite/lv_draw_vg_lite_line.c b/src/draw/vg_lite/lv_draw_vg_lite_line.c index ff9b6e9df..501e8b653 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_line.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_line.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" #include "lv_draw_vg_lite.h" #if LV_USE_DRAW_VG_LITE @@ -60,7 +61,7 @@ void lv_draw_vg_lite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * rel_clip_area.y1 = (int32_t)(LV_MIN(p1_y, p2_y) - half_w); rel_clip_area.y2 = (int32_t)(LV_MAX(p1_y, p2_y) + half_w); - if(!_lv_area_intersect(&rel_clip_area, &rel_clip_area, draw_unit->clip_area)) { + if(!lv_area_intersect(&rel_clip_area, &rel_clip_area, draw_unit->clip_area)) { return; /*Fully clipped, nothing to do*/ } diff --git a/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c b/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c index a7cbda0cb..227aeb4c8 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_mask_rect.c @@ -7,6 +7,9 @@ * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "../sw/lv_draw_sw_mask_private.h" +#include "../lv_draw_mask_private.h" #include "lv_draw_vg_lite.h" #if LV_USE_DRAW_VG_LITE @@ -44,7 +47,7 @@ void lv_draw_vg_lite_mask_rect(lv_draw_unit_t * draw_unit, const lv_draw_mask_re LV_UNUSED(coords); lv_area_t draw_area; - if(!_lv_area_intersect(&draw_area, &dsc->area, draw_unit->clip_area)) { + if(!lv_area_intersect(&draw_area, &dsc->area, draw_unit->clip_area)) { return; } diff --git a/src/draw/vg_lite/lv_draw_vg_lite_triangle.c b/src/draw/vg_lite/lv_draw_vg_lite_triangle.c index b41b1aa11..e0258984f 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_triangle.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_triangle.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" #include "lv_draw_vg_lite.h" #if LV_USE_DRAW_VG_LITE @@ -50,7 +51,7 @@ void lv_draw_vg_lite_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle bool is_common; lv_area_t clip_area; - is_common = _lv_area_intersect(&clip_area, &tri_area, draw_unit->clip_area); + is_common = lv_area_intersect(&clip_area, &tri_area, draw_unit->clip_area); if(!is_common) return; LV_PROFILER_BEGIN; diff --git a/src/draw/vg_lite/lv_draw_vg_lite_type.h b/src/draw/vg_lite/lv_draw_vg_lite_type.h index d1ba5d7ed..d325be51b 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_type.h +++ b/src/draw/vg_lite/lv_draw_vg_lite_type.h @@ -18,7 +18,7 @@ extern "C" { #if LV_USE_DRAW_VG_LITE -#include "../lv_draw.h" +#include "../lv_draw_private.h" #include "../../misc/lv_array.h" #if LV_USE_VG_LITE_THORVG @@ -35,23 +35,23 @@ extern "C" { * TYPEDEFS **********************/ -struct _lv_vg_lite_pending_t; +struct lv_vg_lite_pending_t; -struct _lv_draw_vg_lite_unit_t { +struct lv_draw_vg_lite_unit_t { lv_draw_unit_t base_unit; lv_draw_task_t * task_act; - struct _lv_vg_lite_pending_t * image_dsc_pending; + struct lv_vg_lite_pending_t * image_dsc_pending; lv_cache_t * grad_cache; - struct _lv_vg_lite_pending_t * grad_pending; + struct lv_vg_lite_pending_t * grad_pending; lv_cache_t * stroke_cache; uint16_t flush_count; vg_lite_buffer_t target_buffer; vg_lite_matrix_t global_matrix; - struct _lv_vg_lite_path_t * global_path; + struct lv_vg_lite_path_t * global_path; bool path_in_use; }; diff --git a/src/draw/vg_lite/lv_draw_vg_lite_vector.c b/src/draw/vg_lite/lv_draw_vg_lite_vector.c index 80d637e67..a70caf804 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_vector.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_vector.c @@ -7,6 +7,8 @@ * INCLUDES *********************/ +#include "../lv_image_decoder_private.h" +#include "../lv_draw_vector_private.h" #include "lv_draw_vg_lite.h" #if LV_USE_DRAW_VG_LITE && LV_USE_VECTOR_GRAPHIC @@ -28,7 +30,7 @@ **********************/ typedef void * path_drop_data_t; -typedef void (*path_drop_func_t)(struct _lv_draw_vg_lite_unit_t *, path_drop_data_t); +typedef void (*path_drop_func_t)(struct lv_draw_vg_lite_unit_t *, path_drop_data_t); /********************** * STATIC PROTOTYPES @@ -62,7 +64,7 @@ void lv_draw_vg_lite_vector(lv_draw_unit_t * draw_unit, const lv_draw_vector_tas return; LV_PROFILER_BEGIN; - _lv_vector_for_each_destroy_tasks(dsc->task_list, task_draw_cb, draw_unit); + lv_vector_for_each_destroy_tasks(dsc->task_list, task_draw_cb, draw_unit); LV_PROFILER_END; } diff --git a/src/draw/vg_lite/lv_vg_lite_decoder.c b/src/draw/vg_lite/lv_vg_lite_decoder.c index 822db0dfb..a7a4ead2b 100644 --- a/src/draw/vg_lite/lv_vg_lite_decoder.c +++ b/src/draw/vg_lite/lv_vg_lite_decoder.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ +#include "../lv_image_decoder_private.h" #include "lv_vg_lite_decoder.h" #if LV_USE_DRAW_VG_LITE @@ -14,6 +15,7 @@ #include "lv_vg_lite_utils.h" #include <stdlib.h> #include <string.h> +#include "../../core/lv_global.h" /********************* * DEFINES diff --git a/src/draw/vg_lite/lv_vg_lite_grad.c b/src/draw/vg_lite/lv_vg_lite_grad.c index 4276aedc9..5158d057d 100644 --- a/src/draw/vg_lite/lv_vg_lite_grad.c +++ b/src/draw/vg_lite/lv_vg_lite_grad.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ +#include "../lv_draw_vector_private.h" #include "lv_vg_lite_grad.h" #if LV_USE_DRAW_VG_LITE && LV_USE_VECTOR_GRAPHIC @@ -52,7 +53,7 @@ typedef struct { * STATIC PROTOTYPES **********************/ -static grad_item_t * grad_get(struct _lv_draw_vg_lite_unit_t * u, const lv_vector_gradient_t * grad); +static grad_item_t * grad_get(struct lv_draw_vg_lite_unit_t * u, const lv_vector_gradient_t * grad); static void grad_cache_release_cb(void * entry, void * user_data); static bool grad_create_cb(grad_item_t * item, void * user_data); static void grad_free_cb(grad_item_t * item, void * user_data); @@ -74,7 +75,7 @@ static vg_lite_gradient_spreadmode_t lv_spread_to_vg(lv_vector_gradient_spread_t * GLOBAL FUNCTIONS **********************/ -void lv_vg_lite_grad_init(struct _lv_draw_vg_lite_unit_t * u, uint32_t cache_cnt) +void lv_vg_lite_grad_init(struct lv_draw_vg_lite_unit_t * u, uint32_t cache_cnt) { LV_ASSERT_NULL(u); @@ -90,7 +91,7 @@ void lv_vg_lite_grad_init(struct _lv_draw_vg_lite_unit_t * u, uint32_t cache_cnt lv_vg_lite_pending_set_free_cb(u->grad_pending, grad_cache_release_cb, u->grad_cache); } -void lv_vg_lite_grad_deinit(struct _lv_draw_vg_lite_unit_t * u) +void lv_vg_lite_grad_deinit(struct lv_draw_vg_lite_unit_t * u) { LV_ASSERT_NULL(u); LV_ASSERT_NULL(u->grad_pending) @@ -101,7 +102,7 @@ void lv_vg_lite_grad_deinit(struct _lv_draw_vg_lite_unit_t * u) } bool lv_vg_lite_draw_grad( - struct _lv_draw_vg_lite_unit_t * u, + struct lv_draw_vg_lite_unit_t * u, vg_lite_buffer_t * buffer, vg_lite_path_t * path, const lv_vector_gradient_t * grad, @@ -224,7 +225,7 @@ bool lv_vg_lite_draw_grad( } bool lv_vg_lite_draw_grad_helper( - struct _lv_draw_vg_lite_unit_t * u, + struct lv_draw_vg_lite_unit_t * u, vg_lite_buffer_t * buffer, vg_lite_path_t * path, const lv_area_t * area, @@ -321,7 +322,7 @@ bool lv_vg_lite_draw_grad_helper( * STATIC FUNCTIONS **********************/ -static grad_item_t * grad_get(struct _lv_draw_vg_lite_unit_t * u, const lv_vector_gradient_t * grad) +static grad_item_t * grad_get(struct lv_draw_vg_lite_unit_t * u, const lv_vector_gradient_t * grad) { LV_ASSERT_NULL(u); LV_ASSERT_NULL(grad); diff --git a/src/draw/vg_lite/lv_vg_lite_grad.h b/src/draw/vg_lite/lv_vg_lite_grad.h index d9bde91e9..d8b9d1f97 100644 --- a/src/draw/vg_lite/lv_vg_lite_grad.h +++ b/src/draw/vg_lite/lv_vg_lite_grad.h @@ -32,12 +32,12 @@ extern "C" { * GLOBAL PROTOTYPES **********************/ -void lv_vg_lite_grad_init(struct _lv_draw_vg_lite_unit_t * u, uint32_t cache_cnt); +void lv_vg_lite_grad_init(struct lv_draw_vg_lite_unit_t * u, uint32_t cache_cnt); -void lv_vg_lite_grad_deinit(struct _lv_draw_vg_lite_unit_t * u); +void lv_vg_lite_grad_deinit(struct lv_draw_vg_lite_unit_t * u); bool lv_vg_lite_draw_grad( - struct _lv_draw_vg_lite_unit_t * u, + struct lv_draw_vg_lite_unit_t * u, vg_lite_buffer_t * buffer, vg_lite_path_t * path, const lv_vector_gradient_t * grad, @@ -47,7 +47,7 @@ bool lv_vg_lite_draw_grad( vg_lite_blend_t blend); bool lv_vg_lite_draw_grad_helper( - struct _lv_draw_vg_lite_unit_t * u, + struct lv_draw_vg_lite_unit_t * u, vg_lite_buffer_t * buffer, vg_lite_path_t * path, const lv_area_t * area, diff --git a/src/draw/vg_lite/lv_vg_lite_path.c b/src/draw/vg_lite/lv_vg_lite_path.c index 62f5ad969..77d002677 100644 --- a/src/draw/vg_lite/lv_vg_lite_path.c +++ b/src/draw/vg_lite/lv_vg_lite_path.c @@ -34,7 +34,7 @@ * TYPEDEFS **********************/ -struct _lv_vg_lite_path_t { +struct lv_vg_lite_path_t { vg_lite_path_t base; size_t mem_size; uint8_t format_len; @@ -63,14 +63,14 @@ typedef struct { * GLOBAL FUNCTIONS **********************/ -void lv_vg_lite_path_init(struct _lv_draw_vg_lite_unit_t * unit) +void lv_vg_lite_path_init(struct lv_draw_vg_lite_unit_t * unit) { LV_ASSERT_NULL(unit); unit->global_path = lv_vg_lite_path_create(VG_LITE_FP32); unit->path_in_use = false; } -void lv_vg_lite_path_deinit(struct _lv_draw_vg_lite_unit_t * unit) +void lv_vg_lite_path_deinit(struct lv_draw_vg_lite_unit_t * unit) { LV_ASSERT_NULL(unit); LV_ASSERT(!unit->path_in_use); @@ -111,7 +111,7 @@ void lv_vg_lite_path_destroy(lv_vg_lite_path_t * path) LV_PROFILER_END; } -lv_vg_lite_path_t * lv_vg_lite_path_get(struct _lv_draw_vg_lite_unit_t * unit, vg_lite_format_t data_format) +lv_vg_lite_path_t * lv_vg_lite_path_get(struct lv_draw_vg_lite_unit_t * unit, vg_lite_format_t data_format) { LV_ASSERT_NULL(unit); LV_ASSERT_NULL(unit->global_path); @@ -121,7 +121,7 @@ lv_vg_lite_path_t * lv_vg_lite_path_get(struct _lv_draw_vg_lite_unit_t * unit, v return unit->global_path; } -void lv_vg_lite_path_drop(struct _lv_draw_vg_lite_unit_t * unit, lv_vg_lite_path_t * path) +void lv_vg_lite_path_drop(struct lv_draw_vg_lite_unit_t * unit, lv_vg_lite_path_t * path) { LV_ASSERT_NULL(unit); LV_ASSERT_NULL(path); diff --git a/src/draw/vg_lite/lv_vg_lite_path.h b/src/draw/vg_lite/lv_vg_lite_path.h index f8c224717..914e07c92 100644 --- a/src/draw/vg_lite/lv_vg_lite_path.h +++ b/src/draw/vg_lite/lv_vg_lite_path.h @@ -22,8 +22,8 @@ extern "C" { * DEFINES *********************/ -typedef struct _lv_vg_lite_path_t lv_vg_lite_path_t; -typedef struct _lv_draw_vg_lite_unit_t lv_draw_vg_lite_unit_t; +typedef struct lv_vg_lite_path_t lv_vg_lite_path_t; +typedef struct lv_draw_vg_lite_unit_t lv_draw_vg_lite_unit_t; typedef void (*lv_vg_lite_path_iter_cb_t)(void * user_data, uint8_t op_code, const float * data, uint32_t len); diff --git a/src/draw/vg_lite/lv_vg_lite_pending.c b/src/draw/vg_lite/lv_vg_lite_pending.c index 044417207..b8429f0f5 100644 --- a/src/draw/vg_lite/lv_vg_lite_pending.c +++ b/src/draw/vg_lite/lv_vg_lite_pending.c @@ -19,7 +19,7 @@ * TYPEDEFS **********************/ -struct _lv_vg_lite_pending_t { +struct lv_vg_lite_pending_t { lv_array_t objs; lv_vg_lite_pending_free_cb_t free_cb; void * user_data; diff --git a/src/draw/vg_lite/lv_vg_lite_pending.h b/src/draw/vg_lite/lv_vg_lite_pending.h index 8def9dcf5..bf439b74d 100644 --- a/src/draw/vg_lite/lv_vg_lite_pending.h +++ b/src/draw/vg_lite/lv_vg_lite_pending.h @@ -26,7 +26,7 @@ extern "C" { * TYPEDEFS **********************/ -typedef struct _lv_vg_lite_pending_t lv_vg_lite_pending_t; +typedef struct lv_vg_lite_pending_t lv_vg_lite_pending_t; typedef void (*lv_vg_lite_pending_free_cb_t)(void * obj, void * user_data); diff --git a/src/draw/vg_lite/lv_vg_lite_stroke.c b/src/draw/vg_lite/lv_vg_lite_stroke.c index f438d6c5f..1b8a20248 100644 --- a/src/draw/vg_lite/lv_vg_lite_stroke.c +++ b/src/draw/vg_lite/lv_vg_lite_stroke.c @@ -14,6 +14,7 @@ #include "lv_vg_lite_path.h" #include "lv_draw_vg_lite_type.h" #include "lv_vg_lite_math.h" +#include "../lv_draw_vector_private.h" /********************* * DEFINES @@ -55,7 +56,7 @@ static lv_cache_compare_res_t stroke_compare_cb(const stroke_item_t * lhs, const * GLOBAL FUNCTIONS **********************/ -void lv_vg_lite_stroke_init(struct _lv_draw_vg_lite_unit_t * unit, uint32_t cache_cnt) +void lv_vg_lite_stroke_init(struct lv_draw_vg_lite_unit_t * unit, uint32_t cache_cnt) { LV_ASSERT_NULL(unit); @@ -69,7 +70,7 @@ void lv_vg_lite_stroke_init(struct _lv_draw_vg_lite_unit_t * unit, uint32_t cach lv_cache_set_name(unit->stroke_cache, "VG_STROKE"); } -void lv_vg_lite_stroke_deinit(struct _lv_draw_vg_lite_unit_t * unit) +void lv_vg_lite_stroke_deinit(struct lv_draw_vg_lite_unit_t * unit) { LV_ASSERT_NULL(unit); LV_ASSERT_NULL(unit->stroke_cache); @@ -105,8 +106,8 @@ static vg_lite_join_style_t lv_stroke_join_to_vg(lv_vector_stroke_join_t join) } } -lv_cache_entry_t * lv_vg_lite_stroke_get(struct _lv_draw_vg_lite_unit_t * unit, - struct _lv_vg_lite_path_t * path, +lv_cache_entry_t * lv_vg_lite_stroke_get(struct lv_draw_vg_lite_unit_t * unit, + struct lv_vg_lite_path_t * path, const lv_vector_stroke_dsc_t * dsc) { LV_ASSERT_NULL(unit); @@ -146,7 +147,7 @@ lv_cache_entry_t * lv_vg_lite_stroke_get(struct _lv_draw_vg_lite_unit_t * unit, return cache_node_entry; } -struct _lv_vg_lite_path_t * lv_vg_lite_stroke_get_path(lv_cache_entry_t * cache_entry) +struct lv_vg_lite_path_t * lv_vg_lite_stroke_get_path(lv_cache_entry_t * cache_entry) { LV_ASSERT_NULL(cache_entry); @@ -155,7 +156,7 @@ struct _lv_vg_lite_path_t * lv_vg_lite_stroke_get_path(lv_cache_entry_t * cache_ return stroke_item->path; } -void lv_vg_lite_stroke_drop(struct _lv_draw_vg_lite_unit_t * unit, +void lv_vg_lite_stroke_drop(struct lv_draw_vg_lite_unit_t * unit, lv_cache_entry_t * cache_entry) { LV_ASSERT_NULL(unit); diff --git a/src/draw/vg_lite/lv_vg_lite_stroke.h b/src/draw/vg_lite/lv_vg_lite_stroke.h index 81c7e510d..4a0602d62 100644 --- a/src/draw/vg_lite/lv_vg_lite_stroke.h +++ b/src/draw/vg_lite/lv_vg_lite_stroke.h @@ -26,9 +26,9 @@ extern "C" { * TYPEDEFS **********************/ -struct _lv_vg_lite_path_t; +struct lv_vg_lite_path_t; -struct _lv_draw_vg_lite_unit_t; +struct lv_draw_vg_lite_unit_t; /********************** * GLOBAL PROTOTYPES @@ -38,13 +38,13 @@ struct _lv_draw_vg_lite_unit_t; * Initialize the stroke module * @param unit pointer to the unit */ -void lv_vg_lite_stroke_init(struct _lv_draw_vg_lite_unit_t * unit, uint32_t cache_cnt); +void lv_vg_lite_stroke_init(struct lv_draw_vg_lite_unit_t * unit, uint32_t cache_cnt); /** * Deinitialize the stroke module * @param unit pointer to the unit */ -void lv_vg_lite_stroke_deinit(struct _lv_draw_vg_lite_unit_t * unit); +void lv_vg_lite_stroke_deinit(struct lv_draw_vg_lite_unit_t * unit); /** * Get the stroke cache entry @@ -53,8 +53,8 @@ void lv_vg_lite_stroke_deinit(struct _lv_draw_vg_lite_unit_t * unit); * @param dsc pointer to the stroke descriptor * @return pointer to the stroke cache entry */ -lv_cache_entry_t * lv_vg_lite_stroke_get(struct _lv_draw_vg_lite_unit_t * unit, - struct _lv_vg_lite_path_t * path, +lv_cache_entry_t * lv_vg_lite_stroke_get(struct lv_draw_vg_lite_unit_t * unit, + struct lv_vg_lite_path_t * path, const lv_vector_stroke_dsc_t * dsc); /** @@ -62,14 +62,14 @@ lv_cache_entry_t * lv_vg_lite_stroke_get(struct _lv_draw_vg_lite_unit_t * unit, * @param cache_entry pointer to the stroke cache entry * @return pointer to the path */ -struct _lv_vg_lite_path_t * lv_vg_lite_stroke_get_path(lv_cache_entry_t * cache_entry); +struct lv_vg_lite_path_t * lv_vg_lite_stroke_get_path(lv_cache_entry_t * cache_entry); /** * Drop the stroke cache entry * @param unit pointer to the unit * @param stroke pointer to the stroke */ -void lv_vg_lite_stroke_drop(struct _lv_draw_vg_lite_unit_t * unit, lv_cache_entry_t * cache_entry); +void lv_vg_lite_stroke_drop(struct lv_draw_vg_lite_unit_t * unit, lv_cache_entry_t * cache_entry); /********************** * MACROS diff --git a/src/draw/vg_lite/lv_vg_lite_utils.c b/src/draw/vg_lite/lv_vg_lite_utils.c index 8c6d23a6c..e1e921d2a 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.c +++ b/src/draw/vg_lite/lv_vg_lite_utils.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ +#include "../lv_image_decoder_private.h" #include "lv_vg_lite_utils.h" #if LV_USE_DRAW_VG_LITE @@ -757,13 +758,13 @@ bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_ds return true; } -void lv_vg_lite_image_dsc_init(struct _lv_draw_vg_lite_unit_t * unit) +void lv_vg_lite_image_dsc_init(struct lv_draw_vg_lite_unit_t * unit) { unit->image_dsc_pending = lv_vg_lite_pending_create(sizeof(lv_image_decoder_dsc_t), 4); lv_vg_lite_pending_set_free_cb(unit->image_dsc_pending, image_dsc_free_cb, NULL); } -void lv_vg_lite_image_dsc_deinit(struct _lv_draw_vg_lite_unit_t * unit) +void lv_vg_lite_image_dsc_deinit(struct lv_draw_vg_lite_unit_t * unit) { lv_vg_lite_pending_destroy(unit->image_dsc_pending); unit->image_dsc_pending = NULL; @@ -1160,7 +1161,7 @@ void lv_vg_lite_disable_scissor(void) LV_VER_RES)); } -void lv_vg_lite_flush(struct _lv_draw_vg_lite_unit_t * u) +void lv_vg_lite_flush(struct lv_draw_vg_lite_unit_t * u) { LV_ASSERT_NULL(u); LV_PROFILER_BEGIN; @@ -1188,7 +1189,7 @@ void lv_vg_lite_flush(struct _lv_draw_vg_lite_unit_t * u) LV_PROFILER_END; } -void lv_vg_lite_finish(struct _lv_draw_vg_lite_unit_t * u) +void lv_vg_lite_finish(struct lv_draw_vg_lite_unit_t * u) { LV_ASSERT_NULL(u); LV_PROFILER_BEGIN; diff --git a/src/draw/vg_lite/lv_vg_lite_utils.h b/src/draw/vg_lite/lv_vg_lite_utils.h index d107840d7..62e65620d 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.h +++ b/src/draw/vg_lite/lv_vg_lite_utils.h @@ -71,7 +71,7 @@ extern "C" { * TYPEDEFS **********************/ -struct _lv_draw_vg_lite_unit_t; +struct lv_draw_vg_lite_unit_t; /********************** * GLOBAL PROTOTYPES @@ -133,9 +133,9 @@ void lv_vg_lite_image_dec_init(vg_lite_matrix_t * matrix, int32_t x, int32_t y, bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_dsc_t * decoder_dsc, const void * src, bool no_cache); -void lv_vg_lite_image_dsc_init(struct _lv_draw_vg_lite_unit_t * unit); +void lv_vg_lite_image_dsc_init(struct lv_draw_vg_lite_unit_t * unit); -void lv_vg_lite_image_dsc_deinit(struct _lv_draw_vg_lite_unit_t * unit); +void lv_vg_lite_image_dsc_deinit(struct lv_draw_vg_lite_unit_t * unit); vg_lite_blend_t lv_vg_lite_blend_mode(lv_blend_mode_t blend_mode); @@ -175,9 +175,9 @@ void lv_vg_lite_set_scissor_area(const lv_area_t * area); void lv_vg_lite_disable_scissor(void); -void lv_vg_lite_flush(struct _lv_draw_vg_lite_unit_t * u); +void lv_vg_lite_flush(struct lv_draw_vg_lite_unit_t * u); -void lv_vg_lite_finish(struct _lv_draw_vg_lite_unit_t * u); +void lv_vg_lite_finish(struct lv_draw_vg_lite_unit_t * u); /********************** * MACROS diff --git a/src/drivers/libinput/lv_libinput.c b/src/drivers/libinput/lv_libinput.c index ff75a2a78..7410f40fd 100644 --- a/src/drivers/libinput/lv_libinput.c +++ b/src/drivers/libinput/lv_libinput.c @@ -7,7 +7,8 @@ * INCLUDES *********************/ -#include "lv_libinput.h" +#include "../../indev/lv_indev_private.h" +#include "lv_libinput_private.h" #if LV_USE_LIBINPUT @@ -603,7 +604,7 @@ static void _read_keypad(lv_libinput_t * dsc, struct libinput_event * event) /* Only record button state when actual output is produced to prevent widgets from refreshing */ evt->pressed = (key_state == LIBINPUT_KEY_STATE_RELEASED) ? LV_INDEV_STATE_RELEASED : LV_INDEV_STATE_PRESSED; - // just release the key immediatly after it got pressed. + // just release the key immediately after it got pressed. // but don't handle special keys where holding a key makes sense if(evt->key_val != LV_KEY_BACKSPACE && evt->key_val != LV_KEY_UP && diff --git a/src/drivers/libinput/lv_libinput.h b/src/drivers/libinput/lv_libinput.h index 0441c25a7..ce19a33b5 100644 --- a/src/drivers/libinput/lv_libinput.h +++ b/src/drivers/libinput/lv_libinput.h @@ -39,43 +39,10 @@ typedef enum { LV_LIBINPUT_CAPABILITY_TOUCH = 1U << 2 } lv_libinput_capability; -typedef struct { - lv_indev_state_t pressed; - int key_val; - lv_point_t point; -} lv_libinput_event_t; +struct libinput_device; #define LV_LIBINPUT_MAX_EVENTS 32 -typedef struct { - int fd; - struct pollfd fds[1]; - - /* The points array is implemented as a circular LIFO queue */ - lv_libinput_event_t points[LV_LIBINPUT_MAX_EVENTS]; /* Event buffer */ - lv_libinput_event_t slots[2]; /* Realtime state of up to 2 fingers to handle multitouch */ - - /* Pointer devices work a bit differently in libinput which requires us to store their last known state */ - lv_point_t pointer_position; - bool pointer_button_down; - - int start; /* Index of start of event queue */ - int end; /* Index of end of queue*/ - lv_libinput_event_t last_event; /* Report when no new events - * to keep indev state consistent - */ - bool deinit; /* Tell worker thread to quit */ - pthread_mutex_t event_lock; - pthread_t worker_thread; - - struct libinput * libinput_context; - struct libinput_device * libinput_device; - -#if LV_LIBINPUT_XKB - lv_xkb_t xkb; -#endif /* LV_LIBINPUT_XKB */ -} lv_libinput_t; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/drivers/libinput/lv_libinput_private.h b/src/drivers/libinput/lv_libinput_private.h new file mode 100644 index 000000000..6d1844c6b --- /dev/null +++ b/src/drivers/libinput/lv_libinput_private.h @@ -0,0 +1,79 @@ +/** + * @file lv_libinput_private.h + * + */ + +#ifndef LV_LIBINPUT_PRIVATE_H +#define LV_LIBINPUT_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_libinput.h" + +#if LV_USE_LIBINPUT + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_libinput_event_t { + lv_indev_state_t pressed; + int key_val; + lv_point_t point; +}; + +struct lv_libinput_t { + int fd; + struct pollfd fds[1]; + + /* The points array is implemented as a circular LIFO queue */ + lv_libinput_event_t points[LV_LIBINPUT_MAX_EVENTS]; /* Event buffer */ + lv_libinput_event_t slots[2]; /* Realtime state of up to 2 fingers to handle multitouch */ + + /* Pointer devices work a bit differently in libinput which requires us to store their last known state */ + lv_point_t pointer_position; + bool pointer_button_down; + + int start; /* Index of start of event queue */ + int end; /* Index of end of queue*/ + lv_libinput_event_t last_event; /* Report when no new events + * to keep indev state consistent + */ + bool deinit; /* Tell worker thread to quit */ + pthread_mutex_t event_lock; + pthread_t worker_thread; + + struct libinput * libinput_context; + struct libinput_device * libinput_device; + +#if LV_LIBINPUT_XKB + lv_xkb_t xkb; +#endif /* LV_LIBINPUT_XKB */ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_LIBINPUT */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LIBINPUT_PRIVATE_H*/ diff --git a/src/drivers/libinput/lv_xkb.c b/src/drivers/libinput/lv_xkb.c index 96aeb4c0b..1e8ddb10c 100644 --- a/src/drivers/libinput/lv_xkb.c +++ b/src/drivers/libinput/lv_xkb.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_xkb.h" +#include "lv_xkb_private.h" #if defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB diff --git a/src/drivers/libinput/lv_xkb.h b/src/drivers/libinput/lv_xkb.h index d048f33cb..daaa4dc1d 100644 --- a/src/drivers/libinput/lv_xkb.h +++ b/src/drivers/libinput/lv_xkb.h @@ -26,15 +26,6 @@ extern "C" { *********************/ /********************** - * TYPEDEFS - **********************/ - -typedef struct { - struct xkb_keymap * keymap; - struct xkb_state * state; -} lv_xkb_t; - -/********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/drivers/libinput/lv_xkb_private.h b/src/drivers/libinput/lv_xkb_private.h new file mode 100644 index 000000000..315762541 --- /dev/null +++ b/src/drivers/libinput/lv_xkb_private.h @@ -0,0 +1,53 @@ +/** + * @file lv_xkb_private.h + * + */ + +#ifndef LV_XKB_PRIVATE_H +#define LV_XKB_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_xkb.h" + +#if defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_xkb_t { + struct xkb_keymap * keymap; + struct xkb_state * state; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* defined(LV_LIBINPUT_XKB) && LV_LIBINPUT_XKB */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_XKB_PRIVATE_H*/ diff --git a/src/drivers/nuttx/lv_nuttx_cache.c b/src/drivers/nuttx/lv_nuttx_cache.c index 713e987f2..273f49ef8 100644 --- a/src/drivers/nuttx/lv_nuttx_cache.c +++ b/src/drivers/nuttx/lv_nuttx_cache.c @@ -12,6 +12,7 @@ #if LV_USE_NUTTX +#include "../../draw/lv_draw_buf_private.h" #include <nuttx/cache.h> /********************* diff --git a/src/drivers/nuttx/lv_nuttx_entry.c b/src/drivers/nuttx/lv_nuttx_entry.c index 4a9166604..4166b20c3 100644 --- a/src/drivers/nuttx/lv_nuttx_entry.c +++ b/src/drivers/nuttx/lv_nuttx_entry.c @@ -258,7 +258,7 @@ static uint32_t millis(void) #if LV_USE_LOG static void syslog_print(lv_log_level_t level, const char * buf) { - static const int priority[_LV_LOG_LEVEL_NUM] = { + static const int priority[LV_LOG_LEVEL_NUM] = { LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERR, LOG_CRIT }; diff --git a/src/drivers/nuttx/lv_nuttx_entry.h b/src/drivers/nuttx/lv_nuttx_entry.h index 049e741e5..64ece994e 100644 --- a/src/drivers/nuttx/lv_nuttx_entry.h +++ b/src/drivers/nuttx/lv_nuttx_entry.h @@ -43,7 +43,7 @@ typedef struct { lv_indev_t * utouch_indev; } lv_nuttx_result_t; -typedef struct _lv_nuttx_ctx_t { +typedef struct lv_nuttx_ctx_t { void * image_cache; } lv_nuttx_ctx_t; diff --git a/src/drivers/nuttx/lv_nuttx_fbdev.c b/src/drivers/nuttx/lv_nuttx_fbdev.c index 65caea556..5ff500e28 100644 --- a/src/drivers/nuttx/lv_nuttx_fbdev.c +++ b/src/drivers/nuttx/lv_nuttx_fbdev.c @@ -204,9 +204,9 @@ static void fbdev_join_inv_areas(lv_display_t * disp, lv_area_t * final_inv_area area_joined = true; } else { - _lv_area_join(final_inv_area, - final_inv_area, - area_p); + lv_area_join(final_inv_area, + final_inv_area, + area_p); } } } @@ -230,7 +230,7 @@ static void display_refr_timer_cb(lv_timer_t * tmr) } if(pfds[0].revents & POLLOUT) { - _lv_display_refr_timer(tmr); + lv_display_refr_timer(tmr); } } diff --git a/src/drivers/nuttx/lv_nuttx_image_cache.c b/src/drivers/nuttx/lv_nuttx_image_cache.c index 886597fe4..3c0de01ce 100644 --- a/src/drivers/nuttx/lv_nuttx_image_cache.c +++ b/src/drivers/nuttx/lv_nuttx_image_cache.c @@ -12,6 +12,7 @@ #if LV_USE_NUTTX +#include "../../lv_draw_buf_private.h" #include <nuttx/mm/mm.h> /********************* diff --git a/src/drivers/nuttx/lv_nuttx_libuv.c b/src/drivers/nuttx/lv_nuttx_libuv.c index 0235e5ec0..12b8c439c 100644 --- a/src/drivers/nuttx/lv_nuttx_libuv.c +++ b/src/drivers/nuttx/lv_nuttx_libuv.c @@ -202,7 +202,7 @@ static void lv_nuttx_uv_disp_poll_cb(uv_poll_t * handle, int status, int events) LV_UNUSED(status); LV_UNUSED(events); uv_poll_stop(handle); - _lv_display_refr_timer(NULL); + lv_display_refr_timer(NULL); fb_ctx->polling = false; } diff --git a/src/drivers/sdl/lv_sdl_keyboard.c b/src/drivers/sdl/lv_sdl_keyboard.c index 188e5cacb..0bb94d6e3 100644 --- a/src/drivers/sdl/lv_sdl_keyboard.c +++ b/src/drivers/sdl/lv_sdl_keyboard.c @@ -9,7 +9,6 @@ #include "lv_sdl_keyboard.h" #if LV_USE_SDL -#include "../../indev/lv_indev.h" #include "../../core/lv_group.h" #include "../../stdlib/lv_string.h" #include "lv_sdl_private.h" diff --git a/src/drivers/sdl/lv_sdl_mousewheel.c b/src/drivers/sdl/lv_sdl_mousewheel.c index 080312668..b31a72309 100644 --- a/src/drivers/sdl/lv_sdl_mousewheel.c +++ b/src/drivers/sdl/lv_sdl_mousewheel.c @@ -10,7 +10,6 @@ #if LV_USE_SDL && LV_SDL_MOUSEWHEEL_MODE == LV_SDL_MOUSEWHEEL_MODE_ENCODER #include "../../core/lv_group.h" -#include "../../indev/lv_indev_private.h" #include "../../stdlib/lv_string.h" #include "lv_sdl_private.h" diff --git a/src/drivers/windows/lv_windows_context.h b/src/drivers/windows/lv_windows_context.h index 4517d9b54..c4fc9417a 100644 --- a/src/drivers/windows/lv_windows_context.h +++ b/src/drivers/windows/lv_windows_context.h @@ -41,31 +41,31 @@ extern "C" { * TYPEDEFS **********************/ -typedef struct _lv_windows_pointer_context_t { +typedef struct lv_windows_pointer_context_t { lv_indev_state_t state; lv_point_t point; lv_indev_t * indev; } lv_windows_pointer_context_t; -typedef struct _lv_windows_keypad_queue_item_t { +typedef struct lv_windows_keypad_queue_item_t { uint32_t key; lv_indev_state_t state; } lv_windows_keypad_queue_item_t; -typedef struct _lv_windows_keypad_context_t { +typedef struct lv_windows_keypad_context_t { lv_ll_t queue; uint16_t utf16_high_surrogate; uint16_t utf16_low_surrogate; lv_indev_t * indev; } lv_windows_keypad_context_t; -typedef struct _lv_windows_encoder_context_t { +typedef struct lv_windows_encoder_context_t { lv_indev_state_t state; int16_t enc_diff; lv_indev_t * indev; } lv_windows_encoder_context_t; -typedef struct _lv_windows_window_context_t { +typedef struct lv_windows_window_context_t { lv_display_t * display_device_object; lv_timer_t * display_timer_object; @@ -86,7 +86,7 @@ typedef struct _lv_windows_window_context_t { } lv_windows_window_context_t; -typedef struct _lv_windows_create_display_data_t { +typedef struct lv_windows_create_display_data_t { const wchar_t * title; int32_t hor_res; int32_t ver_res; diff --git a/src/drivers/windows/lv_windows_input.c b/src/drivers/windows/lv_windows_input.c index 5611e3fb4..d3b781646 100644 --- a/src/drivers/windows/lv_windows_input.c +++ b/src/drivers/windows/lv_windows_input.c @@ -18,10 +18,11 @@ #include "lv_windows_display.h" #include "lv_windows_input_private.h" #include "../../misc/lv_text_private.h" +#include "../../core/lv_obj_private.h" #include <windowsx.h> -#include "../../widgets/textarea/lv_textarea.h" +#include "../../widgets/textarea/lv_textarea_private.h" #include "../../widgets/keyboard/lv_keyboard.h" /********************* @@ -128,7 +129,7 @@ lv_indev_t * lv_windows_acquire_keypad_indev(lv_display_t * display) } if(!context->keypad.indev) { - _lv_ll_init( + lv_ll_init( &context->keypad.queue, sizeof(lv_windows_keypad_queue_item_t)); context->keypad.utf16_high_surrogate = 0; @@ -421,12 +422,12 @@ static void lv_windows_keypad_driver_read_callback( } lv_windows_keypad_queue_item_t * current = (lv_windows_keypad_queue_item_t *)( - _lv_ll_get_head(&context->keypad.queue)); + lv_ll_get_head(&context->keypad.queue)); if(current) { data->key = current->key; data->state = current->state; - _lv_ll_remove(&context->keypad.queue, current); + lv_ll_remove(&context->keypad.queue, current); lv_free(current); data->continue_reading = true; @@ -451,7 +452,7 @@ static void lv_windows_release_keypad_device_event_callback(lv_event_t * e) return; } - _lv_ll_clear(&context->keypad.queue); + lv_ll_clear(&context->keypad.queue); context->keypad.utf16_high_surrogate = 0; context->keypad.utf16_low_surrogate = 0; @@ -464,7 +465,7 @@ static void lv_windows_push_key_to_keyboard_queue( lv_indev_state_t state) { lv_windows_keypad_queue_item_t * current = (lv_windows_keypad_queue_item_t *)( - _lv_ll_ins_tail(&context->keypad.queue)); + lv_ll_ins_tail(&context->keypad.queue)); if(current) { current->key = key; current->state = state; diff --git a/src/font/lv_binfont_loader.c b/src/font/lv_binfont_loader.c index 4b06e6ccf..4746026f5 100644 --- a/src/font/lv_binfont_loader.c +++ b/src/font/lv_binfont_loader.c @@ -6,8 +6,9 @@ /********************* * INCLUDES *********************/ +#include "lv_font_fmt_txt_private.h" #include "../lvgl.h" -#include "../misc/lv_fs.h" +#include "../misc/lv_fs_private.h" #include "../misc/lv_types.h" #include "../stdlib/lv_string.h" #include "lv_binfont_loader.h" diff --git a/src/font/lv_font.c b/src/font/lv_font.c index 51d9a2de1..35ae352e3 100644 --- a/src/font/lv_font.c +++ b/src/font/lv_font.c @@ -134,6 +134,16 @@ void lv_font_set_kerning(lv_font_t * font, lv_font_kerning_t kerning) font->kerning = kerning; } +int32_t lv_font_get_line_height(const lv_font_t * font) +{ + return font->line_height; +} + +const lv_font_t * lv_font_default(void) +{ + return LV_FONT_DEFAULT; +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/font/lv_font.h b/src/font/lv_font.h index 2d142456e..c38d6d5cb 100644 --- a/src/font/lv_font.h +++ b/src/font/lv_font.h @@ -34,7 +34,7 @@ extern "C" { *-----------------*/ /** The font format.*/ -enum _lv_font_glyph_format_t { +typedef enum { LV_FONT_GLYPH_FORMAT_NONE = 0, /**< Maybe not visible*/ /**< Legacy simple formats*/ @@ -49,13 +49,7 @@ enum _lv_font_glyph_format_t { LV_FONT_GLYPH_FORMAT_VECTOR = 0x0A, /**< Vectorial format*/ LV_FONT_GLYPH_FORMAT_SVG = 0x0B, /**< SVG format*/ LV_FONT_GLYPH_FORMAT_CUSTOM = 0xFF, /**< Custom format*/ -}; - -#ifdef DOXYGEN -typedef _lv_font_glyph_format_t lv_font_glyph_format_t; -#else -typedef uint8_t lv_font_glyph_format_t; -#endif /*DOXYGEN*/ +} lv_font_glyph_format_t; /** Describes the properties of a glyph.*/ typedef struct { @@ -77,33 +71,21 @@ typedef struct { } lv_font_glyph_dsc_t; /** The bitmaps might be upscaled by 3 to achieve subpixel rendering.*/ -enum _lv_font_subpx_t { +typedef enum { LV_FONT_SUBPX_NONE, LV_FONT_SUBPX_HOR, LV_FONT_SUBPX_VER, LV_FONT_SUBPX_BOTH, -}; - -#ifdef DOXYGEN -typedef _lv_font_subpx_t lv_font_subpx_t; -#else -typedef uint8_t lv_font_subpx_t; -#endif /*DOXYGEN*/ +} lv_font_subpx_t; /** Adjust letter spacing for specific character pairs.*/ -enum _lv_font_kerning_t { +typedef enum { LV_FONT_KERNING_NORMAL, LV_FONT_KERNING_NONE, -}; - -#ifdef DOXYGEN -typedef _lv_font_kerning_t lv_font_kerning_t; -#else -typedef uint8_t lv_font_kerning_t; -#endif /*DOXYGEN*/ +} lv_font_kerning_t; /** Describe the properties of a font*/ -struct _lv_font_t { +struct lv_font_t { /** Get a glyph's descriptor from a font*/ bool (*get_glyph_dsc)(const lv_font_t *, lv_font_glyph_dsc_t *, uint32_t letter, uint32_t letter_next); @@ -173,10 +155,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 int32_t lv_font_get_line_height(const lv_font_t * font) -{ - return font->line_height; -} +int32_t lv_font_get_line_height(const lv_font_t * font); /** * Configure the use of kerning information stored in a font @@ -308,10 +287,7 @@ LV_FONT_CUSTOM_DECLARE * Just a wrapper around LV_FONT_DEFAULT because it might be more convenient to use a function in some cases * @return pointer to LV_FONT_DEFAULT */ -static inline const lv_font_t * lv_font_default(void) -{ - return LV_FONT_DEFAULT; -} +const lv_font_t * lv_font_default(void); #ifdef __cplusplus } /*extern "C"*/ diff --git a/src/font/lv_font_fmt_txt.c b/src/font/lv_font_fmt_txt.c index 4aa3d2dee..5d0130454 100644 --- a/src/font/lv_font_fmt_txt.c +++ b/src/font/lv_font_fmt_txt.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ #include "lv_font.h" -#include "lv_font_fmt_txt.h" +#include "lv_font_fmt_txt_private.h" #include "../core/lv_global.h" #include "../misc/lv_assert.h" #include "../misc/lv_types.h" diff --git a/src/font/lv_font_fmt_txt.h b/src/font/lv_font_fmt_txt.h index 4240c95b0..057a05a0e 100644 --- a/src/font/lv_font_fmt_txt.h +++ b/src/font/lv_font_fmt_txt.h @@ -44,18 +44,12 @@ typedef struct { } lv_font_fmt_txt_glyph_dsc_t; /** Format of font character map.*/ -enum _lv_font_fmt_txt_cmap_type_t { +typedef enum { LV_FONT_FMT_TXT_CMAP_FORMAT0_FULL, LV_FONT_FMT_TXT_CMAP_SPARSE_FULL, LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY, LV_FONT_FMT_TXT_CMAP_SPARSE_TINY, -}; - -#ifdef DOXYGEN -typedef _lv_font_fmt_txt_cmap_type_t lv_font_fmt_txt_cmap_type_t; -#else -typedef uint8_t lv_font_fmt_txt_cmap_type_t; -#endif /*DOXYGEN*/ +} lv_font_fmt_txt_cmap_type_t; /** * Map codepoints to a `glyph_dsc`s @@ -114,21 +108,6 @@ typedef struct { lv_font_fmt_txt_cmap_type_t type; } lv_font_fmt_txt_cmap_t; -/** A simple mapping of kern values from pairs*/ -typedef struct { - /*To get a kern value of two code points: - 1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t - 2. for(i = 0; i < pair_cnt * 2; i += 2) - if(glyph_ids[i] == glyph_id_left && - glyph_ids[i+1] == glyph_id_right) - return values[i / 2]; - */ - const void * glyph_ids; - const int8_t * values; - uint32_t pair_cnt : 30; - uint32_t glyph_ids_size : 2; /*0: `glyph_ids` is stored as `uint8_t`; 1: as `uint16_t`*/ -} lv_font_fmt_txt_kern_pair_t; - /** More complex but more optimal class based kern value storage*/ typedef struct { /*To get a kern value of two code points: @@ -191,23 +170,6 @@ typedef struct { uint16_t bitmap_format : 2; } lv_font_fmt_txt_dsc_t; -#if LV_USE_FONT_COMPRESSED -typedef enum { - RLE_STATE_SINGLE = 0, - RLE_STATE_REPEATED, - RLE_STATE_COUNTER, -} lv_font_fmt_rle_state_t; - -typedef struct { - uint32_t rdp; - const uint8_t * in; - uint8_t bpp; - uint8_t prev_v; - uint8_t count; - lv_font_fmt_rle_state_t state; -} lv_font_fmt_rle_t; -#endif - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/font/lv_font_fmt_txt_private.h b/src/font/lv_font_fmt_txt_private.h new file mode 100644 index 000000000..21d4d94aa --- /dev/null +++ b/src/font/lv_font_fmt_txt_private.h @@ -0,0 +1,71 @@ +/** + * @file lv_font_fmt_txt_private.h + * + */ + +#ifndef LV_FONT_FMT_TXT_PRIVATE_H +#define LV_FONT_FMT_TXT_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_font_fmt_txt.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** A simple mapping of kern values from pairs*/ +struct lv_font_fmt_txt_kern_pair_t { + /*To get a kern value of two code points: + 1. Get the `glyph_id_left` and `glyph_id_right` from `lv_font_fmt_txt_cmap_t + 2. for(i = 0; i < pair_cnt * 2; i += 2) + if(glyph_ids[i] == glyph_id_left && + glyph_ids[i+1] == glyph_id_right) + return values[i / 2]; + */ + const void * glyph_ids; + const int8_t * values; + uint32_t pair_cnt : 30; + uint32_t glyph_ids_size : 2; /*0: `glyph_ids` is stored as `uint8_t`; 1: as `uint16_t`*/ +}; + +#if LV_USE_FONT_COMPRESSED +typedef enum { + RLE_STATE_SINGLE = 0, + RLE_STATE_REPEATED, + RLE_STATE_COUNTER, +} lv_font_fmt_rle_state_t; + +typedef struct { + uint32_t rdp; + const uint8_t * in; + uint8_t bpp; + uint8_t prev_v; + uint8_t count; + lv_font_fmt_rle_state_t state; +} lv_font_fmt_rle_t; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FONT_FMT_TXT_PRIVATE_H*/ diff --git a/src/font/lv_symbol_def.h b/src/font/lv_symbol_def.h index 3fc2a6d71..d858bea75 100644 --- a/src/font/lv_symbol_def.h +++ b/src/font/lv_symbol_def.h @@ -278,71 +278,71 @@ extern "C" { /* * The following list is generated using - * cat src/font/lv_symbol_def.h | sed -E -n 's/^#define\s+LV_(SYMBOL_\w+).*".*$/ _LV_STR_\1,/p' + * cat src/font/lv_symbol_def.h | sed -E -n 's/^#define\s+LV_(SYMBOL_\w+).*".*$/ LV_STR_\1,/p' */ enum { - _LV_STR_SYMBOL_BULLET, - _LV_STR_SYMBOL_AUDIO, - _LV_STR_SYMBOL_VIDEO, - _LV_STR_SYMBOL_LIST, - _LV_STR_SYMBOL_OK, - _LV_STR_SYMBOL_CLOSE, - _LV_STR_SYMBOL_POWER, - _LV_STR_SYMBOL_SETTINGS, - _LV_STR_SYMBOL_HOME, - _LV_STR_SYMBOL_DOWNLOAD, - _LV_STR_SYMBOL_DRIVE, - _LV_STR_SYMBOL_REFRESH, - _LV_STR_SYMBOL_MUTE, - _LV_STR_SYMBOL_VOLUME_MID, - _LV_STR_SYMBOL_VOLUME_MAX, - _LV_STR_SYMBOL_IMAGE, - _LV_STR_SYMBOL_TINT, - _LV_STR_SYMBOL_PREV, - _LV_STR_SYMBOL_PLAY, - _LV_STR_SYMBOL_PAUSE, - _LV_STR_SYMBOL_STOP, - _LV_STR_SYMBOL_NEXT, - _LV_STR_SYMBOL_EJECT, - _LV_STR_SYMBOL_LEFT, - _LV_STR_SYMBOL_RIGHT, - _LV_STR_SYMBOL_PLUS, - _LV_STR_SYMBOL_MINUS, - _LV_STR_SYMBOL_EYE_OPEN, - _LV_STR_SYMBOL_EYE_CLOSE, - _LV_STR_SYMBOL_WARNING, - _LV_STR_SYMBOL_SHUFFLE, - _LV_STR_SYMBOL_UP, - _LV_STR_SYMBOL_DOWN, - _LV_STR_SYMBOL_LOOP, - _LV_STR_SYMBOL_DIRECTORY, - _LV_STR_SYMBOL_UPLOAD, - _LV_STR_SYMBOL_CALL, - _LV_STR_SYMBOL_CUT, - _LV_STR_SYMBOL_COPY, - _LV_STR_SYMBOL_SAVE, - _LV_STR_SYMBOL_BARS, - _LV_STR_SYMBOL_ENVELOPE, - _LV_STR_SYMBOL_CHARGE, - _LV_STR_SYMBOL_PASTE, - _LV_STR_SYMBOL_BELL, - _LV_STR_SYMBOL_KEYBOARD, - _LV_STR_SYMBOL_GPS, - _LV_STR_SYMBOL_FILE, - _LV_STR_SYMBOL_WIFI, - _LV_STR_SYMBOL_BATTERY_FULL, - _LV_STR_SYMBOL_BATTERY_3, - _LV_STR_SYMBOL_BATTERY_2, - _LV_STR_SYMBOL_BATTERY_1, - _LV_STR_SYMBOL_BATTERY_EMPTY, - _LV_STR_SYMBOL_USB, - _LV_STR_SYMBOL_BLUETOOTH, - _LV_STR_SYMBOL_TRASH, - _LV_STR_SYMBOL_EDIT, - _LV_STR_SYMBOL_BACKSPACE, - _LV_STR_SYMBOL_SD_CARD, - _LV_STR_SYMBOL_NEW_LINE, - _LV_STR_SYMBOL_DUMMY, + LV_STR_SYMBOL_BULLET, + LV_STR_SYMBOL_AUDIO, + LV_STR_SYMBOL_VIDEO, + LV_STR_SYMBOL_LIST, + LV_STR_SYMBOL_OK, + LV_STR_SYMBOL_CLOSE, + LV_STR_SYMBOL_POWER, + LV_STR_SYMBOL_SETTINGS, + LV_STR_SYMBOL_HOME, + LV_STR_SYMBOL_DOWNLOAD, + LV_STR_SYMBOL_DRIVE, + LV_STR_SYMBOL_REFRESH, + LV_STR_SYMBOL_MUTE, + LV_STR_SYMBOL_VOLUME_MID, + LV_STR_SYMBOL_VOLUME_MAX, + LV_STR_SYMBOL_IMAGE, + LV_STR_SYMBOL_TINT, + LV_STR_SYMBOL_PREV, + LV_STR_SYMBOL_PLAY, + LV_STR_SYMBOL_PAUSE, + LV_STR_SYMBOL_STOP, + LV_STR_SYMBOL_NEXT, + LV_STR_SYMBOL_EJECT, + LV_STR_SYMBOL_LEFT, + LV_STR_SYMBOL_RIGHT, + LV_STR_SYMBOL_PLUS, + LV_STR_SYMBOL_MINUS, + LV_STR_SYMBOL_EYE_OPEN, + LV_STR_SYMBOL_EYE_CLOSE, + LV_STR_SYMBOL_WARNING, + LV_STR_SYMBOL_SHUFFLE, + LV_STR_SYMBOL_UP, + LV_STR_SYMBOL_DOWN, + LV_STR_SYMBOL_LOOP, + LV_STR_SYMBOL_DIRECTORY, + LV_STR_SYMBOL_UPLOAD, + LV_STR_SYMBOL_CALL, + LV_STR_SYMBOL_CUT, + LV_STR_SYMBOL_COPY, + LV_STR_SYMBOL_SAVE, + LV_STR_SYMBOL_BARS, + LV_STR_SYMBOL_ENVELOPE, + LV_STR_SYMBOL_CHARGE, + LV_STR_SYMBOL_PASTE, + LV_STR_SYMBOL_BELL, + LV_STR_SYMBOL_KEYBOARD, + LV_STR_SYMBOL_GPS, + LV_STR_SYMBOL_FILE, + LV_STR_SYMBOL_WIFI, + LV_STR_SYMBOL_BATTERY_FULL, + LV_STR_SYMBOL_BATTERY_3, + LV_STR_SYMBOL_BATTERY_2, + LV_STR_SYMBOL_BATTERY_1, + LV_STR_SYMBOL_BATTERY_EMPTY, + LV_STR_SYMBOL_USB, + LV_STR_SYMBOL_BLUETOOTH, + LV_STR_SYMBOL_TRASH, + LV_STR_SYMBOL_EDIT, + LV_STR_SYMBOL_BACKSPACE, + LV_STR_SYMBOL_SD_CARD, + LV_STR_SYMBOL_NEW_LINE, + LV_STR_SYMBOL_DUMMY, }; #ifdef __cplusplus diff --git a/src/indev/lv_indev.c b/src/indev/lv_indev.c index 52c904e48..e2bbe40dd 100644 --- a/src/indev/lv_indev.c +++ b/src/indev/lv_indev.c @@ -1,3 +1,7 @@ +#include "../misc/lv_event_private.h" +#include "../misc/lv_area_private.h" +#include "../misc/lv_anim_private.h" +#include "../core/lv_obj_draw_private.h" /** * @file lv_indev.c * @@ -10,12 +14,12 @@ #include "lv_indev_scroll.h" #include "../display/lv_display_private.h" #include "../core/lv_global.h" -#include "../core/lv_obj.h" +#include "../core/lv_obj_private.h" #include "../core/lv_group.h" #include "../core/lv_refr.h" #include "../tick/lv_tick.h" -#include "../misc/lv_timer.h" +#include "../misc/lv_timer_private.h" #include "../misc/lv_math.h" #include "../misc/lv_profiler.h" #include "../stdlib/lv_string.h" @@ -113,7 +117,7 @@ lv_indev_t * lv_indev_create(void) LV_LOG_WARN("no display was created so far"); } - lv_indev_t * indev = _lv_ll_ins_head(indev_ll_head); + lv_indev_t * indev = lv_ll_ins_head(indev_ll_head); LV_ASSERT_MALLOC(indev); if(indev == NULL) { return NULL; @@ -149,7 +153,7 @@ void lv_indev_delete(lv_indev_t * indev) if(indev->read_timer) lv_timer_delete(indev->read_timer); /*Remove the input device from the list*/ - _lv_ll_remove(indev_ll_head, indev); + lv_ll_remove(indev_ll_head, indev); /*Free the memory of the input device*/ lv_free(indev); } @@ -157,9 +161,9 @@ void lv_indev_delete(lv_indev_t * indev) lv_indev_t * lv_indev_get_next(lv_indev_t * indev) { if(indev == NULL) - return _lv_ll_get_head(indev_ll_head); + return lv_ll_get_head(indev_ll_head); else - return _lv_ll_get_next(indev_ll_head, indev); + return lv_ll_get_next(indev_ll_head, indev); } void indev_read_core(lv_indev_t * indev, lv_indev_data_t * data) @@ -534,10 +538,10 @@ 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)) { - int32_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)) { + if(lv_area_is_point_on(&obj_coords, &p_trans, 0)) { int32_t i; uint32_t child_cnt = lv_obj_get_child_count(obj); @@ -1138,7 +1142,7 @@ static void indev_proc_press(lv_indev_t * indev) indev->scroll_throw_anim = NULL; } - _lv_indev_scroll_throw_handler(indev); + lv_indev_scroll_throw_handler(indev); if(indev_reset_check(indev)) return; } @@ -1226,7 +1230,7 @@ static void indev_proc_press(lv_indev_t * indev) if(indev_act->wait_until_release) return; - _lv_indev_scroll_handler(indev); + lv_indev_scroll_handler(indev); if(indev_reset_check(indev)) return; indev_gesture(indev); if(indev_reset_check(indev)) return; @@ -1391,7 +1395,7 @@ static void indev_proc_pointer_diff(lv_indev_t * indev) indev->pointer.scroll_throw_vect.y = diff; indev->pointer.scroll_throw_vect_ori.y = diff; - _lv_indev_scroll_handler(indev); + lv_indev_scroll_handler(indev); } } @@ -1647,7 +1651,7 @@ static void indev_scroll_throw_anim_cb(void * var, int32_t v) LV_UNUSED(v); lv_indev_t * indev = (lv_indev_t *)var; - _lv_indev_scroll_throw_handler(indev); + lv_indev_scroll_throw_handler(indev); if(indev->pointer.scroll_dir == LV_DIR_NONE || indev->pointer.scroll_obj == NULL) { if(indev->scroll_throw_anim) { diff --git a/src/indev/lv_indev.h b/src/indev/lv_indev.h index 6a9d83cc2..c7206edb6 100644 --- a/src/indev/lv_indev.h +++ b/src/indev/lv_indev.h @@ -143,7 +143,7 @@ void lv_indev_set_driver_data(lv_indev_t * indev, void * driver_data); * @param indev pointer to an input device * @param disp pointer to an display */ -void lv_indev_set_display(lv_indev_t * indev, struct _lv_display_t * disp); +void lv_indev_set_display(lv_indev_t * indev, struct lv_display_t * disp); /** * Get the type of an input device diff --git a/src/indev/lv_indev_private.h b/src/indev/lv_indev_private.h index 04a37e801..d4aa27c97 100644 --- a/src/indev/lv_indev_private.h +++ b/src/indev/lv_indev_private.h @@ -23,7 +23,7 @@ extern "C" { * TYPEDEFS **********************/ -struct _lv_indev_t { +struct lv_indev_t { /**< Input device type*/ lv_indev_type_t type; @@ -91,8 +91,8 @@ struct _lv_indev_t { int32_t diff; /*Flags*/ - lv_dir_t scroll_dir : 4; - lv_dir_t gesture_dir : 4; + uint8_t scroll_dir : 4; + uint8_t gesture_dir : 4; uint8_t gesture_sent : 1; } pointer; struct { diff --git a/src/indev/lv_indev_scroll.c b/src/indev/lv_indev_scroll.c index 93cf9f153..f32786577 100644 --- a/src/indev/lv_indev_scroll.c +++ b/src/indev/lv_indev_scroll.c @@ -6,6 +6,8 @@ /********************* * INCLUDES *********************/ +#include "../core/lv_obj_scroll_private.h" +#include "../core/lv_obj_private.h" #include "lv_indev.h" #include "lv_indev_private.h" #include "lv_indev_scroll.h" @@ -41,7 +43,7 @@ static int32_t elastic_diff(lv_obj_t * scroll_obj, int32_t diff, int32_t scroll_ * GLOBAL FUNCTIONS **********************/ -void _lv_indev_scroll_handler(lv_indev_t * indev) +void lv_indev_scroll_handler(lv_indev_t * indev) { if(indev->pointer.vect.x == 0 && indev->pointer.vect.y == 0) { return; @@ -104,13 +106,13 @@ void _lv_indev_scroll_handler(lv_indev_t * indev) /*Respect the scroll limit area*/ scroll_limit_diff(indev, &diff_x, &diff_y); - _lv_obj_scroll_by_raw(scroll_obj, diff_x, diff_y); + lv_obj_scroll_by_raw(scroll_obj, diff_x, diff_y); if(indev->reset_query) return; indev->pointer.scroll_sum.x += diff_x; indev->pointer.scroll_sum.y += diff_y; } -void _lv_indev_scroll_throw_handler(lv_indev_t * indev) +void lv_indev_scroll_throw_handler(lv_indev_t * indev) { lv_obj_t * scroll_obj = indev->pointer.scroll_obj; if(scroll_obj == NULL) return; @@ -139,7 +141,7 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev) indev->pointer.scroll_throw_vect.y = elastic_diff(scroll_obj, indev->pointer.scroll_throw_vect.y, st, sb, LV_DIR_VER); - _lv_obj_scroll_by_raw(scroll_obj, 0, indev->pointer.scroll_throw_vect.y); + lv_obj_scroll_by_raw(scroll_obj, 0, indev->pointer.scroll_throw_vect.y); if(indev->reset_query) return; } /*With snapping find the nearest snap point and scroll there*/ @@ -165,7 +167,7 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev) indev->pointer.scroll_throw_vect.x = elastic_diff(scroll_obj, indev->pointer.scroll_throw_vect.x, sl, sr, LV_DIR_HOR); - _lv_obj_scroll_by_raw(scroll_obj, indev->pointer.scroll_throw_vect.x, 0); + lv_obj_scroll_by_raw(scroll_obj, indev->pointer.scroll_throw_vect.x, 0); if(indev->reset_query) return; } /*With snapping find the nearest snap point and scroll there*/ diff --git a/src/indev/lv_indev_scroll.h b/src/indev/lv_indev_scroll.h index 64d1d018b..413376f16 100644 --- a/src/indev/lv_indev_scroll.h +++ b/src/indev/lv_indev_scroll.h @@ -31,13 +31,13 @@ extern "C" { * Handle scrolling. Called by LVGL during input device processing * @param indev pointer to an input device */ -void _lv_indev_scroll_handler(lv_indev_t * indev); +void lv_indev_scroll_handler(lv_indev_t * indev); /** * Handle throwing after scrolling. Called by LVGL during input device processing * @param indev pointer to an input device */ -void _lv_indev_scroll_throw_handler(lv_indev_t * indev); +void lv_indev_scroll_throw_handler(lv_indev_t * indev); /** * Predict where would a scroll throw end diff --git a/src/layouts/flex/lv_flex.c b/src/layouts/flex/lv_flex.c index 03993b549..2af3bf35a 100644 --- a/src/layouts/flex/lv_flex.c +++ b/src/layouts/flex/lv_flex.c @@ -8,7 +8,7 @@ *********************/ #include "lv_flex.h" #include "../lv_layout.h" -#include "../../core/lv_obj.h" +#include "../../core/lv_obj_private.h" #if LV_USE_FLEX @@ -130,9 +130,9 @@ static void flex_update(lv_obj_t * cont, void * user_data) flex_t f; lv_flex_flow_t flow = lv_obj_get_style_flex_flow(cont, LV_PART_MAIN); - f.row = flow & _LV_FLEX_COLUMN ? 0 : 1; - f.wrap = flow & _LV_FLEX_WRAP ? 1 : 0; - f.rev = flow & _LV_FLEX_REVERSE ? 1 : 0; + f.row = flow & LV_FLEX_COLUMN ? 0 : 1; + f.wrap = flow & LV_FLEX_WRAP ? 1 : 0; + f.rev = flow & LV_FLEX_REVERSE ? 1 : 0; f.main_place = lv_obj_get_style_flex_main_place(cont, LV_PART_MAIN); f.cross_place = lv_obj_get_style_flex_cross_place(cont, LV_PART_MAIN); f.track_place = lv_obj_get_style_flex_track_place(cont, LV_PART_MAIN); diff --git a/src/layouts/flex/lv_flex.h b/src/layouts/flex/lv_flex.h index 17e62790e..840597d81 100644 --- a/src/layouts/flex/lv_flex.h +++ b/src/layouts/flex/lv_flex.h @@ -22,9 +22,9 @@ extern "C" { * DEFINES *********************/ -#define _LV_FLEX_COLUMN (1 << 0) -#define _LV_FLEX_WRAP (1 << 2) -#define _LV_FLEX_REVERSE (1 << 3) +#define LV_FLEX_COLUMN (1 << 0) +#define LV_FLEX_WRAP (1 << 2) +#define LV_FLEX_REVERSE (1 << 3) /********************** * TYPEDEFS @@ -43,13 +43,13 @@ typedef enum { typedef enum { LV_FLEX_FLOW_ROW = 0x00, - LV_FLEX_FLOW_COLUMN = _LV_FLEX_COLUMN, - LV_FLEX_FLOW_ROW_WRAP = LV_FLEX_FLOW_ROW | _LV_FLEX_WRAP, - LV_FLEX_FLOW_ROW_REVERSE = LV_FLEX_FLOW_ROW | _LV_FLEX_REVERSE, - LV_FLEX_FLOW_ROW_WRAP_REVERSE = LV_FLEX_FLOW_ROW | _LV_FLEX_WRAP | _LV_FLEX_REVERSE, - LV_FLEX_FLOW_COLUMN_WRAP = LV_FLEX_FLOW_COLUMN | _LV_FLEX_WRAP, - LV_FLEX_FLOW_COLUMN_REVERSE = LV_FLEX_FLOW_COLUMN | _LV_FLEX_REVERSE, - LV_FLEX_FLOW_COLUMN_WRAP_REVERSE = LV_FLEX_FLOW_COLUMN | _LV_FLEX_WRAP | _LV_FLEX_REVERSE, + LV_FLEX_FLOW_COLUMN = LV_FLEX_COLUMN, + LV_FLEX_FLOW_ROW_WRAP = LV_FLEX_FLOW_ROW | LV_FLEX_WRAP, + LV_FLEX_FLOW_ROW_REVERSE = LV_FLEX_FLOW_ROW | LV_FLEX_REVERSE, + LV_FLEX_FLOW_ROW_WRAP_REVERSE = LV_FLEX_FLOW_ROW | LV_FLEX_WRAP | LV_FLEX_REVERSE, + LV_FLEX_FLOW_COLUMN_WRAP = LV_FLEX_FLOW_COLUMN | LV_FLEX_WRAP, + LV_FLEX_FLOW_COLUMN_REVERSE = LV_FLEX_FLOW_COLUMN | LV_FLEX_REVERSE, + LV_FLEX_FLOW_COLUMN_WRAP_REVERSE = LV_FLEX_FLOW_COLUMN | LV_FLEX_WRAP | LV_FLEX_REVERSE, } lv_flex_flow_t; /********************** diff --git a/src/layouts/grid/lv_grid.c b/src/layouts/grid/lv_grid.c index 59d66c78d..70d3f7936 100644 --- a/src/layouts/grid/lv_grid.c +++ b/src/layouts/grid/lv_grid.c @@ -12,7 +12,7 @@ #include "../../stdlib/lv_string.h" #include "../lv_layout.h" -#include "../../core/lv_obj.h" +#include "../../core/lv_obj_private.h" #include "../../core/lv_global.h" /********************* * DEFINES @@ -44,7 +44,7 @@ typedef struct { uint32_t row_num; int32_t grid_w; int32_t grid_h; -} _lv_grid_calc_t; +} lv_grid_calc_t; /********************** * GLOBAL PROTOTYPES @@ -54,11 +54,11 @@ typedef struct { * STATIC PROTOTYPES **********************/ static void grid_update(lv_obj_t * cont, void * user_data); -static void calc(lv_obj_t * obj, _lv_grid_calc_t * calc); -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 void calc(lv_obj_t * obj, lv_grid_calc_t * calc); +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 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); @@ -175,6 +175,11 @@ void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t x_align, int32_t col_p lv_obj_mark_layout_as_dirty(lv_obj_get_parent(obj)); } +int32_t lv_grid_fr(uint8_t x) +{ + return LV_GRID_FR(x); +} + /********************** * STATIC FUNCTIONS **********************/ @@ -188,7 +193,7 @@ static void grid_update(lv_obj_t * cont, void * user_data) // const int32_t * row_templ = get_row_dsc(cont); // if(col_templ == NULL || row_templ == NULL) return; - _lv_grid_calc_t c; + lv_grid_calc_t c; calc(cont, &c); item_repos_hint_t hint; @@ -223,12 +228,12 @@ static void grid_update(lv_obj_t * cont, void * user_data) * Calculate the grid cells coordinates * @param cont an object that has a grid * @param calc store the calculated cells sizes here - * @note `_lv_grid_calc_free(calc_out)` needs to be called when `calc_out` is not needed anymore + * @note `lv_grid_calc_free(calc_out)` needs to be called when `calc_out` is not needed anymore */ -static void calc(lv_obj_t * cont, _lv_grid_calc_t * calc_out) +static void calc(lv_obj_t * cont, lv_grid_calc_t * calc_out) { if(lv_obj_get_child(cont, 0) == NULL) { - lv_memzero(calc_out, sizeof(_lv_grid_calc_t)); + lv_memzero(calc_out, sizeof(lv_grid_calc_t)); return; } @@ -259,7 +264,7 @@ static void calc(lv_obj_t * cont, _lv_grid_calc_t * calc_out) * Free the a grid calculation's data * @param calc pointer to the calculated grid cell coordinates */ -static void calc_free(_lv_grid_calc_t * calc) +static void calc_free(lv_grid_calc_t * calc) { lv_free(calc->x); lv_free(calc->y); @@ -267,7 +272,7 @@ static void calc_free(_lv_grid_calc_t * calc) lv_free(calc->h); } -static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c) +static void calc_cols(lv_obj_t * cont, lv_grid_calc_t * c) { const int32_t * col_templ; @@ -360,7 +365,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) +static void calc_rows(lv_obj_t * cont, lv_grid_calc_t * c) { const int32_t * row_templ; row_templ = get_row_dsc(cont); @@ -456,7 +461,7 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c) * @param child_id_ext helper value if the ID of the child is know (order from the oldest) else -1 * @param grid_abs helper value, the absolute position of the grid, NULL if unknown */ -static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * hint) +static void item_repos(lv_obj_t * item, lv_grid_calc_t * c, item_repos_hint_t * hint) { if(lv_obj_has_flag_any(item, LV_OBJ_FLAG_IGNORE_LAYOUT | LV_OBJ_FLAG_HIDDEN | LV_OBJ_FLAG_FLOATING)) return; uint32_t col_span = get_col_span(item); diff --git a/src/layouts/grid/lv_grid.h b/src/layouts/grid/lv_grid.h index 3c64177e4..a7bf73822 100644 --- a/src/layouts/grid/lv_grid.h +++ b/src/layouts/grid/lv_grid.h @@ -80,10 +80,7 @@ void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t column_align, int32_t /** * Just a wrapper to `LV_GRID_FR` for bindings. */ -static inline int32_t lv_grid_fr(uint8_t x) -{ - return LV_GRID_FR(x); -} +int32_t lv_grid_fr(uint8_t x); /********************** * GLOBAL VARIABLES diff --git a/src/layouts/lv_layout.c b/src/layouts/lv_layout.c index a14c1219f..ddb3b0e5a 100644 --- a/src/layouts/lv_layout.c +++ b/src/layouts/lv_layout.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_layout.h" +#include "lv_layout_private.h" #include "../core/lv_global.h" #include "../core/lv_obj.h" @@ -36,7 +36,7 @@ * GLOBAL FUNCTIONS **********************/ -void _lv_layout_init(void) +void lv_layout_init(void) { /*Malloc a list for the built in layouts*/ layout_list_def = lv_malloc(layout_cnt * sizeof(lv_layout_dsc_t)); @@ -50,7 +50,7 @@ void _lv_layout_init(void) #endif } -void _lv_layout_deinit(void) +void lv_layout_deinit(void) { lv_free(layout_list_def); } @@ -65,7 +65,7 @@ uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data) return layout_cnt++; } -void _lv_layout_apply(lv_obj_t * obj) +void lv_layout_apply(lv_obj_t * obj) { lv_layout_t layout_id = lv_obj_get_style_layout(obj, LV_PART_MAIN); if(layout_id > 0 && layout_id <= layout_cnt) { diff --git a/src/layouts/lv_layout.h b/src/layouts/lv_layout.h index 4f0c62c07..a783d2b28 100644 --- a/src/layouts/lv_layout.h +++ b/src/layouts/lv_layout.h @@ -25,10 +25,6 @@ extern "C" { **********************/ typedef void (*lv_layout_update_cb_t)(lv_obj_t *, void * user_data); -typedef struct { - lv_layout_update_cb_t cb; - void * user_data; -} lv_layout_dsc_t; typedef enum { LV_LAYOUT_NONE = 0, @@ -41,17 +37,9 @@ typedef enum { LV_LAYOUT_GRID, #endif - _LV_LAYOUT_LAST + LV_LAYOUT_LAST } lv_layout_t; -/********************** - * GLOBAL PROTOTYPES - **********************/ - -void _lv_layout_init(void); - -void _lv_layout_deinit(void); - /** * Register a new layout * @param cb the layout update callback @@ -60,12 +48,6 @@ void _lv_layout_deinit(void); */ uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data); -/** - * Update the layout of a widget - * @param obj pointer to a widget - */ -void _lv_layout_apply(lv_obj_t * obj); - /********************** * MACROS **********************/ diff --git a/src/layouts/lv_layout_private.h b/src/layouts/lv_layout_private.h new file mode 100644 index 000000000..dace2fccb --- /dev/null +++ b/src/layouts/lv_layout_private.h @@ -0,0 +1,58 @@ +/** + * @file lv_layout_private.h + * + */ + +#ifndef LV_LAYOUT_PRIVATE_H +#define LV_LAYOUT_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_layout.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + lv_layout_update_cb_t cb; + void * user_data; +} lv_layout_dsc_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +void lv_layout_init(void); + +void lv_layout_deinit(void); + +/** + * Update the layout of a widget + * @param obj pointer to a widget + */ +void lv_layout_apply(lv_obj_t * obj); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LAYOUT_PRIVATE_H*/ diff --git a/src/libs/barcode/lv_barcode.c b/src/libs/barcode/lv_barcode.c index 1003b2a47..56885330b 100644 --- a/src/libs/barcode/lv_barcode.c +++ b/src/libs/barcode/lv_barcode.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_barcode.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_barcode_private.h" #include "../../lvgl.h" #if LV_USE_BARCODE diff --git a/src/libs/barcode/lv_barcode.h b/src/libs/barcode/lv_barcode.h index 664f38bb9..c9c0ce657 100644 --- a/src/libs/barcode/lv_barcode.h +++ b/src/libs/barcode/lv_barcode.h @@ -28,16 +28,6 @@ extern "C" { * TYPEDEFS **********************/ -/*Data of barcode*/ -typedef struct { - lv_canvas_t canvas; - lv_color_t dark_color; - lv_color_t light_color; - uint16_t scale; - lv_dir_t direction; - bool tiled; -} lv_barcode_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_barcode_class; /********************** diff --git a/src/libs/barcode/lv_barcode_private.h b/src/libs/barcode/lv_barcode_private.h new file mode 100644 index 000000000..e6d18198f --- /dev/null +++ b/src/libs/barcode/lv_barcode_private.h @@ -0,0 +1,55 @@ +/** + * @file lv_barcode_private.h + * + */ + +#ifndef LV_BARCODE_PRIVATE_H +#define LV_BARCODE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../widgets/canvas/lv_canvas_private.h" +#include "lv_barcode.h" + +#if LV_USE_BARCODE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of barcode*/ +struct lv_barcode_t { + lv_canvas_t canvas; + lv_color_t dark_color; + lv_color_t light_color; + uint16_t scale; + lv_dir_t direction; + bool tiled; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_BARCODE */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BARCODE_PRIVATE_H*/ diff --git a/src/libs/bin_decoder/lv_bin_decoder.c b/src/libs/bin_decoder/lv_bin_decoder.c index 5e8a5dbf6..0df2f624b 100644 --- a/src/libs/bin_decoder/lv_bin_decoder.c +++ b/src/libs/bin_decoder/lv_bin_decoder.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "../../draw/lv_image_decoder_private.h" #include "lv_bin_decoder.h" #include "../../draw/lv_draw_image.h" #include "../../draw/lv_draw_buf.h" @@ -38,7 +39,7 @@ * Data format for compressed image data. */ -typedef struct _lv_image_compressed_t { +typedef struct lv_image_compressed_t { uint32_t method: 4; /*Compression method, see `lv_image_compress_t`*/ uint32_t reserved : 28; /*Reserved to be used later*/ uint32_t compressed_size; /*Compressed data size in byte*/ @@ -180,7 +181,8 @@ lv_result_t lv_bin_decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d { LV_UNUSED(decoder); - lv_fs_res_t res = LV_RESULT_INVALID; + lv_result_t res = LV_RESULT_INVALID; + lv_fs_res_t fs_res = LV_FS_RES_UNKNOWN; bool use_directly = false; /*If the image is already decoded and can be used directly*/ /*Open the file if it's a file*/ @@ -201,9 +203,9 @@ lv_result_t lv_bin_decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d return LV_RESULT_INVALID; } - res = lv_fs_open(f, dsc->src, LV_FS_MODE_RD); - if(res != LV_FS_RES_OK) { - LV_LOG_WARN("Open file failed: %d", res); + fs_res = lv_fs_open(f, dsc->src, LV_FS_MODE_RD); + if(fs_res != LV_FS_RES_OK) { + LV_LOG_WARN("Open file failed: %d", fs_res); lv_free(f); free_decoder_data(dsc); return LV_RESULT_INVALID; @@ -386,7 +388,7 @@ lv_result_t lv_bin_decoder_get_area(lv_image_decoder_t * decoder, lv_image_decod return LV_RESULT_INVALID; } - lv_result_t res = LV_RESULT_INVALID; + lv_fs_res_t res = LV_FS_RES_UNKNOWN; decoder_data_t * decoder_data = dsc->user_data; if(decoder_data == NULL) { LV_LOG_ERROR("Unexpected null decoder data"); @@ -545,7 +547,7 @@ static void free_decoder_data(lv_image_decoder_dsc_t * dsc) static lv_result_t decode_indexed(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc) { LV_UNUSED(decoder); /*Unused*/ - lv_result_t res; + lv_fs_res_t res; uint32_t rn; decoder_data_t * decoder_data = dsc->user_data; lv_fs_file_t * f = decoder_data->f; @@ -675,7 +677,7 @@ static lv_result_t load_indexed(lv_image_decoder_t * decoder, lv_image_decoder_d LV_UNUSED(decoder); /*Unused*/ - lv_result_t res; + lv_fs_res_t res; uint32_t rn; decoder_data_t * decoder_data = dsc->user_data; @@ -761,7 +763,7 @@ static lv_result_t load_indexed(lv_image_decoder_t * decoder, lv_image_decoder_d static lv_result_t decode_rgb(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc) { LV_UNUSED(decoder); - lv_result_t res; + lv_fs_res_t res; decoder_data_t * decoder_data = dsc->user_data; lv_fs_file_t * f = decoder_data->f; lv_color_format_t cf = dsc->header.cf; @@ -814,7 +816,7 @@ static inline uint8_t bit_extend(uint8_t value, uint8_t bpp) static lv_result_t decode_alpha_only(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t * dsc) { LV_UNUSED(decoder); - lv_result_t res; + lv_fs_res_t res; uint32_t rn; decoder_data_t * decoder_data = dsc->user_data; uint8_t bpp = lv_color_format_get_bpp(dsc->header.cf); @@ -890,6 +892,7 @@ static lv_result_t decode_compressed(lv_image_decoder_t * decoder, lv_image_deco uint32_t compressed_len; decoder_data_t * decoder_data = get_decoder_data(dsc); lv_result_t res; + lv_fs_res_t fs_res; uint8_t * file_buf = NULL; lv_image_compressed_t * compressed = &decoder_data->compressed; @@ -909,9 +912,9 @@ static lv_result_t decode_compressed(lv_image_decoder_t * decoder, lv_image_deco /*Read compress header*/ len = 12; - res = fs_read_file_at(f, sizeof(lv_image_header_t), compressed, len, &rn); - if(res != LV_FS_RES_OK || rn != len) { - LV_LOG_WARN("Read compressed header failed: %d", res); + fs_res = fs_read_file_at(f, sizeof(lv_image_header_t), compressed, len, &rn); + if(fs_res != LV_FS_RES_OK || rn != len) { + LV_LOG_WARN("Read compressed header failed: %d", fs_res); return LV_RESULT_INVALID; } @@ -928,9 +931,9 @@ static lv_result_t decode_compressed(lv_image_decoder_t * decoder, lv_image_deco } /*Continue to read the compressed data following compression header*/ - res = lv_fs_read(f, file_buf, compressed_len, &rn); - if(res != LV_FS_RES_OK || rn != compressed_len) { - LV_LOG_WARN("Read compressed file failed: %d", res); + fs_res = lv_fs_read(f, file_buf, compressed_len, &rn); + if(fs_res != LV_FS_RES_OK || rn != compressed_len) { + LV_LOG_WARN("Read compressed file failed: %d", fs_res); lv_free(file_buf); return LV_RESULT_INVALID; } diff --git a/src/libs/bmp/lv_bmp.c b/src/libs/bmp/lv_bmp.c index f23ae6ceb..323a14741 100644 --- a/src/libs/bmp/lv_bmp.c +++ b/src/libs/bmp/lv_bmp.c @@ -6,10 +6,12 @@ /********************* * INCLUDES *********************/ +#include "../../draw/lv_image_decoder_private.h" #include "../../../lvgl.h" #if LV_USE_BMP #include <string.h> +#include "../../core/lv_global.h" /********************* * DEFINES @@ -158,7 +160,7 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d lv_memset(&b, 0x00, sizeof(b)); lv_fs_res_t res = lv_fs_open(&b.f, dsc->src, LV_FS_MODE_RD); - if(res == LV_RESULT_OK) return LV_RESULT_INVALID; + if(res != LV_FS_RES_OK) return LV_RESULT_INVALID; uint8_t header[54]; lv_fs_read(&b.f, header, 54, NULL); diff --git a/src/libs/ffmpeg/lv_ffmpeg.c b/src/libs/ffmpeg/lv_ffmpeg.c index a86a6627d..8290944a5 100644 --- a/src/libs/ffmpeg/lv_ffmpeg.c +++ b/src/libs/ffmpeg/lv_ffmpeg.c @@ -6,8 +6,10 @@ /********************* * INCLUDES *********************/ -#include "lv_ffmpeg.h" +#include "lv_ffmpeg_private.h" #if LV_USE_FFMPEG != 0 +#include "../../draw/lv_image_decoder_private.h" +#include "../../core/lv_obj_class_private.h" #include <libavcodec/avcodec.h> #include <libavformat/avformat.h> @@ -804,7 +806,7 @@ static void ffmpeg_close(struct ffmpeg_context_s * ffmpeg_ctx) static void lv_ffmpeg_player_frame_update_cb(lv_timer_t * timer) { - lv_obj_t * obj = (lv_obj_t *)timer->user_data; + lv_obj_t * obj = (lv_obj_t *)lv_timer_get_user_data(timer); lv_ffmpeg_player_t * player = (lv_ffmpeg_player_t *)obj; if(!player->ffmpeg_ctx) { diff --git a/src/libs/ffmpeg/lv_ffmpeg.h b/src/libs/ffmpeg/lv_ffmpeg.h index 51203e543..1cb86b9d4 100644 --- a/src/libs/ffmpeg/lv_ffmpeg.h +++ b/src/libs/ffmpeg/lv_ffmpeg.h @@ -13,8 +13,8 @@ extern "C" { * INCLUDES *********************/ #include "../../lv_conf_internal.h" -#include "../../widgets/image/lv_image.h" #if LV_USE_FFMPEG != 0 +#include "../../misc/lv_types.h" /********************* * DEFINES @@ -27,20 +27,12 @@ struct ffmpeg_context_s; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_ffmpeg_player_class; -typedef struct { - lv_image_t img; - lv_timer_t * timer; - lv_image_dsc_t imgdsc; - bool auto_restart; - struct ffmpeg_context_s * ffmpeg_ctx; -} lv_ffmpeg_player_t; - typedef enum { LV_FFMPEG_PLAYER_CMD_START, LV_FFMPEG_PLAYER_CMD_STOP, LV_FFMPEG_PLAYER_CMD_PAUSE, LV_FFMPEG_PLAYER_CMD_RESUME, - _LV_FFMPEG_PLAYER_CMD_LAST + LV_FFMPEG_PLAYER_CMD_LAST } lv_ffmpeg_player_cmd_t; /********************** diff --git a/src/libs/ffmpeg/lv_ffmpeg_private.h b/src/libs/ffmpeg/lv_ffmpeg_private.h new file mode 100644 index 000000000..b27b6bf02 --- /dev/null +++ b/src/libs/ffmpeg/lv_ffmpeg_private.h @@ -0,0 +1,51 @@ +/** + * @file lv_ffmpeg_private.h + * + */ + +#ifndef LV_FFMPEG_PRIVATE_H +#define LV_FFMPEG_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_ffmpeg.h" +#if LV_USE_FFMPEG != 0 +#include "../../widgets/image/lv_image_private.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_ffmpeg_player_t { + lv_image_t img; + lv_timer_t * timer; + lv_image_dsc_t imgdsc; + bool auto_restart; + struct ffmpeg_context_s * ffmpeg_ctx; +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_FFMPEG*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FFMPEG_PRIVATE_H*/ diff --git a/src/libs/freetype/lv_freetype.c b/src/libs/freetype/lv_freetype.c index 6de49b60d..b1da8f13e 100755 --- a/src/libs/freetype/lv_freetype.c +++ b/src/libs/freetype/lv_freetype.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_freetype.h" +#include "../../misc/lv_fs_private.h" +#include "lv_freetype_private.h" #if LV_USE_FREETYPE @@ -88,7 +89,7 @@ lv_result_t lv_freetype_init(uint32_t max_glyph_cnt) return LV_RESULT_INVALID; } - _lv_ll_init(&ctx->face_id_ll, sizeof(face_id_node_t)); + lv_ll_init(&ctx->face_id_ll, sizeof(face_id_node_t)); lv_cache_ops_t ops = { .compare_cb = (lv_cache_compare_cb_t)cache_node_cache_compare_cb, @@ -289,7 +290,7 @@ static FTC_FaceID lv_freetype_req_face_id(lv_freetype_context_t * ctx, const cha face_id_node_t * node; /* search cache */ - _LV_LL_READ(ll_p, node) { + LV_LL_READ(ll_p, node) { if(strcmp(node->pathname, pathname) == 0) { node->ref_cnt++; LV_LOG_INFO("reuse face_id: %s, ref_cnt = %d", node->pathname, node->ref_cnt); @@ -298,7 +299,7 @@ static FTC_FaceID lv_freetype_req_face_id(lv_freetype_context_t * ctx, const cha } /* insert new cache */ - node = _lv_ll_ins_tail(ll_p); + node = lv_ll_ins_tail(ll_p); LV_ASSERT_MALLOC(node); #if LV_USE_FS_MEMFS @@ -327,13 +328,13 @@ static void lv_freetype_drop_face_id(lv_freetype_context_t * ctx, FTC_FaceID fac { lv_ll_t * ll_p = &ctx->face_id_ll; face_id_node_t * node; - _LV_LL_READ(ll_p, node) { + LV_LL_READ(ll_p, node) { if(face_id == node->pathname) { LV_LOG_INFO("found face_id: %s, ref_cnt = %d", node->pathname, node->ref_cnt); node->ref_cnt--; if(node->ref_cnt == 0) { LV_LOG_INFO("drop face_id: %s", node->pathname); - _lv_ll_remove(ll_p, node); + lv_ll_remove(ll_p, node); lv_free(node->pathname); lv_free(node); } diff --git a/src/libs/freetype/lv_freetype.h b/src/libs/freetype/lv_freetype.h index 7104e2f1b..76b9f7b56 100755 --- a/src/libs/freetype/lv_freetype.h +++ b/src/libs/freetype/lv_freetype.h @@ -15,7 +15,7 @@ extern "C" { #include "../../lv_conf_internal.h" #include "../../misc/lv_types.h" #include "../../misc/lv_event.h" -#include <stdbool.h> +#include LV_STDBOOL_INCLUDE #if LV_USE_FREETYPE @@ -34,21 +34,18 @@ extern "C" { * TYPEDEFS **********************/ -enum { +typedef enum { LV_FREETYPE_FONT_STYLE_NORMAL = 0, LV_FREETYPE_FONT_STYLE_ITALIC = 1 << 0, LV_FREETYPE_FONT_STYLE_BOLD = 1 << 1, -}; +} lv_freetype_font_style_t; -typedef uint16_t lv_freetype_font_style_t; typedef lv_freetype_font_style_t LV_FT_FONT_STYLE; -enum { +typedef enum { LV_FREETYPE_FONT_RENDER_MODE_BITMAP = 0, LV_FREETYPE_FONT_RENDER_MODE_OUTLINE = 1, -}; - -typedef uint16_t lv_freetype_font_render_mode_t; +} lv_freetype_font_render_mode_t; typedef void * lv_freetype_outline_t; @@ -60,19 +57,6 @@ typedef enum { LV_FREETYPE_OUTLINE_CONIC_TO, } lv_freetype_outline_type_t; -typedef struct { - int32_t x; - int32_t y; -} lv_freetype_outline_vector_t; - -typedef struct { - lv_freetype_outline_t outline; - lv_freetype_outline_type_t type; - lv_freetype_outline_vector_t to; - lv_freetype_outline_vector_t control1; - lv_freetype_outline_vector_t control2; -} lv_freetype_outline_event_param_t; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/libs/freetype/lv_freetype_glyph.c b/src/libs/freetype/lv_freetype_glyph.c index 04b9b21e6..733f7396b 100644 --- a/src/libs/freetype/lv_freetype_glyph.c +++ b/src/libs/freetype/lv_freetype_glyph.c @@ -21,7 +21,7 @@ /********************** * TYPEDEFS **********************/ -typedef struct _lv_freetype_glyph_cache_data_t { +typedef struct lv_freetype_glyph_cache_data_t { uint32_t unicode; uint32_t size; diff --git a/src/libs/freetype/lv_freetype_image.c b/src/libs/freetype/lv_freetype_image.c index 9765242d3..f85054e39 100755 --- a/src/libs/freetype/lv_freetype_image.c +++ b/src/libs/freetype/lv_freetype_image.c @@ -26,7 +26,7 @@ * TYPEDEFS **********************/ -typedef struct _lv_freetype_image_cache_data_t { +typedef struct lv_freetype_image_cache_data_t { FT_UInt glyph_index; uint32_t size; diff --git a/src/libs/freetype/lv_freetype_outline.c b/src/libs/freetype/lv_freetype_outline.c index 006dc4b4f..01cc2983e 100755 --- a/src/libs/freetype/lv_freetype_outline.c +++ b/src/libs/freetype/lv_freetype_outline.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ +#include "../../misc/lv_event_private.h" #include "../../lvgl.h" #include "lv_freetype_private.h" @@ -22,7 +23,7 @@ * TYPEDEFS **********************/ -typedef struct _lv_freetype_outline_node_t { +typedef struct lv_freetype_outline_node_t { FT_UInt glyph_index; lv_freetype_outline_t outline; } lv_freetype_outline_node_t; diff --git a/src/libs/freetype/lv_freetype_private.h b/src/libs/freetype/lv_freetype_private.h index 9c6862339..7644101ab 100755 --- a/src/libs/freetype/lv_freetype_private.h +++ b/src/libs/freetype/lv_freetype_private.h @@ -14,7 +14,10 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lvgl.h" +#include "lv_freetype.h" +#include "../../misc/cache/lv_cache.h" +#include "../../misc/lv_ll.h" +#include "../../font/lv_font.h" #if LV_USE_FREETYPE @@ -57,9 +60,23 @@ extern "C" { * TYPEDEFS **********************/ -typedef struct _lv_freetype_cache_node_t lv_freetype_cache_node_t; +struct lv_freetype_outline_vector_t { + int32_t x; + int32_t y; +}; + +struct lv_freetype_outline_event_param_t { + lv_freetype_outline_t outline; + lv_freetype_outline_type_t type; + lv_freetype_outline_vector_t to; + lv_freetype_outline_vector_t control1; + lv_freetype_outline_vector_t control2; +}; + + +typedef struct lv_freetype_cache_node_t lv_freetype_cache_node_t; -struct _lv_freetype_cache_node_t { +struct lv_freetype_cache_node_t { const char * pathname; lv_freetype_font_style_t style; lv_freetype_font_render_mode_t render_mode; @@ -76,7 +93,7 @@ struct _lv_freetype_cache_node_t { lv_cache_t * draw_data_cache; }; -typedef struct _lv_freetype_context_t { +typedef struct lv_freetype_context_t { FT_Library library; lv_ll_t face_id_ll; lv_event_cb_t event_cb; @@ -86,7 +103,7 @@ typedef struct _lv_freetype_context_t { lv_cache_t * cache_node_cache; } lv_freetype_context_t; -typedef struct _lv_freetype_font_dsc_t { +typedef struct lv_freetype_font_dsc_t { uint32_t magic_num; lv_font_t font; uint32_t size; diff --git a/src/libs/fsdrv/lv_fs_memfs.c b/src/libs/fsdrv/lv_fs_memfs.c index 52379beb7..5b678f5a9 100644 --- a/src/libs/fsdrv/lv_fs_memfs.c +++ b/src/libs/fsdrv/lv_fs_memfs.c @@ -40,6 +40,7 @@ /********************* * INCLUDES *********************/ +#include "../../misc/lv_fs_private.h" #include "../../../lvgl.h" #if LV_USE_FS_MEMFS diff --git a/src/libs/fsdrv/lv_fs_posix.c b/src/libs/fsdrv/lv_fs_posix.c index 3e17a3649..95269af24 100644 --- a/src/libs/fsdrv/lv_fs_posix.c +++ b/src/libs/fsdrv/lv_fs_posix.c @@ -16,6 +16,7 @@ #include <dirent.h> #include <unistd.h> #include <errno.h> +#include "../../core/lv_global.h" /********************* * DEFINES diff --git a/src/libs/gif/lv_gif.c b/src/libs/gif/lv_gif.c index 7bc40a64b..ca48f13fd 100644 --- a/src/libs/gif/lv_gif.c +++ b/src/libs/gif/lv_gif.c @@ -6,7 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_gif.h" +#include "../../misc/lv_timer_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_gif_private.h" #if LV_USE_GIF #include "gifdec.h" @@ -176,7 +178,7 @@ static void next_frame_task_cb(lv_timer_t * t) /*It was the last repeat*/ lv_result_t res = lv_obj_send_event(obj, LV_EVENT_READY, NULL); lv_timer_pause(t); - if(res != LV_FS_RES_OK) return; + if(res != LV_RESULT_OK) return; } gd_render_frame(gifobj->gif, (uint8_t *)gifobj->imgdsc.data); diff --git a/src/libs/gif/lv_gif.h b/src/libs/gif/lv_gif.h index 9a7ca7a8e..fc6323fa6 100644 --- a/src/libs/gif/lv_gif.h +++ b/src/libs/gif/lv_gif.h @@ -14,7 +14,13 @@ extern "C" { * INCLUDES *********************/ -#include "../../../lvgl.h" +#include "../../lv_conf_internal.h" +#include "../../misc/lv_types.h" +#include "../../draw/lv_draw_buf.h" +#include "../../widgets/image/lv_image.h" +#include "../../core/lv_obj_class.h" +#include LV_STDBOOL_INCLUDE +#include LV_STDINT_INCLUDE #if LV_USE_GIF #include "gifdec.h" @@ -27,14 +33,6 @@ extern "C" { * TYPEDEFS **********************/ -typedef struct { - lv_image_t img; - gd_GIF * gif; - lv_timer_t * timer; - lv_image_dsc_t imgdsc; - uint32_t last_call; -} lv_gif_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_gif_class; /********************** diff --git a/src/libs/gif/lv_gif_private.h b/src/libs/gif/lv_gif_private.h new file mode 100644 index 000000000..c4ea17af7 --- /dev/null +++ b/src/libs/gif/lv_gif_private.h @@ -0,0 +1,57 @@ +/** + * @file lv_gif_private.h + * + */ + +#ifndef LV_GIF_PRIVATE_H +#define LV_GIF_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../widgets/image/lv_image_private.h" +#include "lv_gif.h" + +#if LV_USE_GIF + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_gif_t { + lv_image_t img; + gd_GIF * gif; + lv_timer_t * timer; + lv_image_dsc_t imgdsc; + uint32_t last_call; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_GIF */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_GIF_PRIVATE_H*/ diff --git a/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c b/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c index c4309be7f..ac89953c8 100644 --- a/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c +++ b/src/libs/libjpeg_turbo/lv_libjpeg_turbo.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "../../draw/lv_image_decoder_private.h" #include "../../../lvgl.h" #if LV_USE_LIBJPEG_TURBO @@ -14,6 +15,7 @@ #include <jpeglib.h> #include <jpegint.h> #include <setjmp.h> +#include "../../core/lv_global.h" /********************* * DEFINES diff --git a/src/libs/libpng/lv_libpng.c b/src/libs/libpng/lv_libpng.c index 85834b32f..a77103106 100644 --- a/src/libs/libpng/lv_libpng.c +++ b/src/libs/libpng/lv_libpng.c @@ -6,12 +6,14 @@ /********************* * INCLUDES *********************/ +#include "../../draw/lv_image_decoder_private.h" #include "../../../lvgl.h" #if LV_USE_LIBPNG #include "lv_libpng.h" #include <png.h> #include <string.h> +#include "../../core/lv_global.h" /********************* * DEFINES diff --git a/src/libs/lodepng/lodepng.c b/src/libs/lodepng/lodepng.c index 9509ec3fa..4d8cdb1cf 100644 --- a/src/libs/lodepng/lodepng.c +++ b/src/libs/lodepng/lodepng.c @@ -30,6 +30,7 @@ Rename this file to lodepng.cpp to use it for C++, or to lodepng.c to use it for #include "lodepng.h" #if LV_USE_LODEPNG +#include "../../core/lv_global.h" #define image_cache_draw_buf_handlers &(LV_GLOBAL_DEFAULT()->image_cache_draw_buf_handlers) @@ -5835,9 +5836,9 @@ unsigned lodepng_decode(unsigned char ** out, unsigned * w, unsigned * h, state->error = 83; /*alloc fail*/ } else { - state->error = lodepng_convert(new_buf->data, old_buf->data, + state->error = lodepng_convert(new_buf->data, old_buf->data, &state->info_raw, &state->info_png.color, *w, *h); - + if (state->error) { lv_draw_buf_destroy_user(image_cache_draw_buf_handlers,new_buf); new_buf = NULL; diff --git a/src/libs/lodepng/lv_lodepng.c b/src/libs/lodepng/lv_lodepng.c index 4ea989fca..86765b35e 100644 --- a/src/libs/lodepng/lv_lodepng.c +++ b/src/libs/lodepng/lv_lodepng.c @@ -6,7 +6,9 @@ /********************* * INCLUDES *********************/ +#include "../../draw/lv_image_decoder_private.h" #include "../../../lvgl.h" +#include "../../core/lv_global.h" #if LV_USE_LODEPNG #include "lv_lodepng.h" diff --git a/src/libs/qrcode/lv_qrcode.c b/src/libs/qrcode/lv_qrcode.c index 39f255f3c..f4b5b5456 100644 --- a/src/libs/qrcode/lv_qrcode.c +++ b/src/libs/qrcode/lv_qrcode.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "../../lvgl.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_qrcode_private.h" #if LV_USE_QRCODE diff --git a/src/libs/qrcode/lv_qrcode.h b/src/libs/qrcode/lv_qrcode.h index 6bf6d2c81..ba9b0e869 100644 --- a/src/libs/qrcode/lv_qrcode.h +++ b/src/libs/qrcode/lv_qrcode.h @@ -14,6 +14,11 @@ extern "C" { * INCLUDES *********************/ #include "../../lv_conf_internal.h" +#include "../../misc/lv_color.h" +#include "../../misc/lv_types.h" +#include "../../widgets/canvas/lv_canvas.h" +#include LV_STDBOOL_INCLUDE +#include LV_STDINT_INCLUDE #if LV_USE_QRCODE /********************* @@ -24,13 +29,6 @@ extern "C" { * TYPEDEFS **********************/ -/*Data of qrcode*/ -typedef struct { - lv_canvas_t canvas; - lv_color_t dark_color; - lv_color_t light_color; -} lv_qrcode_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_qrcode_class; /********************** diff --git a/src/libs/qrcode/lv_qrcode_private.h b/src/libs/qrcode/lv_qrcode_private.h new file mode 100644 index 000000000..b912d6575 --- /dev/null +++ b/src/libs/qrcode/lv_qrcode_private.h @@ -0,0 +1,52 @@ +/** + * @file lv_qrcode_private.h + * + */ + +#ifndef LV_QRCODE_PRIVATE_H +#define LV_QRCODE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../widgets/canvas/lv_canvas_private.h" +#include "lv_qrcode.h" + +#if LV_USE_QRCODE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of qrcode*/ +struct lv_qrcode_t { + lv_canvas_t canvas; + lv_color_t dark_color; + lv_color_t light_color; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_QRCODE */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_QRCODE_PRIVATE_H*/ diff --git a/src/libs/rlottie/lv_rlottie.c b/src/libs/rlottie/lv_rlottie.c index eed803252..3c723ec0f 100644 --- a/src/libs/rlottie/lv_rlottie.c +++ b/src/libs/rlottie/lv_rlottie.c @@ -9,6 +9,8 @@ #include "../../lvgl.h" #if LV_USE_RLOTTIE +#include "lv_rlottie_private.h" +#include "../../core/lv_obj_class_private.h" #include <rlottie_capi.h> #include <string.h> @@ -187,7 +189,7 @@ static void lv_rlottie_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj static void next_frame_task_cb(lv_timer_t * t) { - lv_obj_t * obj = t->user_data; + lv_obj_t * obj = lv_timer_get_user_data(t); lv_rlottie_t * rlottie = (lv_rlottie_t *) obj; if((rlottie->play_ctrl & LV_RLOTTIE_CTRL_PAUSE) == LV_RLOTTIE_CTRL_PAUSE) { diff --git a/src/libs/rlottie/lv_rlottie.h b/src/libs/rlottie/lv_rlottie.h index f9ab93ff7..44bcf2ef4 100644 --- a/src/libs/rlottie/lv_rlottie.h +++ b/src/libs/rlottie/lv_rlottie.h @@ -31,23 +31,6 @@ typedef enum { LV_RLOTTIE_CTRL_LOOP = 8, } lv_rlottie_ctrl_t; -/** definition in lottieanimation_capi.c */ -struct Lottie_Animation_S; -typedef struct { - lv_image_t img_ext; - struct Lottie_Animation_S * animation; - lv_timer_t * task; - lv_image_dsc_t imgdsc; - size_t total_frames; - size_t current_frame; - size_t framerate; - uint32_t * allocated_buf; - size_t allocated_buffer_size; - size_t scanline_width; - lv_rlottie_ctrl_t play_ctrl; - size_t dest_frame; -} lv_rlottie_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_rlottie_class; /********************** diff --git a/src/libs/rlottie/lv_rlottie_private.h b/src/libs/rlottie/lv_rlottie_private.h new file mode 100644 index 000000000..91587bd6c --- /dev/null +++ b/src/libs/rlottie/lv_rlottie_private.h @@ -0,0 +1,61 @@ +/** + * @file lv_rlottie_private.h + * + */ + +#ifndef LV_RLOTTIE_PRIVATE_H +#define LV_RLOTTIE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_rlottie.h" +#if LV_USE_RLOTTIE +#include "../../widgets/image/lv_image_private.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** definition in lottieanimation_capi.c */ +struct Lottie_Animation_S; + +struct lv_rlottie_t { + lv_image_t img_ext; + struct Lottie_Animation_S * animation; + lv_timer_t * task; + lv_image_dsc_t imgdsc; + size_t total_frames; + size_t current_frame; + size_t framerate; + uint32_t * allocated_buf; + size_t allocated_buffer_size; + size_t scanline_width; + lv_rlottie_ctrl_t play_ctrl; + size_t dest_frame; +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_USE_RLOTTIE*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_RLOTTIE_PRIVATE_H*/ diff --git a/src/libs/tiny_ttf/lv_tiny_ttf.c b/src/libs/tiny_ttf/lv_tiny_ttf.c index 00927e104..c7fa4e168 100644 --- a/src/libs/tiny_ttf/lv_tiny_ttf.c +++ b/src/libs/tiny_ttf/lv_tiny_ttf.c @@ -9,6 +9,7 @@ #include "../../lvgl.h" #if LV_USE_TINY_TTF != 0 +#include "../../core/lv_global.h" #define font_draw_buf_handlers &(LV_GLOBAL_DEFAULT()->font_draw_buf_handlers) @@ -76,7 +77,7 @@ typedef struct _tiny_ttf_glyph_cache_data_t { lv_font_glyph_dsc_t glyph_dsc; } tiny_ttf_glyph_cache_data_t; -typedef struct _lv_tiny_ttf_cache_data_t { +typedef struct lv_tiny_ttf_cache_data_t { uint32_t glyph_index; uint32_t size; lv_draw_buf_t * draw_buf; diff --git a/src/libs/tjpgd/lv_tjpgd.c b/src/libs/tjpgd/lv_tjpgd.c index 551a03dac..650b36ad6 100644 --- a/src/libs/tjpgd/lv_tjpgd.c +++ b/src/libs/tjpgd/lv_tjpgd.c @@ -7,12 +7,13 @@ * INCLUDES *********************/ +#include "../../draw/lv_image_decoder_private.h" #include "../../../lvgl.h" #if LV_USE_TJPGD #include "tjpgd.h" #include "lv_tjpgd.h" -#include "../../misc/lv_fs.h" +#include "../../misc/lv_fs_private.h" #include <string.h> /********************* @@ -187,7 +188,7 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d JDEC * jd = lv_malloc(sizeof(JDEC)); dsc->user_data = jd; JRESULT rc = jd_prepare(jd, input_func, workb_temp, (size_t)TJPGD_WORKBUFF_SIZE, f); - if(rc) return rc; + if(rc) return LV_RESULT_INVALID; dsc->header.cf = LV_COLOR_FORMAT_RGB888; dsc->header.w = jd->width; @@ -231,7 +232,7 @@ static lv_result_t decoder_get_area(lv_image_decoder_t * decoder, lv_image_decod else { lv_fs_seek(jd->device, 0, LV_FS_SEEK_SET); JRESULT rc = jd_prepare(jd, input_func, jd->pool_original, (size_t)TJPGD_WORKBUFF_SIZE, jd->device); - if(rc) return rc; + if(rc) return LV_RESULT_INVALID; } decoded->data = jd->workbuf; decoded->header = dsc->header; @@ -259,17 +260,17 @@ static lv_result_t decoder_get_area(lv_image_decoder_t * decoder, lv_image_decod JRESULT rc; if(jd->nrst && jd->rst++ == jd->nrst) { rc = jd_restart(jd, jd->rsc++); - if(rc != JDR_OK) return rc; + if(rc != JDR_OK) return LV_RESULT_INVALID; jd->rst = 1; } /* Load an MCU (decompress huffman coded stream, dequantize and apply IDCT) */ rc = jd_mcu_load(jd); - if(rc != JDR_OK) return rc; + if(rc != JDR_OK) return LV_RESULT_INVALID; /* Output the MCU (YCbCr to RGB, scaling and output) */ rc = jd_mcu_output(jd, NULL, decoded_area->x1, decoded_area->y1); - if(rc != JDR_OK) return rc; + if(rc != JDR_OK) return LV_RESULT_INVALID; return LV_RESULT_OK; } diff --git a/src/lv_api_map_v8.h b/src/lv_api_map_v8.h index 664e53e2e..65fd22d28 100644 --- a/src/lv_api_map_v8.h +++ b/src/lv_api_map_v8.h @@ -143,8 +143,8 @@ static inline void lv_obj_move_background(lv_obj_t * obj) #define lv_disp_trig_activity lv_display_trigger_activity #define lv_disp_enable_invalidation lv_display_enable_invalidation #define lv_disp_is_invalidation_enabled lv_display_is_invalidation_enabled -#define _lv_disp_refr_timer _lv_display_refr_timer -#define _lv_disp_get_refr_timer lv_display_get_refr_timer +#define lv_disp_refr_timer lv_display_refr_timer +#define lv_disp_get_refr_timer lv_display_get_refr_timer #define lv_timer_del lv_timer_delete diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index d89bde5ba..1f950263d 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -67,7 +67,7 @@ #endif #ifdef CONFIG_LV_COLOR_DEPTH - #define _LV_KCONFIG_PRESENT + #define LV_KCONFIG_PRESENT #endif /*---------------------------------- @@ -273,7 +273,7 @@ /*Align the stride of all layers and images to this bytes*/ #ifndef LV_DRAW_BUF_STRIDE_ALIGN - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_BUF_STRIDE_ALIGN #define LV_DRAW_BUF_STRIDE_ALIGN CONFIG_LV_DRAW_BUF_STRIDE_ALIGN #else @@ -331,7 +331,7 @@ #endif #ifndef LV_USE_DRAW_SW - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_DRAW_SW #define LV_USE_DRAW_SW CONFIG_LV_USE_DRAW_SW #else @@ -351,7 +351,7 @@ */ #ifndef LV_DRAW_SW_SUPPORT_RGB565 - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565 #define LV_DRAW_SW_SUPPORT_RGB565 CONFIG_LV_DRAW_SW_SUPPORT_RGB565 #else @@ -362,7 +362,7 @@ #endif #endif #ifndef LV_DRAW_SW_SUPPORT_RGB565A8 - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8 #define LV_DRAW_SW_SUPPORT_RGB565A8 CONFIG_LV_DRAW_SW_SUPPORT_RGB565A8 #else @@ -373,7 +373,7 @@ #endif #endif #ifndef LV_DRAW_SW_SUPPORT_RGB888 - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_SUPPORT_RGB888 #define LV_DRAW_SW_SUPPORT_RGB888 CONFIG_LV_DRAW_SW_SUPPORT_RGB888 #else @@ -384,7 +384,7 @@ #endif #endif #ifndef LV_DRAW_SW_SUPPORT_XRGB8888 - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888 #define LV_DRAW_SW_SUPPORT_XRGB8888 CONFIG_LV_DRAW_SW_SUPPORT_XRGB8888 #else @@ -395,7 +395,7 @@ #endif #endif #ifndef LV_DRAW_SW_SUPPORT_ARGB8888 - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888 #define LV_DRAW_SW_SUPPORT_ARGB8888 CONFIG_LV_DRAW_SW_SUPPORT_ARGB8888 #else @@ -406,7 +406,7 @@ #endif #endif #ifndef LV_DRAW_SW_SUPPORT_L8 - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_SUPPORT_L8 #define LV_DRAW_SW_SUPPORT_L8 CONFIG_LV_DRAW_SW_SUPPORT_L8 #else @@ -417,7 +417,7 @@ #endif #endif #ifndef LV_DRAW_SW_SUPPORT_AL88 - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_SUPPORT_AL88 #define LV_DRAW_SW_SUPPORT_AL88 CONFIG_LV_DRAW_SW_SUPPORT_AL88 #else @@ -428,7 +428,7 @@ #endif #endif #ifndef LV_DRAW_SW_SUPPORT_A8 - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_SUPPORT_A8 #define LV_DRAW_SW_SUPPORT_A8 CONFIG_LV_DRAW_SW_SUPPORT_A8 #else @@ -439,7 +439,7 @@ #endif #endif #ifndef LV_DRAW_SW_SUPPORT_I1 - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_SUPPORT_I1 #define LV_DRAW_SW_SUPPORT_I1 CONFIG_LV_DRAW_SW_SUPPORT_I1 #else @@ -454,7 +454,7 @@ * > 1 requires an operating system enabled in `LV_USE_OS` * > 1 means multiple threads will render the screen in parallel */ #ifndef LV_DRAW_SW_DRAW_UNIT_CNT - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_DRAW_UNIT_CNT #define LV_DRAW_SW_DRAW_UNIT_CNT CONFIG_LV_DRAW_SW_DRAW_UNIT_CNT #else @@ -486,7 +486,7 @@ /* 0: use a simple renderer capable of drawing only simple rectangles with gradient, images, texts, and straight lines only * 1: use a complex renderer capable of drawing rounded corners, shadow, skew lines, and arcs too */ #ifndef LV_DRAW_SW_COMPLEX - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_DRAW_SW_COMPLEX #define LV_DRAW_SW_COMPLEX CONFIG_LV_DRAW_SW_COMPLEX #else @@ -572,7 +572,7 @@ #if LV_USE_OS /* Enable VGLite draw async. Queue multiple tasks and flash them once to the GPU. */ #ifndef LV_USE_VGLITE_DRAW_ASYNC - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_VGLITE_DRAW_ASYNC #define LV_USE_VGLITE_DRAW_ASYNC CONFIG_LV_USE_VGLITE_DRAW_ASYNC #else @@ -754,7 +754,7 @@ /*1: Enable print timestamp; *0: Disable print timestamp*/ #ifndef LV_LOG_USE_TIMESTAMP - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_USE_TIMESTAMP #define LV_LOG_USE_TIMESTAMP CONFIG_LV_LOG_USE_TIMESTAMP #else @@ -768,7 +768,7 @@ /*1: Print file and line number of the log; *0: Do not print file and line number of the log*/ #ifndef LV_LOG_USE_FILE_LINE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_USE_FILE_LINE #define LV_LOG_USE_FILE_LINE CONFIG_LV_LOG_USE_FILE_LINE #else @@ -782,7 +782,7 @@ /*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ #ifndef LV_LOG_TRACE_MEM - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_TRACE_MEM #define LV_LOG_TRACE_MEM CONFIG_LV_LOG_TRACE_MEM #else @@ -793,7 +793,7 @@ #endif #endif #ifndef LV_LOG_TRACE_TIMER - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_TRACE_TIMER #define LV_LOG_TRACE_TIMER CONFIG_LV_LOG_TRACE_TIMER #else @@ -804,7 +804,7 @@ #endif #endif #ifndef LV_LOG_TRACE_INDEV - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_TRACE_INDEV #define LV_LOG_TRACE_INDEV CONFIG_LV_LOG_TRACE_INDEV #else @@ -815,7 +815,7 @@ #endif #endif #ifndef LV_LOG_TRACE_DISP_REFR - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_TRACE_DISP_REFR #define LV_LOG_TRACE_DISP_REFR CONFIG_LV_LOG_TRACE_DISP_REFR #else @@ -826,7 +826,7 @@ #endif #endif #ifndef LV_LOG_TRACE_EVENT - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_TRACE_EVENT #define LV_LOG_TRACE_EVENT CONFIG_LV_LOG_TRACE_EVENT #else @@ -837,7 +837,7 @@ #endif #endif #ifndef LV_LOG_TRACE_OBJ_CREATE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_TRACE_OBJ_CREATE #define LV_LOG_TRACE_OBJ_CREATE CONFIG_LV_LOG_TRACE_OBJ_CREATE #else @@ -848,7 +848,7 @@ #endif #endif #ifndef LV_LOG_TRACE_LAYOUT - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_TRACE_LAYOUT #define LV_LOG_TRACE_LAYOUT CONFIG_LV_LOG_TRACE_LAYOUT #else @@ -859,7 +859,7 @@ #endif #endif #ifndef LV_LOG_TRACE_ANIM - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_TRACE_ANIM #define LV_LOG_TRACE_ANIM CONFIG_LV_LOG_TRACE_ANIM #else @@ -870,7 +870,7 @@ #endif #endif #ifndef LV_LOG_TRACE_CACHE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LOG_TRACE_CACHE #define LV_LOG_TRACE_CACHE CONFIG_LV_LOG_TRACE_CACHE #else @@ -890,7 +890,7 @@ /*Enable asserts if an operation is failed or an invalid data is found. *If LV_USE_LOG is enabled an error message will be printed on failure*/ #ifndef LV_USE_ASSERT_NULL - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_ASSERT_NULL #define LV_USE_ASSERT_NULL CONFIG_LV_USE_ASSERT_NULL #else @@ -901,7 +901,7 @@ #endif #endif #ifndef LV_USE_ASSERT_MALLOC - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_ASSERT_MALLOC #define LV_USE_ASSERT_MALLOC CONFIG_LV_USE_ASSERT_MALLOC #else @@ -1080,7 +1080,7 @@ * - lv_obj_free_id: Does nothing, as there is no memory allocation for the ID. * When disabled these functions needs to be implemented by the user.*/ #ifndef LV_USE_OBJ_ID_BUILTIN - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_OBJ_ID_BUILTIN #define LV_USE_OBJ_ID_BUILTIN CONFIG_LV_USE_OBJ_ID_BUILTIN #else @@ -1102,7 +1102,7 @@ /*Enable property name support*/ #ifndef LV_USE_OBJ_PROPERTY_NAME - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_OBJ_PROPERTY_NAME #define LV_USE_OBJ_PROPERTY_NAME CONFIG_LV_USE_OBJ_PROPERTY_NAME #else @@ -1154,7 +1154,7 @@ /*Enable 16 pixels alignment*/ #ifndef LV_VG_LITE_THORVG_16PIXELS_ALIGN - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_VG_LITE_THORVG_16PIXELS_ALIGN #define LV_VG_LITE_THORVG_16PIXELS_ALIGN CONFIG_LV_VG_LITE_THORVG_16PIXELS_ALIGN #else @@ -1227,7 +1227,7 @@ /*Required alignment size for buffers*/ #ifndef LV_ATTRIBUTE_MEM_ALIGN_SIZE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE #define LV_ATTRIBUTE_MEM_ALIGN_SIZE CONFIG_LV_ATTRIBUTE_MEM_ALIGN_SIZE #else @@ -1341,7 +1341,7 @@ #endif #endif #ifndef LV_FONT_MONTSERRAT_14 - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_FONT_MONTSERRAT_14 #define LV_FONT_MONTSERRAT_14 CONFIG_LV_FONT_MONTSERRAT_14 #else @@ -1559,7 +1559,7 @@ /*Enable drawing placeholders when glyph dsc is not found*/ #ifndef LV_USE_FONT_PLACEHOLDER - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_FONT_PLACEHOLDER #define LV_USE_FONT_PLACEHOLDER CONFIG_LV_USE_FONT_PLACEHOLDER #else @@ -1668,7 +1668,7 @@ /*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ #ifndef LV_WIDGETS_HAS_DEFAULT_VALUE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_WIDGETS_HAS_DEFAULT_VALUE #define LV_WIDGETS_HAS_DEFAULT_VALUE CONFIG_LV_WIDGETS_HAS_DEFAULT_VALUE #else @@ -1680,7 +1680,7 @@ #endif #ifndef LV_USE_ANIMIMG - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_ANIMIMG #define LV_USE_ANIMIMG CONFIG_LV_USE_ANIMIMG #else @@ -1692,7 +1692,7 @@ #endif #ifndef LV_USE_ARC - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_ARC #define LV_USE_ARC CONFIG_LV_USE_ARC #else @@ -1704,7 +1704,7 @@ #endif #ifndef LV_USE_BAR - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_BAR #define LV_USE_BAR CONFIG_LV_USE_BAR #else @@ -1716,7 +1716,7 @@ #endif #ifndef LV_USE_BUTTON - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_BUTTON #define LV_USE_BUTTON CONFIG_LV_USE_BUTTON #else @@ -1728,7 +1728,7 @@ #endif #ifndef LV_USE_BUTTONMATRIX - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_BUTTONMATRIX #define LV_USE_BUTTONMATRIX CONFIG_LV_USE_BUTTONMATRIX #else @@ -1740,7 +1740,7 @@ #endif #ifndef LV_USE_CALENDAR - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_CALENDAR #define LV_USE_CALENDAR CONFIG_LV_USE_CALENDAR #else @@ -1784,7 +1784,7 @@ #endif #endif #ifndef LV_USE_CALENDAR_HEADER_ARROW - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_CALENDAR_HEADER_ARROW #define LV_USE_CALENDAR_HEADER_ARROW CONFIG_LV_USE_CALENDAR_HEADER_ARROW #else @@ -1795,7 +1795,7 @@ #endif #endif #ifndef LV_USE_CALENDAR_HEADER_DROPDOWN - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_CALENDAR_HEADER_DROPDOWN #define LV_USE_CALENDAR_HEADER_DROPDOWN CONFIG_LV_USE_CALENDAR_HEADER_DROPDOWN #else @@ -1815,7 +1815,7 @@ #endif /*LV_USE_CALENDAR*/ #ifndef LV_USE_CANVAS - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_CANVAS #define LV_USE_CANVAS CONFIG_LV_USE_CANVAS #else @@ -1827,7 +1827,7 @@ #endif #ifndef LV_USE_CHART - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_CHART #define LV_USE_CHART CONFIG_LV_USE_CHART #else @@ -1839,7 +1839,7 @@ #endif #ifndef LV_USE_CHECKBOX - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_CHECKBOX #define LV_USE_CHECKBOX CONFIG_LV_USE_CHECKBOX #else @@ -1851,7 +1851,7 @@ #endif #ifndef LV_USE_DROPDOWN - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_DROPDOWN #define LV_USE_DROPDOWN CONFIG_LV_USE_DROPDOWN #else @@ -1863,7 +1863,7 @@ #endif #ifndef LV_USE_IMAGE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_IMAGE #define LV_USE_IMAGE CONFIG_LV_USE_IMAGE #else @@ -1875,7 +1875,7 @@ #endif #ifndef LV_USE_IMAGEBUTTON - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_IMAGEBUTTON #define LV_USE_IMAGEBUTTON CONFIG_LV_USE_IMAGEBUTTON #else @@ -1887,7 +1887,7 @@ #endif #ifndef LV_USE_KEYBOARD - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_KEYBOARD #define LV_USE_KEYBOARD CONFIG_LV_USE_KEYBOARD #else @@ -1899,7 +1899,7 @@ #endif #ifndef LV_USE_LABEL - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_LABEL #define LV_USE_LABEL CONFIG_LV_USE_LABEL #else @@ -1911,7 +1911,7 @@ #endif #if LV_USE_LABEL #ifndef LV_LABEL_TEXT_SELECTION - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LABEL_TEXT_SELECTION #define LV_LABEL_TEXT_SELECTION CONFIG_LV_LABEL_TEXT_SELECTION #else @@ -1922,7 +1922,7 @@ #endif #endif #ifndef LV_LABEL_LONG_TXT_HINT - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_LABEL_LONG_TXT_HINT #define LV_LABEL_LONG_TXT_HINT CONFIG_LV_LABEL_LONG_TXT_HINT #else @@ -1942,7 +1942,7 @@ #endif #ifndef LV_USE_LED - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_LED #define LV_USE_LED CONFIG_LV_USE_LED #else @@ -1954,7 +1954,7 @@ #endif #ifndef LV_USE_LINE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_LINE #define LV_USE_LINE CONFIG_LV_USE_LINE #else @@ -1966,7 +1966,7 @@ #endif #ifndef LV_USE_LIST - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_LIST #define LV_USE_LIST CONFIG_LV_USE_LIST #else @@ -1986,7 +1986,7 @@ #endif #ifndef LV_USE_MENU - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_MENU #define LV_USE_MENU CONFIG_LV_USE_MENU #else @@ -1998,7 +1998,7 @@ #endif #ifndef LV_USE_MSGBOX - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_MSGBOX #define LV_USE_MSGBOX CONFIG_LV_USE_MSGBOX #else @@ -2010,7 +2010,7 @@ #endif #ifndef LV_USE_ROLLER - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_ROLLER #define LV_USE_ROLLER CONFIG_LV_USE_ROLLER #else @@ -2022,7 +2022,7 @@ #endif #ifndef LV_USE_SCALE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_SCALE #define LV_USE_SCALE CONFIG_LV_USE_SCALE #else @@ -2034,7 +2034,7 @@ #endif #ifndef LV_USE_SLIDER - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_SLIDER #define LV_USE_SLIDER CONFIG_LV_USE_SLIDER #else @@ -2046,7 +2046,7 @@ #endif #ifndef LV_USE_SPAN - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_SPAN #define LV_USE_SPAN CONFIG_LV_USE_SPAN #else @@ -2068,7 +2068,7 @@ #endif #ifndef LV_USE_SPINBOX - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_SPINBOX #define LV_USE_SPINBOX CONFIG_LV_USE_SPINBOX #else @@ -2080,7 +2080,7 @@ #endif #ifndef LV_USE_SPINNER - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_SPINNER #define LV_USE_SPINNER CONFIG_LV_USE_SPINNER #else @@ -2092,7 +2092,7 @@ #endif #ifndef LV_USE_SWITCH - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_SWITCH #define LV_USE_SWITCH CONFIG_LV_USE_SWITCH #else @@ -2104,7 +2104,7 @@ #endif #ifndef LV_USE_TEXTAREA - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_TEXTAREA #define LV_USE_TEXTAREA CONFIG_LV_USE_TEXTAREA #else @@ -2125,7 +2125,7 @@ #endif #ifndef LV_USE_TABLE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_TABLE #define LV_USE_TABLE CONFIG_LV_USE_TABLE #else @@ -2137,7 +2137,7 @@ #endif #ifndef LV_USE_TABVIEW - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_TABVIEW #define LV_USE_TABVIEW CONFIG_LV_USE_TABVIEW #else @@ -2149,7 +2149,7 @@ #endif #ifndef LV_USE_TILEVIEW - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_TILEVIEW #define LV_USE_TILEVIEW CONFIG_LV_USE_TILEVIEW #else @@ -2161,7 +2161,7 @@ #endif #ifndef LV_USE_WIN - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_WIN #define LV_USE_WIN CONFIG_LV_USE_WIN #else @@ -2178,7 +2178,7 @@ /*A simple, impressive and very complete theme*/ #ifndef LV_USE_THEME_DEFAULT - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_THEME_DEFAULT #define LV_USE_THEME_DEFAULT CONFIG_LV_USE_THEME_DEFAULT #else @@ -2201,7 +2201,7 @@ /*1: Enable grow on press*/ #ifndef LV_THEME_DEFAULT_GROW - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_THEME_DEFAULT_GROW #define LV_THEME_DEFAULT_GROW CONFIG_LV_THEME_DEFAULT_GROW #else @@ -2224,7 +2224,7 @@ /*A very simple theme that is a good starting point for a custom theme*/ #ifndef LV_USE_THEME_SIMPLE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_THEME_SIMPLE #define LV_USE_THEME_SIMPLE CONFIG_LV_USE_THEME_SIMPLE #else @@ -2237,7 +2237,7 @@ /*A theme designed for monochrome displays*/ #ifndef LV_USE_THEME_MONO - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_THEME_MONO #define LV_USE_THEME_MONO CONFIG_LV_USE_THEME_MONO #else @@ -2254,7 +2254,7 @@ /*A layout similar to Flexbox in CSS.*/ #ifndef LV_USE_FLEX - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_FLEX #define LV_USE_FLEX CONFIG_LV_USE_FLEX #else @@ -2267,7 +2267,7 @@ /*A layout similar to Grid in CSS.*/ #ifndef LV_USE_GRID - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_GRID #define LV_USE_GRID CONFIG_LV_USE_GRID #else @@ -2816,7 +2816,7 @@ #if LV_USE_PROFILER /*1: Enable the built-in profiler*/ #ifndef LV_USE_PROFILER_BUILTIN - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_PROFILER_BUILTIN #define LV_USE_PROFILER_BUILTIN CONFIG_LV_USE_PROFILER_BUILTIN #else @@ -2921,7 +2921,7 @@ /*1: Enable an observer pattern implementation*/ #ifndef LV_USE_OBSERVER - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_OBSERVER #define LV_USE_OBSERVER CONFIG_LV_USE_OBSERVER #else @@ -2945,7 +2945,7 @@ /*1: Use default thesaurus*/ /*If you do not use the default thesaurus, be sure to use `lv_ime_pinyin` after setting the thesaurus*/ #ifndef LV_IME_PINYIN_USE_DEFAULT_DICT - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_IME_PINYIN_USE_DEFAULT_DICT #define LV_IME_PINYIN_USE_DEFAULT_DICT CONFIG_LV_IME_PINYIN_USE_DEFAULT_DICT #else @@ -2967,7 +2967,7 @@ /*Use 9 key input(k9)*/ #ifndef LV_IME_PINYIN_USE_K9_MODE - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_IME_PINYIN_USE_K9_MODE #define LV_IME_PINYIN_USE_K9_MODE CONFIG_LV_IME_PINYIN_USE_K9_MODE #else @@ -3009,7 +3009,7 @@ /*Quick access bar, 1:use, 0:not use*/ /*Requires: lv_list*/ #ifndef LV_FILE_EXPLORER_QUICK_ACCESS - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_FILE_EXPLORER_QUICK_ACCESS #define LV_FILE_EXPLORER_QUICK_ACCESS CONFIG_LV_FILE_EXPLORER_QUICK_ACCESS #else @@ -3049,7 +3049,7 @@ #endif #endif #ifndef LV_SDL_BUF_COUNT - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_SDL_BUF_COUNT #define LV_SDL_BUF_COUNT CONFIG_LV_SDL_BUF_COUNT #else @@ -3067,7 +3067,7 @@ #endif #endif #ifndef LV_SDL_DIRECT_EXIT - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_SDL_DIRECT_EXIT #define LV_SDL_DIRECT_EXIT CONFIG_LV_SDL_DIRECT_EXIT #else @@ -3096,7 +3096,7 @@ #endif #if LV_USE_X11 #ifndef LV_X11_DIRECT_EXIT - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_X11_DIRECT_EXIT #define LV_X11_DIRECT_EXIT CONFIG_LV_X11_DIRECT_EXIT #else @@ -3107,7 +3107,7 @@ #endif #endif #ifndef LV_X11_DOUBLE_BUFFER - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_X11_DOUBLE_BUFFER #define LV_X11_DOUBLE_BUFFER CONFIG_LV_X11_DOUBLE_BUFFER #else @@ -3119,7 +3119,7 @@ #endif /*select only 1 of the following render modes (LV_X11_RENDER_MODE_PARTIAL preferred!)*/ #ifndef LV_X11_RENDER_MODE_PARTIAL - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_X11_RENDER_MODE_PARTIAL #define LV_X11_RENDER_MODE_PARTIAL CONFIG_LV_X11_RENDER_MODE_PARTIAL #else @@ -3378,7 +3378,7 @@ #endif #if LV_USE_OPENGLES #ifndef LV_USE_OPENGLES_DEBUG - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_USE_OPENGLES_DEBUG #define LV_USE_OPENGLES_DEBUG CONFIG_LV_USE_OPENGLES_DEBUG #else @@ -3400,7 +3400,7 @@ #endif #if LV_USE_QNX #ifndef LV_QNX_BUF_COUNT - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_QNX_BUF_COUNT #define LV_QNX_BUF_COUNT CONFIG_LV_QNX_BUF_COUNT #else @@ -3418,7 +3418,7 @@ /*Enable the examples to be built with the library*/ #ifndef LV_BUILD_EXAMPLES - #ifdef _LV_KCONFIG_PRESENT + #ifdef LV_KCONFIG_PRESENT #ifdef CONFIG_LV_BUILD_EXAMPLES #define LV_BUILD_EXAMPLES CONFIG_LV_BUILD_EXAMPLES #else @@ -3581,7 +3581,7 @@ LV_EXPORT_CONST_INT(LV_DRAW_BUF_STRIDE_ALIGN); LV_EXPORT_CONST_INT(LV_DRAW_BUF_ALIGN); #endif -#undef _LV_KCONFIG_PRESENT +#undef LV_KCONFIG_PRESENT /*Set some defines if a dependency is disabled*/ #if LV_USE_LOG == 0 diff --git a/src/lv_init.c b/src/lv_init.c index 53e090245..26897a7bc 100644 --- a/src/lv_init.c +++ b/src/lv_init.c @@ -6,11 +6,21 @@ /********************* * INCLUDES *********************/ +#include "others/sysmon/lv_sysmon_private.h" +#include "misc/lv_timer_private.h" +#include "misc/lv_profiler_builtin_private.h" +#include "misc/lv_anim_private.h" +#include "draw/lv_image_decoder_private.h" +#include "draw/lv_draw_buf_private.h" +#include "core/lv_refr_private.h" +#include "core/lv_obj_style_private.h" +#include "core/lv_group_private.h" +#include "lv_init.h" #include "core/lv_global.h" #include "core/lv_obj.h" #include "display/lv_display_private.h" #include "indev/lv_indev_private.h" -#include "layouts/lv_layout.h" +#include "layouts/lv_layout_private.h" #include "libs/bin_decoder/lv_bin_decoder.h" #include "libs/bmp/lv_bmp.h" #include "libs/ffmpeg/lv_ffmpeg.h" @@ -21,8 +31,12 @@ #include "libs/libjpeg_turbo/lv_libjpeg_turbo.h" #include "libs/lodepng/lv_lodepng.h" #include "libs/libpng/lv_libpng.h" +#include "libs/tiny_ttf/lv_tiny_ttf.h" #include "draw/lv_draw.h" #include "misc/lv_async.h" +#include "misc/lv_fs_private.h" +#include "widgets/span/lv_span.h" +#include "themes/simple/lv_theme_simple.h" #include "misc/lv_fs.h" #include "osal/lv_os_private.h" @@ -88,14 +102,14 @@ static inline void lv_global_init(lv_global_t * global) lv_memzero(global, sizeof(lv_global_t)); - _lv_ll_init(&(global->disp_ll), sizeof(lv_display_t)); - _lv_ll_init(&(global->indev_ll), sizeof(lv_indev_t)); + lv_ll_init(&(global->disp_ll), sizeof(lv_display_t)); + lv_ll_init(&(global->indev_ll), sizeof(lv_indev_t)); global->memory_zero = ZERO_MEM_SENTINEL; global->style_refresh = true; - global->layout_count = _LV_LAYOUT_LAST; - global->style_last_custom_prop_id = (uint32_t)_LV_STYLE_LAST_BUILT_IN_PROP; - global->event_last_register_id = _LV_EVENT_LAST; + global->layout_count = LV_LAYOUT_LAST; + global->style_last_custom_prop_id = (uint32_t)LV_STYLE_LAST_BUILT_IN_PROP; + global->event_last_register_id = LV_EVENT_LAST; lv_rand_set_seed(0x1234ABCD); #ifdef LV_LOG_PRINT_CB @@ -109,14 +123,14 @@ static inline void lv_global_init(lv_global_t * global) #endif } -static inline void _lv_cleanup_devices(lv_global_t * global) +static inline void lv_cleanup_devices(lv_global_t * global) { LV_ASSERT_NULL(global); if(global) { /* cleanup indev and display */ - _lv_ll_clear_custom(&(global->indev_ll), (void (*)(void *)) lv_indev_delete); - _lv_ll_clear_custom(&(global->disp_ll), (void (*)(void *)) lv_display_delete); + lv_ll_clear_custom(&(global->indev_ll), (void (*)(void *)) lv_indev_delete); + lv_ll_clear_custom(&(global->disp_ll), (void (*)(void *)) lv_display_delete); } } @@ -150,7 +164,7 @@ void lv_init(void) lv_mem_init(); - _lv_draw_buf_init_handlers(); + lv_draw_buf_init_handlers(); #if LV_USE_SPAN != 0 lv_span_stack_init(); @@ -164,15 +178,15 @@ void lv_init(void) lv_os_init(); - _lv_timer_core_init(); + lv_timer_core_init(); - _lv_fs_init(); + lv_fs_init(); - _lv_layout_init(); + lv_layout_init(); - _lv_anim_core_init(); + lv_anim_core_init(); - _lv_group_init(); + lv_group_init(); lv_draw_init(); @@ -200,16 +214,16 @@ void lv_init(void) lv_windows_platform_init(); #endif - _lv_obj_style_init(); + lv_obj_style_init(); /*Initialize the screen refresh system*/ - _lv_refr_init(); + lv_refr_init(); #if LV_USE_SYSMON - _lv_sysmon_builtin_init(); + lv_sysmon_builtin_init(); #endif - _lv_image_decoder_init(LV_CACHE_DEF_SIZE, LV_IMAGE_HEADER_CACHE_DEF_CNT); + lv_image_decoder_init(LV_CACHE_DEF_SIZE, LV_IMAGE_HEADER_CACHE_DEF_CNT); lv_bin_decoder_init(); /*LVGL built-in binary image decoder*/ #if LV_USE_DRAW_VG_LITE @@ -334,12 +348,12 @@ void lv_deinit(void) lv_deinit_in_progress = true; #if LV_USE_SYSMON - _lv_sysmon_builtin_deinit(); + lv_sysmon_builtin_deinit(); #endif lv_display_set_default(NULL); - _lv_cleanup_devices(LV_GLOBAL_DEFAULT()); + lv_cleanup_devices(LV_GLOBAL_DEFAULT()); #if LV_USE_SPAN != 0 lv_span_stack_deinit(); @@ -365,11 +379,11 @@ void lv_deinit(void) lv_theme_mono_deinit(); #endif - _lv_image_decoder_deinit(); + lv_image_decoder_deinit(); - _lv_refr_deinit(); + lv_refr_deinit(); - _lv_obj_style_deinit(); + lv_obj_style_deinit(); #if LV_USE_DRAW_PXP lv_draw_pxp_deinit(); @@ -389,15 +403,15 @@ void lv_deinit(void) lv_draw_deinit(); - _lv_group_deinit(); + lv_group_deinit(); - _lv_anim_core_deinit(); + lv_anim_core_deinit(); - _lv_layout_deinit(); + lv_layout_deinit(); - _lv_fs_deinit(); + lv_fs_deinit(); - _lv_timer_core_deinit(); + lv_timer_core_deinit(); #if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN lv_profiler_builtin_uninit(); diff --git a/src/lvgl_private.h b/src/lvgl_private.h index 96c29aa34..cda92217b 100644 --- a/src/lvgl_private.h +++ b/src/lvgl_private.h @@ -13,11 +13,95 @@ extern "C" { /********************* * INCLUDES *********************/ +#include "core/lv_global.h" + #include "display/lv_display_private.h" #include "indev/lv_indev_private.h" #include "misc/lv_text_private.h" #include "misc/cache/lv_cache_entry_private.h" #include "misc/cache/lv_cache_private.h" +#include "layouts/lv_layout_private.h" +#include "stdlib/lv_mem_private.h" +#include "others/file_explorer/lv_file_explorer_private.h" +#include "others/sysmon/lv_sysmon_private.h" +#include "others/monkey/lv_monkey_private.h" +#include "others/ime/lv_ime_pinyin_private.h" +#include "others/fragment/lv_fragment_private.h" +#include "others/observer/lv_observer_private.h" +#include "libs/qrcode/lv_qrcode_private.h" +#include "libs/barcode/lv_barcode_private.h" +#include "libs/gif/lv_gif_private.h" +#include "draw/lv_draw_triangle_private.h" +#include "draw/lv_draw_private.h" +#include "draw/lv_draw_rect_private.h" +#include "draw/lv_draw_image_private.h" +#include "draw/lv_image_decoder_private.h" +#include "draw/lv_draw_label_private.h" +#include "draw/lv_draw_vector_private.h" +#include "draw/lv_draw_buf_private.h" +#include "draw/lv_draw_mask_private.h" +#include "draw/sw/lv_draw_sw_gradient_private.h" +#include "draw/sw/lv_draw_sw_private.h" +#include "draw/sw/lv_draw_sw_mask_private.h" +#include "draw/sw/blend/lv_draw_sw_blend_private.h" +#include "drivers/libinput/lv_xkb_private.h" +#include "drivers/libinput/lv_libinput_private.h" +#include "font/lv_font_fmt_txt_private.h" +#include "themes/lv_theme_private.h" +#include "core/lv_refr_private.h" +#include "core/lv_obj_style_private.h" +#include "core/lv_obj_private.h" +#include "core/lv_obj_scroll_private.h" +#include "core/lv_obj_draw_private.h" +#include "core/lv_obj_class_private.h" +#include "core/lv_group_private.h" +#include "core/lv_obj_event_private.h" +#include "misc/lv_timer_private.h" +#include "misc/lv_area_private.h" +#include "misc/lv_fs_private.h" +#include "misc/lv_profiler_builtin_private.h" +#include "misc/lv_event_private.h" +#include "misc/lv_bidi_private.h" +#include "misc/lv_rb_private.h" +#include "misc/lv_style_private.h" +#include "misc/lv_color_op_private.h" +#include "misc/lv_anim_private.h" +#include "widgets/msgbox/lv_msgbox_private.h" +#include "widgets/buttonmatrix/lv_buttonmatrix_private.h" +#include "widgets/slider/lv_slider_private.h" +#include "widgets/switch/lv_switch_private.h" +#include "widgets/calendar/lv_calendar_chinese_private.h" +#include "widgets/calendar/lv_calendar_private.h" +#include "widgets/imagebutton/lv_imagebutton_private.h" +#include "widgets/bar/lv_bar_private.h" +#include "widgets/image/lv_image_private.h" +#include "widgets/textarea/lv_textarea_private.h" +#include "widgets/table/lv_table_private.h" +#include "widgets/checkbox/lv_checkbox_private.h" +#include "widgets/roller/lv_roller_private.h" +#include "widgets/win/lv_win_private.h" +#include "widgets/keyboard/lv_keyboard_private.h" +#include "widgets/line/lv_line_private.h" +#include "widgets/animimage/lv_animimage_private.h" +#include "widgets/dropdown/lv_dropdown_private.h" +#include "widgets/menu/lv_menu_private.h" +#include "widgets/chart/lv_chart_private.h" +#include "widgets/button/lv_button_private.h" +#include "widgets/scale/lv_scale_private.h" +#include "widgets/led/lv_led_private.h" +#include "widgets/arc/lv_arc_private.h" +#include "widgets/tileview/lv_tileview_private.h" +#include "widgets/spinbox/lv_spinbox_private.h" +#include "widgets/span/lv_span_private.h" +#include "widgets/label/lv_label_private.h" +#include "widgets/canvas/lv_canvas_private.h" +#include "widgets/tabview/lv_tabview_private.h" +#include "tick/lv_tick_private.h" +#include "stdlib/builtin/lv_tlsf_private.h" +#include "libs/rlottie/lv_rlottie_private.h" +#include "libs/ffmpeg/lv_ffmpeg_private.h" +#include "widgets/lottie/lv_lottie_private.h" +#include "osal/lv_os_private.h" /********************* * DEFINES diff --git a/src/misc/cache/lv_cache.h b/src/misc/cache/lv_cache.h index 20dfb1658..a52d70a4f 100644 --- a/src/misc/cache/lv_cache.h +++ b/src/misc/cache/lv_cache.h @@ -17,7 +17,7 @@ extern "C" { #include "lv_cache_private.h" #include "../lv_types.h" -#include "_lv_cache_lru_rb.h" +#include "lv_cache_lru_rb.h" #include "lv_image_cache.h" #include "lv_image_header_cache.h" diff --git a/src/misc/cache/lv_cache_entry.c b/src/misc/cache/lv_cache_entry.c index 242e1a0f2..e0cc66434 100644 --- a/src/misc/cache/lv_cache_entry.c +++ b/src/misc/cache/lv_cache_entry.c @@ -19,7 +19,7 @@ /********************** * TYPEDEFS **********************/ -struct _lv_cache_entry_t { +struct lv_cache_entry_t { const lv_cache_t * cache; int32_t ref_cnt; uint32_t node_size; diff --git a/src/misc/cache/_lv_cache_lru_rb.c b/src/misc/cache/lv_cache_lru_rb.c index cc5bb08ff..0a73102d1 100644 --- a/src/misc/cache/_lv_cache_lru_rb.c +++ b/src/misc/cache/lv_cache_lru_rb.c @@ -1,5 +1,5 @@ /** -* @file _lv_cache_lru_rb.c +* @file lv_cache_lru_rb.c * */ @@ -43,11 +43,11 @@ /********************* * INCLUDES *********************/ -#include "_lv_cache_lru_rb.h" +#include "lv_cache_lru_rb.h" #include "../../stdlib/lv_sprintf.h" #include "../../stdlib/lv_string.h" #include "../lv_ll.h" -#include "../lv_rb.h" +#include "../lv_rb_private.h" /********************* * DEFINES @@ -58,7 +58,7 @@ **********************/ typedef uint32_t (get_data_size_cb_t)(const void * data); -struct _lv_lru_rb_t { +struct lv_lru_rb_t { lv_cache_t cache; lv_rb_t rb; @@ -66,7 +66,7 @@ struct _lv_lru_rb_t { get_data_size_cb_t * get_data_size_cb; }; -typedef struct _lv_lru_rb_t lv_lru_rb_t_; +typedef struct lv_lru_rb_t lv_lru_rb_t_; /********************** * STATIC PROTOTYPES **********************/ @@ -155,7 +155,7 @@ static void * alloc_new_node(lv_lru_rb_t_ * lru, void * key, void * user_data) lv_cache_entry_t * entry = lv_cache_entry_get_entry(data, lru->cache.node_size); lv_memcpy(data, key, lru->cache.node_size); - void * lru_node = _lv_ll_ins_head(&lru->ll); + void * lru_node = lv_ll_ins_head(&lru->ll); if(lru_node == NULL) goto FAILED_HANDLER1; @@ -206,7 +206,7 @@ static bool init_cnt_cb(lv_cache_t * cache) if(!lv_rb_init(&lru->rb, lru->cache.ops.compare_cb, lv_cache_entry_get_size(lru->cache.node_size) + sizeof(void *))) { return false; } - _lv_ll_init(&lru->ll, sizeof(void *)); + lv_ll_init(&lru->ll, sizeof(void *)); lru->get_data_size_cb = cnt_get_data_size_cb; @@ -229,7 +229,7 @@ static bool init_size_cb(lv_cache_t * cache) if(!lv_rb_init(&lru->rb, lru->cache.ops.compare_cb, lv_cache_entry_get_size(lru->cache.node_size) + sizeof(void *))) { return false; } - _lv_ll_init(&lru->ll, sizeof(void *)); + lv_ll_init(&lru->ll, sizeof(void *)); lru->get_data_size_cb = size_get_data_size_cb; @@ -265,7 +265,7 @@ static lv_cache_entry_t * get_cb(lv_cache_t * cache, const void * key, void * us } /*try the first ll node first*/ - void * head = _lv_ll_get_head(&lru->ll); + void * head = lv_ll_get_head(&lru->ll); if(head) { lv_rb_node_t * node = *(lv_rb_node_t **)head; void * data = node->data; @@ -279,8 +279,8 @@ static lv_cache_entry_t * get_cb(lv_cache_t * cache, const void * key, void * us /*cache hit*/ if(node) { void * lru_node = *get_lru_node(lru, node); - head = _lv_ll_get_head(&lru->ll); - _lv_ll_move_before(&lru->ll, lru_node, head); + head = lv_ll_get_head(&lru->ll); + lv_ll_move_before(&lru->ll, lru_node, head); lv_cache_entry_t * entry = lv_cache_entry_get_entry(node->data, cache->node_size); return entry; @@ -334,7 +334,7 @@ static void remove_cb(lv_cache_t * cache, lv_cache_entry_t * entry, void * user_ void * lru_node = *get_lru_node(lru, node); lv_rb_remove_node(&lru->rb, node); - _lv_ll_remove(&lru->ll, lru_node); + lv_ll_remove(&lru->ll, lru_node); lv_free(lru_node); cache->size -= lru->get_data_size_cb(data); @@ -367,7 +367,7 @@ static void drop_cb(lv_cache_t * cache, const void * key, void * user_data) lv_rb_remove_node(&lru->rb, node); lv_cache_entry_delete(entry); - _lv_ll_remove(&lru->ll, lru_node); + lv_ll_remove(&lru->ll, lru_node); lv_free(lru_node); } @@ -383,7 +383,7 @@ static void drop_all_cb(lv_cache_t * cache, void * user_data) uint32_t used_cnt = 0; lv_rb_node_t ** node; - _LV_LL_READ(&lru->ll, node) { + LV_LL_READ(&lru->ll, node) { /*free user handled data and do other clean up*/ void * search_key = (*node)->data; lv_cache_entry_t * entry = lv_cache_entry_get_entry(search_key, cache->node_size); @@ -400,7 +400,7 @@ static void drop_all_cb(lv_cache_t * cache, void * user_data) } lv_rb_destroy(&lru->rb); - _lv_ll_clear(&lru->ll); + lv_ll_clear(&lru->ll); cache->size = 0; } @@ -414,7 +414,7 @@ static lv_cache_entry_t * get_victim_cb(lv_cache_t * cache, void * user_data) LV_ASSERT_NULL(lru); lv_rb_node_t ** tail; - _LV_LL_READ_BACK(&lru->ll, tail) { + LV_LL_READ_BACK(&lru->ll, tail) { lv_rb_node_t * tail_node = *tail; lv_cache_entry_t * entry = lv_cache_entry_get_entry(tail_node->data, cache->node_size); if(lv_cache_entry_get_ref(entry) == 0) { diff --git a/src/misc/cache/_lv_cache_lru_rb.h b/src/misc/cache/lv_cache_lru_rb.h index a27110b94..c0f44f396 100644 --- a/src/misc/cache/_lv_cache_lru_rb.h +++ b/src/misc/cache/lv_cache_lru_rb.h @@ -1,5 +1,5 @@ /** -* @file _lv_cache_lru_rb.h +* @file lv_cache_lru_rb.h * */ diff --git a/src/misc/cache/lv_cache_private.h b/src/misc/cache/lv_cache_private.h index 0bb8afe61..aac1a9687 100644 --- a/src/misc/cache/lv_cache_private.h +++ b/src/misc/cache/lv_cache_private.h @@ -34,15 +34,15 @@ typedef enum { LV_CACHE_RESERVE_COND_ERROR /**< An error occurred while checking the condition */ } lv_cache_reserve_cond_res_t; -struct _lv_cache_ops_t; -struct _lv_cache_t; -struct _lv_cache_class_t; -struct _lv_cache_entry_t; +struct lv_cache_ops_t; +struct lv_cache_t; +struct lv_cache_class_t; +struct lv_cache_entry_t; -typedef struct _lv_cache_ops_t lv_cache_ops_t; -typedef struct _lv_cache_t lv_cache_t; -typedef struct _lv_cache_class_t lv_cache_class_t; -typedef struct _lv_cache_entry_t lv_cache_entry_t; +typedef struct lv_cache_ops_t lv_cache_ops_t; +typedef struct lv_cache_t lv_cache_t; +typedef struct lv_cache_class_t lv_cache_class_t; +typedef struct lv_cache_entry_t lv_cache_entry_t; typedef int8_t lv_cache_compare_res_t; typedef bool (*lv_cache_create_cb_t)(void * node, void * user_data); @@ -110,7 +110,7 @@ typedef lv_cache_reserve_cond_res_t (*lv_cache_reserve_cond_cb)(lv_cache_t * cac /** * The cache operations struct */ -struct _lv_cache_ops_t { +struct lv_cache_ops_t { lv_cache_compare_cb_t compare_cb; /**< Compare function for keys */ lv_cache_create_cb_t create_cb; /**< Create function for nodes */ lv_cache_free_cb_t free_cb; /**< Free function for nodes */ @@ -119,7 +119,7 @@ struct _lv_cache_ops_t { /** * The cache entry struct */ -struct _lv_cache_t { +struct lv_cache_t { const lv_cache_class_t * clz; /**< The cache class. There are two built-in classes: * @lv_cache_class_lru_rb_count for LRU-based cache with count-based eviction policy. * @lv_cache_class_lru_rb_size for LRU-based cache with size-based eviction policy. */ @@ -141,7 +141,7 @@ struct _lv_cache_t { * @lv_cache_class_lru_rb_count for LRU-based cache with count-based eviction policy. * @lv_cache_class_lru_rb_size for LRU-based cache with size-based eviction policy. */ -struct _lv_cache_class_t { +struct lv_cache_class_t { lv_cache_alloc_cb_t alloc_cb; /**< The allocation function for cache entries */ lv_cache_init_cb_t init_cb; /**< The initialization function for cache entries */ lv_cache_destroy_cb_t destroy_cb; /**< The destruction function for cache entries */ @@ -159,16 +159,16 @@ struct _lv_cache_class_t { * Cache entry slot *----------------*/ -struct _lv_cache_slot_size_t; +struct lv_cache_slot_size_t; -typedef struct _lv_cache_slot_size_t lv_cache_slot_size_t; +typedef struct lv_cache_slot_size_t lv_cache_slot_size_t; /** * The cache entry slot struct * To add new fields to the cache entry, add them to a new struct and add it to the first field of the cache data struct. * And this one is a size slot for the cache entry. */ -struct _lv_cache_slot_size_t { +struct lv_cache_slot_size_t { size_t size; }; /********************** diff --git a/src/misc/cache/lv_image_cache.c b/src/misc/cache/lv_image_cache.c index 00697977e..91af55766 100644 --- a/src/misc/cache/lv_image_cache.c +++ b/src/misc/cache/lv_image_cache.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ +#include "../../draw/lv_image_decoder_private.h" #include "../lv_assert.h" #include "../../core/lv_global.h" diff --git a/src/misc/cache/lv_image_header_cache.c b/src/misc/cache/lv_image_header_cache.c index d5e5f3aa2..ef124fb0a 100644 --- a/src/misc/cache/lv_image_header_cache.c +++ b/src/misc/cache/lv_image_header_cache.c @@ -7,6 +7,7 @@ * INCLUDES *********************/ +#include "../../draw/lv_image_decoder_private.h" #include "../lv_assert.h" #include "../../core/lv_global.h" diff --git a/src/misc/lv_anim.c b/src/misc/lv_anim.c index 9e7db92b1..0e57f2435 100644 --- a/src/misc/lv_anim.c +++ b/src/misc/lv_anim.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_anim.h" +#include "lv_anim_private.h" #include "../core/lv_global.h" #include "../tick/lv_tick.h" @@ -58,16 +58,16 @@ static void remove_anim(void * a); * GLOBAL FUNCTIONS **********************/ -void _lv_anim_core_init(void) +void lv_anim_core_init(void) { - _lv_ll_init(anim_ll_p, sizeof(lv_anim_t)); + lv_ll_init(anim_ll_p, sizeof(lv_anim_t)); state.timer = lv_timer_create(anim_timer, LV_DEF_REFR_PERIOD, NULL); anim_mark_list_change(); /*Turn off the animation timer*/ state.anim_list_changed = false; state.anim_run_round = false; } -void _lv_anim_core_deinit(void) +void lv_anim_core_deinit(void) { lv_anim_delete_all(); } @@ -88,7 +88,7 @@ lv_anim_t * lv_anim_start(const lv_anim_t * a) LV_TRACE_ANIM("begin"); /*Add the new animation to the animation linked list*/ - lv_anim_t * new_anim = _lv_ll_ins_head(anim_ll_p); + lv_anim_t * new_anim = lv_ll_ins_head(anim_ll_p); LV_ASSERT_MALLOC(new_anim); if(new_anim == NULL) return NULL; @@ -146,7 +146,7 @@ bool lv_anim_delete(void * var, lv_anim_exec_xcb_t exec_cb) { lv_anim_t * a; bool del_any = false; - a = _lv_ll_get_head(anim_ll_p); + a = lv_ll_get_head(anim_ll_p); while(a != NULL) { bool del = false; if((a->var == var || var == NULL) && (a->exec_cb == exec_cb || exec_cb == NULL)) { @@ -159,7 +159,7 @@ bool lv_anim_delete(void * var, lv_anim_exec_xcb_t exec_cb) /*Always start from the head on delete, because we don't know *how `anim_ll_p` was changes in `a->deleted_cb` */ - a = del ? _lv_ll_get_head(anim_ll_p) : _lv_ll_get_next(anim_ll_p, a); + a = del ? lv_ll_get_head(anim_ll_p) : lv_ll_get_next(anim_ll_p, a); } return del_any; @@ -167,14 +167,14 @@ bool lv_anim_delete(void * var, lv_anim_exec_xcb_t exec_cb) void lv_anim_delete_all(void) { - _lv_ll_clear_custom(anim_ll_p, remove_anim); + lv_ll_clear_custom(anim_ll_p, remove_anim); anim_mark_list_change(); } lv_anim_t * lv_anim_get(void * var, lv_anim_exec_xcb_t exec_cb) { lv_anim_t * a; - _LV_LL_READ(anim_ll_p, a) { + LV_LL_READ(anim_ll_p, a) { if(a->var == var && (a->exec_cb == exec_cb || exec_cb == NULL)) { return a; } @@ -192,7 +192,7 @@ uint16_t lv_anim_count_running(void) { uint16_t cnt = 0; lv_anim_t * a; - _LV_LL_READ(anim_ll_p, a) cnt++; + LV_LL_READ(anim_ll_p, a) cnt++; return cnt; } @@ -342,10 +342,147 @@ int32_t lv_anim_path_step(const lv_anim_t * a) int32_t lv_anim_path_custom_bezier3(const lv_anim_t * a) { - const struct _lv_anim_bezier3_para_t * para = &a->parameter.bezier3; + const lv_anim_bezier3_para_t * para = &a->parameter.bezier3; return lv_anim_path_cubic_bezier(a, para->x1, para->y1, para->x2, para->y2); } +void lv_anim_set_var(lv_anim_t * a, void * var) +{ + a->var = var; +} + +void lv_anim_set_exec_cb(lv_anim_t * a, lv_anim_exec_xcb_t exec_cb) +{ + a->exec_cb = exec_cb; +} + +void lv_anim_set_duration(lv_anim_t * a, uint32_t duration) +{ + a->duration = duration; +} + +void lv_anim_set_time(lv_anim_t * a, uint32_t duration) +{ + lv_anim_set_duration(a, duration); +} + +void lv_anim_set_delay(lv_anim_t * a, uint32_t delay) +{ + a->act_time = -(int32_t)(delay); +} + +void lv_anim_set_values(lv_anim_t * a, int32_t start, int32_t end) +{ + a->start_value = start; + a->current_value = INT32_MIN; + a->end_value = end; +} + +void lv_anim_set_custom_exec_cb(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb) +{ + a->custom_exec_cb = exec_cb; +} + +void lv_anim_set_path_cb(lv_anim_t * a, lv_anim_path_cb_t path_cb) +{ + a->path_cb = path_cb; +} + +void lv_anim_set_start_cb(lv_anim_t * a, lv_anim_start_cb_t start_cb) +{ + a->start_cb = start_cb; +} + +void lv_anim_set_get_value_cb(lv_anim_t * a, lv_anim_get_value_cb_t get_value_cb) +{ + a->get_value_cb = get_value_cb; +} + +void lv_anim_set_completed_cb(lv_anim_t * a, lv_anim_completed_cb_t completed_cb) +{ + a->completed_cb = completed_cb; +} + +void lv_anim_set_deleted_cb(lv_anim_t * a, lv_anim_deleted_cb_t deleted_cb) +{ + a->deleted_cb = deleted_cb; +} + +void lv_anim_set_playback_duration(lv_anim_t * a, uint32_t duration) +{ + a->playback_duration = duration; +} + +void lv_anim_set_playback_time(lv_anim_t * a, uint32_t duration) +{ + lv_anim_set_playback_duration(a, duration); +} + +void lv_anim_set_playback_delay(lv_anim_t * a, uint32_t delay) +{ + a->playback_delay = delay; +} + +void lv_anim_set_repeat_count(lv_anim_t * a, uint32_t cnt) +{ + a->repeat_cnt = cnt; +} + +void lv_anim_set_repeat_delay(lv_anim_t * a, uint32_t delay) +{ + a->repeat_delay = delay; +} + +void lv_anim_set_early_apply(lv_anim_t * a, bool en) +{ + a->early_apply = en; +} + +void lv_anim_set_user_data(lv_anim_t * a, void * user_data) +{ + a->user_data = user_data; +} + +void lv_anim_set_bezier3_param(lv_anim_t * a, int16_t x1, int16_t y1, int16_t x2, int16_t y2) +{ + lv_anim_bezier3_para_t * para = &a->parameter.bezier3; + + para->x1 = x1; + para->x2 = x2; + para->y1 = y1; + para->y2 = y2; +} + +uint32_t lv_anim_get_delay(const lv_anim_t * a) +{ + return -a->act_time; +} + +uint32_t lv_anim_get_time(const lv_anim_t * a) +{ + return a->duration; +} + +uint32_t lv_anim_get_repeat_count(const lv_anim_t * a) +{ + return a->repeat_cnt; +} + +void * lv_anim_get_user_data(const lv_anim_t * a) +{ + return a->user_data; +} + +bool lv_anim_custom_delete(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb) +{ + return lv_anim_delete(a ? a->var : NULL, (lv_anim_exec_xcb_t)exec_cb); +} + +lv_anim_t * lv_anim_custom_get(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb) +{ + return lv_anim_get(a ? a->var : NULL, (lv_anim_exec_xcb_t)exec_cb); +} + /********************** * STATIC FUNCTIONS **********************/ @@ -360,7 +497,7 @@ static void anim_timer(lv_timer_t * param) /*Flip the run round*/ state.anim_run_round = state.anim_run_round ? false : true; - lv_anim_t * a = _lv_ll_get_head(anim_ll_p); + lv_anim_t * a = lv_ll_get_head(anim_ll_p); while(a != NULL) { uint32_t elaps = lv_tick_elaps(a->last_timer_run); @@ -418,9 +555,9 @@ static void anim_timer(lv_timer_t * param) /*If the linked list changed due to anim. delete then it's not safe to continue *the reading of the list from here -> start from the head*/ if(state.anim_list_changed) - a = _lv_ll_get_head(anim_ll_p); + a = lv_ll_get_head(anim_ll_p); else - a = _lv_ll_get_next(anim_ll_p, a); + a = lv_ll_get_next(anim_ll_p, a); } } @@ -444,7 +581,7 @@ static void anim_completed_handler(lv_anim_t * a) /*Delete the animation from the list. * This way the `completed_cb` will see the animations like it's animation is already deleted*/ - _lv_ll_remove(anim_ll_p, a); + lv_ll_remove(anim_ll_p, a); /*Flag that the list has changed*/ anim_mark_list_change(); @@ -478,7 +615,7 @@ static void anim_completed_handler(lv_anim_t * a) static void anim_mark_list_change(void) { state.anim_list_changed = true; - if(_lv_ll_get_head(anim_ll_p) == NULL) + if(lv_ll_get_head(anim_ll_p) == NULL) lv_timer_pause(state.timer); else lv_timer_resume(state.timer); @@ -532,7 +669,7 @@ static bool remove_concurrent_anims(lv_anim_t * a_current) lv_anim_t * a; bool del_any = false; - a = _lv_ll_get_head(anim_ll_p); + a = lv_ll_get_head(anim_ll_p); while(a != NULL) { bool del = false; /*We can't test for custom_exec_cb equality because in the MicroPython binding @@ -543,7 +680,7 @@ static bool remove_concurrent_anims(lv_anim_t * a_current) (a->var == a_current->var) && ((a->exec_cb && a->exec_cb == a_current->exec_cb) /*|| (a->custom_exec_cb && a->custom_exec_cb == a_current->custom_exec_cb)*/)) { - _lv_ll_remove(anim_ll_p, a); + lv_ll_remove(anim_ll_p, a); if(a->deleted_cb != NULL) a->deleted_cb(a); lv_free(a); /*Read by `anim_timer`. It need to know if a delete occurred in the linked list*/ @@ -555,7 +692,7 @@ static bool remove_concurrent_anims(lv_anim_t * a_current) /*Always start from the head on delete, because we don't know *how `anim_ll_p` was changes in `a->deleted_cb` */ - a = del ? _lv_ll_get_head(anim_ll_p) : _lv_ll_get_next(anim_ll_p, a); + a = del ? lv_ll_get_head(anim_ll_p) : lv_ll_get_next(anim_ll_p, a); } return del_any; @@ -564,7 +701,7 @@ static bool remove_concurrent_anims(lv_anim_t * a_current) static void remove_anim(void * a) { lv_anim_t * anim = a; - _lv_ll_remove(anim_ll_p, a); + lv_ll_remove(anim_ll_p, a); if(anim->deleted_cb != NULL) anim->deleted_cb(anim); lv_free(a); } diff --git a/src/misc/lv_anim.h b/src/misc/lv_anim.h index d83e800cb..bcc08b545 100644 --- a/src/misc/lv_anim.h +++ b/src/misc/lv_anim.h @@ -42,7 +42,7 @@ extern "C" { */ #define _PARA(a, x1, y1, x2, y2) ((a)->parameter.bezier3 = \ -(struct _lv_anim_bezier3_para_t) { \ +(lv_anim_bezier3_para_t) { \ LV_BEZIER_VAL_FLOAT(x1), LV_BEZIER_VAL_FLOAT(y1), \ LV_BEZIER_VAL_FLOAT(x2), LV_BEZIER_VAL_FLOAT(y2) } \ ) @@ -85,13 +85,6 @@ typedef enum { LV_ANIM_ON, } lv_anim_enable_t; -typedef struct { - bool anim_list_changed; - bool anim_run_round; - lv_timer_t * timer; - lv_ll_t anim_ll; -} lv_anim_state_t; - /** Get the current value during an animation*/ typedef int32_t (*lv_anim_path_cb_t)(const lv_anim_t *); @@ -119,7 +112,7 @@ typedef int32_t (*lv_anim_get_value_cb_t)(lv_anim_t *); /** Callback used when the animation is deleted*/ typedef void (*lv_anim_deleted_cb_t)(lv_anim_t *); -typedef struct _lv_anim_bezier3_para_t { +typedef struct { int16_t x1; int16_t y1; int16_t x2; @@ -127,7 +120,7 @@ typedef struct _lv_anim_bezier3_para_t { } lv_anim_bezier3_para_t; /**< Parameter used when path is custom_bezier*/ /** Describes an animation*/ -struct _lv_anim_t { +struct lv_anim_t { void * var; /**<Variable to animate*/ lv_anim_exec_xcb_t exec_cb; /**< Function to execute to animate*/ lv_anim_custom_exec_cb_t custom_exec_cb;/**< Function to execute to animate, @@ -147,7 +140,7 @@ struct _lv_anim_t { uint32_t playback_duration; /**< Duration of playback animation*/ uint32_t repeat_delay; /**< Wait before repeat*/ uint32_t repeat_cnt; /**< Repeat count for the animation*/ - union _lv_anim_path_para_t { + union lv_anim_path_para_t { lv_anim_bezier3_para_t bezier3; /**< Parameter used when path is custom_bezier*/ } parameter; @@ -164,16 +157,6 @@ struct _lv_anim_t { **********************/ /** - * Init the animation module - */ -void _lv_anim_core_init(void); - -/** - * Deinit the animation module - */ -void _lv_anim_core_deinit(void); - -/** * Initialize an animation variable. * E.g.: * lv_anim_t a; @@ -189,10 +172,7 @@ void lv_anim_init(lv_anim_t * a); * @param a pointer to an initialized `lv_anim_t` variable * @param var pointer to a variable to animate */ -static inline void lv_anim_set_var(lv_anim_t * a, void * var) -{ - a->var = var; -} +void lv_anim_set_var(lv_anim_t * a, void * var); /** * Set a function to animate `var` @@ -201,38 +181,26 @@ static inline void lv_anim_set_var(lv_anim_t * a, void * var) * LVGL's built-in functions can be used. * E.g. lv_obj_set_x */ -static inline void lv_anim_set_exec_cb(lv_anim_t * a, lv_anim_exec_xcb_t exec_cb) -{ - a->exec_cb = exec_cb; -} +void lv_anim_set_exec_cb(lv_anim_t * a, lv_anim_exec_xcb_t exec_cb); /** * Set the duration of an animation * @param a pointer to an initialized `lv_anim_t` variable * @param duration duration of the animation in milliseconds */ -static inline void lv_anim_set_duration(lv_anim_t * a, uint32_t duration) -{ - a->duration = duration; -} +void lv_anim_set_duration(lv_anim_t * a, uint32_t duration); /** * Legacy `lv_anim_set_time` API will be removed soon, use `lv_anim_set_duration` instead. */ -static inline void lv_anim_set_time(lv_anim_t * a, uint32_t duration) -{ - lv_anim_set_duration(a, duration); -} +void lv_anim_set_time(lv_anim_t * a, uint32_t duration); /** * Set a delay before starting the animation * @param a pointer to an initialized `lv_anim_t` variable * @param delay delay before the animation in milliseconds */ -static inline void lv_anim_set_delay(lv_anim_t * a, uint32_t delay) -{ - a->act_time = -(int32_t)(delay); -} +void lv_anim_set_delay(lv_anim_t * a, uint32_t delay); /** * Set the start and end values of an animation @@ -240,12 +208,7 @@ static inline void lv_anim_set_delay(lv_anim_t * a, uint32_t delay) * @param start the start value * @param end the end value */ -static inline void lv_anim_set_values(lv_anim_t * a, int32_t start, int32_t end) -{ - a->start_value = start; - a->current_value = INT32_MIN; - a->end_value = end; -} +void lv_anim_set_values(lv_anim_t * a, int32_t start, int32_t end); /** * Similar to `lv_anim_set_exec_cb` but `lv_anim_custom_exec_cb_t` receives @@ -255,30 +218,21 @@ static inline void lv_anim_set_values(lv_anim_t * a, int32_t start, int32_t end) * @param a pointer to an initialized `lv_anim_t` variable * @param exec_cb a function to execute. */ -static inline void lv_anim_set_custom_exec_cb(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb) -{ - a->custom_exec_cb = exec_cb; -} +void lv_anim_set_custom_exec_cb(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb); /** * Set the path (curve) of the animation. * @param a pointer to an initialized `lv_anim_t` variable * @param path_cb a function to set the current value of the animation. */ -static inline void lv_anim_set_path_cb(lv_anim_t * a, lv_anim_path_cb_t path_cb) -{ - a->path_cb = path_cb; -} +void lv_anim_set_path_cb(lv_anim_t * a, lv_anim_path_cb_t path_cb); /** * Set a function call when the animation really starts (considering `delay`) * @param a pointer to an initialized `lv_anim_t` variable * @param start_cb a function call when the animation starts */ -static inline void lv_anim_set_start_cb(lv_anim_t * a, lv_anim_start_cb_t start_cb) -{ - a->start_cb = start_cb; -} +void lv_anim_set_start_cb(lv_anim_t * a, lv_anim_start_cb_t start_cb); /** * Set a function to use the current value of the variable and make start and end value @@ -286,78 +240,54 @@ static inline void lv_anim_set_start_cb(lv_anim_t * a, lv_anim_start_cb_t start_ * @param a pointer to an initialized `lv_anim_t` variable * @param get_value_cb a function call when the animation starts */ -static inline void lv_anim_set_get_value_cb(lv_anim_t * a, lv_anim_get_value_cb_t get_value_cb) -{ - a->get_value_cb = get_value_cb; -} +void lv_anim_set_get_value_cb(lv_anim_t * a, lv_anim_get_value_cb_t get_value_cb); /** * Set a function call when the animation is completed * @param a pointer to an initialized `lv_anim_t` variable * @param completed_cb a function call when the animation is fully completed */ -static inline void lv_anim_set_completed_cb(lv_anim_t * a, lv_anim_completed_cb_t completed_cb) -{ - a->completed_cb = completed_cb; -} +void lv_anim_set_completed_cb(lv_anim_t * a, lv_anim_completed_cb_t completed_cb); /** * Set a function call when the animation is deleted. * @param a pointer to an initialized `lv_anim_t` variable * @param deleted_cb a function call when the animation is deleted */ -static inline void lv_anim_set_deleted_cb(lv_anim_t * a, lv_anim_deleted_cb_t deleted_cb) -{ - a->deleted_cb = deleted_cb; -} +void lv_anim_set_deleted_cb(lv_anim_t * a, lv_anim_deleted_cb_t deleted_cb); /** * Make the animation to play back to when the forward direction is ready * @param a pointer to an initialized `lv_anim_t` variable * @param time the duration of the playback animation in milliseconds. 0: disable playback */ -static inline void lv_anim_set_playback_duration(lv_anim_t * a, uint32_t duration) -{ - a->playback_duration = duration; -} +void lv_anim_set_playback_duration(lv_anim_t * a, uint32_t duration); /** * Legacy `lv_anim_set_playback_time` API will be removed soon, use `lv_anim_set_playback_duration` instead. */ -static inline void lv_anim_set_playback_time(lv_anim_t * a, uint32_t duration) -{ - lv_anim_set_playback_duration(a, duration); -} +void lv_anim_set_playback_time(lv_anim_t * a, uint32_t duration); /** * Make the animation to play back to when the forward direction is ready * @param a pointer to an initialized `lv_anim_t` variable * @param delay delay in milliseconds before starting the playback animation. */ -static inline void lv_anim_set_playback_delay(lv_anim_t * a, uint32_t delay) -{ - a->playback_delay = delay; -} +void lv_anim_set_playback_delay(lv_anim_t * a, uint32_t delay); /** * Make the animation repeat itself. * @param a pointer to an initialized `lv_anim_t` variable * @param cnt repeat count or `LV_ANIM_REPEAT_INFINITE` for infinite repetition. 0: to disable repetition. */ -static inline void lv_anim_set_repeat_count(lv_anim_t * a, uint32_t cnt) -{ - a->repeat_cnt = cnt; -} +void lv_anim_set_repeat_count(lv_anim_t * a, uint32_t cnt); /** * Set a delay before repeating the animation. * @param a pointer to an initialized `lv_anim_t` variable * @param delay delay in milliseconds before repeating the animation. */ -static inline void lv_anim_set_repeat_delay(lv_anim_t * a, uint32_t delay) -{ - a->repeat_delay = delay; -} +void lv_anim_set_repeat_delay(lv_anim_t * a, uint32_t delay); /** * Set a whether the animation's should be applied immediately or only when the delay expired. @@ -365,20 +295,14 @@ static inline void lv_anim_set_repeat_delay(lv_anim_t * a, uint32_t delay) * @param en true: apply the start value immediately in `lv_anim_start`; * false: apply the start value only when `delay` ms is elapsed and the animations really starts */ -static inline void lv_anim_set_early_apply(lv_anim_t * a, bool en) -{ - a->early_apply = en; -} +void lv_anim_set_early_apply(lv_anim_t * a, bool en); /** * Set the custom user data field of the animation. * @param a pointer to an initialized `lv_anim_t` variable * @param user_data pointer to the new user_data. */ -static inline void lv_anim_set_user_data(lv_anim_t * a, void * user_data) -{ - a->user_data = user_data; -} +void lv_anim_set_user_data(lv_anim_t * a, void * user_data); /** * Set parameter for cubic bezier path @@ -387,15 +311,7 @@ static inline void lv_anim_set_user_data(lv_anim_t * a, void * user_data) * @param y1 * @param y1 second control point */ -static inline void lv_anim_set_bezier3_param(lv_anim_t * a, int16_t x1, int16_t y1, int16_t x2, int16_t y2) -{ - struct _lv_anim_bezier3_para_t * para = &a->parameter.bezier3; - - para->x1 = x1; - para->x2 = x2; - para->y1 = y1; - para->y2 = y2; -} +void lv_anim_set_bezier3_param(lv_anim_t * a, int16_t x1, int16_t y1, int16_t x2, int16_t y2); /** * Create an animation @@ -409,10 +325,7 @@ lv_anim_t * lv_anim_start(const lv_anim_t * a); * @param a pointer to an initialized `lv_anim_t` variable * @return delay before the animation in milliseconds */ -static inline uint32_t lv_anim_get_delay(const lv_anim_t * a) -{ - return -a->act_time; -} +uint32_t lv_anim_get_delay(const lv_anim_t * a); /** * Get the time used to play the animation. @@ -426,30 +339,21 @@ uint32_t lv_anim_get_playtime(const lv_anim_t * a); * @param a pointer to an initialized `lv_anim_t` variable * @return the duration of the animation in milliseconds */ -static inline uint32_t lv_anim_get_time(const lv_anim_t * a) -{ - return a->duration; -} +uint32_t lv_anim_get_time(const lv_anim_t * a); /** * Get the repeat count of the animation. * @param a pointer to an initialized `lv_anim_t` variable * @return the repeat count or `LV_ANIM_REPEAT_INFINITE` for infinite repetition. 0: disabled repetition. */ -static inline uint32_t lv_anim_get_repeat_count(const lv_anim_t * a) -{ - return a->repeat_cnt; -} +uint32_t lv_anim_get_repeat_count(const lv_anim_t * a); /** * Get the user_data field of the animation * @param a pointer to an initialized `lv_anim_t` variable * @return the pointer to the custom user_data of the animation */ -static inline void * lv_anim_get_user_data(const lv_anim_t * a) -{ - return a->user_data; -} +void * lv_anim_get_user_data(const lv_anim_t * a); /** * Delete animation(s) of a variable with a given animator function @@ -490,10 +394,7 @@ lv_timer_t * lv_anim_get_timer(void); * or NULL to ignore it and delete all the animations of 'var * @return true: at least 1 animation is deleted, false: no animation is deleted */ -static inline bool lv_anim_custom_delete(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb) -{ - return lv_anim_delete(a ? a->var : NULL, (lv_anim_exec_xcb_t)exec_cb); -} +bool lv_anim_custom_delete(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb); /** * Get the animation of a variable and its `exec_cb`. @@ -504,10 +405,7 @@ static inline bool lv_anim_custom_delete(lv_anim_t * a, lv_anim_custom_exec_cb_t * @param exec_cb a function pointer which is animating 'var', or NULL to return first matching 'var' * @return pointer to the animation. */ -static inline lv_anim_t * lv_anim_custom_get(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb) -{ - return lv_anim_get(a ? a->var : NULL, (lv_anim_exec_xcb_t)exec_cb); -} +lv_anim_t * lv_anim_custom_get(lv_anim_t * a, lv_anim_custom_exec_cb_t exec_cb); /** * Get the number of currently running animations diff --git a/src/misc/lv_anim_private.h b/src/misc/lv_anim_private.h new file mode 100644 index 000000000..5c2585017 --- /dev/null +++ b/src/misc/lv_anim_private.h @@ -0,0 +1,56 @@ +/** + * @file lv_anim_private.h + * + */ + +#ifndef LV_ANIM_PRIVATE_H +#define LV_ANIM_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_anim.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + bool anim_list_changed; + bool anim_run_round; + lv_timer_t * timer; + lv_ll_t anim_ll; +} lv_anim_state_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Init the animation module + */ +void lv_anim_core_init(void); + +/** + * Deinit the animation module + */ +void lv_anim_core_deinit(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ANIM_PRIVATE_H*/ diff --git a/src/misc/lv_anim_timeline.c b/src/misc/lv_anim_timeline.c index d2e6dff36..c1d4a6fce 100644 --- a/src/misc/lv_anim_timeline.c +++ b/src/misc/lv_anim_timeline.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "lv_anim_private.h" #include "lv_assert.h" #include "lv_anim_timeline.h" #include "../stdlib/lv_mem.h" @@ -27,7 +28,7 @@ typedef struct { } lv_anim_timeline_dsc_t; /*Data of anim_timeline*/ -struct _lv_anim_timeline_t { +struct lv_anim_timeline_t { lv_anim_timeline_dsc_t * anim_dsc; /**< Dynamically allocated anim dsc array*/ uint32_t anim_dsc_cnt; /**< The length of anim dsc array*/ uint32_t act_time; /**< Current time of the animation*/ diff --git a/src/misc/lv_anim_timeline.h b/src/misc/lv_anim_timeline.h index dd2707041..7449a6a6b 100644 --- a/src/misc/lv_anim_timeline.h +++ b/src/misc/lv_anim_timeline.h @@ -25,7 +25,7 @@ extern "C" { * TYPEDEFS **********************/ -typedef struct _lv_anim_timeline_t lv_anim_timeline_t; +typedef struct lv_anim_timeline_t lv_anim_timeline_t; /********************** * GLOBAL PROTOTYPES diff --git a/src/misc/lv_area.c b/src/misc/lv_area.c index 3cfd12144..4410076d6 100644 --- a/src/misc/lv_area.c +++ b/src/misc/lv_area.c @@ -9,7 +9,7 @@ #include "../lv_conf_internal.h" #include "../core/lv_global.h" -#include "lv_area.h" +#include "lv_area_private.h" #include "lv_math.h" /********************* @@ -56,7 +56,7 @@ void lv_area_set_height(lv_area_t * area_p, int32_t h) area_p->y2 = area_p->y1 + h - 1; } -void _lv_area_set_pos(lv_area_t * area_p, int32_t x, int32_t y) +void lv_area_set_pos(lv_area_t * area_p, int32_t x, int32_t y) { int32_t w = lv_area_get_width(area_p); int32_t h = lv_area_get_height(area_p); @@ -91,7 +91,7 @@ void lv_area_move(lv_area_t * area, int32_t x_ofs, int32_t y_ofs) area->y2 += y_ofs; } -bool _lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p) +bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p) { /*Get the smaller area from 'a1_p' and 'a2_p'*/ res_p->x1 = LV_MAX(a1_p->x1, a2_p->x1); @@ -108,13 +108,13 @@ bool _lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area return union_ok; } -int8_t _lv_area_diff(lv_area_t res_p[], const lv_area_t * a1_p, const lv_area_t * a2_p) +int8_t lv_area_diff(lv_area_t res_p[], const lv_area_t * a1_p, const lv_area_t * a2_p) { /*Areas have no common parts*/ - if(!_lv_area_is_on(a1_p, a2_p)) return -1; + if(!lv_area_is_on(a1_p, a2_p)) return -1; /*No remaining areas after removing common parts*/ - if(_lv_area_is_in(a1_p, a2_p, 0)) return 0; + if(lv_area_is_in(a1_p, a2_p, 0)) return 0; /*Result counter*/ int8_t res_c = 0; @@ -173,7 +173,7 @@ int8_t _lv_area_diff(lv_area_t res_p[], const lv_area_t * a1_p, const lv_area_t return res_c; } -void _lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p) +void lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p) { a_res_p->x1 = LV_MIN(a1_p->x1, a2_p->x1); a_res_p->y1 = LV_MIN(a1_p->y1, a2_p->y1); @@ -181,7 +181,7 @@ void _lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t a_res_p->y2 = LV_MAX(a1_p->y2, a2_p->y2); } -bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, int32_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; @@ -208,7 +208,7 @@ bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, int32_t corner_area.x2 = a_p->x1 + radius; corner_area.y1 = a_p->y1; corner_area.y2 = a_p->y1 + radius; - if(_lv_area_is_point_on(&corner_area, p_p, 0)) { + if(lv_area_is_point_on(&corner_area, p_p, 0)) { corner_area.x2 += radius; corner_area.y2 += radius; return lv_point_within_circle(&corner_area, p_p); @@ -216,7 +216,7 @@ bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, int32_t /*Bottom left*/ corner_area.y1 = a_p->y2 - radius; corner_area.y2 = a_p->y2; - if(_lv_area_is_point_on(&corner_area, p_p, 0)) { + if(lv_area_is_point_on(&corner_area, p_p, 0)) { corner_area.x2 += radius; corner_area.y1 -= radius; return lv_point_within_circle(&corner_area, p_p); @@ -224,7 +224,7 @@ bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, int32_t /*Bottom right*/ corner_area.x1 = a_p->x2 - radius; corner_area.x2 = a_p->x2; - if(_lv_area_is_point_on(&corner_area, p_p, 0)) { + if(lv_area_is_point_on(&corner_area, p_p, 0)) { corner_area.x1 -= radius; corner_area.y1 -= radius; return lv_point_within_circle(&corner_area, p_p); @@ -232,7 +232,7 @@ bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, int32_t /*Top right*/ corner_area.y1 = a_p->y1; corner_area.y2 = a_p->y1 + radius; - if(_lv_area_is_point_on(&corner_area, p_p, 0)) { + if(lv_area_is_point_on(&corner_area, p_p, 0)) { corner_area.x1 -= radius; corner_area.y2 += radius; return lv_point_within_circle(&corner_area, p_p); @@ -241,7 +241,7 @@ bool _lv_area_is_point_on(const lv_area_t * a_p, const lv_point_t * p_p, int32_t return true; } -bool _lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p) +bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p) { if((a1_p->x1 <= a2_p->x2) && (a1_p->x2 >= a2_p->x1) && (a1_p->y1 <= a2_p->y2) && (a1_p->y2 >= a2_p->y1)) { return true; @@ -251,7 +251,7 @@ bool _lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p) } } -bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, int32_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; @@ -267,21 +267,21 @@ bool _lv_area_is_in(const lv_area_t * ain_p, const lv_area_t * aholder_p, int32_ lv_point_t p; lv_point_set(&p, ain_p->x1, ain_p->y1); - if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; + if(lv_area_is_point_on(aholder_p, &p, radius) == false) return false; lv_point_set(&p, ain_p->x2, ain_p->y1); - if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; + if(lv_area_is_point_on(aholder_p, &p, radius) == false) return false; lv_point_set(&p, ain_p->x1, ain_p->y2); - if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; + if(lv_area_is_point_on(aholder_p, &p, radius) == false) return false; lv_point_set(&p, ain_p->x2, ain_p->y2); - if(_lv_area_is_point_on(aholder_p, &p, radius) == false) return false; + if(lv_area_is_point_on(aholder_p, &p, radius) == false) return false; return true; } -bool _lv_area_is_out(const lv_area_t * aout_p, const lv_area_t * aholder_p, int32_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) { @@ -294,21 +294,21 @@ bool _lv_area_is_out(const lv_area_t * aout_p, const lv_area_t * aholder_p, int3 lv_point_t p; lv_point_set(&p, aout_p->x1, aout_p->y1); - if(_lv_area_is_point_on(aholder_p, &p, radius)) return false; + if(lv_area_is_point_on(aholder_p, &p, radius)) return false; lv_point_set(&p, aout_p->x2, aout_p->y1); - if(_lv_area_is_point_on(aholder_p, &p, radius)) return false; + if(lv_area_is_point_on(aholder_p, &p, radius)) return false; lv_point_set(&p, aout_p->x1, aout_p->y2); - if(_lv_area_is_point_on(aholder_p, &p, radius)) return false; + if(lv_area_is_point_on(aholder_p, &p, radius)) return false; lv_point_set(&p, aout_p->x2, aout_p->y2); - if(_lv_area_is_point_on(aholder_p, &p, radius)) return false; + if(lv_area_is_point_on(aholder_p, &p, radius)) return false; return true; } -bool _lv_area_is_equal(const lv_area_t * a, const lv_area_t * b) +bool lv_area_is_equal(const lv_area_t * a, const lv_area_t * b) { return a->x1 == b->x1 && a->x2 == b->x2 && a->y1 == b->y1 && a->y2 == b->y2; } @@ -438,7 +438,7 @@ void lv_area_align(const lv_area_t * base, lv_area_t * to_align, lv_align_t alig to_align->y2 = to_align->y1 + h - 1; } -#define _LV_TRANSFORM_TRIGO_SHIFT 10 +#define LV_TRANSFORM_TRIGO_SHIFT 10 void lv_point_transform(lv_point_t * point, int32_t angle, int32_t scale_x, int32_t scale_y, const lv_point_t * pivot, bool zoom_first) @@ -483,32 +483,100 @@ void lv_point_array_transform(lv_point_t * points, size_t count, int32_t angle, int32_t c2 = lv_trigo_sin(angle_high + 90); int32_t sinma = (s1 * (10 - angle_rem) + s2 * angle_rem) / 10; - sinma = sinma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT); + sinma = sinma >> (LV_TRIGO_SHIFT - LV_TRANSFORM_TRIGO_SHIFT); int32_t cosma = (c1 * (10 - angle_rem) + c2 * angle_rem) / 10; - cosma = cosma >> (LV_TRIGO_SHIFT - _LV_TRANSFORM_TRIGO_SHIFT); + cosma = cosma >> (LV_TRIGO_SHIFT - LV_TRANSFORM_TRIGO_SHIFT); for(i = 0; i < count; i++) { int32_t x = points[i].x; int32_t y = points[i].y; if(scale_x == 256 && scale_y == 256) { - points[i].x = ((cosma * x - sinma * y) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->x; - points[i].y = ((sinma * x + cosma * y) >> _LV_TRANSFORM_TRIGO_SHIFT) + pivot->y; + points[i].x = ((cosma * x - sinma * y) >> LV_TRANSFORM_TRIGO_SHIFT) + pivot->x; + points[i].y = ((sinma * x + cosma * y) >> LV_TRANSFORM_TRIGO_SHIFT) + pivot->y; } else { if(zoom_first) { x *= scale_x; y *= scale_y; - points[i].x = (((cosma * x - sinma * y)) >> (_LV_TRANSFORM_TRIGO_SHIFT + 8)) + pivot->x; - points[i].y = (((sinma * x + cosma * y)) >> (_LV_TRANSFORM_TRIGO_SHIFT + 8)) + pivot->y; + points[i].x = (((cosma * x - sinma * y)) >> (LV_TRANSFORM_TRIGO_SHIFT + 8)) + pivot->x; + points[i].y = (((sinma * x + cosma * y)) >> (LV_TRANSFORM_TRIGO_SHIFT + 8)) + pivot->y; } else { - points[i].x = (((cosma * x - sinma * y) * scale_x) >> (_LV_TRANSFORM_TRIGO_SHIFT + 8)) + pivot->x; - points[i].y = (((sinma * x + cosma * y) * scale_y) >> (_LV_TRANSFORM_TRIGO_SHIFT + 8)) + pivot->y; + points[i].x = (((cosma * x - sinma * y) * scale_x) >> (LV_TRANSFORM_TRIGO_SHIFT + 8)) + pivot->x; + points[i].y = (((sinma * x + cosma * y) * scale_y) >> (LV_TRANSFORM_TRIGO_SHIFT + 8)) + pivot->y; } } } } +int32_t lv_area_get_width(const lv_area_t * area_p) +{ + return (int32_t)(area_p->x2 - area_p->x1 + 1); +} + +int32_t lv_area_get_height(const lv_area_t * area_p) +{ + return (int32_t)(area_p->y2 - area_p->y1 + 1); +} + +lv_point_t lv_point_from_precise(const lv_point_precise_t * p) +{ + lv_point_t point = { + (int32_t)p->x, (int32_t)p->y + }; + + return point; +} + +lv_point_precise_t lv_point_to_precise(const lv_point_t * p) +{ + lv_point_precise_t point = { + (lv_value_precise_t)p->x, (lv_value_precise_t)p->y + }; + + return point; +} + +void lv_point_set(lv_point_t * p, int32_t x, int32_t y) +{ + p->x = x; + p->y = y; +} + +void lv_point_precise_set(lv_point_precise_t * p, lv_value_precise_t x, lv_value_precise_t y) +{ + p->x = x; + p->y = y; +} + +void lv_point_swap(lv_point_t * p1, lv_point_t * p2) +{ + lv_point_t tmp = *p1; + *p1 = *p2; + *p2 = tmp; +} + +void lv_point_precise_swap(lv_point_precise_t * p1, lv_point_precise_t * p2) +{ + lv_point_precise_t tmp = *p1; + *p1 = *p2; + *p2 = tmp; +} + +int32_t lv_pct(int32_t x) +{ + return LV_PCT(x); +} + +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; + } + + return v; +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/misc/lv_area.h b/src/misc/lv_area.h index 9a0c8a847..1b0d80ba8 100644 --- a/src/misc/lv_area.h +++ b/src/misc/lv_area.h @@ -48,7 +48,7 @@ typedef struct { /** Alignments*/ -enum _lv_align_t { +typedef enum { LV_ALIGN_DEFAULT = 0, LV_ALIGN_TOP_LEFT, LV_ALIGN_TOP_MID, @@ -72,15 +72,9 @@ enum _lv_align_t { LV_ALIGN_OUT_RIGHT_TOP, LV_ALIGN_OUT_RIGHT_MID, LV_ALIGN_OUT_RIGHT_BOTTOM, -}; +} lv_align_t; -#ifdef DOXYGEN -typedef _lv_align_t lv_align_t; -#else -typedef uint8_t lv_align_t; -#endif /*DOXYGEN*/ - -enum _lv_dir_t { +typedef enum { LV_DIR_NONE = 0x00, LV_DIR_LEFT = (1 << 0), LV_DIR_RIGHT = (1 << 1), @@ -89,13 +83,7 @@ enum _lv_dir_t { LV_DIR_HOR = LV_DIR_LEFT | LV_DIR_RIGHT, LV_DIR_VER = LV_DIR_TOP | LV_DIR_BOTTOM, LV_DIR_ALL = LV_DIR_HOR | LV_DIR_VER, -}; - -#ifdef DOXYGEN -typedef _lv_dir_t lv_dir_t; -#else -typedef uint8_t lv_dir_t; -#endif /*DOXYGEN*/ +} lv_dir_t; /********************** * GLOBAL PROTOTYPES @@ -129,20 +117,14 @@ 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 int32_t lv_area_get_width(const lv_area_t * area_p) -{ - return (int32_t)(area_p->x2 - area_p->x1 + 1); -} +int32_t lv_area_get_width(const lv_area_t * area_p); /** * Get the height of an area * @param area_p pointer to an area * @return the height of the area (if y1 == y2 -> height = 1) */ -static inline int32_t lv_area_get_height(const lv_area_t * area_p) -{ - return (int32_t)(area_p->y2 - area_p->y1 + 1); -} +int32_t lv_area_get_height(const lv_area_t * area_p); /** * Set the width of an area @@ -159,14 +141,6 @@ void lv_area_set_width(lv_area_t * area_p, int32_t w); 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) - * @param area_p pointer to an area - * @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, int32_t x, int32_t y); - -/** * Return with area of an area (x * y) * @param area_p pointer to an area * @return size of area @@ -178,74 +152,6 @@ void lv_area_increase(lv_area_t * area, int32_t w_extra, int32_t h_extra); void lv_area_move(lv_area_t * area, int32_t x_ofs, int32_t y_ofs); /** - * Get the common parts of two areas - * @param res_p pointer to an area, the result will be stored her - * @param a1_p pointer to the first area - * @param a2_p pointer to the second area - * @return false: the two area has NO common parts, res_p is invalid - */ -bool _lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p); - -/** - * Get resulting sub areas after removing the common parts of two areas from the first area - * @param res_p pointer to an array of areas with a count of 4, the resulting areas will be stored here - * @param a1_p pointer to the first area - * @param a2_p pointer to the second area - * @return number of results (max 4) or -1 if no intersect - */ -int8_t _lv_area_diff(lv_area_t res_p[], const lv_area_t * a1_p, const lv_area_t * a2_p); - -/** - * Join two areas into a third which involves the other two - * @param a_res_p pointer to an area, the result will be stored here - * @param a1_p pointer to the first area - * @param a2_p pointer to the second area - */ -void _lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p); - -/** - * Check if a point is on an area - * @param a_p pointer to an area - * @param p_p pointer to a point - * @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, int32_t radius); - -/** - * Check if two area has common parts - * @param a1_p pointer to an area. - * @param a2_p pointer to another area - * @return false: a1_p and a2_p has no common parts - */ -bool _lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p); - -/** - * Check if an area is fully on another - * @param ain_p pointer to an area which could be in 'aholder_p' - * @param aholder_p pointer to an area which could involve 'ain_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, int32_t radius); - -/** - * Check if an area is fully out of another - * @param aout_p pointer to an area which could be in 'aholder_p' - * @param aholder_p pointer to an area which could involve 'ain_p' - * @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, int32_t radius); - -/** - * Check if 2 area is the same - * @param a pointer to an area - * @param b pointer to another area - */ -bool _lv_area_is_equal(const lv_area_t * a, const lv_area_t * b); - -/** * Align an area to another * @param base an area where the other will be aligned * @param to_align the area to align @@ -281,83 +187,51 @@ void lv_point_array_transform(lv_point_t * points, size_t count, int32_t angle, const lv_point_t * pivot, bool zoom_first); -static inline lv_point_t lv_point_from_precise(const lv_point_precise_t * p) -{ - lv_point_t point = { - (int32_t)p->x, (int32_t)p->y - }; - - return point; -} +lv_point_t lv_point_from_precise(const lv_point_precise_t * p); -static inline lv_point_precise_t lv_point_to_precise(const lv_point_t * p) -{ - lv_point_precise_t point = { - (lv_value_precise_t)p->x, (lv_value_precise_t)p->y - }; - - return point; -} +lv_point_precise_t lv_point_to_precise(const lv_point_t * p); -static inline void lv_point_set(lv_point_t * p, int32_t x, int32_t y) -{ - p->x = x; - p->y = y; -} +void lv_point_set(lv_point_t * p, int32_t x, int32_t y); -static inline void lv_point_precise_set(lv_point_precise_t * p, lv_value_precise_t x, lv_value_precise_t y) -{ - p->x = x; - p->y = y; -} +void lv_point_precise_set(lv_point_precise_t * p, lv_value_precise_t x, lv_value_precise_t y); -static inline void lv_point_swap(lv_point_t * p1, lv_point_t * p2) -{ - lv_point_t tmp = *p1; - *p1 = *p2; - *p2 = tmp; -} +void lv_point_swap(lv_point_t * p1, lv_point_t * p2); -static inline void lv_point_precise_swap(lv_point_precise_t * p1, lv_point_precise_t * p2) -{ - lv_point_precise_t tmp = *p1; - *p1 = *p2; - *p2 = tmp; -} +void lv_point_precise_swap(lv_point_precise_t * p1, lv_point_precise_t * p2); /********************** * MACROS **********************/ -#define _LV_COORD_TYPE_SHIFT (29U) +#define LV_COORD_TYPE_SHIFT (29U) -#define _LV_COORD_TYPE_MASK (3 << _LV_COORD_TYPE_SHIFT) -#define _LV_COORD_TYPE(x) ((x) & _LV_COORD_TYPE_MASK) /*Extract type specifiers*/ -#define _LV_COORD_PLAIN(x) ((x) & ~_LV_COORD_TYPE_MASK) /*Remove type specifiers*/ +#define LV_COORD_TYPE_MASK (3 << LV_COORD_TYPE_SHIFT) +#define LV_COORD_TYPE(x) ((x) & LV_COORD_TYPE_MASK) /*Extract type specifiers*/ +#define LV_COORD_PLAIN(x) ((x) & ~LV_COORD_TYPE_MASK) /*Remove type specifiers*/ -#define _LV_COORD_TYPE_PX (0 << _LV_COORD_TYPE_SHIFT) -#define _LV_COORD_TYPE_SPEC (1 << _LV_COORD_TYPE_SHIFT) -#define _LV_COORD_TYPE_PX_NEG (3 << _LV_COORD_TYPE_SHIFT) +#define LV_COORD_TYPE_PX (0 << LV_COORD_TYPE_SHIFT) +#define LV_COORD_TYPE_SPEC (1 << LV_COORD_TYPE_SHIFT) +#define LV_COORD_TYPE_PX_NEG (3 << LV_COORD_TYPE_SHIFT) -#define LV_COORD_IS_PX(x) (_LV_COORD_TYPE(x) == _LV_COORD_TYPE_PX || _LV_COORD_TYPE(x) == _LV_COORD_TYPE_PX_NEG) -#define LV_COORD_IS_SPEC(x) (_LV_COORD_TYPE(x) == _LV_COORD_TYPE_SPEC) +#define LV_COORD_IS_PX(x) (LV_COORD_TYPE(x) == LV_COORD_TYPE_PX || LV_COORD_TYPE(x) == LV_COORD_TYPE_PX_NEG) +#define LV_COORD_IS_SPEC(x) (LV_COORD_TYPE(x) == LV_COORD_TYPE_SPEC) -#define LV_COORD_SET_SPEC(x) ((x) | _LV_COORD_TYPE_SPEC) +#define LV_COORD_SET_SPEC(x) ((x) | LV_COORD_TYPE_SPEC) /*Max coordinate value*/ -#define LV_COORD_MAX ((1 << _LV_COORD_TYPE_SHIFT) - 1) +#define LV_COORD_MAX ((1 << LV_COORD_TYPE_SHIFT) - 1) #define LV_COORD_MIN (-LV_COORD_MAX) /*Special coordinates*/ #define LV_SIZE_CONTENT LV_COORD_SET_SPEC(LV_COORD_MAX) -#define _LV_PCT_STORED_MAX (LV_COORD_MAX - 1) -#if _LV_PCT_STORED_MAX % 2 != 0 -#error _LV_PCT_STORED_MAX should be an even number +#define LV_PCT_STORED_MAX (LV_COORD_MAX - 1) +#if LV_PCT_STORED_MAX % 2 != 0 +#error LV_PCT_STORED_MAX should be an even number #endif -#define _LV_PCT_POS_MAX (_LV_PCT_STORED_MAX / 2) -#define LV_PCT(x) (LV_COORD_SET_SPEC(((x) < 0 ? (_LV_PCT_POS_MAX - LV_MAX((x), -_LV_PCT_POS_MAX)) : LV_MIN((x), _LV_PCT_POS_MAX)))) -#define LV_COORD_IS_PCT(x) ((LV_COORD_IS_SPEC(x) && _LV_COORD_PLAIN(x) <= _LV_PCT_STORED_MAX)) -#define LV_COORD_GET_PCT(x) (_LV_COORD_PLAIN(x) > _LV_PCT_POS_MAX ? _LV_PCT_POS_MAX - _LV_COORD_PLAIN(x) : _LV_COORD_PLAIN(x)) +#define LV_PCT_POS_MAX (LV_PCT_STORED_MAX / 2) +#define LV_PCT(x) (LV_COORD_SET_SPEC(((x) < 0 ? (LV_PCT_POS_MAX - LV_MAX((x), -LV_PCT_POS_MAX)) : LV_MIN((x), LV_PCT_POS_MAX)))) +#define LV_COORD_IS_PCT(x) ((LV_COORD_IS_SPEC(x) && LV_COORD_PLAIN(x) <= LV_PCT_STORED_MAX)) +#define LV_COORD_GET_PCT(x) (LV_COORD_PLAIN(x) > LV_PCT_POS_MAX ? LV_PCT_POS_MAX - LV_COORD_PLAIN(x) : LV_COORD_PLAIN(x)) LV_EXPORT_CONST_INT(LV_COORD_MAX); LV_EXPORT_CONST_INT(LV_COORD_MIN); @@ -369,19 +243,9 @@ LV_EXPORT_CONST_INT(LV_SIZE_CONTENT); * @param x the percentage (0..1000) * @return a coordinate that stores the percentage */ -static inline int32_t lv_pct(int32_t x) -{ - return LV_PCT(x); -} +int32_t lv_pct(int32_t x); -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; - } - - return v; -} +int32_t lv_pct_to_px(int32_t v, int32_t base); #ifdef __cplusplus } /*extern "C"*/ diff --git a/src/misc/lv_area_private.h b/src/misc/lv_area_private.h new file mode 100644 index 000000000..bebca5940 --- /dev/null +++ b/src/misc/lv_area_private.h @@ -0,0 +1,115 @@ +/** + * @file lv_area_private.h + * + */ + +#ifndef LV_AREA_PRIVATE_H +#define LV_AREA_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_area.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Set the position of an area (width and height will be kept) + * @param area_p pointer to an area + * @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, int32_t x, int32_t y); + +/** + * Get the common parts of two areas + * @param res_p pointer to an area, the result will be stored her + * @param a1_p pointer to the first area + * @param a2_p pointer to the second area + * @return false: the two area has NO common parts, res_p is invalid + */ +bool lv_area_intersect(lv_area_t * res_p, const lv_area_t * a1_p, const lv_area_t * a2_p); + +/** + * Get resulting sub areas after removing the common parts of two areas from the first area + * @param res_p pointer to an array of areas with a count of 4, the resulting areas will be stored here + * @param a1_p pointer to the first area + * @param a2_p pointer to the second area + * @return number of results (max 4) or -1 if no intersect + */ +int8_t lv_area_diff(lv_area_t res_p[], const lv_area_t * a1_p, const lv_area_t * a2_p); + +/** + * Join two areas into a third which involves the other two + * @param a_res_p pointer to an area, the result will be stored here + * @param a1_p pointer to the first area + * @param a2_p pointer to the second area + */ +void lv_area_join(lv_area_t * a_res_p, const lv_area_t * a1_p, const lv_area_t * a2_p); + +/** + * Check if a point is on an area + * @param a_p pointer to an area + * @param p_p pointer to a point + * @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, int32_t radius); + +/** + * Check if two area has common parts + * @param a1_p pointer to an area. + * @param a2_p pointer to another area + * @return false: a1_p and a2_p has no common parts + */ +bool lv_area_is_on(const lv_area_t * a1_p, const lv_area_t * a2_p); + +/** + * Check if an area is fully on another + * @param ain_p pointer to an area which could be in 'aholder_p' + * @param aholder_p pointer to an area which could involve 'ain_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, int32_t radius); + +/** + * Check if an area is fully out of another + * @param aout_p pointer to an area which could be in 'aholder_p' + * @param aholder_p pointer to an area which could involve 'ain_p' + * @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, int32_t radius); + +/** + * Check if 2 area is the same + * @param a pointer to an area + * @param b pointer to another area + */ +bool lv_area_is_equal(const lv_area_t * a, const lv_area_t * b); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_AREA_PRIVATE_H*/ diff --git a/src/misc/lv_array.c b/src/misc/lv_array.c index 5de604b45..39382bcbf 100644 --- a/src/misc/lv_array.c +++ b/src/misc/lv_array.c @@ -181,3 +181,42 @@ lv_result_t lv_array_assign(lv_array_t * array, uint32_t index, const void * val lv_memcpy(data, value, array->element_size); return LV_RESULT_OK; } + +uint32_t lv_array_size(const lv_array_t * array) +{ + return array->size; +} + +uint32_t lv_array_capacity(const lv_array_t * array) +{ + return array->capacity; +} + +bool lv_array_is_empty(const lv_array_t * array) +{ + return array->size == 0; +} + +bool lv_array_is_full(const lv_array_t * array) +{ + return array->size == array->capacity; +} + +void lv_array_clear(lv_array_t * array) +{ + array->size = 0; +} + +void * lv_array_front(const lv_array_t * array) +{ + return lv_array_at(array, 0); +} + +void * lv_array_back(const lv_array_t * array) +{ + return lv_array_at(array, lv_array_size(array) - 1); +} + +/********************** + * STATIC FUNCTIONS + **********************/ diff --git a/src/misc/lv_array.h b/src/misc/lv_array.h index a32490913..e63f56318 100644 --- a/src/misc/lv_array.h +++ b/src/misc/lv_array.h @@ -70,40 +70,28 @@ void lv_array_deinit(lv_array_t * array); * @param array pointer to an `lv_array_t` variable * @return the number of elements stored in the array */ -static inline uint32_t lv_array_size(const lv_array_t * array) -{ - return array->size; -} +uint32_t lv_array_size(const lv_array_t * array); /** * Return the capacity of the array, i.e. how many elements can be stored. * @param array pointer to an `lv_array_t` variable * @return the capacity of the array */ -static inline uint32_t lv_array_capacity(const lv_array_t * array) -{ - return array->capacity; -} +uint32_t lv_array_capacity(const lv_array_t * array); /** * Return if the array is empty * @param array pointer to an `lv_array_t` variable * @return true: array is empty; false: array is not empty */ -static inline bool lv_array_is_empty(const lv_array_t * array) -{ - return array->size == 0; -} +bool lv_array_is_empty(const lv_array_t * array); /** * Return if the array is full * @param array pointer to an `lv_array_t` variable * @return true: array is full; false: array is not full */ -static inline bool lv_array_is_full(const lv_array_t * array) -{ - return array->size == array->capacity; -} +bool lv_array_is_full(const lv_array_t * array); /** * Copy an array to another. @@ -117,10 +105,7 @@ void lv_array_copy(lv_array_t * target, const lv_array_t * source); * Remove all elements in array. * @param array pointer to an `lv_array_t` variable */ -static inline void lv_array_clear(lv_array_t * array) -{ - array->size = 0; -} +void lv_array_clear(lv_array_t * array); /** * Shrink the memory capacity of array if necessary. @@ -187,19 +172,13 @@ void * lv_array_at(const lv_array_t * array, uint32_t index); * @param array pointer to an `lv_array_t` variable * @return a pointer to the first element in the array */ -static inline void * lv_array_front(const lv_array_t * array) -{ - return lv_array_at(array, 0); -} +void * lv_array_front(const lv_array_t * array); /** * Returns a pointer to the last element in the array. * @param array pointer to an `lv_array_t` variable */ -static inline void * lv_array_back(const lv_array_t * array) -{ - return lv_array_at(array, lv_array_size(array) - 1); -} +void * lv_array_back(const lv_array_t * array); /********************** * MACROS diff --git a/src/misc/lv_async.c b/src/misc/lv_async.c index 591d2303f..e1657aeb4 100644 --- a/src/misc/lv_async.c +++ b/src/misc/lv_async.c @@ -8,7 +8,7 @@ *********************/ #include "lv_async.h" -#include "lv_timer.h" +#include "lv_timer_private.h" #include "../stdlib/lv_mem.h" /********************* @@ -19,7 +19,7 @@ * TYPEDEFS **********************/ -typedef struct _lv_async_info_t { +typedef struct lv_async_info_t { lv_async_cb_t cb; void * user_data; } lv_async_info_t; diff --git a/src/misc/lv_bidi.c b/src/misc/lv_bidi.c index f3a0f7489..44f014e28 100644 --- a/src/misc/lv_bidi.c +++ b/src/misc/lv_bidi.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_bidi.h" +#include "lv_bidi_private.h" #include "lv_text_private.h" #include "lv_types.h" #include "../stdlib/lv_mem.h" @@ -74,9 +74,9 @@ static const char * custom_neutrals = NULL; * GLOBAL FUNCTIONS **********************/ -void _lv_bidi_process(const char * str_in, char * str_out, lv_base_dir_t base_dir) +void lv_bidi_process(const char * str_in, char * str_out, lv_base_dir_t base_dir) { - if(base_dir == LV_BASE_DIR_AUTO) base_dir = _lv_bidi_detect_base_dir(str_in); + if(base_dir == LV_BASE_DIR_AUTO) base_dir = lv_bidi_detect_base_dir(str_in); uint32_t par_start = 0; uint32_t par_len; @@ -88,7 +88,7 @@ void _lv_bidi_process(const char * str_in, char * str_out, lv_base_dir_t base_di while(str_in[par_start] != '\0') { par_len = lv_bidi_get_next_paragraph(&str_in[par_start]); - _lv_bidi_process_paragraph(&str_in[par_start], &str_out[par_start], par_len, base_dir, NULL, 0); + lv_bidi_process_paragraph(&str_in[par_start], &str_out[par_start], par_len, base_dir, NULL, 0); par_start += par_len; while(str_in[par_start] == '\n' || str_in[par_start] == '\r') { @@ -105,7 +105,7 @@ void _lv_bidi_process(const char * str_in, char * str_out, lv_base_dir_t base_di * @param txt the text to process * @return `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` */ -lv_base_dir_t _lv_bidi_detect_base_dir(const char * txt) +lv_base_dir_t lv_bidi_detect_base_dir(const char * txt) { uint32_t i = 0; uint32_t letter; @@ -122,8 +122,8 @@ lv_base_dir_t _lv_bidi_detect_base_dir(const char * txt) else return LV_BIDI_BASE_DIR_DEF; } -uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_base_dir_t base_dir, - uint32_t visual_pos, bool * is_rtl) +uint16_t lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_base_dir_t base_dir, + uint32_t visual_pos, bool * is_rtl) { uint32_t pos_conv_len = get_txt_len(str_in, len); char * buf = lv_malloc(len + 1); @@ -137,7 +137,7 @@ uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_ if(bidi_txt) *bidi_txt = buf; - _lv_bidi_process_paragraph(str_in, bidi_txt ? *bidi_txt : NULL, len, base_dir, pos_conv_buf, pos_conv_len); + lv_bidi_process_paragraph(str_in, bidi_txt ? *bidi_txt : NULL, len, base_dir, pos_conv_buf, pos_conv_len); if(is_rtl) *is_rtl = IS_RTL_POS(pos_conv_buf[visual_pos]); @@ -147,8 +147,8 @@ uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_ return res; } -uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_base_dir_t base_dir, - uint32_t logical_pos, bool * is_rtl) +uint16_t lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_base_dir_t base_dir, + uint32_t logical_pos, bool * is_rtl) { uint32_t pos_conv_len = get_txt_len(str_in, len); char * buf = lv_malloc(len + 1); @@ -162,7 +162,7 @@ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t if(bidi_txt) *bidi_txt = buf; - _lv_bidi_process_paragraph(str_in, bidi_txt ? *bidi_txt : NULL, len, base_dir, pos_conv_buf, pos_conv_len); + lv_bidi_process_paragraph(str_in, bidi_txt ? *bidi_txt : NULL, len, base_dir, pos_conv_buf, pos_conv_len); for(uint16_t i = 0; i < pos_conv_len; i++) { if(GET_POS(pos_conv_buf[i]) == logical_pos) { @@ -179,8 +179,8 @@ uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t return (uint16_t) -1; } -void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_base_dir_t base_dir, - uint16_t * pos_conv_out, uint16_t pos_conv_len) +void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_base_dir_t base_dir, + uint16_t * pos_conv_out, uint16_t pos_conv_len) { uint32_t run_len = 0; lv_base_dir_t run_dir; @@ -190,7 +190,7 @@ void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t le uint16_t pos_conv_rd = 0; uint16_t pos_conv_wr; - if(base_dir == LV_BASE_DIR_AUTO) base_dir = _lv_bidi_detect_base_dir(str_in); + if(base_dir == LV_BASE_DIR_AUTO) base_dir = lv_bidi_detect_base_dir(str_in); if(base_dir == LV_BASE_DIR_RTL) { wr = len; pos_conv_wr = pos_conv_len; @@ -274,7 +274,7 @@ void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t le void lv_bidi_calculate_align(lv_text_align_t * align, lv_base_dir_t * base_dir, const char * txt) { - if(*base_dir == LV_BASE_DIR_AUTO) *base_dir = _lv_bidi_detect_base_dir(txt); + if(*base_dir == LV_BASE_DIR_AUTO) *base_dir = lv_bidi_detect_base_dir(txt); if(*align == LV_TEXT_ALIGN_AUTO) { if(*base_dir == LV_BASE_DIR_RTL) *align = LV_TEXT_ALIGN_RIGHT; diff --git a/src/misc/lv_bidi.h b/src/misc/lv_bidi.h index c54edf8d6..b0e5f4e4a 100644 --- a/src/misc/lv_bidi.h +++ b/src/misc/lv_bidi.h @@ -28,20 +28,14 @@ extern "C" { /********************** * TYPEDEFS **********************/ -enum _lv_base_dir_t { +typedef enum { LV_BASE_DIR_LTR = 0x00, LV_BASE_DIR_RTL = 0x01, LV_BASE_DIR_AUTO = 0x02, LV_BASE_DIR_NEUTRAL = 0x20, LV_BASE_DIR_WEAK = 0x21, -}; - -#ifdef DOXYGEN -typedef _lv_base_dir_t lv_base_dir_t; -#else -typedef uint8_t lv_base_dir_t; -#endif /*DOXYGEN*/ +} lv_base_dir_t; /********************** * GLOBAL PROTOTYPES @@ -49,65 +43,6 @@ typedef uint8_t lv_base_dir_t; #if LV_USE_BIDI /** - * Convert a text to get the characters in the correct visual order according to - * Unicode Bidirectional Algorithm - * @param str_in the text to process - * @param str_out store the result here. Has the be `strlen(str_in)` length - * @param base_dir `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` - */ -void _lv_bidi_process(const char * str_in, char * str_out, lv_base_dir_t base_dir); - -/** - * Auto-detect the direction of a text based on the first strong character - * @param txt the text to process - * @return `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` - */ -lv_base_dir_t _lv_bidi_detect_base_dir(const char * txt); - -/** - * Get the logical position of a character in a line - * @param str_in the input string. Can be only one line. - * @param bidi_txt internally the text is bidi processed which buffer can be get here. - * If not required anymore has to freed with `lv_free()` - * Can be `NULL` is unused - * @param len length of the line in character count - * @param base_dir base direction of the text: `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` - * @param visual_pos the visual character position which logical position should be get - * @param is_rtl tell the char at `visual_pos` is RTL or LTR context - * @return the logical character position - */ -uint16_t _lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_base_dir_t base_dir, - uint32_t visual_pos, bool * is_rtl); - -/** - * Get the visual position of a character in a line - * @param str_in the input string. Can be only one line. - * @param bidi_txt internally the text is bidi processed which buffer can be get here. - * If not required anymore has to freed with `lv_free()` - * Can be `NULL` is unused - * @param len length of the line in character count - * @param base_dir base direction of the text: `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` - * @param logical_pos the logical character position which visual position should be get - * @param is_rtl tell the char at `logical_pos` is RTL or LTR context - * @return the visual character position - */ -uint16_t _lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_base_dir_t base_dir, - uint32_t logical_pos, bool * is_rtl); - -/** - * Bidi process a paragraph of text - * @param str_in the string to process - * @param str_out store the result here - * @param len length of the text - * @param base_dir base dir of the text - * @param pos_conv_out an `uint16_t` array to store the related logical position of the character. - * Can be `NULL` is unused - * @param pos_conv_len length of `pos_conv_out` in element count - */ -void _lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_base_dir_t base_dir, - uint16_t * pos_conv_out, uint16_t pos_conv_len); - -/** * Get the real text alignment from the a text alignment, base direction and a text. * @param align LV_TEXT_ALIGN_..., write back the calculated align here (LV_TEXT_ALIGN_LEFT/RIGHT/CENTER) * @param base_dir LV_BASE_DIR_..., write the calculated base dir here (LV_BASE_DIR_LTR/RTL) diff --git a/src/misc/lv_bidi_private.h b/src/misc/lv_bidi_private.h new file mode 100644 index 000000000..d197e4ac4 --- /dev/null +++ b/src/misc/lv_bidi_private.h @@ -0,0 +1,98 @@ +/** + * @file lv_bidi_private.h + * + */ + +#ifndef LV_BIDI_PRIVATE_H +#define LV_BIDI_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_bidi.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Convert a text to get the characters in the correct visual order according to + * Unicode Bidirectional Algorithm + * @param str_in the text to process + * @param str_out store the result here. Has the be `strlen(str_in)` length + * @param base_dir `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` + */ +void lv_bidi_process(const char * str_in, char * str_out, lv_base_dir_t base_dir); + +/** + * Auto-detect the direction of a text based on the first strong character + * @param txt the text to process + * @return `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` + */ +lv_base_dir_t lv_bidi_detect_base_dir(const char * txt); + +/** + * Get the logical position of a character in a line + * @param str_in the input string. Can be only one line. + * @param bidi_txt internally the text is bidi processed which buffer can be get here. + * If not required anymore has to freed with `lv_free()` + * Can be `NULL` is unused + * @param len length of the line in character count + * @param base_dir base direction of the text: `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` + * @param visual_pos the visual character position which logical position should be get + * @param is_rtl tell the char at `visual_pos` is RTL or LTR context + * @return the logical character position + */ +uint16_t lv_bidi_get_logical_pos(const char * str_in, char ** bidi_txt, uint32_t len, lv_base_dir_t base_dir, + uint32_t visual_pos, bool * is_rtl); + +/** + * Get the visual position of a character in a line + * @param str_in the input string. Can be only one line. + * @param bidi_txt internally the text is bidi processed which buffer can be get here. + * If not required anymore has to freed with `lv_free()` + * Can be `NULL` is unused + * @param len length of the line in character count + * @param base_dir base direction of the text: `LV_BASE_DIR_LTR` or `LV_BASE_DIR_RTL` + * @param logical_pos the logical character position which visual position should be get + * @param is_rtl tell the char at `logical_pos` is RTL or LTR context + * @return the visual character position + */ +uint16_t lv_bidi_get_visual_pos(const char * str_in, char ** bidi_txt, uint16_t len, lv_base_dir_t base_dir, + uint32_t logical_pos, bool * is_rtl); + +/** + * Bidi process a paragraph of text + * @param str_in the string to process + * @param str_out store the result here + * @param len length of the text + * @param base_dir base dir of the text + * @param pos_conv_out an `uint16_t` array to store the related logical position of the character. + * Can be `NULL` is unused + * @param pos_conv_len length of `pos_conv_out` in element count + */ +void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len, lv_base_dir_t base_dir, + uint16_t * pos_conv_out, uint16_t pos_conv_len); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BIDI_PRIVATE_H*/ diff --git a/src/misc/lv_color.c b/src/misc/lv_color.c index 8e63d3c56..d56e355fe 100644 --- a/src/misc/lv_color.c +++ b/src/misc/lv_color.c @@ -8,7 +8,6 @@ *********************/ #include "lv_color.h" #include "lv_log.h" -#include "../misc/lv_color.h" /********************* * DEFINES @@ -241,6 +240,143 @@ lv_color_hsv_t lv_color_to_hsv(lv_color_t c) return lv_color_rgb_to_hsv(c.red, c.green, c.blue); } +uint8_t lv_color_format_get_size(lv_color_format_t cf) +{ + return (lv_color_format_get_bpp(cf) + 7) >> 3; +} + +uint32_t lv_color_to_int(lv_color_t c) +{ + uint8_t * tmp = (uint8_t *) &c; + return tmp[0] + (tmp[1] << 8) + (tmp[2] << 16); +} + +bool lv_color_eq(lv_color_t c1, lv_color_t c2) +{ + return lv_color_to_int(c1) == lv_color_to_int(c2); +} + +bool lv_color32_eq(lv_color32_t c1, lv_color32_t c2) +{ + return *((uint32_t *)&c1) == *((uint32_t *)&c2); +} + +lv_color_t lv_color_hex(uint32_t c) +{ + lv_color_t ret; + ret.red = (c >> 16) & 0xff; + ret.green = (c >> 8) & 0xff; + ret.blue = (c >> 0) & 0xff; + return ret; +} + +lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b) +{ + lv_color_t ret; + ret.red = r; + ret.green = g; + ret.blue = b; + return ret; +} + +lv_color32_t lv_color32_make(uint8_t r, uint8_t g, uint8_t b, uint8_t a) +{ + lv_color32_t ret; + ret.red = r; + ret.green = g; + ret.blue = b; + ret.alpha = a; + return ret; +} + +lv_color_t lv_color_hex3(uint32_t c) +{ + return lv_color_make((uint8_t)(((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), (uint8_t)((c & 0xF0) | ((c & 0xF0) >> 4)), + (uint8_t)((c & 0xF) | ((c & 0xF) << 4))); +} + +uint16_t LV_ATTRIBUTE_FAST_MEM lv_color_16_16_mix(uint16_t c1, uint16_t c2, uint8_t mix) +{ + if(mix == 255) return c1; + if(mix == 0) return c2; + if(c1 == c2) return c1; + + uint16_t ret; + + /* Source: https://stackoverflow.com/a/50012418/1999969*/ + mix = (uint32_t)((uint32_t)mix + 4) >> 3; + + /*0x7E0F81F = 0b00000111111000001111100000011111*/ + uint32_t bg = (uint32_t)(c2 | ((uint32_t)c2 << 16)) & 0x7E0F81F; + uint32_t fg = (uint32_t)(c1 | ((uint32_t)c1 << 16)) & 0x7E0F81F; + uint32_t result = ((((fg - bg) * mix) >> 5) + bg) & 0x7E0F81F; + ret = (uint16_t)(result >> 16) | result; + + return ret; +} + +lv_color_t lv_color_white(void) +{ + return lv_color_make(0xff, 0xff, 0xff); +} + +lv_color_t lv_color_black(void) +{ + return lv_color_make(0x00, 0x00, 0x00); +} + +void lv_color_premultiply(lv_color32_t * c) +{ + if(c->alpha == LV_OPA_COVER) { + return; + } + + if(c->alpha == LV_OPA_TRANSP) { + lv_memzero(c, sizeof(lv_color32_t)); + return; + } + + c->red = LV_OPA_MIX2(c->red, c->alpha); + c->green = LV_OPA_MIX2(c->green, c->alpha); + c->blue = LV_OPA_MIX2(c->blue, c->alpha); +} + +void lv_color16_premultiply(lv_color16_t * c, lv_opa_t a) +{ + if(a == LV_OPA_COVER) { + return; + } + + if(a == LV_OPA_TRANSP) { + lv_memzero(c, sizeof(lv_color16_t)); + return; + } + + c->red = LV_OPA_MIX2(c->red, a); + c->green = LV_OPA_MIX2(c->green, a); + c->blue = LV_OPA_MIX2(c->blue, a); +} + +uint8_t lv_color_luminance(lv_color_t c) +{ + return (uint8_t)((uint16_t)(77u * c.red + 151u * c.green + 28u * c.blue) >> 8); +} + +uint8_t lv_color16_luminance(const lv_color16_t c) +{ + return (uint8_t)((uint16_t)(635u * c.red + 613u * c.green + 231u * c.blue) >> 8); +} + +uint8_t lv_color24_luminance(const uint8_t * c) +{ + return (uint8_t)((uint16_t)(77u * c[2] + 151u * c[1] + 28u * c[0]) >> 8); +} + +uint8_t lv_color32_luminance(lv_color32_t c) +{ + return (uint8_t)((uint16_t)(77u * c.red + 151u * c.green + 28u * c.blue) >> 8); +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/misc/lv_color.h b/src/misc/lv_color.h index 993045f01..e5beb2103 100644 --- a/src/misc/lv_color.h +++ b/src/misc/lv_color.h @@ -24,20 +24,20 @@ extern "C" { LV_EXPORT_CONST_INT(LV_COLOR_DEPTH); #if LV_COLOR_DEPTH == 8 -#define _LV_COLOR_NATIVE_WITH_ALPHA_SIZE 2 +#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 2 #elif LV_COLOR_DEPTH == 16 -#define _LV_COLOR_NATIVE_WITH_ALPHA_SIZE 3 +#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 3 #elif LV_COLOR_DEPTH == 24 -#define _LV_COLOR_NATIVE_WITH_ALPHA_SIZE 4 +#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 4 #elif LV_COLOR_DEPTH == 32 -#define _LV_COLOR_NATIVE_WITH_ALPHA_SIZE 4 +#define LV_COLOR_NATIVE_WITH_ALPHA_SIZE 4 #endif /** * Opacity percentages. */ -enum _lv_opa_t { +enum { LV_OPA_TRANSP = 0, LV_OPA_0 = 0, LV_OPA_10 = 25, @@ -53,12 +53,6 @@ enum _lv_opa_t { LV_OPA_COVER = 255, }; -#ifdef DOXYGEN -typedef _lv_opa_t lv_opa_t; -#else -typedef uint8_t lv_opa_t; -#endif /*DOXYGEN*/ - #define LV_OPA_MIN 2 /*Opacities below this will be transparent*/ #define LV_OPA_MAX 253 /*Opacities above this will fully cover*/ @@ -130,7 +124,7 @@ typedef struct { uint8_t alpha; } lv_color16a_t; -enum _lv_color_format_t { +typedef enum { LV_COLOR_FORMAT_UNKNOWN = 0, LV_COLOR_FORMAT_RAW = 0x01, @@ -190,13 +184,7 @@ enum _lv_color_format_t { LV_COLOR_FORMAT_NATIVE = LV_COLOR_FORMAT_XRGB8888, LV_COLOR_FORMAT_NATIVE_WITH_ALPHA = LV_COLOR_FORMAT_ARGB8888, #endif -}; - -#ifdef DOXYGEN -typedef _lv_color_format_t lv_color_format_t; -#else -typedef uint8_t lv_color_format_t; -#endif /*DOXYGEN*/ +} lv_color_format_t; #define LV_COLOR_FORMAT_IS_ALPHA_ONLY(cf) ((cf) >= LV_COLOR_FORMAT_A1 && (cf) <= LV_COLOR_FORMAT_A8) #define LV_COLOR_FORMAT_IS_INDEXED(cf) ((cf) >= LV_COLOR_FORMAT_I1 && (cf) <= LV_COLOR_FORMAT_I8) @@ -233,10 +221,7 @@ uint8_t lv_color_format_get_bpp(lv_color_format_t cf); * @return the pixel size in bytes * @sa LV_COLOR_FORMAT_GET_SIZE */ -static inline uint8_t lv_color_format_get_size(lv_color_format_t cf) -{ - return (lv_color_format_get_bpp(cf) + 7) >> 3; -} +uint8_t lv_color_format_get_size(lv_color_format_t cf); /** * Check if a color format has alpha channel or not @@ -258,11 +243,7 @@ lv_color32_t lv_color_to_32(lv_color_t color, lv_opa_t opa); * @param c an RGB888 color * @return `c` as an integer */ -static inline uint32_t lv_color_to_int(lv_color_t c) -{ - uint8_t * tmp = (uint8_t *) &c; - return tmp[0] + (tmp[1] << 8) + (tmp[2] << 16); -} +uint32_t lv_color_to_int(lv_color_t c); /** * Check if two RGB888 color are equal @@ -270,10 +251,7 @@ static inline uint32_t lv_color_to_int(lv_color_t c) * @param c2 the second color * @return true: equal */ -static inline bool lv_color_eq(lv_color_t c1, lv_color_t c2) -{ - return lv_color_to_int(c1) == lv_color_to_int(c2); -} +bool lv_color_eq(lv_color_t c1, lv_color_t c2); /** * Check if two ARGB8888 color are equal @@ -281,24 +259,14 @@ static inline bool lv_color_eq(lv_color_t c1, lv_color_t c2) * @param c2 the second color * @return true: equal */ -static inline bool lv_color32_eq(lv_color32_t c1, lv_color32_t c2) -{ - return *((uint32_t *)&c1) == *((uint32_t *)&c2); -} +bool lv_color32_eq(lv_color32_t c1, lv_color32_t c2); /** * Create a color from 0x000000..0xffffff input * @param c the hex input * @return the color */ -static inline lv_color_t lv_color_hex(uint32_t c) -{ - lv_color_t ret; - ret.red = (c >> 16) & 0xff; - ret.green = (c >> 8) & 0xff; - ret.blue = (c >> 0) & 0xff; - return ret; -} +lv_color_t lv_color_hex(uint32_t c); /** * Create an RGB888 color @@ -307,14 +275,7 @@ static inline lv_color_t lv_color_hex(uint32_t c) * @param b the blue channel (0..255) * @return the color */ -static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b) -{ - lv_color_t ret; - ret.red = r; - ret.green = g; - ret.blue = b; - return ret; -} +lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b); /** * Create an ARGB8888 color @@ -324,26 +285,14 @@ static inline lv_color_t lv_color_make(uint8_t r, uint8_t g, uint8_t b) * @param a the alpha channel (0..255) * @return the color */ -static inline lv_color32_t lv_color32_make(uint8_t r, uint8_t g, uint8_t b, uint8_t a) -{ - lv_color32_t ret; - ret.red = r; - ret.green = g; - ret.blue = b; - ret.alpha = a; - return ret; -} +lv_color32_t lv_color32_make(uint8_t r, uint8_t g, uint8_t b, uint8_t a); /** * Create a color from 0x000..0xfff input * @param c the hex input (e.g. 0x123 will be 0x112233) * @return the color */ -static inline lv_color_t lv_color_hex3(uint32_t c) -{ - return lv_color_make((uint8_t)(((c >> 4) & 0xF0) | ((c >> 8) & 0xF)), (uint8_t)((c & 0xF0) | ((c & 0xF0) >> 4)), - (uint8_t)((c & 0xF) | ((c & 0xF) << 4))); -} +lv_color_t lv_color_hex3(uint32_t c); /** * Convert am RGB888 color to RGB565 stored in `uint16_t` @@ -368,25 +317,7 @@ uint32_t lv_color_to_u32(lv_color_t color); * mix == 255: c1 * mix == 128: 0.5 x c1 + 0.5 x c2 */ -static inline uint16_t LV_ATTRIBUTE_FAST_MEM lv_color_16_16_mix(uint16_t c1, uint16_t c2, uint8_t mix) -{ - if(mix == 255) return c1; - if(mix == 0) return c2; - if(c1 == c2) return c1; - - uint16_t ret; - - /* Source: https://stackoverflow.com/a/50012418/1999969*/ - mix = (uint32_t)((uint32_t)mix + 4) >> 3; - - /*0x7E0F81F = 0b00000111111000001111100000011111*/ - uint32_t bg = (uint32_t)(c2 | ((uint32_t)c2 << 16)) & 0x7E0F81F; - uint32_t fg = (uint32_t)(c1 | ((uint32_t)c1 << 16)) & 0x7E0F81F; - uint32_t result = ((((fg - bg) * mix) >> 5) + bg) & 0x7E0F81F; - ret = (uint16_t)(result >> 16) | result; - - return ret; -} +uint16_t LV_ATTRIBUTE_FAST_MEM lv_color_16_16_mix(uint16_t c1, uint16_t c2, uint8_t mix); /** * Mix white to a color @@ -435,91 +366,45 @@ lv_color_hsv_t lv_color_to_hsv(lv_color_t color); * A helper for white color * @return a white color */ -static inline lv_color_t lv_color_white(void) -{ - return lv_color_make(0xff, 0xff, 0xff); -} +lv_color_t lv_color_white(void); /** * A helper for black color * @return a black color */ -static inline lv_color_t lv_color_black(void) -{ - return lv_color_make(0x00, 0x00, 0x00); -} - -static inline void lv_color_premultiply(lv_color32_t * c) -{ - if(c->alpha == LV_OPA_COVER) { - return; - } - - if(c->alpha == LV_OPA_TRANSP) { - lv_memzero(c, sizeof(lv_color32_t)); - return; - } - - c->red = LV_OPA_MIX2(c->red, c->alpha); - c->green = LV_OPA_MIX2(c->green, c->alpha); - c->blue = LV_OPA_MIX2(c->blue, c->alpha); -} - -static inline void lv_color16_premultiply(lv_color16_t * c, lv_opa_t a) -{ - if(a == LV_OPA_COVER) { - return; - } - - if(a == LV_OPA_TRANSP) { - lv_memzero(c, sizeof(lv_color16_t)); - return; - } - - c->red = LV_OPA_MIX2(c->red, a); - c->green = LV_OPA_MIX2(c->green, a); - c->blue = LV_OPA_MIX2(c->blue, a); -} +lv_color_t lv_color_black(void); + +void lv_color_premultiply(lv_color32_t * c); + +void lv_color16_premultiply(lv_color16_t * c, lv_opa_t a); /** * Get the luminance of a color: luminance = 0.3 R + 0.59 G + 0.11 B * @param color a color * @return the brightness [0..255] */ -static inline uint8_t lv_color_luminance(lv_color_t c) -{ - return (uint8_t)((uint16_t)(77u * c.red + 151u * c.green + 28u * c.blue) >> 8); -} +uint8_t lv_color_luminance(lv_color_t c); /** * Get the luminance of a color16: luminance = 0.3 R + 0.59 G + 0.11 B * @param color a color * @return the brightness [0..255] */ -static inline uint8_t lv_color16_luminance(const lv_color16_t c) -{ - return (uint8_t)((uint16_t)(635u * c.red + 613u * c.green + 231u * c.blue) >> 8); -} +uint8_t lv_color16_luminance(const lv_color16_t c); /** * Get the luminance of a color24: luminance = 0.3 R + 0.59 G + 0.11 B * @param color a color * @return the brightness [0..255] */ -static inline uint8_t lv_color24_luminance(const uint8_t * c) -{ - return (uint8_t)((uint16_t)(77u * c[2] + 151u * c[1] + 28u * c[0]) >> 8); -} +uint8_t lv_color24_luminance(const uint8_t * c); /** * Get the luminance of a color32: luminance = 0.3 R + 0.59 G + 0.11 B * @param color a color * @return the brightness [0..255] */ -static inline uint8_t lv_color32_luminance(lv_color32_t c) -{ - return (uint8_t)((uint16_t)(77u * c.red + 151u * c.green + 28u * c.blue) >> 8); -} +uint8_t lv_color32_luminance(lv_color32_t c); /********************** * MACROS diff --git a/src/misc/lv_color_op.c b/src/misc/lv_color_op.c index 5e2fb3455..a26f2b453 100644 --- a/src/misc/lv_color_op.c +++ b/src/misc/lv_color_op.c @@ -6,9 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_color.h" +#include "lv_color_op_private.h" #include "lv_log.h" -#include "../misc/lv_color.h" /********************* * DEFINES @@ -33,3 +32,43 @@ /********************** * GLOBAL FUNCTIONS **********************/ + +lv_color_t LV_ATTRIBUTE_FAST_MEM lv_color_mix(lv_color_t c1, lv_color_t c2, uint8_t mix) +{ + lv_color_t ret; + + ret.red = LV_UDIV255((uint16_t)c1.red * mix + c2.red * (255 - mix) + LV_COLOR_MIX_ROUND_OFS); + ret.green = LV_UDIV255((uint16_t)c1.green * mix + c2.green * (255 - mix) + LV_COLOR_MIX_ROUND_OFS); + ret.blue = LV_UDIV255((uint16_t)c1.blue * mix + c2.blue * (255 - mix) + LV_COLOR_MIX_ROUND_OFS); + return ret; +} + +lv_color32_t lv_color_mix32(lv_color32_t fg, lv_color32_t bg) +{ + if(fg.alpha >= LV_OPA_MAX) { + fg.alpha = bg.alpha; + return fg; + } + if(fg.alpha <= LV_OPA_MIN) { + return bg; + } + bg.red = (uint32_t)((uint32_t)fg.red * fg.alpha + (uint32_t)bg.red * (255 - fg.alpha)) >> 8; + bg.green = (uint32_t)((uint32_t)fg.green * fg.alpha + (uint32_t)bg.green * (255 - fg.alpha)) >> 8; + bg.blue = (uint32_t)((uint32_t)fg.blue * fg.alpha + (uint32_t)bg.blue * (255 - fg.alpha)) >> 8; + return bg; +} + +uint8_t lv_color_brightness(lv_color_t c) +{ + uint16_t bright = (uint16_t)(3u * c.red + c.green + 4u * c.blue); + return (uint8_t)(bright >> 3); +} + +void lv_color_filter_dsc_init(lv_color_filter_dsc_t * dsc, lv_color_filter_cb_t cb) +{ + dsc->filter_cb = cb; +} + +/********************** + * STATIC FUNCTIONS + **********************/ diff --git a/src/misc/lv_color_op.h b/src/misc/lv_color_op.h index e16510abc..c1820a6aa 100644 --- a/src/misc/lv_color_op.h +++ b/src/misc/lv_color_op.h @@ -26,14 +26,14 @@ extern "C" { * TYPEDEFS **********************/ -struct _lv_color_filter_dsc_t; +struct lv_color_filter_dsc_t; -typedef lv_color_t (*lv_color_filter_cb_t)(const struct _lv_color_filter_dsc_t *, lv_color_t, lv_opa_t); +typedef lv_color_t (*lv_color_filter_cb_t)(const struct lv_color_filter_dsc_t *, lv_color_t, lv_opa_t); -typedef struct _lv_color_filter_dsc_t { +struct lv_color_filter_dsc_t { lv_color_filter_cb_t filter_cb; void * user_data; -} lv_color_filter_dsc_t; +}; /********************** * GLOBAL PROTOTYPES @@ -46,15 +46,7 @@ typedef struct _lv_color_filter_dsc_t { * @param mix The ratio of the colors. 0: full `c2`, 255: full `c1`, 127: half `c1` and half`c2` * @return the mixed color */ -static inline lv_color_t LV_ATTRIBUTE_FAST_MEM lv_color_mix(lv_color_t c1, lv_color_t c2, uint8_t mix) -{ - lv_color_t ret; - - ret.red = LV_UDIV255((uint16_t)c1.red * mix + c2.red * (255 - mix) + LV_COLOR_MIX_ROUND_OFS); - ret.green = LV_UDIV255((uint16_t)c1.green * mix + c2.green * (255 - mix) + LV_COLOR_MIX_ROUND_OFS); - ret.blue = LV_UDIV255((uint16_t)c1.blue * mix + c2.blue * (255 - mix) + LV_COLOR_MIX_ROUND_OFS); - return ret; -} +lv_color_t LV_ATTRIBUTE_FAST_MEM lv_color_mix(lv_color_t c1, lv_color_t c2, uint8_t mix); /** * @@ -64,20 +56,7 @@ static inline lv_color_t LV_ATTRIBUTE_FAST_MEM lv_color_mix(lv_color_t c1, lv_co * @note Use bg.alpha in the return value * @note Use fg.alpha as mix ratio */ -static inline lv_color32_t lv_color_mix32(lv_color32_t fg, lv_color32_t bg) -{ - if(fg.alpha >= LV_OPA_MAX) { - fg.alpha = bg.alpha; - return fg; - } - if(fg.alpha <= LV_OPA_MIN) { - return bg; - } - bg.red = (uint32_t)((uint32_t)fg.red * fg.alpha + (uint32_t)bg.red * (255 - fg.alpha)) >> 8; - bg.green = (uint32_t)((uint32_t)fg.green * fg.alpha + (uint32_t)bg.green * (255 - fg.alpha)) >> 8; - bg.blue = (uint32_t)((uint32_t)fg.blue * fg.alpha + (uint32_t)bg.blue * (255 - fg.alpha)) >> 8; - return bg; -} +lv_color32_t lv_color_mix32(lv_color32_t fg, lv_color32_t bg); //! @endcond @@ -86,16 +65,9 @@ static inline lv_color32_t lv_color_mix32(lv_color32_t fg, lv_color32_t bg) * @param color a color * @return the brightness [0..255] */ -static inline uint8_t lv_color_brightness(lv_color_t c) -{ - uint16_t bright = (uint16_t)(3u * c.red + c.green + 4u * c.blue); - return (uint8_t)(bright >> 3); -} - -static inline void lv_color_filter_dsc_init(lv_color_filter_dsc_t * dsc, lv_color_filter_cb_t cb) -{ - dsc->filter_cb = cb; -} +uint8_t lv_color_brightness(lv_color_t c); + +void lv_color_filter_dsc_init(lv_color_filter_dsc_t * dsc, lv_color_filter_cb_t cb); /********************** * PREDEFINED COLORS diff --git a/src/misc/lv_color_op_private.h b/src/misc/lv_color_op_private.h new file mode 100644 index 000000000..d6516ebd0 --- /dev/null +++ b/src/misc/lv_color_op_private.h @@ -0,0 +1,39 @@ +/** + * @file lv_color_op_private.h + * + */ + +#ifndef LV_COLOR_OP_PRIVATE_H +#define LV_COLOR_OP_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_color_op.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_COLOR_OP_PRIVATE_H*/ diff --git a/src/misc/lv_event.c b/src/misc/lv_event.c index 00f16f62b..ec985ed25 100644 --- a/src/misc/lv_event.c +++ b/src/misc/lv_event.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_event.h" +#include "lv_event_private.h" #include "../core/lv_global.h" #include "../stdlib/lv_mem.h" #include "lv_assert.h" @@ -45,7 +45,7 @@ * GLOBAL FUNCTIONS **********************/ -void _lv_event_push(lv_event_t * e) +void lv_event_push(lv_event_t * e) { /*Build a simple linked list from the objects used in the events *It's important to know if this object was deleted by a nested event @@ -55,7 +55,7 @@ void _lv_event_push(lv_event_t * e) } -void _lv_event_pop(lv_event_t * e) +void lv_event_pop(lv_event_t * e) { event_head = e->prev; } @@ -209,7 +209,7 @@ uint32_t lv_event_register_id(void) return event_last_id; } -void _lv_event_mark_deleted(void * target) +void lv_event_mark_deleted(void * target) { lv_event_t * e = event_head; diff --git a/src/misc/lv_event.h b/src/misc/lv_event.h index 606ea04c0..10c36c32c 100644 --- a/src/misc/lv_event.h +++ b/src/misc/lv_event.h @@ -28,12 +28,6 @@ extern "C" { typedef void (*lv_event_cb_t)(lv_event_t * e); -typedef struct { - lv_event_cb_t cb; - void * user_data; - uint32_t filter; -} lv_event_dsc_t; - /** * Type of event being sent to the object. */ @@ -113,7 +107,7 @@ typedef enum { LV_EVENT_VSYNC, - _LV_EVENT_LAST, /** Number of default events*/ + LV_EVENT_LAST, /** Number of default events*/ LV_EVENT_PREPROCESS = 0x8000, /** This is a flag that can be set with an event so it's processed before the class default event processing */ @@ -121,32 +115,12 @@ typedef enum { typedef lv_array_t lv_event_list_t; -struct _lv_event_t { - void * current_target; - void * original_target; - lv_event_code_t code; - void * user_data; - void * param; - lv_event_t * prev; - uint8_t deleted : 1; - uint8_t stop_processing : 1; - uint8_t stop_bubbling : 1; -}; - /** * @brief Event callback. * Events are used to notify the user of some action being taken on the object. * For details, see ::lv_event_t. */ -/********************** - * GLOBAL PROTOTYPES - **********************/ - -void _lv_event_push(lv_event_t * e); - -void _lv_event_pop(lv_event_t * e); - lv_result_t lv_event_send(lv_event_list_t * list, lv_event_t * e, bool preprocess); lv_event_dsc_t * lv_event_add(lv_event_list_t * list, lv_event_cb_t cb, lv_event_code_t filter, void * user_data); @@ -227,13 +201,6 @@ void lv_event_stop_processing(lv_event_t * e); */ uint32_t lv_event_register_id(void); -/** - * Nested events can be called and one of them might belong to an object that is being deleted. - * Mark this object's `event_temp_data` deleted to know that its `lv_obj_send_event` should return `LV_RESULT_INVALID` - * @param target pointer to an event target which was deleted - */ -void _lv_event_mark_deleted(void * target); - /********************** * MACROS **********************/ diff --git a/src/misc/lv_event_private.h b/src/misc/lv_event_private.h new file mode 100644 index 000000000..b31ca81b8 --- /dev/null +++ b/src/misc/lv_event_private.h @@ -0,0 +1,73 @@ +/** + * @file lv_event_private.h + * + */ + +#ifndef LV_EVENT_PRIVATE_H +#define LV_EVENT_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_event.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_event_dsc_t { + lv_event_cb_t cb; + void * user_data; + uint32_t filter; +}; + +struct lv_event_t { + void * current_target; + void * original_target; + lv_event_code_t code; + void * user_data; + void * param; + lv_event_t * prev; + uint8_t deleted : 1; + uint8_t stop_processing : 1; + uint8_t stop_bubbling : 1; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +void lv_event_push(lv_event_t * e); + +void lv_event_pop(lv_event_t * e); + +/** + * Nested events can be called and one of them might belong to an object that is being deleted. + * Mark this object's `event_temp_data` deleted to know that its `lv_obj_send_event` should return `LV_RESULT_INVALID` + * @param target pointer to an event target which was deleted + */ +void lv_event_mark_deleted(void * target); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_EVENT_PRIVATE_H*/ diff --git a/src/misc/lv_fs.c b/src/misc/lv_fs.c index c7079f521..3c3a587eb 100644 --- a/src/misc/lv_fs.c +++ b/src/misc/lv_fs.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_fs.h" +#include "lv_fs_private.h" #include "../misc/lv_assert.h" #include "../misc/lv_profiler.h" @@ -43,14 +43,14 @@ static lv_fs_res_t lv_fs_seek_cached(lv_fs_file_t * file_p, uint32_t pos, lv_fs_ * GLOBAL FUNCTIONS **********************/ -void _lv_fs_init(void) +void lv_fs_init(void) { - _lv_ll_init(fsdrv_ll_p, sizeof(lv_fs_drv_t *)); + lv_ll_init(fsdrv_ll_p, sizeof(lv_fs_drv_t *)); } -void _lv_fs_deinit(void) +void lv_fs_deinit(void) { - _lv_ll_clear(fsdrv_ll_p); + lv_ll_clear(fsdrv_ll_p); } bool lv_fs_is_ready(char letter) @@ -388,7 +388,7 @@ void lv_fs_drv_register(lv_fs_drv_t * drv_p) { /*Save the new driver*/ lv_fs_drv_t ** new_drv; - new_drv = _lv_ll_ins_head(fsdrv_ll_p); + new_drv = lv_ll_ins_head(fsdrv_ll_p); LV_ASSERT_MALLOC(new_drv); if(new_drv == NULL) return; @@ -399,7 +399,7 @@ lv_fs_drv_t * lv_fs_get_drv(char letter) { lv_fs_drv_t ** drv; - _LV_LL_READ(fsdrv_ll_p, drv) { + LV_LL_READ(fsdrv_ll_p, drv) { if((*drv)->letter == letter) { return *drv; } @@ -413,7 +413,7 @@ char * lv_fs_get_letters(char * buf) lv_fs_drv_t ** drv; uint8_t i = 0; - _LV_LL_READ(fsdrv_ll_p, drv) { + LV_LL_READ(fsdrv_ll_p, drv) { buf[i] = (*drv)->letter; i++; } diff --git a/src/misc/lv_fs.h b/src/misc/lv_fs.h index dfa004e81..27e311f5d 100644 --- a/src/misc/lv_fs.h +++ b/src/misc/lv_fs.h @@ -31,7 +31,7 @@ extern "C" { /** * Errors in the file system module. */ -enum _lv_fs_res_t { +typedef enum { LV_FS_RES_OK = 0, LV_FS_RES_HW_ERR, /*Low level hardware error*/ LV_FS_RES_FS_ERR, /*Error in the file system structure*/ @@ -45,27 +45,15 @@ enum _lv_fs_res_t { LV_FS_RES_OUT_OF_MEM, /*Not enough memory for an internal operation*/ LV_FS_RES_INV_PARAM, /*Invalid parameter among arguments*/ LV_FS_RES_UNKNOWN, /*Other unknown error*/ -}; - -#ifdef DOXYGEN -typedef _lv_fs_res_t lv_fs_res_t; -#else -typedef uint8_t lv_fs_res_t; -#endif /*DOXYGEN*/ +} lv_fs_res_t; /** * File open mode. */ -enum _lv_fs_mode_t { +typedef enum { LV_FS_MODE_WR = 0x01, LV_FS_MODE_RD = 0x02, -}; - -#ifdef DOXYGEN -typedef _lv_fs_mode_t lv_fs_mode_t; -#else -typedef uint8_t lv_fs_mode_t; -#endif /*DOXYGEN*/ +} lv_fs_mode_t; /** * Seek modes. @@ -76,9 +64,9 @@ typedef enum { LV_FS_SEEK_END = 0x02, /**< Set the position from the end of the file*/ } lv_fs_whence_t; -struct _lv_fs_drv_t; -typedef struct _lv_fs_drv_t lv_fs_drv_t; -struct _lv_fs_drv_t { +struct lv_fs_drv_t; +typedef struct lv_fs_drv_t lv_fs_drv_t; +struct lv_fs_drv_t { char letter; uint32_t cache_size; bool (*ready_cb)(lv_fs_drv_t * drv); @@ -98,45 +86,16 @@ struct _lv_fs_drv_t { }; typedef struct { - uint32_t start; - uint32_t end; - uint32_t file_position; - void * buffer; -} lv_fs_file_cache_t; - -typedef struct { void * file_d; lv_fs_drv_t * drv; lv_fs_file_cache_t * cache; } lv_fs_file_t; -/* Extended path object to specify the buffer for memory-mapped files */ -typedef struct { - char path[4]; /* This is needed to make it compatible with a normal path */ - const void * buffer; - uint32_t size; -} lv_fs_path_ex_t; - -typedef struct { - void * dir_d; - lv_fs_drv_t * drv; -} lv_fs_dir_t; - /********************** * GLOBAL PROTOTYPES **********************/ /** - * Initialize the File system interface - */ -void _lv_fs_init(void); - -/** - * Deinitialize the File system interface - */ -void _lv_fs_deinit(void); - -/** * Initialize a file system driver with default values. * It is used to ensure all fields have known values and not memory junk. * After it you can set the fields. diff --git a/src/misc/lv_fs_private.h b/src/misc/lv_fs_private.h new file mode 100644 index 000000000..60f23d22c --- /dev/null +++ b/src/misc/lv_fs_private.h @@ -0,0 +1,69 @@ +/** + * @file lv_fs_private.h + * + */ + +#ifndef LV_FS_PRIVATE_H +#define LV_FS_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_fs.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_fs_file_cache_t { + uint32_t start; + uint32_t end; + uint32_t file_position; + void * buffer; +}; + +/* Extended path object to specify the buffer for memory-mapped files */ +struct lv_fs_path_ex_t { + char path[4]; /* This is needed to make it compatible with a normal path */ + const void * buffer; + uint32_t size; +}; + +struct lv_fs_dir_t { + void * dir_d; + lv_fs_drv_t * drv; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize the File system interface + */ +void lv_fs_init(void); + +/** + * Deinitialize the File system interface + */ +void lv_fs_deinit(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FS_PRIVATE_H*/ diff --git a/src/misc/lv_ll.c b/src/misc/lv_ll.c index 6debda073..ca1339ec5 100644 --- a/src/misc/lv_ll.c +++ b/src/misc/lv_ll.c @@ -39,7 +39,7 @@ static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * nex * GLOBAL FUNCTIONS **********************/ -void _lv_ll_init(lv_ll_t * ll_p, uint32_t node_size) +void lv_ll_init(lv_ll_t * ll_p, uint32_t node_size) { ll_p->head = NULL; ll_p->tail = NULL; @@ -54,7 +54,7 @@ void _lv_ll_init(lv_ll_t * ll_p, uint32_t node_size) ll_p->n_size = node_size; } -void * _lv_ll_ins_head(lv_ll_t * ll_p) +void * lv_ll_ins_head(lv_ll_t * ll_p) { lv_ll_node_t * n_new; @@ -77,14 +77,14 @@ void * _lv_ll_ins_head(lv_ll_t * ll_p) return n_new; } -void * _lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act) +void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act) { lv_ll_node_t * n_new; if(NULL == ll_p || NULL == n_act) return NULL; - if(_lv_ll_get_head(ll_p) == n_act) { - n_new = _lv_ll_ins_head(ll_p); + if(lv_ll_get_head(ll_p) == n_act) { + n_new = lv_ll_ins_head(ll_p); if(n_new == NULL) return NULL; } else { @@ -92,7 +92,7 @@ void * _lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act) if(n_new == NULL) return NULL; lv_ll_node_t * n_prev; - n_prev = _lv_ll_get_prev(ll_p, n_act); + n_prev = lv_ll_get_prev(ll_p, n_act); node_set_next(ll_p, n_prev, n_new); node_set_prev(ll_p, n_new, n_prev); node_set_prev(ll_p, n_act, n_new); @@ -102,7 +102,7 @@ void * _lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act) return n_new; } -void * _lv_ll_ins_tail(lv_ll_t * ll_p) +void * lv_ll_ins_tail(lv_ll_t * ll_p) { lv_ll_node_t * n_new; @@ -124,13 +124,13 @@ void * _lv_ll_ins_tail(lv_ll_t * ll_p) return n_new; } -void _lv_ll_remove(lv_ll_t * ll_p, void * node_p) +void lv_ll_remove(lv_ll_t * ll_p, void * node_p) { if(ll_p == NULL) return; - if(_lv_ll_get_head(ll_p) == node_p) { + if(lv_ll_get_head(ll_p) == node_p) { /*The new head will be the node after 'n_act'*/ - ll_p->head = _lv_ll_get_next(ll_p, node_p); + ll_p->head = lv_ll_get_next(ll_p, node_p); if(ll_p->head == NULL) { ll_p->tail = NULL; } @@ -138,9 +138,9 @@ void _lv_ll_remove(lv_ll_t * ll_p, void * node_p) node_set_prev(ll_p, ll_p->head, NULL); } } - else if(_lv_ll_get_tail(ll_p) == node_p) { + else if(lv_ll_get_tail(ll_p) == node_p) { /*The new tail will be the node before 'n_act'*/ - ll_p->tail = _lv_ll_get_prev(ll_p, node_p); + ll_p->tail = lv_ll_get_prev(ll_p, node_p); if(ll_p->tail == NULL) { ll_p->head = NULL; } @@ -149,26 +149,26 @@ void _lv_ll_remove(lv_ll_t * ll_p, void * node_p) } } else { - lv_ll_node_t * n_prev = _lv_ll_get_prev(ll_p, node_p); - lv_ll_node_t * n_next = _lv_ll_get_next(ll_p, node_p); + lv_ll_node_t * n_prev = lv_ll_get_prev(ll_p, node_p); + lv_ll_node_t * n_next = lv_ll_get_next(ll_p, node_p); node_set_next(ll_p, n_prev, n_next); node_set_prev(ll_p, n_next, n_prev); } } -void _lv_ll_clear_custom(lv_ll_t * ll_p, void(*cleanup)(void *)) +void lv_ll_clear_custom(lv_ll_t * ll_p, void(*cleanup)(void *)) { void * i; void * i_next; - i = _lv_ll_get_head(ll_p); + i = lv_ll_get_head(ll_p); i_next = NULL; while(i != NULL) { - i_next = _lv_ll_get_next(ll_p, i); + i_next = lv_ll_get_next(ll_p, i); if(cleanup == NULL) { - _lv_ll_remove(ll_p, i); + lv_ll_remove(ll_p, i); lv_free(i); } else { @@ -178,9 +178,9 @@ void _lv_ll_clear_custom(lv_ll_t * ll_p, void(*cleanup)(void *)) } } -void _lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head) +void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head) { - _lv_ll_remove(ll_ori_p, node); + lv_ll_remove(ll_ori_p, node); if(head) { /*Set node as head*/ @@ -212,19 +212,19 @@ void _lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool h } } -void * _lv_ll_get_head(const lv_ll_t * ll_p) +void * lv_ll_get_head(const lv_ll_t * ll_p) { if(ll_p == NULL) return NULL; return ll_p->head; } -void * _lv_ll_get_tail(const lv_ll_t * ll_p) +void * lv_ll_get_tail(const lv_ll_t * ll_p) { if(ll_p == NULL) return NULL; return ll_p->tail; } -void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act) +void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act) { /*Pointer to the next node is stored in the end of this node. *Go there and return the address found there*/ @@ -233,7 +233,7 @@ void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act) return *((lv_ll_node_t **)n_act_d); } -void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act) +void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act) { /*Pointer to the prev. node is stored in the end of this node. *Go there and return the address found there*/ @@ -242,32 +242,32 @@ void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act) return *((lv_ll_node_t **)n_act_d); } -uint32_t _lv_ll_get_len(const lv_ll_t * ll_p) +uint32_t lv_ll_get_len(const lv_ll_t * ll_p) { uint32_t len = 0; void * node; - for(node = _lv_ll_get_head(ll_p); node != NULL; node = _lv_ll_get_next(ll_p, node)) { + for(node = lv_ll_get_head(ll_p); node != NULL; node = lv_ll_get_next(ll_p, node)) { len++; } return len; } -void _lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after) +void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after) { if(n_act == n_after) return; /*Can't move before itself*/ void * n_before; if(n_after != NULL) - n_before = _lv_ll_get_prev(ll_p, n_after); + n_before = lv_ll_get_prev(ll_p, n_after); else - n_before = _lv_ll_get_tail(ll_p); /*if `n_after` is NULL `n_act` should be the new tail*/ + n_before = lv_ll_get_tail(ll_p); /*if `n_after` is NULL `n_act` should be the new tail*/ if(n_act == n_before) return; /*Already before `n_after`*/ /*It's much easier to remove from the list and add again*/ - _lv_ll_remove(ll_p, n_act); + lv_ll_remove(ll_p, n_act); /*Add again by setting the prev. and next nodes*/ node_set_next(ll_p, n_before, n_act); @@ -282,7 +282,7 @@ void _lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after) if(n_before == NULL) ll_p->head = n_act; } -bool _lv_ll_is_empty(lv_ll_t * ll_p) +bool lv_ll_is_empty(lv_ll_t * ll_p) { if(ll_p == NULL) return true; @@ -291,6 +291,11 @@ bool _lv_ll_is_empty(lv_ll_t * ll_p) return false; } +void lv_ll_clear(lv_ll_t * ll_p) +{ + lv_ll_clear_custom(ll_p, NULL); +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/misc/lv_ll.h b/src/misc/lv_ll.h index 7a9007c8f..384bf3a2f 100644 --- a/src/misc/lv_ll.h +++ b/src/misc/lv_ll.h @@ -43,14 +43,14 @@ typedef struct { * @param ll_p pointer to lv_ll_t variable * @param node_size the size of 1 node in bytes */ -void _lv_ll_init(lv_ll_t * ll_p, uint32_t node_size); +void lv_ll_init(lv_ll_t * ll_p, uint32_t node_size); /** * Add a new head to a linked list * @param ll_p pointer to linked list * @return pointer to the new head */ -void * _lv_ll_ins_head(lv_ll_t * ll_p); +void * lv_ll_ins_head(lv_ll_t * ll_p); /** * Insert a new node in front of the n_act node @@ -58,14 +58,14 @@ void * _lv_ll_ins_head(lv_ll_t * ll_p); * @param n_act pointer a node * @return pointer to the new node */ -void * _lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act); +void * lv_ll_ins_prev(lv_ll_t * ll_p, void * n_act); /** * Add a new tail to a linked list * @param ll_p pointer to linked list * @return pointer to the new tail */ -void * _lv_ll_ins_tail(lv_ll_t * ll_p); +void * lv_ll_ins_tail(lv_ll_t * ll_p); /** * Remove the node 'node_p' from 'll_p' linked list. @@ -73,18 +73,15 @@ void * _lv_ll_ins_tail(lv_ll_t * ll_p); * @param ll_p pointer to the linked list of 'node_p' * @param node_p pointer to node in 'll_p' linked list */ -void _lv_ll_remove(lv_ll_t * ll_p, void * node_p); +void lv_ll_remove(lv_ll_t * ll_p, void * node_p); -void _lv_ll_clear_custom(lv_ll_t * ll_p, void(*cleanup)(void *)); +void lv_ll_clear_custom(lv_ll_t * ll_p, void(*cleanup)(void *)); /** * Remove and free all elements from a linked list. The list remain valid but become empty. * @param ll_p pointer to linked list */ -static inline void _lv_ll_clear(lv_ll_t * ll_p) -{ - _lv_ll_clear_custom(ll_p, NULL); -} +void lv_ll_clear(lv_ll_t * ll_p); /** * Move a node to a new linked list @@ -94,21 +91,21 @@ static inline void _lv_ll_clear(lv_ll_t * ll_p) * @param head true: be the head in the new list * false be the tail in the new list */ -void _lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head); +void lv_ll_chg_list(lv_ll_t * ll_ori_p, lv_ll_t * ll_new_p, void * node, bool head); /** * Return with head node of the linked list * @param ll_p pointer to linked list * @return pointer to the head of 'll_p' */ -void * _lv_ll_get_head(const lv_ll_t * ll_p); +void * lv_ll_get_head(const lv_ll_t * ll_p); /** * Return with tail node of the linked list * @param ll_p pointer to linked list * @return pointer to the tail of 'll_p' */ -void * _lv_ll_get_tail(const lv_ll_t * ll_p); +void * lv_ll_get_tail(const lv_ll_t * ll_p); /** * Return with the pointer of the next node after 'n_act' @@ -116,7 +113,7 @@ void * _lv_ll_get_tail(const lv_ll_t * ll_p); * @param n_act pointer a node * @return pointer to the next node */ -void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act); +void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act); /** * Return with the pointer of the previous node after 'n_act' @@ -124,14 +121,14 @@ void * _lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act); * @param n_act pointer a node * @return pointer to the previous node */ -void * _lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act); +void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act); /** * Return the length of the linked list. * @param ll_p pointer to linked list * @return length of the linked list */ -uint32_t _lv_ll_get_len(const lv_ll_t * ll_p); +uint32_t lv_ll_get_len(const lv_ll_t * ll_p); /** * TODO @@ -147,22 +144,22 @@ void lv_ll_swap(lv_ll_t * ll_p, void * n1_p, void * n2_p); * @param n_act pointer to node to move * @param n_after pointer to a node which should be after `n_act` */ -void _lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after); +void lv_ll_move_before(lv_ll_t * ll_p, void * n_act, void * n_after); /** * Check if a linked list is empty * @param ll_p pointer to a linked list * @return true: the linked list is empty; false: not empty */ -bool _lv_ll_is_empty(lv_ll_t * ll_p); +bool lv_ll_is_empty(lv_ll_t * ll_p); /********************** * MACROS **********************/ -#define _LV_LL_READ(list, i) for(i = _lv_ll_get_head(list); i != NULL; i = _lv_ll_get_next(list, i)) +#define LV_LL_READ(list, i) for(i = lv_ll_get_head(list); i != NULL; i = lv_ll_get_next(list, i)) -#define _LV_LL_READ_BACK(list, i) for(i = _lv_ll_get_tail(list); i != NULL; i = _lv_ll_get_prev(list, i)) +#define LV_LL_READ_BACK(list, i) for(i = lv_ll_get_tail(list); i != NULL; i = lv_ll_get_prev(list, i)) #ifdef __cplusplus } /*extern "C"*/ diff --git a/src/misc/lv_log.c b/src/misc/lv_log.c index 46f78873d..3f3caec8d 100644 --- a/src/misc/lv_log.c +++ b/src/misc/lv_log.c @@ -69,9 +69,9 @@ void lv_log_register_print_cb(lv_log_print_g_cb_t print_cb) custom_print_cb = print_cb; } -void _lv_log_add(lv_log_level_t level, const char * file, int line, const char * func, const char * format, ...) +void lv_log_add(lv_log_level_t level, const char * file, int line, const char * func, const char * format, ...) { - if(level >= _LV_LOG_LEVEL_NUM) return; /*Invalid level*/ + if(level >= LV_LOG_LEVEL_NUM) return; /*Invalid level*/ if(level >= LV_LOG_LEVEL) { va_list args; diff --git a/src/misc/lv_log.h b/src/misc/lv_log.h index acf264303..a04898343 100644 --- a/src/misc/lv_log.h +++ b/src/misc/lv_log.h @@ -29,7 +29,7 @@ extern "C" { #define LV_LOG_LEVEL_ERROR 3 /**< Only critical issue, when the system may fail*/ #define LV_LOG_LEVEL_USER 4 /**< Custom logs from the user*/ #define LV_LOG_LEVEL_NONE 5 /**< Do not log anything*/ -#define _LV_LOG_LEVEL_NUM 6 /**< Number of log levels*/ +#define LV_LOG_LEVEL_NUM 6 /**< Number of log levels*/ LV_EXPORT_CONST_INT(LV_LOG_LEVEL_TRACE); LV_EXPORT_CONST_INT(LV_LOG_LEVEL_INFO); @@ -88,15 +88,15 @@ void lv_log(const char * format, ...) LV_FORMAT_ATTRIBUTE(1, 2); * @param format printf-like format string * @param ... parameters for `format` */ -void _lv_log_add(lv_log_level_t level, const char * file, int line, - const char * func, const char * format, ...) LV_FORMAT_ATTRIBUTE(5, 6); +void lv_log_add(lv_log_level_t level, const char * file, int line, + const char * func, const char * format, ...) LV_FORMAT_ATTRIBUTE(5, 6); /********************** * MACROS **********************/ #ifndef LV_LOG_TRACE # if LV_LOG_LEVEL <= LV_LOG_LEVEL_TRACE -# define LV_LOG_TRACE(...) _lv_log_add(LV_LOG_LEVEL_TRACE, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) +# define LV_LOG_TRACE(...) lv_log_add(LV_LOG_LEVEL_TRACE, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) # else # define LV_LOG_TRACE(...) do {}while(0) # endif @@ -104,7 +104,7 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, #ifndef LV_LOG_INFO # if LV_LOG_LEVEL <= LV_LOG_LEVEL_INFO -# define LV_LOG_INFO(...) _lv_log_add(LV_LOG_LEVEL_INFO, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) +# define LV_LOG_INFO(...) lv_log_add(LV_LOG_LEVEL_INFO, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) # else # define LV_LOG_INFO(...) do {}while(0) # endif @@ -112,7 +112,7 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, #ifndef LV_LOG_WARN # if LV_LOG_LEVEL <= LV_LOG_LEVEL_WARN -# define LV_LOG_WARN(...) _lv_log_add(LV_LOG_LEVEL_WARN, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) +# define LV_LOG_WARN(...) lv_log_add(LV_LOG_LEVEL_WARN, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) # else # define LV_LOG_WARN(...) do {}while(0) # endif @@ -120,7 +120,7 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, #ifndef LV_LOG_ERROR # if LV_LOG_LEVEL <= LV_LOG_LEVEL_ERROR -# define LV_LOG_ERROR(...) _lv_log_add(LV_LOG_LEVEL_ERROR, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) +# define LV_LOG_ERROR(...) lv_log_add(LV_LOG_LEVEL_ERROR, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) # else # define LV_LOG_ERROR(...) do {}while(0) # endif @@ -128,7 +128,7 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, #ifndef LV_LOG_USER # if LV_LOG_LEVEL <= LV_LOG_LEVEL_USER -# define LV_LOG_USER(...) _lv_log_add(LV_LOG_LEVEL_USER, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) +# define LV_LOG_USER(...) lv_log_add(LV_LOG_LEVEL_USER, LV_LOG_FILE, LV_LOG_LINE, __func__, __VA_ARGS__) # else # define LV_LOG_USER(...) do {}while(0) # endif @@ -145,7 +145,7 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, #else /*LV_USE_LOG*/ /*Do nothing if `LV_USE_LOG 0`*/ -#define _lv_log_add(level, file, line, ...) +#define lv_log_add(level, file, line, ...) #define LV_LOG_TRACE(...) do {}while(0) #define LV_LOG_INFO(...) do {}while(0) #define LV_LOG_WARN(...) do {}while(0) diff --git a/src/misc/lv_lru.c b/src/misc/lv_lru.c index 006584153..f8d4c0682 100755 --- a/src/misc/lv_lru.c +++ b/src/misc/lv_lru.c @@ -23,13 +23,13 @@ * TYPEDEFS **********************/ -struct _lv_lru_item_t { +struct lv_lru_item_t { void * value; void * key; size_t value_length; size_t key_length; uint64_t access_count; - struct _lv_lru_item_t * next; + struct lv_lru_item_t * next; }; /********************** diff --git a/src/misc/lv_lru.h b/src/misc/lv_lru.h index f9c11182d..1bb25861f 100755 --- a/src/misc/lv_lru.h +++ b/src/misc/lv_lru.h @@ -37,7 +37,7 @@ typedef enum { typedef void (*lv_lru_free_cb_t)(void * v); -typedef struct _lv_lru_item_t lv_lru_item_t; +typedef struct lv_lru_item_t lv_lru_item_t; typedef struct lv_lru_t { lv_lru_item_t ** items; diff --git a/src/misc/lv_math.c b/src/misc/lv_math.c index a303a4c79..bd728fbcf 100644 --- a/src/misc/lv_math.c +++ b/src/misc/lv_math.c @@ -439,6 +439,18 @@ uint32_t lv_rand(uint32_t min, uint32_t max) return (rand_seed % (max - min + 1)) + min; } +int32_t LV_ATTRIBUTE_FAST_MEM lv_trigo_cos(int16_t angle) +{ + return lv_trigo_sin(angle + 90); +} + +int32_t lv_bezier3(int32_t t, int32_t u0, uint32_t u1, int32_t u2, int32_t u3) +{ + LV_UNUSED(u0); + LV_UNUSED(u3); + return lv_cubic_bezier(t, 341, u1, 683, u2); +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/misc/lv_math.h b/src/misc/lv_math.h index 334094009..02870a343 100644 --- a/src/misc/lv_math.h +++ b/src/misc/lv_math.h @@ -53,10 +53,7 @@ typedef struct { */ int32_t /* LV_ATTRIBUTE_FAST_MEM */ lv_trigo_sin(int16_t angle); -static inline int32_t LV_ATTRIBUTE_FAST_MEM lv_trigo_cos(int16_t angle) -{ - return lv_trigo_sin(angle + 90); -} +int32_t LV_ATTRIBUTE_FAST_MEM lv_trigo_cos(int16_t angle); //! @endcond @@ -80,12 +77,7 @@ int32_t lv_cubic_bezier(int32_t x, int32_t x1, int32_t y1, int32_t x2, int32_t y * @param u3 must be LV_BEZIER_VAL_MAX * @return the value calculated from the given parameters in range of [0..LV_BEZIER_VAL_MAX] */ -static inline int32_t lv_bezier3(int32_t t, int32_t u0, uint32_t u1, int32_t u2, int32_t u3) -{ - LV_UNUSED(u0); - LV_UNUSED(u3); - return lv_cubic_bezier(t, 341, u1, 683, u2); -} +int32_t lv_bezier3(int32_t t, int32_t u0, uint32_t u1, int32_t u2, int32_t u3); /** diff --git a/src/misc/lv_matrix.h b/src/misc/lv_matrix.h index 53887317f..9583fa9af 100644 --- a/src/misc/lv_matrix.h +++ b/src/misc/lv_matrix.h @@ -33,9 +33,9 @@ extern "C" { * TYPEDEFS **********************/ -typedef struct { +struct lv_matrix_t { float m[3][3]; -} lv_matrix_t; +}; /********************** * GLOBAL PROTOTYPES diff --git a/src/misc/lv_palette.c b/src/misc/lv_palette.c index 31aa66cf9..cbcdf4e64 100644 --- a/src/misc/lv_palette.c +++ b/src/misc/lv_palette.c @@ -42,7 +42,7 @@ lv_color_t lv_palette_main(lv_palette_t p) LV_COLOR_MAKE(0x79, 0x55, 0x48), LV_COLOR_MAKE(0x60, 0x7D, 0x8B), LV_COLOR_MAKE(0x9E, 0x9E, 0x9E) }; - if(p >= _LV_PALETTE_LAST) { + if(p >= LV_PALETTE_LAST) { LV_LOG_WARN("Invalid palette: %d", p); return lv_color_black(); } @@ -75,7 +75,7 @@ lv_color_t lv_palette_lighten(lv_palette_t p, uint8_t lvl) {LV_COLOR_MAKE(0xBD, 0xBD, 0xBD), LV_COLOR_MAKE(0xE0, 0xE0, 0xE0), LV_COLOR_MAKE(0xEE, 0xEE, 0xEE), LV_COLOR_MAKE(0xF5, 0xF5, 0xF5), LV_COLOR_MAKE(0xFA, 0xFA, 0xFA)}, }; - if(p >= _LV_PALETTE_LAST) { + if(p >= LV_PALETTE_LAST) { LV_LOG_WARN("Invalid palette: %d", p); return lv_color_black(); } @@ -114,7 +114,7 @@ lv_color_t lv_palette_darken(lv_palette_t p, uint8_t lvl) {LV_COLOR_MAKE(0x75, 0x75, 0x75), LV_COLOR_MAKE(0x61, 0x61, 0x61), LV_COLOR_MAKE(0x42, 0x42, 0x42), LV_COLOR_MAKE(0x21, 0x21, 0x21)}, }; - if(p >= _LV_PALETTE_LAST) { + if(p >= LV_PALETTE_LAST) { LV_LOG_WARN("Invalid palette: %d", p); return lv_color_black(); } diff --git a/src/misc/lv_palette.h b/src/misc/lv_palette.h index 39b5cd71f..d2f408ca2 100644 --- a/src/misc/lv_palette.h +++ b/src/misc/lv_palette.h @@ -43,7 +43,7 @@ typedef enum { LV_PALETTE_BROWN, LV_PALETTE_BLUE_GREY, LV_PALETTE_GREY, - _LV_PALETTE_LAST, + LV_PALETTE_LAST, LV_PALETTE_NONE = 0xff, } lv_palette_t; diff --git a/src/misc/lv_profiler_builtin.c b/src/misc/lv_profiler_builtin.c index ba278ae94..b6b6fd435 100644 --- a/src/misc/lv_profiler_builtin.c +++ b/src/misc/lv_profiler_builtin.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_profiler_builtin.h" +#include "lv_profiler_builtin_private.h" #include "../lvgl.h" #include "../core/lv_global.h" @@ -54,7 +54,7 @@ typedef struct { /** * @brief Structure representing a context for the LVGL built-in profiler */ -typedef struct _lv_profiler_builtin_ctx_t { +typedef struct lv_profiler_builtin_ctx_t { lv_profiler_builtin_item_t * item_arr; /**< Pointer to an array of profiler items */ uint32_t item_num; /**< Number of profiler items in the array */ uint32_t cur_index; /**< Index of the current profiler item */ diff --git a/src/misc/lv_profiler_builtin.h b/src/misc/lv_profiler_builtin.h index 5cf2ea105..aa0220b20 100644 --- a/src/misc/lv_profiler_builtin.h +++ b/src/misc/lv_profiler_builtin.h @@ -33,18 +33,6 @@ extern "C" { * TYPEDEFS **********************/ -/** - * @brief LVGL profiler built-in configuration structure - */ -typedef struct { - size_t buf_size; /**< The size of the buffer used for profiling data */ - uint32_t tick_per_sec; /**< The number of ticks per second */ - uint32_t (*tick_get_cb)(void); /**< Callback function to get the current tick count */ - void (*flush_cb)(const char * buf); /**< Callback function to flush the profiling data */ - int (*tid_get_cb)(void); /**< Callback function to get the current thread ID */ - int (*cpu_get_cb)(void); /**< Callback function to get the current CPU */ -} lv_profiler_builtin_config_t; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/misc/lv_profiler_builtin_private.h b/src/misc/lv_profiler_builtin_private.h new file mode 100644 index 000000000..3fb9938a2 --- /dev/null +++ b/src/misc/lv_profiler_builtin_private.h @@ -0,0 +1,56 @@ +/** + * @file lv_profiler_builtin_private.h + * + */ + +#ifndef LV_PROFILER_BUILTIN_PRIVATE_H +#define LV_PROFILER_BUILTIN_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_profiler_builtin.h" + +#if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * @brief LVGL profiler built-in configuration structure + */ +struct lv_profiler_builtin_config_t { + size_t buf_size; /**< The size of the buffer used for profiling data */ + uint32_t tick_per_sec; /**< The number of ticks per second */ + uint32_t (*tick_get_cb)(void); /**< Callback function to get the current tick count */ + void (*flush_cb)(const char * buf); /**< Callback function to flush the profiling data */ + int (*tid_get_cb)(void); /**< Callback function to get the current thread ID */ + int (*cpu_get_cb)(void); /**< Callback function to get the current CPU */ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_PROFILER_BUILTIN_PRIVATE_H*/ diff --git a/src/misc/lv_rb.c b/src/misc/lv_rb.c index 8a564599b..8a7328caa 100755 --- a/src/misc/lv_rb.c +++ b/src/misc/lv_rb.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_rb.h" +#include "lv_rb_private.h" #include "../stdlib/lv_string.h" /********************* diff --git a/src/misc/lv_rb.h b/src/misc/lv_rb.h index dcfacadfb..bec0a788f 100755 --- a/src/misc/lv_rb.h +++ b/src/misc/lv_rb.h @@ -30,24 +30,10 @@ typedef enum { LV_RB_COLOR_BLACK } lv_rb_color_t; -typedef struct lv_rb_node_t { - struct lv_rb_node_t * parent; - struct lv_rb_node_t * left; - struct lv_rb_node_t * right; - lv_rb_color_t color; - void * data; -} lv_rb_node_t; - typedef int8_t lv_rb_compare_res_t; typedef lv_rb_compare_res_t (*lv_rb_compare_t)(const void * a, const void * b); -typedef struct { - lv_rb_node_t * root; - lv_rb_compare_t compare; - size_t size; -} lv_rb_t; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/misc/lv_rb_private.h b/src/misc/lv_rb_private.h new file mode 100644 index 000000000..327b7b0be --- /dev/null +++ b/src/misc/lv_rb_private.h @@ -0,0 +1,54 @@ +/** + * @file lv_rb_private.h + * + */ + +#ifndef LV_RB_PRIVATE_H +#define LV_RB_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_rb.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_rb_node_t { + struct lv_rb_node_t * parent; + struct lv_rb_node_t * left; + struct lv_rb_node_t * right; + lv_rb_color_t color; + void * data; +}; + +struct lv_rb_t { + lv_rb_node_t * root; + lv_rb_compare_t compare; + size_t size; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_RB_PRIVATE_H*/ diff --git a/src/misc/lv_style.c b/src/misc/lv_style.c index e7278434e..d137d67eb 100644 --- a/src/misc/lv_style.c +++ b/src/misc/lv_style.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_style.h" +#include "lv_style_private.h" #include "../core/lv_global.h" #include "../stdlib/lv_mem.h" #include "../stdlib/lv_string.h" @@ -16,8 +16,8 @@ /********************* * DEFINES *********************/ -#define _lv_style_custom_prop_flag_lookup_table_size LV_GLOBAL_DEFAULT()->style_custom_table_size -#define _lv_style_custom_prop_flag_lookup_table LV_GLOBAL_DEFAULT()->style_custom_prop_flag_lookup_table +#define lv_style_custom_prop_flag_lookup_table_size LV_GLOBAL_DEFAULT()->style_custom_table_size +#define lv_style_custom_prop_flag_lookup_table LV_GLOBAL_DEFAULT()->style_custom_prop_flag_lookup_table #define last_custom_prop_id LV_GLOBAL_DEFAULT()->style_last_custom_prop_id /********************** @@ -34,7 +34,7 @@ const lv_style_prop_t lv_style_const_prop_id_inv = LV_STYLE_PROP_INV; -const uint8_t _lv_style_builtin_prop_flag_lookup_table[_LV_STYLE_NUM_BUILT_IN_PROPS] = { +const uint8_t lv_style_builtin_prop_flag_lookup_table[LV_STYLE_NUM_BUILT_IN_PROPS] = { [LV_STYLE_WIDTH] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_MIN_WIDTH] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, [LV_STYLE_MAX_WIDTH] = LV_STYLE_PROP_FLAG_LAYOUT_UPDATE, @@ -200,9 +200,9 @@ void lv_style_reset(lv_style_t * style) lv_style_prop_t lv_style_register_prop(uint8_t flag) { - if(_lv_style_custom_prop_flag_lookup_table == NULL) { - _lv_style_custom_prop_flag_lookup_table_size = 0; - last_custom_prop_id = (uint16_t)_LV_STYLE_LAST_BUILT_IN_PROP; + if(lv_style_custom_prop_flag_lookup_table == NULL) { + lv_style_custom_prop_flag_lookup_table_size = 0; + last_custom_prop_id = (uint16_t)LV_STYLE_LAST_BUILT_IN_PROP; } // if((last_custom_prop_id + 1) != 0) { @@ -213,30 +213,30 @@ lv_style_prop_t lv_style_register_prop(uint8_t flag) /* * Allocate the lookup table if it's not yet available. */ - size_t required_size = (last_custom_prop_id + 1 - _LV_STYLE_LAST_BUILT_IN_PROP); - if(_lv_style_custom_prop_flag_lookup_table_size < required_size) { + size_t required_size = (last_custom_prop_id + 1 - LV_STYLE_LAST_BUILT_IN_PROP); + if(lv_style_custom_prop_flag_lookup_table_size < required_size) { /* Round required_size up to the nearest 32-byte value */ required_size = (required_size + 31) & ~31; LV_ASSERT_MSG(required_size > 0, "required size has become 0?"); - uint8_t * old_p = _lv_style_custom_prop_flag_lookup_table; + uint8_t * old_p = lv_style_custom_prop_flag_lookup_table; uint8_t * new_p = lv_realloc(old_p, required_size * sizeof(uint8_t)); if(new_p == NULL) { LV_LOG_ERROR("Unable to allocate space for custom property lookup table"); return LV_STYLE_PROP_INV; } - _lv_style_custom_prop_flag_lookup_table = new_p; - _lv_style_custom_prop_flag_lookup_table_size = required_size; + lv_style_custom_prop_flag_lookup_table = new_p; + lv_style_custom_prop_flag_lookup_table_size = required_size; } last_custom_prop_id++; /* This should never happen - we should bail out above */ - LV_ASSERT_NULL(_lv_style_custom_prop_flag_lookup_table); - _lv_style_custom_prop_flag_lookup_table[last_custom_prop_id - _LV_STYLE_NUM_BUILT_IN_PROPS] = flag; + LV_ASSERT_NULL(lv_style_custom_prop_flag_lookup_table); + lv_style_custom_prop_flag_lookup_table[last_custom_prop_id - LV_STYLE_NUM_BUILT_IN_PROPS] = flag; return last_custom_prop_id; } lv_style_prop_t lv_style_get_num_custom_props(void) { - return last_custom_prop_id - _LV_STYLE_LAST_BUILT_IN_PROP; + return last_custom_prop_id - LV_STYLE_LAST_BUILT_IN_PROP; } bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop) @@ -329,7 +329,7 @@ void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_ props[style->prop_cnt - 1] = prop; values[style->prop_cnt - 1] = value; - uint32_t group = _lv_style_get_prop_group(prop); + uint32_t group = lv_style_get_prop_group(prop); style->has_group |= (uint32_t)1 << group; } @@ -424,16 +424,16 @@ bool lv_style_is_empty(const lv_style_t * style) return style->prop_cnt == 0; } -uint8_t _lv_style_prop_lookup_flags(lv_style_prop_t prop) +uint8_t lv_style_prop_lookup_flags(lv_style_prop_t prop) { if(prop == LV_STYLE_PROP_ANY) return LV_STYLE_PROP_FLAG_ALL; /*Any prop can have any flags*/ if(prop == LV_STYLE_PROP_INV) return 0; - if(prop < _LV_STYLE_NUM_BUILT_IN_PROPS) - return _lv_style_builtin_prop_flag_lookup_table[prop]; - prop -= _LV_STYLE_NUM_BUILT_IN_PROPS; - if(_lv_style_custom_prop_flag_lookup_table != NULL && prop < _lv_style_custom_prop_flag_lookup_table_size) - return _lv_style_custom_prop_flag_lookup_table[prop]; + if(prop < LV_STYLE_NUM_BUILT_IN_PROPS) + return lv_style_builtin_prop_flag_lookup_table[prop]; + prop -= LV_STYLE_NUM_BUILT_IN_PROPS; + if(lv_style_custom_prop_flag_lookup_table != NULL && prop < lv_style_custom_prop_flag_lookup_table_size) + return lv_style_custom_prop_flag_lookup_table[prop]; return 0; } diff --git a/src/misc/lv_style.h b/src/misc/lv_style.h index 2fd84a0a7..fa35daf8e 100644 --- a/src/misc/lv_style.h +++ b/src/misc/lv_style.h @@ -68,7 +68,7 @@ LV_EXPORT_CONST_INT(LV_SCALE_NONE); #endif // *INDENT-ON* -#define LV_STYLE_CONST_PROPS_END { .prop_ptr = NULL, .value = { .num = 0 } } +#define LV_STYLE_CONST_PROPS_END { .prop = LV_STYLE_PROP_INV, .value = { .num = 0 } } /********************** * TYPEDEFS @@ -77,40 +77,28 @@ LV_EXPORT_CONST_INT(LV_SCALE_NONE); /** * Possible options how to blend opaque drawings */ -enum _lv_blend_mode_t { +typedef enum { LV_BLEND_MODE_NORMAL, /**< Simply mix according to the opacity value*/ LV_BLEND_MODE_ADDITIVE, /**< Add the respective color channels*/ LV_BLEND_MODE_SUBTRACTIVE,/**< Subtract the foreground from the background*/ LV_BLEND_MODE_MULTIPLY, /**< Multiply the foreground and background*/ -}; - -#ifdef DOXYGEN -typedef _lv_blend_mode_t lv_blend_mode_t; -#else -typedef uint8_t lv_blend_mode_t; -#endif /*DOXYGEN*/ +} lv_blend_mode_t; /** * Some options to apply decorations on texts. * 'OR'ed values can be used. */ -enum _lv_text_decor_t { +typedef enum { LV_TEXT_DECOR_NONE = 0x00, LV_TEXT_DECOR_UNDERLINE = 0x01, LV_TEXT_DECOR_STRIKETHROUGH = 0x02, -}; - -#ifdef DOXYGEN -typedef _lv_text_decor_t lv_text_decor_t; -#else -typedef uint8_t lv_text_decor_t; -#endif /*DOXYGEN*/ +} lv_text_decor_t; /** * Selects on which sides border should be drawn * 'OR'ed values can be used. */ -enum _lv_border_side_t { +typedef enum { LV_BORDER_SIDE_NONE = 0x00, LV_BORDER_SIDE_BOTTOM = 0x01, LV_BORDER_SIDE_TOP = 0x02, @@ -118,44 +106,28 @@ enum _lv_border_side_t { LV_BORDER_SIDE_RIGHT = 0x08, LV_BORDER_SIDE_FULL = 0x0F, LV_BORDER_SIDE_INTERNAL = 0x10, /**< FOR matrix-like objects (e.g. Button matrix)*/ -}; - -#ifdef DOXYGEN -typedef _lv_border_side_t lv_border_side_t; -#else -typedef uint8_t lv_border_side_t; -#endif /*DOXYGEN*/ +} lv_border_side_t; /** * The direction of the gradient. */ -enum _lv_grad_dir_t { +typedef enum { LV_GRAD_DIR_NONE, /**< No gradient (the `grad_color` property is ignored)*/ LV_GRAD_DIR_VER, /**< Simple vertical (top to bottom) gradient*/ LV_GRAD_DIR_HOR, /**< Simple horizontal (left to right) gradient*/ LV_GRAD_DIR_LINEAR, /**< Linear gradient defined by start and end points. Can be at any angle.*/ LV_GRAD_DIR_RADIAL, /**< Radial gradient defined by start and end circles*/ LV_GRAD_DIR_CONICAL, /**< Conical gradient defined by center point, start and end angles*/ -}; +} lv_grad_dir_t; /** * Gradient behavior outside the defined range. */ -enum _lv_grad_extend_t { +typedef enum { LV_GRAD_EXTEND_PAD, /**< Repeat the same color*/ LV_GRAD_EXTEND_REPEAT, /**< Repeat the pattern*/ LV_GRAD_EXTEND_REFLECT, /**< Repeat the pattern mirrored*/ -}; - -#ifdef DOXYGEN -typedef _lv_grad_dir_t lv_grad_dir_t; -typedef _lv_grad_type_t lv_grad_type_t; -typedef _lv_grad_extend_t lv_grad_extend_t; -#else -typedef uint8_t lv_grad_dir_t; -typedef uint8_t lv_grad_type_t; -typedef uint8_t lv_grad_extend_t; -#endif /*DOXYGEN*/ +} lv_grad_extend_t; /** A gradient stop definition. * This matches a color and a position in a virtual 0-255 scale. @@ -215,7 +187,7 @@ typedef union { * * Props are split into groups of 16. When adding a new prop to a group, ensure it does not overflow into the next one. */ -enum _lv_style_prop_t { +enum { LV_STYLE_PROP_INV = 0, /*Group 0*/ @@ -359,30 +331,18 @@ enum _lv_style_prop_t { LV_STYLE_GRID_CELL_ROW_SPAN = 138, LV_STYLE_GRID_CELL_Y_ALIGN = 139, - _LV_STYLE_LAST_BUILT_IN_PROP = 140, + LV_STYLE_LAST_BUILT_IN_PROP = 140, - _LV_STYLE_NUM_BUILT_IN_PROPS = _LV_STYLE_LAST_BUILT_IN_PROP + 1, + LV_STYLE_NUM_BUILT_IN_PROPS = LV_STYLE_LAST_BUILT_IN_PROP + 1, LV_STYLE_PROP_ANY = 0xFF, - _LV_STYLE_PROP_CONST = 0xFF /* magic value for const styles */ + LV_STYLE_PROP_CONST = 0xFF /* magic value for const styles */ }; -#ifdef DOXYGEN -typedef _lv_style_prop_t lv_style_prop_t; -#else -typedef uint8_t lv_style_prop_t; -#endif /*DOXYGEN*/ - -enum _lv_style_res_t { +typedef enum { LV_STYLE_RES_NOT_FOUND, LV_STYLE_RES_FOUND, -}; - -#ifdef DOXYGEN -typedef _lv_style_res_t lv_style_res_t; -#else -typedef uint8_t lv_style_res_t; -#endif /*DOXYGEN*/ +} lv_style_res_t; /** * Descriptor for style transitions @@ -399,7 +359,7 @@ typedef struct { * Descriptor of a constant style property. */ typedef struct { - const lv_style_prop_t * prop_ptr; + lv_style_prop_t prop; lv_style_value_t value; } lv_style_const_prop_t; @@ -536,8 +496,8 @@ static inline lv_style_res_t lv_style_get_prop_inlined(const lv_style_t * style, if(lv_style_is_const(style)) { lv_style_const_prop_t * props = (lv_style_const_prop_t *)style->values_and_props; uint32_t i; - for(i = 0; props[i].prop_ptr; i++) { - if(*props[i].prop_ptr == prop) { + for(i = 0; props[i].prop != LV_STYLE_PROP_INV; i++) { + if(props[i].prop == prop) { *value = props[i].value; return LV_STYLE_RES_FOUND; } @@ -570,7 +530,7 @@ bool lv_style_is_empty(const lv_style_t * style); * @param prop a style property * @return the group [0..30] 30 means all the custom properties with index > 120 */ -static inline uint32_t _lv_style_get_prop_group(lv_style_prop_t prop) +static inline uint32_t lv_style_get_prop_group(lv_style_prop_t prop) { uint32_t group = prop >> 2; if(group > 30) group = 31; /*The MSB marks all the custom properties*/ @@ -584,7 +544,7 @@ static inline uint32_t _lv_style_get_prop_group(lv_style_prop_t prop) * @param prop a style property * @return the flags of the property */ -uint8_t _lv_style_prop_lookup_flags(lv_style_prop_t prop); +uint8_t lv_style_prop_lookup_flags(lv_style_prop_t prop); #include "lv_style_gen.h" @@ -638,7 +598,7 @@ static inline void lv_style_set_transform_scale(lv_style_t * style, int32_t valu */ static inline bool lv_style_prop_has_flag(lv_style_prop_t prop, uint8_t flag) { - return _lv_style_prop_lookup_flags(prop) & flag; + return lv_style_prop_lookup_flags(prop) & flag; } /************************* diff --git a/src/misc/lv_style_gen.c b/src/misc/lv_style_gen.c index 3abeffea7..233cf7b94 100644 --- a/src/misc/lv_style_gen.c +++ b/src/misc/lv_style_gen.c @@ -18,8 +18,6 @@ void lv_style_set_width(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_WIDTH, v); } -const lv_style_prop_t _lv_style_const_prop_id_WIDTH = LV_STYLE_WIDTH; - void lv_style_set_min_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { @@ -28,8 +26,6 @@ void lv_style_set_min_width(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_MIN_WIDTH, v); } -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, int32_t value) { lv_style_value_t v = { @@ -38,8 +34,6 @@ void lv_style_set_max_width(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_MAX_WIDTH, v); } -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, int32_t value) { lv_style_value_t v = { @@ -48,8 +42,6 @@ void lv_style_set_height(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_HEIGHT, v); } -const lv_style_prop_t _lv_style_const_prop_id_HEIGHT = LV_STYLE_HEIGHT; - void lv_style_set_min_height(lv_style_t * style, int32_t value) { lv_style_value_t v = { @@ -58,8 +50,6 @@ void lv_style_set_min_height(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_MIN_HEIGHT, v); } -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, int32_t value) { lv_style_value_t v = { @@ -68,8 +58,6 @@ void lv_style_set_max_height(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_MAX_HEIGHT, v); } -const lv_style_prop_t _lv_style_const_prop_id_MAX_HEIGHT = LV_STYLE_MAX_HEIGHT; - void lv_style_set_length(lv_style_t * style, int32_t value) { lv_style_value_t v = { @@ -78,8 +66,6 @@ void lv_style_set_length(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_LENGTH, v); } -const lv_style_prop_t _lv_style_const_prop_id_LENGTH = LV_STYLE_LENGTH; - void lv_style_set_x(lv_style_t * style, int32_t value) { lv_style_value_t v = { @@ -88,8 +74,6 @@ void lv_style_set_x(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_X, v); } -const lv_style_prop_t _lv_style_const_prop_id_X = LV_STYLE_X; - void lv_style_set_y(lv_style_t * style, int32_t value) { lv_style_value_t v = { @@ -98,8 +82,6 @@ void lv_style_set_y(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_Y, v); } -const lv_style_prop_t _lv_style_const_prop_id_Y = LV_STYLE_Y; - void lv_style_set_align(lv_style_t * style, lv_align_t value) { lv_style_value_t v = { @@ -108,8 +90,6 @@ void lv_style_set_align(lv_style_t * style, lv_align_t value) lv_style_set_prop(style, LV_STYLE_ALIGN, v); } -const lv_style_prop_t _lv_style_const_prop_id_ALIGN = LV_STYLE_ALIGN; - void lv_style_set_transform_width(lv_style_t * style, int32_t value) { lv_style_value_t v = { @@ -118,8 +98,6 @@ void lv_style_set_transform_width(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSFORM_WIDTH, v); } -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, int32_t value) { lv_style_value_t v = { @@ -128,8 +106,6 @@ void lv_style_set_transform_height(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSFORM_HEIGHT, v); } -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, int32_t value) { lv_style_value_t v = { @@ -138,8 +114,6 @@ void lv_style_set_translate_x(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSLATE_X, v); } -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, int32_t value) { lv_style_value_t v = { @@ -148,8 +122,6 @@ void lv_style_set_translate_y(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSLATE_Y, v); } -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, int32_t value) { lv_style_value_t v = { @@ -158,8 +130,6 @@ void lv_style_set_transform_scale_x(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSFORM_SCALE_X, v); } -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, int32_t value) { lv_style_value_t v = { @@ -168,8 +138,6 @@ void lv_style_set_transform_scale_y(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSFORM_SCALE_Y, v); } -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, int32_t value) { lv_style_value_t v = { @@ -178,8 +146,6 @@ void lv_style_set_transform_rotation(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSFORM_ROTATION, v); } -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, int32_t value) { lv_style_value_t v = { @@ -188,8 +154,6 @@ void lv_style_set_transform_pivot_x(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSFORM_PIVOT_X, v); } -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, int32_t value) { lv_style_value_t v = { @@ -198,8 +162,6 @@ void lv_style_set_transform_pivot_y(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSFORM_PIVOT_Y, v); } -const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_PIVOT_Y = LV_STYLE_TRANSFORM_PIVOT_Y; - void lv_style_set_transform_skew_x(lv_style_t * style, int32_t value) { lv_style_value_t v = { @@ -208,8 +170,6 @@ void lv_style_set_transform_skew_x(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSFORM_SKEW_X, v); } -const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SKEW_X = LV_STYLE_TRANSFORM_SKEW_X; - void lv_style_set_transform_skew_y(lv_style_t * style, int32_t value) { lv_style_value_t v = { @@ -218,8 +178,6 @@ void lv_style_set_transform_skew_y(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TRANSFORM_SKEW_Y, v); } -const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SKEW_Y = LV_STYLE_TRANSFORM_SKEW_Y; - void lv_style_set_pad_top(lv_style_t * style, int32_t value) { lv_style_value_t v = { @@ -228,8 +186,6 @@ void lv_style_set_pad_top(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_PAD_TOP, v); } -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, int32_t value) { lv_style_value_t v = { @@ -238,8 +194,6 @@ void lv_style_set_pad_bottom(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_PAD_BOTTOM, v); } -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, int32_t value) { lv_style_value_t v = { @@ -248,8 +202,6 @@ void lv_style_set_pad_left(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_PAD_LEFT, v); } -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, int32_t value) { lv_style_value_t v = { @@ -258,8 +210,6 @@ void lv_style_set_pad_right(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_PAD_RIGHT, v); } -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, int32_t value) { lv_style_value_t v = { @@ -268,8 +218,6 @@ void lv_style_set_pad_row(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_PAD_ROW, v); } -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, int32_t value) { lv_style_value_t v = { @@ -278,8 +226,6 @@ void lv_style_set_pad_column(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_PAD_COLUMN, v); } -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, int32_t value) { lv_style_value_t v = { @@ -288,8 +234,6 @@ void lv_style_set_margin_top(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_MARGIN_TOP, v); } -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, int32_t value) { lv_style_value_t v = { @@ -298,8 +242,6 @@ void lv_style_set_margin_bottom(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_MARGIN_BOTTOM, v); } -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, int32_t value) { lv_style_value_t v = { @@ -308,8 +250,6 @@ void lv_style_set_margin_left(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_MARGIN_LEFT, v); } -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, int32_t value) { lv_style_value_t v = { @@ -318,8 +258,6 @@ void lv_style_set_margin_right(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_MARGIN_RIGHT, v); } -const lv_style_prop_t _lv_style_const_prop_id_MARGIN_RIGHT = LV_STYLE_MARGIN_RIGHT; - void lv_style_set_bg_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -328,8 +266,6 @@ void lv_style_set_bg_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_BG_COLOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_COLOR = LV_STYLE_BG_COLOR; - void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -338,8 +274,6 @@ void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_BG_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_OPA = LV_STYLE_BG_OPA; - void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -348,8 +282,6 @@ void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_BG_GRAD_COLOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_GRAD_COLOR = LV_STYLE_BG_GRAD_COLOR; - void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value) { lv_style_value_t v = { @@ -358,8 +290,6 @@ void lv_style_set_bg_grad_dir(lv_style_t * style, lv_grad_dir_t value) lv_style_set_prop(style, LV_STYLE_BG_GRAD_DIR, v); } -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, int32_t value) { lv_style_value_t v = { @@ -368,8 +298,6 @@ void lv_style_set_bg_main_stop(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_BG_MAIN_STOP, v); } -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, int32_t value) { lv_style_value_t v = { @@ -378,8 +306,6 @@ void lv_style_set_bg_grad_stop(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_BG_GRAD_STOP, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_GRAD_STOP = LV_STYLE_BG_GRAD_STOP; - void lv_style_set_bg_main_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -388,8 +314,6 @@ void lv_style_set_bg_main_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_BG_MAIN_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_MAIN_OPA = LV_STYLE_BG_MAIN_OPA; - void lv_style_set_bg_grad_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -398,8 +322,6 @@ void lv_style_set_bg_grad_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_BG_GRAD_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_GRAD_OPA = LV_STYLE_BG_GRAD_OPA; - void lv_style_set_bg_grad(lv_style_t * style, const lv_grad_dsc_t * value) { lv_style_value_t v = { @@ -408,8 +330,6 @@ void lv_style_set_bg_grad(lv_style_t * style, const lv_grad_dsc_t * value) lv_style_set_prop(style, LV_STYLE_BG_GRAD, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_GRAD = LV_STYLE_BG_GRAD; - void lv_style_set_bg_image_src(lv_style_t * style, const void * value) { lv_style_value_t v = { @@ -418,8 +338,6 @@ void lv_style_set_bg_image_src(lv_style_t * style, const void * value) lv_style_set_prop(style, LV_STYLE_BG_IMAGE_SRC, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_IMAGE_SRC = LV_STYLE_BG_IMAGE_SRC; - void lv_style_set_bg_image_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -428,8 +346,6 @@ void lv_style_set_bg_image_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_BG_IMAGE_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_IMAGE_OPA = LV_STYLE_BG_IMAGE_OPA; - void lv_style_set_bg_image_recolor(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -438,8 +354,6 @@ void lv_style_set_bg_image_recolor(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_BG_IMAGE_RECOLOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_IMAGE_RECOLOR = LV_STYLE_BG_IMAGE_RECOLOR; - void lv_style_set_bg_image_recolor_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -448,8 +362,6 @@ void lv_style_set_bg_image_recolor_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_BG_IMAGE_RECOLOR_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_IMAGE_RECOLOR_OPA = LV_STYLE_BG_IMAGE_RECOLOR_OPA; - void lv_style_set_bg_image_tiled(lv_style_t * style, bool value) { lv_style_value_t v = { @@ -458,8 +370,6 @@ void lv_style_set_bg_image_tiled(lv_style_t * style, bool value) lv_style_set_prop(style, LV_STYLE_BG_IMAGE_TILED, v); } -const lv_style_prop_t _lv_style_const_prop_id_BG_IMAGE_TILED = LV_STYLE_BG_IMAGE_TILED; - void lv_style_set_border_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -468,8 +378,6 @@ void lv_style_set_border_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_BORDER_COLOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_BORDER_COLOR = LV_STYLE_BORDER_COLOR; - void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -478,8 +386,6 @@ void lv_style_set_border_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_BORDER_OPA, v); } -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, int32_t value) { lv_style_value_t v = { @@ -488,8 +394,6 @@ void lv_style_set_border_width(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_BORDER_WIDTH, v); } -const lv_style_prop_t _lv_style_const_prop_id_BORDER_WIDTH = LV_STYLE_BORDER_WIDTH; - void lv_style_set_border_side(lv_style_t * style, lv_border_side_t value) { lv_style_value_t v = { @@ -498,8 +402,6 @@ void lv_style_set_border_side(lv_style_t * style, lv_border_side_t value) lv_style_set_prop(style, LV_STYLE_BORDER_SIDE, v); } -const lv_style_prop_t _lv_style_const_prop_id_BORDER_SIDE = LV_STYLE_BORDER_SIDE; - void lv_style_set_border_post(lv_style_t * style, bool value) { lv_style_value_t v = { @@ -508,8 +410,6 @@ void lv_style_set_border_post(lv_style_t * style, bool value) lv_style_set_prop(style, LV_STYLE_BORDER_POST, v); } -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, int32_t value) { lv_style_value_t v = { @@ -518,8 +418,6 @@ void lv_style_set_outline_width(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_OUTLINE_WIDTH, v); } -const lv_style_prop_t _lv_style_const_prop_id_OUTLINE_WIDTH = LV_STYLE_OUTLINE_WIDTH; - void lv_style_set_outline_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -528,8 +426,6 @@ void lv_style_set_outline_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_OUTLINE_COLOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_OUTLINE_COLOR = LV_STYLE_OUTLINE_COLOR; - void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -538,8 +434,6 @@ void lv_style_set_outline_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_OUTLINE_OPA, v); } -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, int32_t value) { lv_style_value_t v = { @@ -548,8 +442,6 @@ void lv_style_set_outline_pad(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_OUTLINE_PAD, v); } -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, int32_t value) { lv_style_value_t v = { @@ -558,8 +450,6 @@ void lv_style_set_shadow_width(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_SHADOW_WIDTH, v); } -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, int32_t value) { lv_style_value_t v = { @@ -568,8 +458,6 @@ void lv_style_set_shadow_offset_x(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_SHADOW_OFFSET_X, v); } -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, int32_t value) { lv_style_value_t v = { @@ -578,8 +466,6 @@ void lv_style_set_shadow_offset_y(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_SHADOW_OFFSET_Y, v); } -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, int32_t value) { lv_style_value_t v = { @@ -588,8 +474,6 @@ void lv_style_set_shadow_spread(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_SHADOW_SPREAD, v); } -const lv_style_prop_t _lv_style_const_prop_id_SHADOW_SPREAD = LV_STYLE_SHADOW_SPREAD; - void lv_style_set_shadow_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -598,8 +482,6 @@ void lv_style_set_shadow_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_SHADOW_COLOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_SHADOW_COLOR = LV_STYLE_SHADOW_COLOR; - void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -608,8 +490,6 @@ void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_SHADOW_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_SHADOW_OPA = LV_STYLE_SHADOW_OPA; - void lv_style_set_image_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -618,8 +498,6 @@ void lv_style_set_image_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_IMAGE_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_IMAGE_OPA = LV_STYLE_IMAGE_OPA; - void lv_style_set_image_recolor(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -628,8 +506,6 @@ void lv_style_set_image_recolor(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_IMAGE_RECOLOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_IMAGE_RECOLOR = LV_STYLE_IMAGE_RECOLOR; - void lv_style_set_image_recolor_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -638,8 +514,6 @@ void lv_style_set_image_recolor_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_IMAGE_RECOLOR_OPA, v); } -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, int32_t value) { lv_style_value_t v = { @@ -648,8 +522,6 @@ void lv_style_set_line_width(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_LINE_WIDTH, v); } -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, int32_t value) { lv_style_value_t v = { @@ -658,8 +530,6 @@ void lv_style_set_line_dash_width(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_LINE_DASH_WIDTH, v); } -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, int32_t value) { lv_style_value_t v = { @@ -668,8 +538,6 @@ void lv_style_set_line_dash_gap(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_LINE_DASH_GAP, v); } -const lv_style_prop_t _lv_style_const_prop_id_LINE_DASH_GAP = LV_STYLE_LINE_DASH_GAP; - void lv_style_set_line_rounded(lv_style_t * style, bool value) { lv_style_value_t v = { @@ -678,8 +546,6 @@ void lv_style_set_line_rounded(lv_style_t * style, bool value) lv_style_set_prop(style, LV_STYLE_LINE_ROUNDED, v); } -const lv_style_prop_t _lv_style_const_prop_id_LINE_ROUNDED = LV_STYLE_LINE_ROUNDED; - void lv_style_set_line_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -688,8 +554,6 @@ void lv_style_set_line_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_LINE_COLOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_LINE_COLOR = LV_STYLE_LINE_COLOR; - void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -698,8 +562,6 @@ void lv_style_set_line_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_LINE_OPA, v); } -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, int32_t value) { lv_style_value_t v = { @@ -708,8 +570,6 @@ void lv_style_set_arc_width(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_ARC_WIDTH, v); } -const lv_style_prop_t _lv_style_const_prop_id_ARC_WIDTH = LV_STYLE_ARC_WIDTH; - void lv_style_set_arc_rounded(lv_style_t * style, bool value) { lv_style_value_t v = { @@ -718,8 +578,6 @@ void lv_style_set_arc_rounded(lv_style_t * style, bool value) lv_style_set_prop(style, LV_STYLE_ARC_ROUNDED, v); } -const lv_style_prop_t _lv_style_const_prop_id_ARC_ROUNDED = LV_STYLE_ARC_ROUNDED; - void lv_style_set_arc_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -728,8 +586,6 @@ void lv_style_set_arc_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_ARC_COLOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_ARC_COLOR = LV_STYLE_ARC_COLOR; - void lv_style_set_arc_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -738,8 +594,6 @@ void lv_style_set_arc_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_ARC_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_ARC_OPA = LV_STYLE_ARC_OPA; - void lv_style_set_arc_image_src(lv_style_t * style, const void * value) { lv_style_value_t v = { @@ -748,8 +602,6 @@ void lv_style_set_arc_image_src(lv_style_t * style, const void * value) lv_style_set_prop(style, LV_STYLE_ARC_IMAGE_SRC, v); } -const lv_style_prop_t _lv_style_const_prop_id_ARC_IMAGE_SRC = LV_STYLE_ARC_IMAGE_SRC; - void lv_style_set_text_color(lv_style_t * style, lv_color_t value) { lv_style_value_t v = { @@ -758,8 +610,6 @@ void lv_style_set_text_color(lv_style_t * style, lv_color_t value) lv_style_set_prop(style, LV_STYLE_TEXT_COLOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_TEXT_COLOR = LV_STYLE_TEXT_COLOR; - void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -768,8 +618,6 @@ void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_TEXT_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_TEXT_OPA = LV_STYLE_TEXT_OPA; - void lv_style_set_text_font(lv_style_t * style, const lv_font_t * value) { lv_style_value_t v = { @@ -778,8 +626,6 @@ void lv_style_set_text_font(lv_style_t * style, const lv_font_t * value) lv_style_set_prop(style, LV_STYLE_TEXT_FONT, v); } -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, int32_t value) { lv_style_value_t v = { @@ -788,8 +634,6 @@ void lv_style_set_text_letter_space(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TEXT_LETTER_SPACE, v); } -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, int32_t value) { lv_style_value_t v = { @@ -798,8 +642,6 @@ void lv_style_set_text_line_space(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_TEXT_LINE_SPACE, v); } -const lv_style_prop_t _lv_style_const_prop_id_TEXT_LINE_SPACE = LV_STYLE_TEXT_LINE_SPACE; - void lv_style_set_text_decor(lv_style_t * style, lv_text_decor_t value) { lv_style_value_t v = { @@ -808,8 +650,6 @@ void lv_style_set_text_decor(lv_style_t * style, lv_text_decor_t value) lv_style_set_prop(style, LV_STYLE_TEXT_DECOR, v); } -const lv_style_prop_t _lv_style_const_prop_id_TEXT_DECOR = LV_STYLE_TEXT_DECOR; - void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value) { lv_style_value_t v = { @@ -818,8 +658,6 @@ void lv_style_set_text_align(lv_style_t * style, lv_text_align_t value) lv_style_set_prop(style, LV_STYLE_TEXT_ALIGN, v); } -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, int32_t value) { lv_style_value_t v = { @@ -828,8 +666,6 @@ void lv_style_set_radius(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_RADIUS, v); } -const lv_style_prop_t _lv_style_const_prop_id_RADIUS = LV_STYLE_RADIUS; - void lv_style_set_clip_corner(lv_style_t * style, bool value) { lv_style_value_t v = { @@ -838,8 +674,6 @@ void lv_style_set_clip_corner(lv_style_t * style, bool value) lv_style_set_prop(style, LV_STYLE_CLIP_CORNER, v); } -const lv_style_prop_t _lv_style_const_prop_id_CLIP_CORNER = LV_STYLE_CLIP_CORNER; - void lv_style_set_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -848,8 +682,6 @@ void lv_style_set_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_OPA = LV_STYLE_OPA; - void lv_style_set_opa_layered(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -858,8 +690,6 @@ void lv_style_set_opa_layered(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_OPA_LAYERED, v); } -const lv_style_prop_t _lv_style_const_prop_id_OPA_LAYERED = LV_STYLE_OPA_LAYERED; - void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value) { lv_style_value_t v = { @@ -868,8 +698,6 @@ void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc lv_style_set_prop(style, LV_STYLE_COLOR_FILTER_DSC, v); } -const lv_style_prop_t _lv_style_const_prop_id_COLOR_FILTER_DSC = LV_STYLE_COLOR_FILTER_DSC; - void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value) { lv_style_value_t v = { @@ -878,8 +706,6 @@ void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value) lv_style_set_prop(style, LV_STYLE_COLOR_FILTER_OPA, v); } -const lv_style_prop_t _lv_style_const_prop_id_COLOR_FILTER_OPA = LV_STYLE_COLOR_FILTER_OPA; - void lv_style_set_anim(lv_style_t * style, const lv_anim_t * value) { lv_style_value_t v = { @@ -888,8 +714,6 @@ void lv_style_set_anim(lv_style_t * style, const lv_anim_t * value) lv_style_set_prop(style, LV_STYLE_ANIM, v); } -const lv_style_prop_t _lv_style_const_prop_id_ANIM = LV_STYLE_ANIM; - void lv_style_set_anim_duration(lv_style_t * style, uint32_t value) { lv_style_value_t v = { @@ -898,8 +722,6 @@ void lv_style_set_anim_duration(lv_style_t * style, uint32_t value) lv_style_set_prop(style, LV_STYLE_ANIM_DURATION, v); } -const lv_style_prop_t _lv_style_const_prop_id_ANIM_DURATION = LV_STYLE_ANIM_DURATION; - void lv_style_set_transition(lv_style_t * style, const lv_style_transition_dsc_t * value) { lv_style_value_t v = { @@ -908,8 +730,6 @@ void lv_style_set_transition(lv_style_t * style, const lv_style_transition_dsc_t lv_style_set_prop(style, LV_STYLE_TRANSITION, v); } -const lv_style_prop_t _lv_style_const_prop_id_TRANSITION = LV_STYLE_TRANSITION; - void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t value) { lv_style_value_t v = { @@ -918,8 +738,6 @@ void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t value) lv_style_set_prop(style, LV_STYLE_BLEND_MODE, v); } -const lv_style_prop_t _lv_style_const_prop_id_BLEND_MODE = LV_STYLE_BLEND_MODE; - void lv_style_set_layout(lv_style_t * style, uint16_t value) { lv_style_value_t v = { @@ -928,8 +746,6 @@ void lv_style_set_layout(lv_style_t * style, uint16_t value) lv_style_set_prop(style, LV_STYLE_LAYOUT, v); } -const lv_style_prop_t _lv_style_const_prop_id_LAYOUT = LV_STYLE_LAYOUT; - void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value) { lv_style_value_t v = { @@ -938,8 +754,6 @@ void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value) lv_style_set_prop(style, LV_STYLE_BASE_DIR, v); } -const lv_style_prop_t _lv_style_const_prop_id_BASE_DIR = LV_STYLE_BASE_DIR; - void lv_style_set_bitmap_mask_src(lv_style_t * style, const void * value) { lv_style_value_t v = { @@ -948,8 +762,6 @@ void lv_style_set_bitmap_mask_src(lv_style_t * style, const void * value) lv_style_set_prop(style, LV_STYLE_BITMAP_MASK_SRC, v); } -const lv_style_prop_t _lv_style_const_prop_id_BITMAP_MASK_SRC = LV_STYLE_BITMAP_MASK_SRC; - void lv_style_set_rotary_sensitivity(lv_style_t * style, uint32_t value) { lv_style_value_t v = { @@ -957,8 +769,6 @@ void lv_style_set_rotary_sensitivity(lv_style_t * style, uint32_t value) }; lv_style_set_prop(style, LV_STYLE_ROTARY_SENSITIVITY, v); } - -const lv_style_prop_t _lv_style_const_prop_id_ROTARY_SENSITIVITY = LV_STYLE_ROTARY_SENSITIVITY; #if LV_USE_FLEX void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value) @@ -969,8 +779,6 @@ void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value) lv_style_set_prop(style, LV_STYLE_FLEX_FLOW, v); } -const lv_style_prop_t _lv_style_const_prop_id_FLEX_FLOW = LV_STYLE_FLEX_FLOW; - void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value) { lv_style_value_t v = { @@ -979,8 +787,6 @@ void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value) lv_style_set_prop(style, LV_STYLE_FLEX_MAIN_PLACE, v); } -const lv_style_prop_t _lv_style_const_prop_id_FLEX_MAIN_PLACE = LV_STYLE_FLEX_MAIN_PLACE; - void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value) { lv_style_value_t v = { @@ -989,8 +795,6 @@ void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value) lv_style_set_prop(style, LV_STYLE_FLEX_CROSS_PLACE, v); } -const lv_style_prop_t _lv_style_const_prop_id_FLEX_CROSS_PLACE = LV_STYLE_FLEX_CROSS_PLACE; - void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value) { lv_style_value_t v = { @@ -999,8 +803,6 @@ void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value) lv_style_set_prop(style, LV_STYLE_FLEX_TRACK_PLACE, v); } -const lv_style_prop_t _lv_style_const_prop_id_FLEX_TRACK_PLACE = LV_STYLE_FLEX_TRACK_PLACE; - void lv_style_set_flex_grow(lv_style_t * style, uint8_t value) { lv_style_value_t v = { @@ -1008,8 +810,6 @@ void lv_style_set_flex_grow(lv_style_t * style, uint8_t value) }; lv_style_set_prop(style, LV_STYLE_FLEX_GROW, v); } - -const lv_style_prop_t _lv_style_const_prop_id_FLEX_GROW = LV_STYLE_FLEX_GROW; #endif /*LV_USE_FLEX*/ #if LV_USE_GRID @@ -1022,8 +822,6 @@ void lv_style_set_grid_column_dsc_array(lv_style_t * style, const int32_t * valu lv_style_set_prop(style, LV_STYLE_GRID_COLUMN_DSC_ARRAY, v); } -const lv_style_prop_t _lv_style_const_prop_id_GRID_COLUMN_DSC_ARRAY = LV_STYLE_GRID_COLUMN_DSC_ARRAY; - void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value) { lv_style_value_t v = { @@ -1032,8 +830,6 @@ void lv_style_set_grid_column_align(lv_style_t * style, lv_grid_align_t value) lv_style_set_prop(style, LV_STYLE_GRID_COLUMN_ALIGN, v); } -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 int32_t * value) { lv_style_value_t v = { @@ -1042,8 +838,6 @@ void lv_style_set_grid_row_dsc_array(lv_style_t * style, const int32_t * value) lv_style_set_prop(style, LV_STYLE_GRID_ROW_DSC_ARRAY, v); } -const lv_style_prop_t _lv_style_const_prop_id_GRID_ROW_DSC_ARRAY = LV_STYLE_GRID_ROW_DSC_ARRAY; - void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value) { lv_style_value_t v = { @@ -1052,8 +846,6 @@ void lv_style_set_grid_row_align(lv_style_t * style, lv_grid_align_t value) lv_style_set_prop(style, LV_STYLE_GRID_ROW_ALIGN, v); } -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, int32_t value) { lv_style_value_t v = { @@ -1062,8 +854,6 @@ void lv_style_set_grid_cell_column_pos(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_GRID_CELL_COLUMN_POS, v); } -const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_COLUMN_POS = LV_STYLE_GRID_CELL_COLUMN_POS; - void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_grid_align_t value) { lv_style_value_t v = { @@ -1072,8 +862,6 @@ void lv_style_set_grid_cell_x_align(lv_style_t * style, lv_grid_align_t value) lv_style_set_prop(style, LV_STYLE_GRID_CELL_X_ALIGN, v); } -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, int32_t value) { lv_style_value_t v = { @@ -1082,8 +870,6 @@ void lv_style_set_grid_cell_column_span(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_GRID_CELL_COLUMN_SPAN, v); } -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, int32_t value) { lv_style_value_t v = { @@ -1092,8 +878,6 @@ void lv_style_set_grid_cell_row_pos(lv_style_t * style, int32_t value) lv_style_set_prop(style, LV_STYLE_GRID_CELL_ROW_POS, v); } -const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_POS = LV_STYLE_GRID_CELL_ROW_POS; - void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_grid_align_t value) { lv_style_value_t v = { @@ -1102,8 +886,6 @@ void lv_style_set_grid_cell_y_align(lv_style_t * style, lv_grid_align_t value) lv_style_set_prop(style, LV_STYLE_GRID_CELL_Y_ALIGN, v); } -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, int32_t value) { lv_style_value_t v = { @@ -1111,7 +893,5 @@ void lv_style_set_grid_cell_row_span(lv_style_t * style, int32_t value) }; lv_style_set_prop(style, LV_STYLE_GRID_CELL_ROW_SPAN, v); } - -const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_SPAN = LV_STYLE_GRID_CELL_ROW_SPAN; #endif /*LV_USE_GRID*/ diff --git a/src/misc/lv_style_gen.h b/src/misc/lv_style_gen.h index 5bd9833ed..5714e74d9 100644 --- a/src/misc/lv_style_gen.h +++ b/src/misc/lv_style_gen.h @@ -15,731 +15,621 @@ extern "C" { #endif void lv_style_set_width(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_WIDTH; void lv_style_set_min_width(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_MIN_WIDTH; void lv_style_set_max_width(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_MAX_WIDTH; void lv_style_set_height(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_HEIGHT; void lv_style_set_min_height(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_MIN_HEIGHT; void lv_style_set_max_height(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_MAX_HEIGHT; void lv_style_set_length(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_LENGTH; void lv_style_set_x(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_X; void lv_style_set_y(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_ALIGN; void lv_style_set_transform_width(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_WIDTH; void lv_style_set_transform_height(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_HEIGHT; void lv_style_set_translate_x(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TRANSLATE_X; void lv_style_set_translate_y(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TRANSLATE_Y; void lv_style_set_transform_scale_x(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SCALE_Y; void lv_style_set_transform_rotation(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_ROTATION; void lv_style_set_transform_pivot_x(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_PIVOT_Y; void lv_style_set_transform_skew_x(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SKEW_X; void lv_style_set_transform_skew_y(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TRANSFORM_SKEW_Y; void lv_style_set_pad_top(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_PAD_TOP; void lv_style_set_pad_bottom(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_PAD_BOTTOM; void lv_style_set_pad_left(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_PAD_LEFT; void lv_style_set_pad_right(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_PAD_RIGHT; void lv_style_set_pad_row(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_PAD_ROW; void lv_style_set_pad_column(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_PAD_COLUMN; void lv_style_set_margin_top(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_MARGIN_TOP; void lv_style_set_margin_bottom(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_MARGIN_BOTTOM; void lv_style_set_margin_left(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_MARGIN_LEFT; void lv_style_set_margin_right(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BG_COLOR; void lv_style_set_bg_opa(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BG_OPA; void lv_style_set_bg_grad_color(lv_style_t * style, lv_color_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BG_MAIN_OPA; void lv_style_set_bg_grad_opa(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BG_GRAD_OPA; void lv_style_set_bg_grad(lv_style_t * style, const lv_grad_dsc_t * value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BG_GRAD; void lv_style_set_bg_image_src(lv_style_t * style, const void * value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BG_IMAGE_SRC; void lv_style_set_bg_image_opa(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BG_IMAGE_OPA; void lv_style_set_bg_image_recolor(lv_style_t * style, lv_color_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BG_IMAGE_RECOLOR; void lv_style_set_bg_image_recolor_opa(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BG_IMAGE_RECOLOR_OPA; void lv_style_set_bg_image_tiled(lv_style_t * style, bool value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BG_IMAGE_TILED; void lv_style_set_border_color(lv_style_t * style, lv_color_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BORDER_OPA; void lv_style_set_border_width(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BORDER_POST; void lv_style_set_outline_width(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_OUTLINE_OPA; void lv_style_set_outline_pad(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_OUTLINE_PAD; void lv_style_set_shadow_width(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_SHADOW_WIDTH; void lv_style_set_shadow_offset_x(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_SHADOW_OFFSET_Y; void lv_style_set_shadow_spread(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_SHADOW_COLOR; void lv_style_set_shadow_opa(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_SHADOW_OPA; void lv_style_set_image_opa(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_IMAGE_OPA; void lv_style_set_image_recolor(lv_style_t * style, lv_color_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_IMAGE_RECOLOR_OPA; void lv_style_set_line_width(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_LINE_WIDTH; void lv_style_set_line_dash_width(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_LINE_ROUNDED; void lv_style_set_line_color(lv_style_t * style, lv_color_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_LINE_OPA; void lv_style_set_arc_width(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_ARC_ROUNDED; void lv_style_set_arc_color(lv_style_t * style, lv_color_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_ARC_COLOR; void lv_style_set_arc_opa(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_ARC_OPA; void lv_style_set_arc_image_src(lv_style_t * style, const void * value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_ARC_IMAGE_SRC; void lv_style_set_text_color(lv_style_t * style, lv_color_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TEXT_COLOR; void lv_style_set_text_opa(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TEXT_FONT; void lv_style_set_text_letter_space(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TEXT_ALIGN; void lv_style_set_radius(lv_style_t * style, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_RADIUS; void lv_style_set_clip_corner(lv_style_t * style, bool value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_CLIP_CORNER; void lv_style_set_opa(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_OPA; void lv_style_set_opa_layered(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_OPA_LAYERED; void lv_style_set_color_filter_dsc(lv_style_t * style, const lv_color_filter_dsc_t * value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_COLOR_FILTER_DSC; void lv_style_set_color_filter_opa(lv_style_t * style, lv_opa_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_COLOR_FILTER_OPA; void lv_style_set_anim(lv_style_t * style, const lv_anim_t * value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_ANIM; void lv_style_set_anim_duration(lv_style_t * style, uint32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_ANIM_DURATION; void lv_style_set_transition(lv_style_t * style, const lv_style_transition_dsc_t * value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_TRANSITION; void lv_style_set_blend_mode(lv_style_t * style, lv_blend_mode_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BLEND_MODE; void lv_style_set_layout(lv_style_t * style, uint16_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_LAYOUT; void lv_style_set_base_dir(lv_style_t * style, lv_base_dir_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BASE_DIR; void lv_style_set_bitmap_mask_src(lv_style_t * style, const void * value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_BITMAP_MASK_SRC; void lv_style_set_rotary_sensitivity(lv_style_t * style, uint32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_ROTARY_SENSITIVITY; #if LV_USE_FLEX void lv_style_set_flex_flow(lv_style_t * style, lv_flex_flow_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_FLOW; void lv_style_set_flex_main_place(lv_style_t * style, lv_flex_align_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_MAIN_PLACE; void lv_style_set_flex_cross_place(lv_style_t * style, lv_flex_align_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_CROSS_PLACE; void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_FLEX_GROW; #endif /*LV_USE_FLEX*/ #if LV_USE_GRID void lv_style_set_grid_column_dsc_array(lv_style_t * style, const int32_t * value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA 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 int32_t * value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA 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); -LV_ATTRIBUTE_EXTERN_DATA 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, int32_t value); -LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_GRID_CELL_ROW_SPAN; #endif /*LV_USE_GRID*/ #define LV_STYLE_CONST_WIDTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_WIDTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_WIDTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_MIN_WIDTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_MIN_WIDTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_MIN_WIDTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_MAX_WIDTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_MAX_WIDTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_MAX_WIDTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_HEIGHT(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_HEIGHT, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_HEIGHT, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_MIN_HEIGHT(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_MIN_HEIGHT, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_MIN_HEIGHT, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_MAX_HEIGHT(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_MAX_HEIGHT, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_MAX_HEIGHT, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_LENGTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_LENGTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_LENGTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_X(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_X, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_X, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_Y(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_Y, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_Y, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_ALIGN(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_ALIGN, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_ALIGN, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSFORM_WIDTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSFORM_WIDTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSFORM_WIDTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSFORM_HEIGHT(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSFORM_HEIGHT, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSFORM_HEIGHT, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSLATE_X(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSLATE_X, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSLATE_X, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSLATE_Y(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSLATE_Y, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSLATE_Y, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSFORM_SCALE_X(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSFORM_SCALE_X, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSFORM_SCALE_X, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSFORM_SCALE_Y(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSFORM_SCALE_Y, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSFORM_SCALE_Y, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSFORM_ROTATION(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSFORM_ROTATION, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSFORM_ROTATION, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSFORM_PIVOT_X(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSFORM_PIVOT_X, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSFORM_PIVOT_X, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSFORM_PIVOT_Y(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSFORM_PIVOT_Y, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSFORM_PIVOT_Y, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSFORM_SKEW_X(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSFORM_SKEW_X, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSFORM_SKEW_X, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSFORM_SKEW_Y(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSFORM_SKEW_Y, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TRANSFORM_SKEW_Y, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_PAD_TOP(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_PAD_TOP, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_PAD_TOP, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_PAD_BOTTOM(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_PAD_BOTTOM, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_PAD_BOTTOM, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_PAD_LEFT(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_PAD_LEFT, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_PAD_LEFT, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_PAD_RIGHT(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_PAD_RIGHT, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_PAD_RIGHT, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_PAD_ROW(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_PAD_ROW, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_PAD_ROW, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_PAD_COLUMN(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_PAD_COLUMN, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_PAD_COLUMN, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_MARGIN_TOP(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_MARGIN_TOP, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_MARGIN_TOP, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_MARGIN_BOTTOM(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_MARGIN_BOTTOM, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_MARGIN_BOTTOM, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_MARGIN_LEFT(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_MARGIN_LEFT, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_MARGIN_LEFT, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_MARGIN_RIGHT(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_MARGIN_RIGHT, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_MARGIN_RIGHT, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BG_COLOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_COLOR, .value = { .color = val } \ + .prop = LV_STYLE_BG_COLOR, .value = { .color = val } \ } #define LV_STYLE_CONST_BG_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BG_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BG_GRAD_COLOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_GRAD_COLOR, .value = { .color = val } \ + .prop = LV_STYLE_BG_GRAD_COLOR, .value = { .color = val } \ } #define LV_STYLE_CONST_BG_GRAD_DIR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_GRAD_DIR, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BG_GRAD_DIR, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BG_MAIN_STOP(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_MAIN_STOP, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BG_MAIN_STOP, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BG_GRAD_STOP(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_GRAD_STOP, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BG_GRAD_STOP, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BG_MAIN_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_MAIN_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BG_MAIN_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BG_GRAD_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_GRAD_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BG_GRAD_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BG_GRAD(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_GRAD, .value = { .ptr = val } \ + .prop = LV_STYLE_BG_GRAD, .value = { .ptr = val } \ } #define LV_STYLE_CONST_BG_IMAGE_SRC(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_IMAGE_SRC, .value = { .ptr = val } \ + .prop = LV_STYLE_BG_IMAGE_SRC, .value = { .ptr = val } \ } #define LV_STYLE_CONST_BG_IMAGE_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_IMAGE_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BG_IMAGE_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BG_IMAGE_RECOLOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_IMAGE_RECOLOR, .value = { .color = val } \ + .prop = LV_STYLE_BG_IMAGE_RECOLOR, .value = { .color = val } \ } #define LV_STYLE_CONST_BG_IMAGE_RECOLOR_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_IMAGE_RECOLOR_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BG_IMAGE_RECOLOR_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BG_IMAGE_TILED(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BG_IMAGE_TILED, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BG_IMAGE_TILED, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BORDER_COLOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BORDER_COLOR, .value = { .color = val } \ + .prop = LV_STYLE_BORDER_COLOR, .value = { .color = val } \ } #define LV_STYLE_CONST_BORDER_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BORDER_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BORDER_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BORDER_WIDTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BORDER_WIDTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BORDER_WIDTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BORDER_SIDE(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BORDER_SIDE, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BORDER_SIDE, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BORDER_POST(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BORDER_POST, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BORDER_POST, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_OUTLINE_WIDTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_OUTLINE_WIDTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_OUTLINE_WIDTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_OUTLINE_COLOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_OUTLINE_COLOR, .value = { .color = val } \ + .prop = LV_STYLE_OUTLINE_COLOR, .value = { .color = val } \ } #define LV_STYLE_CONST_OUTLINE_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_OUTLINE_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_OUTLINE_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_OUTLINE_PAD(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_OUTLINE_PAD, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_OUTLINE_PAD, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_SHADOW_WIDTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_SHADOW_WIDTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_SHADOW_WIDTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_SHADOW_OFFSET_X(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_SHADOW_OFFSET_X, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_SHADOW_OFFSET_X, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_SHADOW_OFFSET_Y(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_SHADOW_OFFSET_Y, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_SHADOW_OFFSET_Y, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_SHADOW_SPREAD(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_SHADOW_SPREAD, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_SHADOW_SPREAD, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_SHADOW_COLOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_SHADOW_COLOR, .value = { .color = val } \ + .prop = LV_STYLE_SHADOW_COLOR, .value = { .color = val } \ } #define LV_STYLE_CONST_SHADOW_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_SHADOW_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_SHADOW_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_IMAGE_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_IMAGE_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_IMAGE_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_IMAGE_RECOLOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_IMAGE_RECOLOR, .value = { .color = val } \ + .prop = LV_STYLE_IMAGE_RECOLOR, .value = { .color = val } \ } #define LV_STYLE_CONST_IMAGE_RECOLOR_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_IMAGE_RECOLOR_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_IMAGE_RECOLOR_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_LINE_WIDTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_LINE_WIDTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_LINE_WIDTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_LINE_DASH_WIDTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_LINE_DASH_WIDTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_LINE_DASH_WIDTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_LINE_DASH_GAP(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_LINE_DASH_GAP, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_LINE_DASH_GAP, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_LINE_ROUNDED(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_LINE_ROUNDED, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_LINE_ROUNDED, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_LINE_COLOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_LINE_COLOR, .value = { .color = val } \ + .prop = LV_STYLE_LINE_COLOR, .value = { .color = val } \ } #define LV_STYLE_CONST_LINE_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_LINE_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_LINE_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_ARC_WIDTH(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_ARC_WIDTH, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_ARC_WIDTH, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_ARC_ROUNDED(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_ARC_ROUNDED, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_ARC_ROUNDED, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_ARC_COLOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_ARC_COLOR, .value = { .color = val } \ + .prop = LV_STYLE_ARC_COLOR, .value = { .color = val } \ } #define LV_STYLE_CONST_ARC_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_ARC_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_ARC_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_ARC_IMAGE_SRC(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_ARC_IMAGE_SRC, .value = { .ptr = val } \ + .prop = LV_STYLE_ARC_IMAGE_SRC, .value = { .ptr = val } \ } #define LV_STYLE_CONST_TEXT_COLOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TEXT_COLOR, .value = { .color = val } \ + .prop = LV_STYLE_TEXT_COLOR, .value = { .color = val } \ } #define LV_STYLE_CONST_TEXT_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TEXT_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TEXT_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TEXT_FONT(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TEXT_FONT, .value = { .ptr = val } \ + .prop = LV_STYLE_TEXT_FONT, .value = { .ptr = val } \ } #define LV_STYLE_CONST_TEXT_LETTER_SPACE(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TEXT_LETTER_SPACE, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TEXT_LETTER_SPACE, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TEXT_LINE_SPACE(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TEXT_LINE_SPACE, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TEXT_LINE_SPACE, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TEXT_DECOR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TEXT_DECOR, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TEXT_DECOR, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TEXT_ALIGN(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TEXT_ALIGN, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_TEXT_ALIGN, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_RADIUS(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_RADIUS, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_RADIUS, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_CLIP_CORNER(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_CLIP_CORNER, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_CLIP_CORNER, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_OPA_LAYERED(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_OPA_LAYERED, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_OPA_LAYERED, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_COLOR_FILTER_DSC(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_COLOR_FILTER_DSC, .value = { .ptr = val } \ + .prop = LV_STYLE_COLOR_FILTER_DSC, .value = { .ptr = val } \ } #define LV_STYLE_CONST_COLOR_FILTER_OPA(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_COLOR_FILTER_OPA, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_COLOR_FILTER_OPA, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_ANIM(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_ANIM, .value = { .ptr = val } \ + .prop = LV_STYLE_ANIM, .value = { .ptr = val } \ } #define LV_STYLE_CONST_ANIM_DURATION(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_ANIM_DURATION, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_ANIM_DURATION, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_TRANSITION(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_TRANSITION, .value = { .ptr = val } \ + .prop = LV_STYLE_TRANSITION, .value = { .ptr = val } \ } #define LV_STYLE_CONST_BLEND_MODE(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BLEND_MODE, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BLEND_MODE, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_LAYOUT(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_LAYOUT, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_LAYOUT, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BASE_DIR(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BASE_DIR, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_BASE_DIR, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_BITMAP_MASK_SRC(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_BITMAP_MASK_SRC, .value = { .ptr = val } \ + .prop = LV_STYLE_BITMAP_MASK_SRC, .value = { .ptr = val } \ } #define LV_STYLE_CONST_ROTARY_SENSITIVITY(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_ROTARY_SENSITIVITY, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_ROTARY_SENSITIVITY, .value = { .num = (int32_t)val } \ } #if LV_USE_FLEX #define LV_STYLE_CONST_FLEX_FLOW(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_FLEX_FLOW, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_FLEX_FLOW, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_FLEX_MAIN_PLACE(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_FLEX_MAIN_PLACE, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_FLEX_MAIN_PLACE, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_FLEX_CROSS_PLACE(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_FLEX_CROSS_PLACE, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_FLEX_CROSS_PLACE, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_FLEX_TRACK_PLACE(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_FLEX_TRACK_PLACE, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_FLEX_TRACK_PLACE, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_FLEX_GROW(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_FLEX_GROW, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_FLEX_GROW, .value = { .num = (int32_t)val } \ } #endif /*LV_USE_FLEX*/ @@ -747,52 +637,52 @@ LV_ATTRIBUTE_EXTERN_DATA extern const lv_style_prop_t _lv_style_const_prop_id_GR #define LV_STYLE_CONST_GRID_COLUMN_DSC_ARRAY(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_GRID_COLUMN_DSC_ARRAY, .value = { .ptr = val } \ + .prop = LV_STYLE_GRID_COLUMN_DSC_ARRAY, .value = { .ptr = val } \ } #define LV_STYLE_CONST_GRID_COLUMN_ALIGN(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_GRID_COLUMN_ALIGN, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_GRID_COLUMN_ALIGN, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_GRID_ROW_DSC_ARRAY(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_GRID_ROW_DSC_ARRAY, .value = { .ptr = val } \ + .prop = LV_STYLE_GRID_ROW_DSC_ARRAY, .value = { .ptr = val } \ } #define LV_STYLE_CONST_GRID_ROW_ALIGN(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_GRID_ROW_ALIGN, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_GRID_ROW_ALIGN, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_GRID_CELL_COLUMN_POS(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_GRID_CELL_COLUMN_POS, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_GRID_CELL_COLUMN_POS, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_GRID_CELL_X_ALIGN(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_GRID_CELL_X_ALIGN, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_GRID_CELL_X_ALIGN, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_GRID_CELL_COLUMN_SPAN(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_GRID_CELL_COLUMN_SPAN, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_GRID_CELL_COLUMN_SPAN, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_GRID_CELL_ROW_POS(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_GRID_CELL_ROW_POS, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_GRID_CELL_ROW_POS, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_GRID_CELL_Y_ALIGN(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_GRID_CELL_Y_ALIGN, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_GRID_CELL_Y_ALIGN, .value = { .num = (int32_t)val } \ } #define LV_STYLE_CONST_GRID_CELL_ROW_SPAN(val) \ { \ - .prop_ptr = &_lv_style_const_prop_id_GRID_CELL_ROW_SPAN, .value = { .num = (int32_t)val } \ + .prop = LV_STYLE_GRID_CELL_ROW_SPAN, .value = { .num = (int32_t)val } \ } #endif /*LV_USE_GRID*/ diff --git a/src/misc/lv_style_private.h b/src/misc/lv_style_private.h new file mode 100644 index 000000000..8a88185d6 --- /dev/null +++ b/src/misc/lv_style_private.h @@ -0,0 +1,39 @@ +/** + * @file lv_style_private.h + * + */ + +#ifndef LV_STYLE_PRIVATE_H +#define LV_STYLE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_style.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_STYLE_PRIVATE_H*/ diff --git a/src/misc/lv_text.c b/src/misc/lv_text.c index d531176dd..9eb240cb2 100644 --- a/src/misc/lv_text.c +++ b/src/misc/lv_text.c @@ -426,13 +426,13 @@ char * lv_text_set_text_vfmt(const char * fmt, va_list ap) lv_vsnprintf(raw_txt, len + 1, fmt, ap); /*Get the size of the Arabic text and process it*/ - size_t len_ap = _lv_text_ap_calc_bytes_count(raw_txt); + size_t len_ap = lv_text_ap_calc_bytes_count(raw_txt); text = lv_malloc(len_ap + 1); LV_ASSERT_MALLOC(text); if(text == NULL) { return NULL; } - _lv_text_ap_proc(raw_txt, text); + lv_text_ap_proc(raw_txt, text); lv_free(raw_txt); #else diff --git a/src/misc/lv_text.h b/src/misc/lv_text.h index 0b8fd5d91..f2407dd8e 100644 --- a/src/misc/lv_text.h +++ b/src/misc/lv_text.h @@ -35,7 +35,7 @@ extern "C" { * Options for text rendering. */ -enum _lv_text_flag_t { +typedef enum { LV_TEXT_FLAG_NONE = 0x00, LV_TEXT_FLAG_EXPAND = 0x01, /**< Ignore max-width to avoid automatic word wrapping*/ LV_TEXT_FLAG_FIT = 0x02, /**< Max-width is already equal to the longest line. (Used to skip some calculation)*/ @@ -43,27 +43,15 @@ enum _lv_text_flag_t { Otherwise breaks are inserted at word boundaries, as configured via LV_TXT_BREAK_CHARS or according to LV_TXT_LINE_BREAK_LONG_LEN, LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN, and LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN.*/ -}; - -#ifdef DOXYGEN -typedef _lv_text_flag_t lv_text_flag_t; -#else -typedef uint8_t lv_text_flag_t; -#endif /*DOXYGEN*/ +} lv_text_flag_t; /** Label align policy*/ -enum _lv_text_align_t { +typedef enum { LV_TEXT_ALIGN_AUTO, /**< Align text auto*/ LV_TEXT_ALIGN_LEFT, /**< Align text to left*/ LV_TEXT_ALIGN_CENTER, /**< Align text to center*/ LV_TEXT_ALIGN_RIGHT, /**< Align text to right*/ -}; - -#ifdef DOXYGEN -typedef _lv_text_align_t lv_text_align_t; -#else -typedef uint8_t lv_text_align_t; -#endif /*DOXYGEN*/ +} lv_text_align_t; /********************** * GLOBAL PROTOTYPES diff --git a/src/misc/lv_text_ap.c b/src/misc/lv_text_ap.c index 00c23fc25..320debd0f 100644 --- a/src/misc/lv_text_ap.c +++ b/src/misc/lv_text_ap.c @@ -106,7 +106,7 @@ const ap_chars_map_t ap_chars_map[] = { /********************** * GLOBAL FUNCTIONS **********************/ -uint32_t _lv_text_ap_calc_bytes_count(const char * txt) +uint32_t lv_text_ap_calc_bytes_count(const char * txt) { uint32_t txt_length = 0; uint32_t chars_cnt = 0; @@ -140,7 +140,7 @@ uint32_t _lv_text_ap_calc_bytes_count(const char * txt) return chars_cnt + 1; } -void _lv_text_ap_proc(const char * txt, char * txt_out) +void lv_text_ap_proc(const char * txt, char * txt_out) { uint32_t txt_length = 0; uint32_t index_current, idx_next, idx_previous, i, j; diff --git a/src/misc/lv_text_ap.h b/src/misc/lv_text_ap.h index 1530190a2..cac7c7121 100644 --- a/src/misc/lv_text_ap.h +++ b/src/misc/lv_text_ap.h @@ -33,8 +33,8 @@ extern "C" { /********************** * GLOBAL PROTOTYPES **********************/ -uint32_t _lv_text_ap_calc_bytes_count(const char * txt); -void _lv_text_ap_proc(const char * txt, char * txt_out); +uint32_t lv_text_ap_calc_bytes_count(const char * txt); +void lv_text_ap_proc(const char * txt, char * txt_out); /********************** * MACROS diff --git a/src/misc/lv_timer.c b/src/misc/lv_timer.c index 57d201fe9..959ce53b9 100644 --- a/src/misc/lv_timer.c +++ b/src/misc/lv_timer.c @@ -5,7 +5,7 @@ /********************* * INCLUDES *********************/ -#include "lv_timer.h" +#include "lv_timer_private.h" #include "../core/lv_global.h" #include "../tick/lv_tick.h" #include "../stdlib/lv_mem.h" @@ -52,9 +52,9 @@ static void lv_timer_handler_resume(void); * GLOBAL FUNCTIONS **********************/ -void _lv_timer_core_init(void) +void lv_timer_core_init(void) { - _lv_ll_init(timer_ll_p, sizeof(lv_timer_t)); + lv_ll_init(timer_ll_p, sizeof(lv_timer_t)); /*Initially enable the lv_timer handling*/ lv_timer_enable(true); @@ -98,11 +98,11 @@ LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void) state_p->timer_deleted = false; state_p->timer_created = false; - timer_active = _lv_ll_get_head(timer_head); + timer_active = lv_ll_get_head(timer_head); while(timer_active) { /*The timer might be deleted if it runs only once ('repeat_count = 1') *So get next element until the current is surely valid*/ - next = _lv_ll_get_next(timer_head, timer_active); + next = lv_ll_get_next(timer_head, timer_active); if(lv_timer_exec(timer_active)) { /*If a timer was created or deleted then this or the next item might be corrupted*/ @@ -117,7 +117,7 @@ LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void) } while(timer_active); uint32_t time_until_next = LV_NO_TIMER_READY; - next = _lv_ll_get_head(timer_head); + next = lv_ll_get_head(timer_head); while(next) { if(!next->paused) { uint32_t delay = lv_timer_time_remaining(next); @@ -125,7 +125,7 @@ LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void) time_until_next = delay; } - next = _lv_ll_get_next(timer_head, next); /*Find the next timer*/ + next = lv_ll_get_next(timer_head, next); /*Find the next timer*/ } state_p->busy_time += lv_tick_elaps(handler_start); @@ -167,7 +167,7 @@ lv_timer_t * lv_timer_create(lv_timer_cb_t timer_xcb, uint32_t period, void * us { lv_timer_t * new_timer = NULL; - new_timer = _lv_ll_ins_head(timer_ll_p); + new_timer = lv_ll_ins_head(timer_ll_p); LV_ASSERT_MALLOC(new_timer); if(new_timer == NULL) return NULL; @@ -194,7 +194,7 @@ void lv_timer_set_cb(lv_timer_t * timer, lv_timer_cb_t timer_cb) void lv_timer_delete(lv_timer_t * timer) { - _lv_ll_remove(timer_ll_p, timer); + lv_ll_remove(timer_ll_p, timer); state.timer_deleted = true; lv_free(timer); @@ -256,11 +256,11 @@ void lv_timer_enable(bool en) if(en) lv_timer_handler_resume(); } -void _lv_timer_core_deinit(void) +void lv_timer_core_deinit(void) { lv_timer_enable(false); - _lv_ll_clear(timer_ll_p); + lv_ll_clear(timer_ll_p); } uint32_t lv_timer_get_idle(void) @@ -275,8 +275,29 @@ uint32_t lv_timer_get_time_until_next(void) lv_timer_t * lv_timer_get_next(lv_timer_t * timer) { - if(timer == NULL) return _lv_ll_get_head(timer_ll_p); - else return _lv_ll_get_next(timer_ll_p, timer); + if(timer == NULL) return lv_ll_get_head(timer_ll_p); + else return lv_ll_get_next(timer_ll_p, timer); +} + +LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler_run_in_period(uint32_t period) +{ + static uint32_t last_tick = 0; + + if(lv_tick_elaps(last_tick) >= period) { + last_tick = lv_tick_get(); + return lv_timer_handler(); + } + return 1; +} + +void * lv_timer_get_user_data(lv_timer_t * timer) +{ + return timer->user_data; +} + +bool lv_timer_get_paused(lv_timer_t * timer) +{ + return timer->paused; } /********************** diff --git a/src/misc/lv_timer.h b/src/misc/lv_timer.h index 119b8bc9a..be2500333 100644 --- a/src/misc/lv_timer.h +++ b/src/misc/lv_timer.h @@ -40,52 +40,10 @@ typedef void (*lv_timer_cb_t)(lv_timer_t *); */ typedef void (*lv_timer_handler_resume_cb_t)(void * data); -/** - * Descriptor of a lv_timer - */ -struct _lv_timer_t { - uint32_t period; /**< How often the timer should run*/ - uint32_t last_run; /**< Last time the timer ran*/ - lv_timer_cb_t timer_cb; /**< Timer function*/ - void * user_data; /**< Custom user data*/ - int32_t repeat_count; /**< 1: One time; -1 : infinity; n>0: residual times*/ - uint32_t paused : 1; - uint32_t auto_delete : 1; -}; - -typedef struct { - lv_ll_t timer_ll; /*Linked list to store the lv_timers*/ - - bool lv_timer_run; - uint8_t idle_last; - bool timer_deleted; - bool timer_created; - uint32_t timer_time_until_next; - - bool already_running; - uint32_t periodic_last_tick; - uint32_t busy_time; - uint32_t idle_period_start; - uint32_t run_cnt; - - lv_timer_handler_resume_cb_t resume_cb; - void * resume_data; -} lv_timer_state_t; - /********************** * GLOBAL PROTOTYPES **********************/ -/** - * Init the lv_timer module - */ -void _lv_timer_core_init(void); - -/** - * Deinit the lv_timer module - */ -void _lv_timer_core_deinit(void); - //! @cond Doxygen_Suppress /** @@ -103,16 +61,7 @@ LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler(void); * @param period the period for running lv_timer_handler() * @return the time after which it must be called again */ -static inline LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler_run_in_period(uint32_t period) -{ - static uint32_t last_tick = 0; - - if(lv_tick_elaps(last_tick) >= period) { - last_tick = lv_tick_get(); - return lv_timer_handler(); - } - return 1; -} +LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_timer_handler_run_in_period(uint32_t period); /** * Call it in the super-loop of main() or threads. It will automatically call lv_timer_handler() at the right time. @@ -241,20 +190,14 @@ lv_timer_t * lv_timer_get_next(lv_timer_t * timer); * @param timer pointer to the lv_timer * @return pointer to the user_data */ -static inline void * lv_timer_get_user_data(lv_timer_t * timer) -{ - return timer->user_data; -} +void * lv_timer_get_user_data(lv_timer_t * timer); /** * Get the pause state of a timer * @param timer pointer to a lv_timer * @return true: timer is paused; false: timer is running */ -static inline bool lv_timer_get_paused(lv_timer_t * timer) -{ - return timer->paused; -} +bool lv_timer_get_paused(lv_timer_t * timer); /********************** * MACROS diff --git a/src/misc/lv_timer_private.h b/src/misc/lv_timer_private.h new file mode 100644 index 000000000..d7c883a47 --- /dev/null +++ b/src/misc/lv_timer_private.h @@ -0,0 +1,81 @@ +/** + * @file lv_timer_private.h + * + */ + +#ifndef LV_TIMER_PRIVATE_H +#define LV_TIMER_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_timer.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Descriptor of a lv_timer + */ +struct lv_timer_t { + uint32_t period; /**< How often the timer should run*/ + uint32_t last_run; /**< Last time the timer ran*/ + lv_timer_cb_t timer_cb; /**< Timer function*/ + void * user_data; /**< Custom user data*/ + int32_t repeat_count; /**< 1: One time; -1 : infinity; n>0: residual times*/ + uint32_t paused : 1; + uint32_t auto_delete : 1; +}; + +typedef struct { + lv_ll_t timer_ll; /*Linked list to store the lv_timers*/ + + bool lv_timer_run; + uint8_t idle_last; + bool timer_deleted; + bool timer_created; + uint32_t timer_time_until_next; + + bool already_running; + uint32_t periodic_last_tick; + uint32_t busy_time; + uint32_t idle_period_start; + uint32_t run_cnt; + + lv_timer_handler_resume_cb_t resume_cb; + void * resume_data; +} lv_timer_state_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Init the lv_timer module + */ +void lv_timer_core_init(void); + +/** + * Deinit the lv_timer module + */ +void lv_timer_core_deinit(void); + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TIMER_PRIVATE_H*/ diff --git a/src/misc/lv_types.h b/src/misc/lv_types.h index 7caf3e183..891259ec8 100644 --- a/src/misc/lv_types.h +++ b/src/misc/lv_types.h @@ -51,17 +51,11 @@ extern "C" { /** * LVGL error codes. */ -enum _lv_result_t { +typedef enum { LV_RESULT_INVALID = 0, /*Typically indicates that the object is deleted (become invalid) in the action function or an operation was failed*/ LV_RESULT_OK, /*The object is valid (no deleted) after the action*/ -}; - -#ifdef DOXYGEN -typedef _lv_result_t lv_result_t; -#else -typedef uint8_t lv_result_t; -#endif /*DOXYGEN*/ +} lv_result_t; #if defined(__cplusplus) || __STDC_VERSION__ >= 199901L /*If c99 or newer, use the definition of uintptr_t directly from <stdint.h>*/ @@ -92,77 +86,257 @@ typedef int32_t lv_value_precise_t; * They are defined here to avoid circular dependencies. */ -struct _lv_obj_t; -typedef struct _lv_obj_t lv_obj_t; +typedef struct lv_obj_t lv_obj_t; -#ifdef DOXYGEN -typedef _lv_state_t lv_state_t; -typedef _lv_part_t lv_part_t; -typedef _lv_obj_flag_t lv_obj_flag_t; -#else typedef uint16_t lv_state_t; typedef uint32_t lv_part_t; -typedef uint32_t lv_obj_flag_t; -#endif /*DOXYGEN*/ -struct _lv_obj_class_t; -typedef struct _lv_obj_class_t lv_obj_class_t; +typedef uint8_t lv_opa_t; -struct _lv_group_t; -typedef struct _lv_group_t lv_group_t; +typedef uint8_t lv_style_prop_t; -#ifdef DOXYGEN -typedef _lv_key_t lv_key_t; -#else -typedef uint8_t lv_key_t; -#endif /*DOXYGEN*/ +typedef struct lv_obj_class_t lv_obj_class_t; + +typedef struct lv_group_t lv_group_t; + +typedef struct lv_display_t lv_display_t; + +typedef struct lv_layer_t lv_layer_t; +typedef struct lv_draw_unit_t lv_draw_unit_t; +typedef struct lv_draw_task_t lv_draw_task_t; + +typedef struct lv_indev_t lv_indev_t; + +typedef struct lv_event_t lv_event_t; + +typedef struct lv_timer_t lv_timer_t; + +typedef struct lv_theme_t lv_theme_t; + +typedef struct lv_anim_t lv_anim_t; + +typedef struct lv_font_t lv_font_t; + +typedef struct lv_image_decoder_t lv_image_decoder_t; + +typedef struct lv_image_decoder_dsc_t lv_image_decoder_dsc_t; + +typedef struct lv_fragment_t lv_fragment_t; +typedef struct lv_fragment_class_t lv_fragment_class_t; +typedef struct lv_fragment_managed_states_t lv_fragment_managed_states_t; + +typedef struct lv_profiler_builtin_config_t lv_profiler_builtin_config_t; + +typedef struct lv_rb_node_t lv_rb_node_t; + +typedef struct lv_rb_t lv_rb_t; + +typedef struct lv_color_filter_dsc_t lv_color_filter_dsc_t; + +typedef struct lv_event_dsc_t lv_event_dsc_t; + +typedef struct lv_fs_file_cache_t lv_fs_file_cache_t; + +typedef struct lv_fs_path_ex_t lv_fs_path_ex_t; + +typedef struct lv_fs_dir_t lv_fs_dir_t; + +typedef struct lv_image_decoder_args_t lv_image_decoder_args_t; + +typedef struct lv_image_cache_data_t lv_image_cache_data_t; + +typedef struct lv_image_header_cache_data_t lv_image_header_cache_data_t; + +typedef struct lv_draw_mask_t lv_draw_mask_t; + +typedef struct lv_grad_t lv_grad_t; + +typedef struct lv_draw_label_hint_t lv_draw_label_hint_t; + +typedef struct lv_draw_glyph_dsc_t lv_draw_glyph_dsc_t; + +typedef struct lv_draw_image_sup_t lv_draw_image_sup_t; + +typedef struct lv_draw_mask_rect_dsc_t lv_draw_mask_rect_dsc_t; + +typedef struct lv_obj_style_t lv_obj_style_t; + +typedef struct lv_obj_style_transition_dsc_t lv_obj_style_transition_dsc_t; + +typedef struct lv_hit_test_info_t lv_hit_test_info_t; + +typedef struct lv_cover_check_info_t lv_cover_check_info_t; + +typedef struct lv_obj_spec_attr_t lv_obj_spec_attr_t; + +typedef struct lv_font_fmt_txt_kern_pair_t lv_font_fmt_txt_kern_pair_t; + +typedef struct lv_image_t lv_image_t; + +typedef struct lv_animimg_t lv_animimg_t; + +typedef struct lv_arc_t lv_arc_t; + +typedef struct lv_label_t lv_label_t; + +typedef struct lv_bar_anim_t lv_bar_anim_t; + +typedef struct lv_bar_t lv_bar_t; + +typedef struct lv_button_t lv_button_t; + +typedef struct lv_buttonmatrix_t lv_buttonmatrix_t; + +typedef struct lv_calendar_t lv_calendar_t; + +typedef struct lv_calendar_chinese_t lv_calendar_chinese_t; + +typedef struct lv_canvas_t lv_canvas_t; + +typedef struct lv_chart_series_t lv_chart_series_t; + +typedef struct lv_chart_cursor_t lv_chart_cursor_t; + +typedef struct lv_chart_t lv_chart_t; + +typedef struct lv_checkbox_t lv_checkbox_t; + +typedef struct lv_dropdown_t lv_dropdown_t; + +typedef struct lv_dropdown_list_t lv_dropdown_list_t; + +typedef struct lv_imagebutton_src_info_t lv_imagebutton_src_info_t; + +typedef struct lv_imagebutton_t lv_imagebutton_t; + +typedef struct lv_keyboard_t lv_keyboard_t; + +typedef struct lv_led_t lv_led_t; + +typedef struct lv_line_t lv_line_t; + +typedef struct lv_menu_load_page_event_data_t lv_menu_load_page_event_data_t; + +typedef struct lv_menu_history_t lv_menu_history_t; + +typedef struct lv_menu_t lv_menu_t; + +typedef struct lv_menu_page_t lv_menu_page_t; + +typedef struct lv_msgbox_t lv_msgbox_t; + +typedef struct lv_roller_t lv_roller_t; + +typedef struct lv_scale_section_t lv_scale_section_t; + +typedef struct lv_scale_t lv_scale_t; + +typedef struct lv_slider_t lv_slider_t; + +typedef struct lv_span_t lv_span_t; + +typedef struct lv_spangroup_t lv_spangroup_t; + +typedef struct lv_textarea_t lv_textarea_t; + +typedef struct lv_spinbox_t lv_spinbox_t; + +typedef struct lv_switch_t lv_switch_t; + +typedef struct lv_table_cell_t lv_table_cell_t; + +typedef struct lv_table_t lv_table_t; + +typedef struct lv_tabview_t lv_tabview_t; + +typedef struct lv_tileview_t lv_tileview_t; + +typedef struct lv_tileview_tile_t lv_tileview_tile_t; + +typedef struct lv_win_t lv_win_t; + +typedef struct lv_observer_t lv_observer_t; + +typedef struct lv_monkey_config_t lv_monkey_config_t; + +typedef struct lv_pinyin_dict_t lv_pinyin_dict_t; + +typedef struct lv_ime_pinyin_t lv_ime_pinyin_t; + +typedef struct lv_file_explorer_t lv_file_explorer_t; + +typedef struct lv_barcode_t lv_barcode_t; + +typedef struct lv_gif_t lv_gif_t; + +typedef struct lv_qrcode_t lv_qrcode_t; + +typedef struct lv_freetype_outline_vector_t lv_freetype_outline_vector_t; + +typedef struct lv_freetype_outline_event_param_t lv_freetype_outline_event_param_t; + +typedef struct lv_fpoint_t lv_fpoint_t; + +typedef struct lv_matrix_t lv_matrix_t; + +typedef struct lv_vector_path_t lv_vector_path_t; + +typedef struct lv_vector_gradient_t lv_vector_gradient_t; + +typedef struct lv_vector_fill_dsc_t lv_vector_fill_dsc_t; + +typedef struct lv_vector_stroke_dsc_t lv_vector_stroke_dsc_t; + +typedef struct lv_vector_draw_dsc_t lv_vector_draw_dsc_t; + +typedef struct lv_draw_vector_task_dsc_t lv_draw_vector_task_dsc_t; + +typedef struct lv_vector_dsc_t lv_vector_dsc_t; + +typedef struct lv_xkb_t lv_xkb_t; + +typedef struct lv_libinput_event_t lv_libinput_event_t; + +typedef struct lv_libinput_t lv_libinput_t; + +typedef struct lv_draw_sw_unit_t lv_draw_sw_unit_t; + +typedef struct lv_draw_sw_mask_common_dsc_t lv_draw_sw_mask_common_dsc_t; + +typedef struct lv_draw_sw_mask_line_param_t lv_draw_sw_mask_line_param_t; + +typedef struct lv_draw_sw_mask_angle_param_t lv_draw_sw_mask_angle_param_t; -struct _lv_display_t; -typedef struct _lv_display_t lv_display_t; +typedef struct lv_draw_sw_mask_radius_param_t lv_draw_sw_mask_radius_param_t; -struct _lv_layer_t; -typedef struct _lv_layer_t lv_layer_t; -struct _lv_draw_unit_t; -typedef struct _lv_draw_unit_t lv_draw_unit_t; -struct _lv_draw_task_t; -typedef struct _lv_draw_task_t lv_draw_task_t; +typedef struct lv_draw_sw_mask_fade_param_t lv_draw_sw_mask_fade_param_t; -struct _lv_indev_t; -typedef struct _lv_indev_t lv_indev_t; +typedef struct lv_draw_sw_mask_map_param_t lv_draw_sw_mask_map_param_t; -struct _lv_event_t; -typedef struct _lv_event_t lv_event_t; +typedef struct lv_draw_sw_blend_dsc_t lv_draw_sw_blend_dsc_t; -struct _lv_timer_t; -typedef struct _lv_timer_t lv_timer_t; +typedef struct lv_draw_sw_blend_fill_dsc_t lv_draw_sw_blend_fill_dsc_t; -struct _lv_theme_t; -typedef struct _lv_theme_t lv_theme_t; +typedef struct lv_draw_sw_blend_image_dsc_t lv_draw_sw_blend_image_dsc_t; -struct _lv_anim_t; -typedef struct _lv_anim_t lv_anim_t; +typedef struct lv_draw_buf_handlers_t lv_draw_buf_handlers_t; -struct _lv_font_t; -typedef struct _lv_font_t lv_font_t; +typedef struct lv_rlottie_t lv_rlottie_t; -struct _lv_image_decoder_t; -typedef struct _lv_image_decoder_t lv_image_decoder_t; +typedef struct lv_ffmpeg_player_t lv_ffmpeg_player_t; typedef uint32_t lv_prop_id_t; #if LV_USE_OBJ_PROPERTY -struct _lv_property_name_t; -typedef struct _lv_property_name_t lv_property_name_t; +typedef struct lv_property_name_t lv_property_name_t; #endif #if LV_USE_SYSMON -struct _lv_sysmon_backend_data_t; -typedef struct _lv_sysmon_backend_data_t lv_sysmon_backend_data_t; +typedef struct lv_sysmon_backend_data_t lv_sysmon_backend_data_t; #if LV_USE_PERF_MONITOR -struct _lv_sysmon_perf_info_t; -typedef struct _lv_sysmon_perf_info_t lv_sysmon_perf_info_t; +typedef struct lv_sysmon_perf_info_t lv_sysmon_perf_info_t; #endif /*LV_USE_PERF_MONITOR*/ #endif /*LV_USE_SYSMON*/ @@ -181,9 +355,11 @@ typedef struct _lv_sysmon_perf_info_t lv_sysmon_perf_info_t; #define _LV_CONCAT(x, y) x ## y #define LV_CONCAT(x, y) _LV_CONCAT(x, y) +#undef _LV_CONCAT #define _LV_CONCAT3(x, y, z) x ## y ## z #define LV_CONCAT3(x, y, z) _LV_CONCAT3(x, y, z) +#undef _LV_CONCAT3 #if defined(PYCPARSER) || defined(__CC_ARM) #define LV_FORMAT_ATTRIBUTE(fmtstr, vararg) diff --git a/src/others/file_explorer/lv_file_explorer.c b/src/others/file_explorer/lv_file_explorer.c index ac68078be..1d9059437 100644 --- a/src/others/file_explorer/lv_file_explorer.c +++ b/src/others/file_explorer/lv_file_explorer.c @@ -6,7 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_file_explorer.h" +#include "../../misc/lv_fs_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_file_explorer_private.h" #if LV_USE_FILE_EXPLORER != 0 #include "../../lvgl.h" diff --git a/src/others/file_explorer/lv_file_explorer.h b/src/others/file_explorer/lv_file_explorer.h index 9d1c3cc8a..8dd7762f5 100644 --- a/src/others/file_explorer/lv_file_explorer.h +++ b/src/others/file_explorer/lv_file_explorer.h @@ -42,30 +42,6 @@ typedef enum { } lv_file_explorer_dir_t; #endif -/*Data of canvas*/ -typedef struct { - lv_obj_t obj; - lv_obj_t * cont; - lv_obj_t * head_area; - lv_obj_t * browser_area; - lv_obj_t * file_table; - lv_obj_t * path_label; -#if LV_FILE_EXPLORER_QUICK_ACCESS - lv_obj_t * quick_access_area; - lv_obj_t * list_device; - lv_obj_t * list_places; - char * home_dir; - char * music_dir; - char * pictures_dir; - char * video_dir; - char * docs_dir; - char * fs_dir; -#endif - const char * sel_fn; - char current_path[LV_FILE_EXPLORER_PATH_MAX_LEN]; - lv_file_explorer_sort_t sort; -} lv_file_explorer_t; - extern const lv_obj_class_t lv_file_explorer_class; /*********************** diff --git a/src/others/file_explorer/lv_file_explorer_private.h b/src/others/file_explorer/lv_file_explorer_private.h new file mode 100644 index 000000000..1b7eca1dd --- /dev/null +++ b/src/others/file_explorer/lv_file_explorer_private.h @@ -0,0 +1,69 @@ +/** + * @file lv_file_explorer_private.h + * + */ + +#ifndef LV_FILE_EXPLORER_PRIVATE_H +#define LV_FILE_EXPLORER_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_file_explorer.h" + +#if LV_USE_FILE_EXPLORER != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of canvas*/ +struct lv_file_explorer_t { + lv_obj_t obj; + lv_obj_t * cont; + lv_obj_t * head_area; + lv_obj_t * browser_area; + lv_obj_t * file_table; + lv_obj_t * path_label; +#if LV_FILE_EXPLORER_QUICK_ACCESS + lv_obj_t * quick_access_area; + lv_obj_t * list_device; + lv_obj_t * list_places; + char * home_dir; + char * music_dir; + char * pictures_dir; + char * video_dir; + char * docs_dir; + char * fs_dir; +#endif + const char * sel_fn; + char current_path[LV_FILE_EXPLORER_PATH_MAX_LEN]; + lv_file_explorer_sort_t sort; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_FILE_EXPLORER != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FILE_EXPLORER_PRIVATE_H*/ diff --git a/src/others/fragment/lv_fragment.c b/src/others/fragment/lv_fragment.c index c04b3e84c..6deb4e785 100644 --- a/src/others/fragment/lv_fragment.c +++ b/src/others/fragment/lv_fragment.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_fragment.h" +#include "lv_fragment_private.h" #if LV_USE_FRAGMENT #include "../../stdlib/lv_string.h" diff --git a/src/others/fragment/lv_fragment.h b/src/others/fragment/lv_fragment.h index 593b5b575..f93473757 100644 --- a/src/others/fragment/lv_fragment.h +++ b/src/others/fragment/lv_fragment.h @@ -25,13 +25,9 @@ extern "C" { * TYPEDEFS **********************/ -typedef struct _lv_fragment_manager_t lv_fragment_manager_t; +typedef struct lv_fragment_manager_t lv_fragment_manager_t; -typedef struct _lv_fragment_t lv_fragment_t; -typedef struct _lv_fragment_class_t lv_fragment_class_t; -typedef struct _lv_fragment_managed_states_t lv_fragment_managed_states_t; - -struct _lv_fragment_t { +struct lv_fragment_t { /** * Class of this fragment */ @@ -53,7 +49,7 @@ struct _lv_fragment_t { }; -struct _lv_fragment_class_t { +struct lv_fragment_class_t { /** * Constructor function for fragment class * @param self Fragment instance @@ -124,40 +120,6 @@ struct _lv_fragment_class_t { size_t instance_size; }; -/** - * Fragment states - */ -struct _lv_fragment_managed_states_t { - /** - * Class of the fragment - */ - const lv_fragment_class_t * cls; - /** - * Manager the fragment attached to - */ - lv_fragment_manager_t * manager; - /** - * Container object the fragment adding view to - */ - lv_obj_t * const * container; - /** - * Fragment instance - */ - lv_fragment_t * instance; - /** - * true between `create_obj_cb` and `obj_deleted_cb` - */ - bool obj_created; - /** - * true before `lv_fragment_delete_obj` is called. Don't touch any object if this is true - */ - bool destroying_obj; - /** - * true if this fragment is in navigation stack that can be popped - */ - bool in_stack; -}; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/others/fragment/lv_fragment_manager.c b/src/others/fragment/lv_fragment_manager.c index 73b0c9df2..a8565185b 100644 --- a/src/others/fragment/lv_fragment_manager.c +++ b/src/others/fragment/lv_fragment_manager.c @@ -7,7 +7,7 @@ * INCLUDES *********************/ -#include "lv_fragment.h" +#include "lv_fragment_private.h" #if LV_USE_FRAGMENT @@ -21,11 +21,11 @@ /********************** * TYPEDEFS **********************/ -typedef struct _lv_fragment_stack_item_t { +typedef struct lv_fragment_stack_item_t { lv_fragment_managed_states_t * states; } lv_fragment_stack_item_t; -struct _lv_fragment_manager_t { +struct lv_fragment_manager_t { lv_fragment_t * parent; /** * Linked list to store attached fragments @@ -66,8 +66,8 @@ lv_fragment_manager_t * lv_fragment_manager_create(lv_fragment_t * parent) { lv_fragment_manager_t * instance = lv_malloc_zeroed(sizeof(lv_fragment_manager_t)); instance->parent = parent; - _lv_ll_init(&instance->attached, sizeof(lv_fragment_managed_states_t)); - _lv_ll_init(&instance->stack, sizeof(lv_fragment_stack_item_t)); + lv_ll_init(&instance->attached, sizeof(lv_fragment_managed_states_t)); + lv_ll_init(&instance->stack, sizeof(lv_fragment_stack_item_t)); return instance; } @@ -75,21 +75,21 @@ void lv_fragment_manager_delete(lv_fragment_manager_t * manager) { LV_ASSERT_NULL(manager); lv_fragment_managed_states_t * states; - _LV_LL_READ_BACK(&manager->attached, states) { + LV_LL_READ_BACK(&manager->attached, states) { item_delete_obj(states); item_delete_fragment(states); } - _lv_ll_clear(&manager->attached); - _lv_ll_clear(&manager->stack); + lv_ll_clear(&manager->attached); + lv_ll_clear(&manager->stack); lv_free(manager); } void lv_fragment_manager_create_obj(lv_fragment_manager_t * manager) { LV_ASSERT_NULL(manager); - lv_fragment_stack_item_t * top = _lv_ll_get_tail(&manager->stack); + lv_fragment_stack_item_t * top = lv_ll_get_tail(&manager->stack); lv_fragment_managed_states_t * states = NULL; - _LV_LL_READ(&manager->attached, states) { + LV_LL_READ(&manager->attached, states) { if(states->in_stack && top->states != states) { /*Only create obj for top item in stack*/ continue; @@ -102,7 +102,7 @@ void lv_fragment_manager_delete_obj(lv_fragment_manager_t * manager) { LV_ASSERT_NULL(manager); lv_fragment_managed_states_t * states = NULL; - _LV_LL_READ_BACK(&manager->attached, states) { + LV_LL_READ_BACK(&manager->attached, states) { item_delete_obj(states); } } @@ -125,25 +125,25 @@ void lv_fragment_manager_remove(lv_fragment_manager_t * manager, lv_fragment_t * lv_fragment_managed_states_t * prev = NULL; bool was_top = false; if(states->in_stack) { - void * stack_top = _lv_ll_get_tail(&manager->stack); + void * stack_top = lv_ll_get_tail(&manager->stack); lv_fragment_stack_item_t * item = NULL; - _LV_LL_READ_BACK(&manager->stack, item) { + LV_LL_READ_BACK(&manager->stack, item) { if(item->states == states) { was_top = stack_top == item; - void * stack_prev = _lv_ll_get_prev(&manager->stack, item); + void * stack_prev = lv_ll_get_prev(&manager->stack, item); if(!stack_prev) break; prev = ((lv_fragment_stack_item_t *) stack_prev)->states; break; } } if(item) { - _lv_ll_remove(&manager->stack, item); + lv_ll_remove(&manager->stack, item); lv_free(item); } } item_delete_obj(states); item_delete_fragment(states); - _lv_ll_remove(&manager->attached, states); + lv_ll_remove(&manager->attached, states); lv_free(states); if(prev && was_top) { item_create_obj(prev); @@ -152,14 +152,14 @@ void lv_fragment_manager_remove(lv_fragment_manager_t * manager, lv_fragment_t * void lv_fragment_manager_push(lv_fragment_manager_t * manager, lv_fragment_t * fragment, lv_obj_t * const * container) { - lv_fragment_stack_item_t * top = _lv_ll_get_tail(&manager->stack); + lv_fragment_stack_item_t * top = lv_ll_get_tail(&manager->stack); if(top != NULL) { item_delete_obj(top->states); } lv_fragment_managed_states_t * states = fragment_attach(manager, fragment, container); states->in_stack = true; /*Add fragment to the top of the stack*/ - lv_fragment_stack_item_t * item = _lv_ll_ins_tail(&manager->stack); + lv_fragment_stack_item_t * item = lv_ll_ins_tail(&manager->stack); lv_memzero(item, sizeof(lv_fragment_stack_item_t)); item->states = states; item_create_obj(states); @@ -187,7 +187,7 @@ bool lv_fragment_manager_send_event(lv_fragment_manager_t * manager, int code, v { LV_ASSERT_NULL(manager); lv_fragment_managed_states_t * p = NULL; - _LV_LL_READ_BACK(&manager->attached, p) { + LV_LL_READ_BACK(&manager->attached, p) { if(!p->obj_created || p->destroying_obj) continue; lv_fragment_t * instance = p->instance; if(!instance) continue; @@ -200,13 +200,13 @@ bool lv_fragment_manager_send_event(lv_fragment_manager_t * manager, int code, v size_t lv_fragment_manager_get_stack_size(lv_fragment_manager_t * manager) { LV_ASSERT_NULL(manager); - return _lv_ll_get_len(&manager->stack); + return lv_ll_get_len(&manager->stack); } lv_fragment_t * lv_fragment_manager_get_top(lv_fragment_manager_t * manager) { LV_ASSERT(manager); - lv_fragment_stack_item_t * top = _lv_ll_get_tail(&manager->stack); + lv_fragment_stack_item_t * top = lv_ll_get_tail(&manager->stack); if(!top)return NULL; return top->states->instance; } @@ -215,7 +215,7 @@ lv_fragment_t * lv_fragment_manager_find_by_container(lv_fragment_manager_t * ma { LV_ASSERT(manager); lv_fragment_managed_states_t * states; - _LV_LL_READ(&manager->attached, states) { + LV_LL_READ(&manager->attached, states) { if(*states->container == container) return states->instance; } return NULL; @@ -263,7 +263,7 @@ static lv_fragment_managed_states_t * fragment_attach(lv_fragment_manager_t * ma LV_ASSERT(manager); LV_ASSERT(fragment); LV_ASSERT(fragment->managed == NULL); - lv_fragment_managed_states_t * states = _lv_ll_ins_tail(&manager->attached); + lv_fragment_managed_states_t * states = lv_ll_ins_tail(&manager->attached); lv_memzero(states, sizeof(lv_fragment_managed_states_t)); states->cls = fragment->cls; states->manager = manager; diff --git a/src/others/fragment/lv_fragment_private.h b/src/others/fragment/lv_fragment_private.h new file mode 100644 index 000000000..3af36ddbc --- /dev/null +++ b/src/others/fragment/lv_fragment_private.h @@ -0,0 +1,77 @@ +/** + * @file lv_fragment_private.h + * + */ + +#ifndef LV_FRAGMENT_PRIVATE_H +#define LV_FRAGMENT_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_fragment.h" + +#if LV_USE_FRAGMENT + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Fragment states + */ +struct lv_fragment_managed_states_t { + /** + * Class of the fragment + */ + const lv_fragment_class_t * cls; + /** + * Manager the fragment attached to + */ + lv_fragment_manager_t * manager; + /** + * Container object the fragment adding view to + */ + lv_obj_t * const * container; + /** + * Fragment instance + */ + lv_fragment_t * instance; + /** + * true between `create_obj_cb` and `obj_deleted_cb` + */ + bool obj_created; + /** + * true before `lv_fragment_delete_obj` is called. Don't touch any object if this is true + */ + bool destroying_obj; + /** + * true if this fragment is in navigation stack that can be popped + */ + bool in_stack; +}; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_FRAGMENT */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_FRAGMENT_PRIVATE_H*/ diff --git a/src/others/gridnav/lv_gridnav.c b/src/others/gridnav/lv_gridnav.c index 51c414dd0..5f348af58 100644 --- a/src/others/gridnav/lv_gridnav.c +++ b/src/others/gridnav/lv_gridnav.c @@ -12,6 +12,7 @@ #include "../../misc/lv_assert.h" #include "../../misc/lv_math.h" #include "../../indev/lv_indev.h" +#include "../../core/lv_obj_private.h" /********************* * DEFINES diff --git a/src/others/ime/lv_ime_pinyin.c b/src/others/ime/lv_ime_pinyin.c index 9343239f6..0bcc76fd2 100644 --- a/src/others/ime/lv_ime_pinyin.c +++ b/src/others/ime/lv_ime_pinyin.c @@ -6,10 +6,12 @@ /********************* * INCLUDES *********************/ -#include "lv_ime_pinyin.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_ime_pinyin_private.h" #if LV_USE_IME_PINYIN != 0 #include "../../lvgl.h" +#include "../../core/lv_global.h" /********************* * DEFINES @@ -582,7 +584,7 @@ static void lv_ime_pinyin_constructor(const lv_obj_class_t * class_p, lv_obj_t * pinyin_k9_init_data(obj); - _lv_ll_init(&(pinyin_ime->k9_legal_py_ll), sizeof(ime_pinyin_k9_py_str_t)); + lv_ll_init(&(pinyin_ime->k9_legal_py_ll), sizeof(ime_pinyin_k9_py_str_t)); #endif } @@ -1005,19 +1007,19 @@ static void pinyin_k9_get_legal_py(lv_obj_t * obj, char * k9_input, const char * uint32_t ll_len = 0; ime_pinyin_k9_py_str_t * ll_index = NULL; - ll_len = _lv_ll_get_len(&pinyin_ime->k9_legal_py_ll); - ll_index = _lv_ll_get_head(&pinyin_ime->k9_legal_py_ll); + ll_len = lv_ll_get_len(&pinyin_ime->k9_legal_py_ll); + ll_index = lv_ll_get_head(&pinyin_ime->k9_legal_py_ll); while(index != -1) { if(index == len) { if(pinyin_k9_is_valid_py(obj, py_comp)) { if((count >= ll_len) || (ll_len == 0)) { - ll_index = _lv_ll_ins_tail(&pinyin_ime->k9_legal_py_ll); + ll_index = lv_ll_ins_tail(&pinyin_ime->k9_legal_py_ll); lv_strcpy(ll_index->py_str, py_comp); } else if((count < ll_len)) { lv_strcpy(ll_index->py_str, py_comp); - ll_index = _lv_ll_get_next(&pinyin_ime->k9_legal_py_ll, ll_index); + ll_index = lv_ll_get_next(&pinyin_ime->k9_legal_py_ll, ll_index); } count++; } @@ -1095,7 +1097,7 @@ static void pinyin_k9_fill_cand(lv_obj_t * obj) cand_len = tmp_len; } - ll_index = _lv_ll_get_head(&pinyin_ime->k9_legal_py_ll); + ll_index = lv_ll_get_head(&pinyin_ime->k9_legal_py_ll); lv_strcpy(pinyin_ime->input_char, ll_index->py_str); for(uint8_t i = 0; i < LV_IME_PINYIN_K9_CAND_TEXT_NUM; i++) { @@ -1110,7 +1112,7 @@ static void pinyin_k9_fill_cand(lv_obj_t * obj) lv_strcpy(lv_pinyin_k9_cand_str[index], ll_index->py_str); } - ll_index = _lv_ll_get_next(&pinyin_ime->k9_legal_py_ll, ll_index); /*Find the next list*/ + ll_index = lv_ll_get_next(&pinyin_ime->k9_legal_py_ll, ll_index); /*Find the next list*/ index++; } pinyin_ime->k9_py_ll_pos = index; @@ -1128,17 +1130,17 @@ static void pinyin_k9_cand_page_proc(lv_obj_t * obj, uint16_t dir) lv_ime_pinyin_t * pinyin_ime = (lv_ime_pinyin_t *)obj; lv_obj_t * ta = lv_keyboard_get_textarea(pinyin_ime->kb); - uint16_t ll_len = _lv_ll_get_len(&pinyin_ime->k9_legal_py_ll); + uint16_t ll_len = lv_ll_get_len(&pinyin_ime->k9_legal_py_ll); if((ll_len > LV_IME_PINYIN_K9_CAND_TEXT_NUM) && (pinyin_ime->k9_legal_py_count > LV_IME_PINYIN_K9_CAND_TEXT_NUM)) { ime_pinyin_k9_py_str_t * ll_index = NULL; int count = 0; - ll_index = _lv_ll_get_head(&pinyin_ime->k9_legal_py_ll); + ll_index = lv_ll_get_head(&pinyin_ime->k9_legal_py_ll); while(ll_index) { if(count >= pinyin_ime->k9_py_ll_pos) break; - ll_index = _lv_ll_get_next(&pinyin_ime->k9_legal_py_ll, ll_index); /*Find the next list*/ + ll_index = lv_ll_get_next(&pinyin_ime->k9_legal_py_ll, ll_index); /*Find the next list*/ count++; } @@ -1160,7 +1162,7 @@ static void pinyin_k9_cand_page_proc(lv_obj_t * obj, uint16_t dir) break; lv_strcpy(lv_pinyin_k9_cand_str[count], ll_index->py_str); - ll_index = _lv_ll_get_next(&pinyin_ime->k9_legal_py_ll, ll_index); /*Find the next list*/ + ll_index = lv_ll_get_next(&pinyin_ime->k9_legal_py_ll, ll_index); /*Find the next list*/ count++; } pinyin_ime->k9_py_ll_pos += count - 1; @@ -1172,12 +1174,12 @@ static void pinyin_k9_cand_page_proc(lv_obj_t * obj, uint16_t dir) lv_strcpy(lv_pinyin_k9_cand_str[i], " "); } count = LV_IME_PINYIN_K9_CAND_TEXT_NUM - 1; - ll_index = _lv_ll_get_prev(&pinyin_ime->k9_legal_py_ll, ll_index); + ll_index = lv_ll_get_prev(&pinyin_ime->k9_legal_py_ll, ll_index); while(ll_index) { if(count < 0) break; lv_strcpy(lv_pinyin_k9_cand_str[count], ll_index->py_str); - ll_index = _lv_ll_get_prev(&pinyin_ime->k9_legal_py_ll, ll_index); /*Find the previous list*/ + ll_index = lv_ll_get_prev(&pinyin_ime->k9_legal_py_ll, ll_index); /*Find the previous list*/ count--; } diff --git a/src/others/ime/lv_ime_pinyin.h b/src/others/ime/lv_ime_pinyin.h index a342d2c72..4e10df715 100644 --- a/src/others/ime/lv_ime_pinyin.h +++ b/src/others/ime/lv_ime_pinyin.h @@ -32,40 +32,11 @@ typedef enum { LV_IME_PINYIN_MODE_K9_NUMBER, } lv_ime_pinyin_mode_t; -/*Data of pinyin_dict*/ -typedef struct { - const char * const py; - const char * const py_mb; -} lv_pinyin_dict_t; - /*Data of 9-key input(k9) mode*/ typedef struct { char py_str[7]; } ime_pinyin_k9_py_str_t; -/*Data of lv_ime_pinyin*/ -typedef struct { - lv_obj_t obj; - lv_obj_t * kb; - lv_obj_t * cand_panel; - const lv_pinyin_dict_t * dict; - lv_ll_t k9_legal_py_ll; - char * cand_str; /* Candidate string */ - char input_char[16]; /* Input box character */ -#if LV_IME_PINYIN_USE_K9_MODE - char k9_input_str[LV_IME_PINYIN_K9_MAX_INPUT + 1]; /* 9-key input(k9) mode input string */ - uint16_t k9_py_ll_pos; /* Current pinyin map pages(k9) */ - uint16_t k9_legal_py_count; /* Count of legal Pinyin numbers(k9) */ - uint16_t k9_input_str_len; /* 9-key input(k9) mode input string max len */ -#endif - uint16_t ta_count; /* The number of characters entered in the text box this time */ - uint16_t cand_num; /* Number of candidates */ - uint16_t py_page; /* Current pinyin map pages(k26) */ - uint16_t py_num[26]; /* Number and length of Pinyin */ - uint16_t py_pos[26]; /* Pinyin position */ - lv_ime_pinyin_mode_t mode; /* Set mode, 1: 26-key input(k26), 0: 9-key input(k9). Default: 1. */ -} lv_ime_pinyin_t; - /*********************** * GLOBAL VARIABLES ***********************/ diff --git a/src/others/ime/lv_ime_pinyin_private.h b/src/others/ime/lv_ime_pinyin_private.h new file mode 100644 index 000000000..6d72cada6 --- /dev/null +++ b/src/others/ime/lv_ime_pinyin_private.h @@ -0,0 +1,74 @@ +/** + * @file lv_ime_pinyin_private.h + * + */ + +#ifndef LV_IME_PINYIN_PRIVATE_H +#define LV_IME_PINYIN_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_ime_pinyin.h" + +#if LV_USE_IME_PINYIN != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of pinyin_dict*/ +struct lv_pinyin_dict_t { + const char * const py; + const char * const py_mb; +}; + +/*Data of lv_ime_pinyin*/ +struct lv_ime_pinyin_t { + lv_obj_t obj; + lv_obj_t * kb; + lv_obj_t * cand_panel; + const lv_pinyin_dict_t * dict; + lv_ll_t k9_legal_py_ll; + char * cand_str; /* Candidate string */ + char input_char[16]; /* Input box character */ +#if LV_IME_PINYIN_USE_K9_MODE + char k9_input_str[LV_IME_PINYIN_K9_MAX_INPUT + 1]; /* 9-key input(k9) mode input string */ + uint16_t k9_py_ll_pos; /* Current pinyin map pages(k9) */ + uint16_t k9_legal_py_count; /* Count of legal Pinyin numbers(k9) */ + uint16_t k9_input_str_len; /* 9-key input(k9) mode input string max len */ +#endif + uint16_t ta_count; /* The number of characters entered in the text box this time */ + uint16_t cand_num; /* Number of candidates */ + uint16_t py_page; /* Current pinyin map pages(k26) */ + uint16_t py_num[26]; /* Number and length of Pinyin */ + uint16_t py_pos[26]; /* Pinyin position */ + lv_ime_pinyin_mode_t mode; /* Set mode, 1: 26-key input(k26), 0: 9-key input(k9). Default: 1. */ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_IME_PINYIN != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_IME_PINYIN_PRIVATE_H*/ diff --git a/src/others/monkey/lv_monkey.c b/src/others/monkey/lv_monkey.c index 9f970919d..97ba10a51 100644 --- a/src/others/monkey/lv_monkey.c +++ b/src/others/monkey/lv_monkey.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_monkey.h" +#include "lv_monkey_private.h" #if LV_USE_MONKEY != 0 @@ -24,7 +24,7 @@ /********************** * TYPEDEFS **********************/ -struct _lv_monkey { +struct lv_monkey_t { lv_monkey_config_t config; lv_indev_data_t indev_data; lv_indev_t * indev; @@ -98,7 +98,7 @@ void lv_monkey_set_enable(lv_monkey_t * monkey, bool en) bool lv_monkey_get_enable(lv_monkey_t * monkey) { LV_ASSERT_NULL(monkey); - return !monkey->timer->paused; + return !lv_timer_get_paused(monkey->timer); } void lv_monkey_set_user_data(lv_monkey_t * monkey, void * user_data) @@ -147,7 +147,7 @@ static int32_t lv_monkey_random(int32_t howsmall, int32_t howbig) static void lv_monkey_timer_cb(lv_timer_t * timer) { - lv_monkey_t * monkey = timer->user_data; + lv_monkey_t * monkey = lv_timer_get_user_data(timer); lv_indev_data_t * data = &monkey->indev_data; switch(lv_indev_get_type(monkey->indev)) { diff --git a/src/others/monkey/lv_monkey.h b/src/others/monkey/lv_monkey.h index 3791abc85..6cbe0ec56 100644 --- a/src/others/monkey/lv_monkey.h +++ b/src/others/monkey/lv_monkey.h @@ -24,10 +24,10 @@ extern "C" { /********************** * TYPEDEFS **********************/ -struct _lv_monkey; -typedef struct _lv_monkey lv_monkey_t; -typedef struct { +typedef struct lv_monkey_t lv_monkey_t; + +struct lv_monkey_config_t { /**< Input device type*/ lv_indev_type_t type; @@ -44,7 +44,7 @@ typedef struct { int32_t min; int32_t max; } input_range; -} lv_monkey_config_t; +}; /********************** * GLOBAL PROTOTYPES diff --git a/src/others/monkey/lv_monkey_private.h b/src/others/monkey/lv_monkey_private.h new file mode 100644 index 000000000..a08ea0731 --- /dev/null +++ b/src/others/monkey/lv_monkey_private.h @@ -0,0 +1,43 @@ +/** + * @file lv_monkey_private.h + * + */ + +#ifndef LV_MONKEY_PRIVATE_H +#define LV_MONKEY_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_monkey.h" + +#if LV_USE_MONKEY != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_MONKEY != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_MONKEY_PRIVATE_H*/ diff --git a/src/others/observer/lv_observer.c b/src/others/observer/lv_observer.c index ced337880..8d43f52de 100644 --- a/src/others/observer/lv_observer.c +++ b/src/others/observer/lv_observer.c @@ -7,10 +7,12 @@ * INCLUDES *********************/ -#include "lv_observer.h" +#include "lv_observer_private.h" #if LV_USE_OBSERVER #include "../../lvgl.h" +#include "../../core/lv_obj_private.h" +#include "../../misc/lv_event_private.h" /********************* * DEFINES @@ -78,7 +80,7 @@ void lv_subject_init_int(lv_subject_t * subject, int32_t value) subject->type = LV_SUBJECT_TYPE_INT; subject->value.num = value; subject->prev_value.num = value; - _lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t)); + lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t)); } void lv_subject_set_int(lv_subject_t * subject, int32_t value) @@ -124,7 +126,7 @@ void lv_subject_init_string(lv_subject_t * subject, char * buf, char * prev_buf, subject->value.pointer = buf; subject->prev_value.pointer = prev_buf; - _lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t)); + lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t)); } void lv_subject_copy_string(lv_subject_t * subject, const char * buf) @@ -171,7 +173,7 @@ void lv_subject_init_pointer(lv_subject_t * subject, void * value) subject->type = LV_SUBJECT_TYPE_POINTER; subject->value.pointer = value; subject->prev_value.pointer = value; - _lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t)); + lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t)); } void lv_subject_set_pointer(lv_subject_t * subject, void * ptr) @@ -212,7 +214,7 @@ void lv_subject_init_color(lv_subject_t * subject, lv_color_t color) subject->type = LV_SUBJECT_TYPE_COLOR; subject->value.color = color; subject->prev_value.color = color; - _lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t)); + lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t)); } void lv_subject_set_color(lv_subject_t * subject, lv_color_t color) @@ -251,7 +253,7 @@ void lv_subject_init_group(lv_subject_t * subject, lv_subject_t * list[], uint32 { subject->type = LV_SUBJECT_TYPE_GROUP; subject->size = list_len; - _lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t)); + lv_ll_init(&(subject->subs_ll), sizeof(lv_observer_t)); subject->value.pointer = list; /* bind all subjects to this subject */ @@ -264,9 +266,9 @@ void lv_subject_init_group(lv_subject_t * subject, lv_subject_t * list[], uint32 void lv_subject_deinit(lv_subject_t * subject) { - lv_observer_t * observer = _lv_ll_get_head(&subject->subs_ll); + lv_observer_t * observer = lv_ll_get_head(&subject->subs_ll); while(observer) { - lv_observer_t * observer_next = _lv_ll_get_next(&subject->subs_ll, observer); + lv_observer_t * observer_next = lv_ll_get_next(&subject->subs_ll, observer); if(observer->for_obj) { lv_obj_remove_event_cb(observer->target, unsubscribe_on_delete_cb); @@ -277,7 +279,7 @@ void lv_subject_deinit(lv_subject_t * subject) observer = observer_next; } - _lv_ll_clear(&subject->subs_ll); + lv_ll_clear(&subject->subs_ll); } lv_subject_t * lv_subject_get_group_element(lv_subject_t * subject, int32_t index) @@ -309,7 +311,7 @@ lv_observer_t * lv_subject_add_observer_obj(lv_subject_t * subject, lv_observer_ LV_LOG_WARN("Subject not initialized yet"); return NULL; } - lv_observer_t * observer = _lv_ll_ins_tail(&(subject->subs_ll)); + lv_observer_t * observer = lv_ll_ins_tail(&(subject->subs_ll)); LV_ASSERT_MALLOC(observer); if(observer == NULL) return NULL; @@ -339,7 +341,7 @@ lv_observer_t * lv_subject_add_observer_with_target(lv_subject_t * subject, lv_o LV_LOG_WARN("Subject not initialized yet"); return NULL; } - lv_observer_t * observer = _lv_ll_ins_tail(&(subject->subs_ll)); + lv_observer_t * observer = lv_ll_ins_tail(&(subject->subs_ll)); LV_ASSERT_MALLOC(observer); if(observer == NULL) return NULL; @@ -363,7 +365,7 @@ void lv_observer_remove(lv_observer_t * observer) observer->subject->notify_restart_query = 1; - _lv_ll_remove(&(observer->subject->subs_ll), observer); + lv_ll_remove(&(observer->subject->subs_ll), observer); if(observer->auto_free_user_data) { lv_free(observer->user_data); @@ -399,13 +401,13 @@ void lv_subject_notify(lv_subject_t * subject) LV_ASSERT_NULL(subject); lv_observer_t * observer; - _LV_LL_READ(&(subject->subs_ll), observer) { + LV_LL_READ(&(subject->subs_ll), observer) { observer->notified = 0; } do { subject->notify_restart_query = 0; - _LV_LL_READ(&(subject->subs_ll), observer) { + LV_LL_READ(&(subject->subs_ll), observer) { if(observer->cb && observer->notified == 0) { observer->cb(observer, subject); if(subject->notify_restart_query) break; @@ -534,6 +536,18 @@ lv_observer_t * lv_dropdown_bind_value(lv_obj_t * obj, lv_subject_t * subject) #endif /*LV_USE_DROPDOWN*/ +lv_obj_t * lv_observer_get_target_obj(lv_observer_t * observer) +{ + return (lv_obj_t *)lv_observer_get_target(observer); +} + +void * lv_observer_get_user_data(const lv_observer_t * observer) +{ + LV_ASSERT_NULL(observer); + + return observer->user_data; +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/others/observer/lv_observer.h b/src/others/observer/lv_observer.h index f7d538965..a3fc2a2d0 100644 --- a/src/others/observer/lv_observer.h +++ b/src/others/observer/lv_observer.h @@ -25,9 +25,6 @@ extern "C" { * TYPEDEFS **********************/ -struct _lv_observer_t; -typedef struct _lv_observer_t lv_observer_t; - typedef enum { LV_SUBJECT_TYPE_INVALID = 0, /**< indicates subject not initialized yet*/ LV_SUBJECT_TYPE_NONE = 1, /**< a null value like None or NILt*/ @@ -67,19 +64,6 @@ typedef struct { */ typedef void (*lv_observer_cb_t)(lv_observer_t * observer, lv_subject_t * subject); -/** - * The observer object: a descriptor returned when subscribing LVGL widgets to subjects - */ -struct _lv_observer_t { - lv_subject_t * subject; /**< The observed value */ - lv_observer_cb_t cb; /**< Callback that should be called when the value changes*/ - void * target; /**< A target for the observer, e.g. a widget or style*/ - void * user_data; /**< Additional parameter supplied when subscribing*/ - uint32_t auto_free_user_data : 1; /**< Automatically free user data when the observer is removed */ - uint32_t notified : 1; /**< Mark if this observer was already notified*/ - uint32_t for_obj : 1; /**< `target` is an `lv_obj_t *`*/ -}; - /********************** * GLOBAL PROTOTYPES **********************/ @@ -286,10 +270,14 @@ void * lv_observer_get_target(lv_observer_t * observer); * @param observer pointer to an observer * @return pointer to the saved object target */ -static inline lv_obj_t * lv_observer_get_target_obj(lv_observer_t * observer) -{ - return (lv_obj_t *)lv_observer_get_target(observer); -} +lv_obj_t * lv_observer_get_target_obj(lv_observer_t * observer); + +/** + * Get the user data of the observer. + * @param observer pointer to an observer + * @return void pointer to the saved user data +*/ +void * lv_observer_get_user_data(const lv_observer_t * observer); /** * Notify all observers of subject diff --git a/src/others/observer/lv_observer_private.h b/src/others/observer/lv_observer_private.h new file mode 100644 index 000000000..04a7992eb --- /dev/null +++ b/src/others/observer/lv_observer_private.h @@ -0,0 +1,57 @@ +/** + * @file lv_observer_private.h + * + */ + +#ifndef LV_OBSERVER_PRIVATE_H +#define LV_OBSERVER_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_observer.h" + +#if LV_USE_OBSERVER + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * The observer object: a descriptor returned when subscribing LVGL widgets to subjects + */ +struct lv_observer_t { + lv_subject_t * subject; /**< The observed value */ + lv_observer_cb_t cb; /**< Callback that should be called when the value changes*/ + void * target; /**< A target for the observer, e.g. a widget or style*/ + void * user_data; /**< Additional parameter supplied when subscribing*/ + uint32_t auto_free_user_data : 1; /**< Automatically free user data when the observer is removed */ + uint32_t notified : 1; /**< Mark if this observer was already notified*/ + uint32_t for_obj : 1; /**< `target` is an `lv_obj_t *`*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_OBSERVER */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_OBSERVER_PRIVATE_H*/ diff --git a/src/others/snapshot/lv_snapshot.c b/src/others/snapshot/lv_snapshot.c index 74609aa37..02ab3510a 100644 --- a/src/others/snapshot/lv_snapshot.c +++ b/src/others/snapshot/lv_snapshot.c @@ -6,12 +6,14 @@ /********************* * INCLUDES *********************/ +#include "../../draw/lv_draw_private.h" +#include "../../core/lv_obj_draw_private.h" #include "lv_snapshot.h" #if LV_USE_SNAPSHOT #include <stdbool.h> #include "../../display/lv_display.h" -#include "../../core/lv_refr.h" +#include "../../core/lv_refr_private.h" #include "../../display/lv_display_private.h" #include "../../stdlib/lv_string.h" @@ -47,7 +49,7 @@ lv_draw_buf_t * lv_snapshot_create_draw_buf(lv_obj_t * obj, lv_color_format_t cf lv_obj_update_layout(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); + int32_t ext_size = lv_obj_get_ext_draw_size(obj); w += ext_size * 2; h += ext_size * 2; if(w == 0 || h == 0) return NULL; @@ -60,7 +62,7 @@ lv_result_t lv_snapshot_reshape_draw_buf(lv_obj_t * obj, lv_draw_buf_t * draw_bu lv_obj_update_layout(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); + int32_t ext_size = lv_obj_get_ext_draw_size(obj); w += ext_size * 2; h += ext_size * 2; if(w == 0 || h == 0) return LV_RESULT_INVALID; @@ -97,7 +99,7 @@ lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t * obj, lv_color_format_t cf, l lv_area_t snapshot_area; int32_t w = draw_buf->header.w; int32_t h = draw_buf->header.h; - int32_t ext_size = _lv_obj_get_ext_draw_size(obj); + int32_t ext_size = lv_obj_get_ext_draw_size(obj); lv_obj_get_coords(obj, &snapshot_area); lv_area_increase(&snapshot_area, ext_size, ext_size); @@ -115,12 +117,12 @@ lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t * obj, lv_color_format_t cf, l lv_matrix_identity(&layer.matrix); #endif - lv_display_t * disp_old = _lv_refr_get_disp_refreshing(); + lv_display_t * disp_old = lv_refr_get_disp_refreshing(); lv_display_t * disp_new = lv_obj_get_display(obj); lv_layer_t * layer_old = disp_new->layer_head; disp_new->layer_head = &layer; - _lv_refr_set_disp_refreshing(disp_new); + lv_refr_set_disp_refreshing(disp_new); lv_obj_redraw(&layer, obj); while(layer.draw_task_head) { @@ -129,7 +131,7 @@ lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t * obj, lv_color_format_t cf, l } disp_new->layer_head = layer_old; - _lv_refr_set_disp_refreshing(disp_old); + lv_refr_set_disp_refreshing(disp_old); return LV_RESULT_OK; } @@ -148,6 +150,26 @@ lv_draw_buf_t * lv_snapshot_take(lv_obj_t * obj, lv_color_format_t cf) return draw_buf; } +void lv_snapshot_free(lv_image_dsc_t * dsc) +{ + LV_LOG_WARN("Deprecated API, use lv_draw_buf_destroy directly."); + lv_draw_buf_destroy((lv_draw_buf_t *)dsc); +} + +lv_result_t lv_snapshot_take_to_buf(lv_obj_t * obj, lv_color_format_t cf, lv_image_dsc_t * dsc, + void * buf, + uint32_t buf_size) +{ + lv_draw_buf_t draw_buf; + LV_LOG_WARN("Deprecated API, use lv_snapshot_take_to_draw_buf instead."); + lv_draw_buf_init(&draw_buf, 1, 1, cf, buf_size, buf, buf_size); + lv_result_t res = lv_snapshot_take_to_draw_buf(obj, cf, &draw_buf); + if(res == LV_RESULT_OK) { + lv_memcpy((void *)dsc, &draw_buf, sizeof(lv_image_dsc_t)); + } + return res; +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/others/snapshot/lv_snapshot.h b/src/others/snapshot/lv_snapshot.h index 3a685cf11..90de106cd 100644 --- a/src/others/snapshot/lv_snapshot.h +++ b/src/others/snapshot/lv_snapshot.h @@ -73,11 +73,7 @@ lv_result_t lv_snapshot_take_to_draw_buf(lv_obj_t * obj, lv_color_format_t cf, l * Free the snapshot image returned by @ref lv_snapshot_take * @param dsc the image descriptor generated by lv_snapshot_take. */ -static inline void lv_snapshot_free(lv_image_dsc_t * dsc) -{ - LV_LOG_WARN("Deprecated API, use lv_draw_buf_destroy directly."); - lv_draw_buf_destroy((lv_draw_buf_t *)dsc); -} +void lv_snapshot_free(lv_image_dsc_t * dsc); /** * Take snapshot for object with its children, save image info to provided buffer. @@ -89,19 +85,9 @@ static inline void lv_snapshot_free(lv_image_dsc_t * dsc) * @return LV_RESULT_OK on success, LV_RESULT_INVALID on error. * @deprecated Use lv_snapshot_take_to_draw_buf instead. */ -static inline lv_result_t lv_snapshot_take_to_buf(lv_obj_t * obj, lv_color_format_t cf, lv_image_dsc_t * dsc, - void * buf, - uint32_t buf_size) -{ - lv_draw_buf_t draw_buf; - LV_LOG_WARN("Deprecated API, use lv_snapshot_take_to_draw_buf instead."); - lv_draw_buf_init(&draw_buf, 1, 1, cf, buf_size, buf, buf_size); - lv_result_t res = lv_snapshot_take_to_draw_buf(obj, cf, &draw_buf); - if(res == LV_RESULT_OK) { - lv_memcpy((void *)dsc, &draw_buf, sizeof(lv_image_dsc_t)); - } - return res; -} +lv_result_t lv_snapshot_take_to_buf(lv_obj_t * obj, lv_color_format_t cf, lv_image_dsc_t * dsc, + void * buf, + uint32_t buf_size); /********************** * MACROS diff --git a/src/others/sysmon/lv_sysmon.c b/src/others/sysmon/lv_sysmon.c index b13a19fea..59fee7078 100644 --- a/src/others/sysmon/lv_sysmon.c +++ b/src/others/sysmon/lv_sysmon.c @@ -7,7 +7,8 @@ * INCLUDES *********************/ -#include "lv_sysmon.h" +#include "../../misc/lv_timer_private.h" +#include "lv_sysmon_private.h" #if LV_USE_SYSMON @@ -59,7 +60,7 @@ * GLOBAL FUNCTIONS **********************/ -void _lv_sysmon_builtin_init(void) +void lv_sysmon_builtin_init(void) { #if LV_USE_MEM_MONITOR @@ -69,7 +70,7 @@ void _lv_sysmon_builtin_init(void) #endif } -void _lv_sysmon_builtin_deinit(void) +void lv_sysmon_builtin_deinit(void) { #if LV_USE_MEM_MONITOR lv_timer_delete(sysmon_mem.timer); diff --git a/src/others/sysmon/lv_sysmon.h b/src/others/sysmon/lv_sysmon.h index e106eadd5..0859c064d 100644 --- a/src/others/sysmon/lv_sysmon.h +++ b/src/others/sysmon/lv_sysmon.h @@ -35,44 +35,6 @@ extern "C" { * TYPEDEFS **********************/ -struct _lv_sysmon_backend_data_t { - lv_subject_t subject; - lv_timer_t * timer; -}; - -#if LV_USE_PERF_MONITOR -struct _lv_sysmon_perf_info_t { - struct { - bool inited; - uint32_t refr_start; - uint32_t refr_interval_sum; - uint32_t refr_elaps_sum; - uint32_t refr_cnt; - uint32_t render_start; - uint32_t render_elaps_sum; /*Contains the flush time too*/ - uint32_t render_cnt; - uint32_t flush_in_render_start; - uint32_t flush_in_render_elaps_sum; - uint32_t flush_not_in_render_start; - uint32_t flush_not_in_render_elaps_sum; - uint32_t last_report_timestamp; - uint32_t render_in_progress : 1; - } measured; - - struct { - uint32_t fps; - uint32_t cpu; - uint32_t refr_avg_time; - uint32_t render_avg_time; /**< Pure rendering time without flush time*/ - uint32_t flush_avg_time; /**< Pure flushing time without rendering time*/ - uint32_t cpu_avg_total; - uint32_t fps_avg_total; - uint32_t run_cnt; - } calculated; - -}; -#endif - /********************** * GLOBAL PROTOTYPES **********************/ @@ -116,16 +78,6 @@ void lv_sysmon_hide_memory(lv_display_t * disp); #endif /*LV_USE_MEM_MONITOR*/ -/** - * Initialize built-in system monitor, such as performance and memory monitor. - */ -void _lv_sysmon_builtin_init(void); - -/** - * DeInitialize built-in system monitor, such as performance and memory monitor. - */ -void _lv_sysmon_builtin_deinit(void); - /********************** * MACROS **********************/ diff --git a/src/others/sysmon/lv_sysmon_private.h b/src/others/sysmon/lv_sysmon_private.h new file mode 100644 index 000000000..08d6156d3 --- /dev/null +++ b/src/others/sysmon/lv_sysmon_private.h @@ -0,0 +1,91 @@ +/** + * @file lv_sysmon_private.h + * + */ + +#ifndef LV_SYSMON_PRIVATE_H +#define LV_SYSMON_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_sysmon.h" + +#if LV_USE_SYSMON + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_sysmon_backend_data_t { + lv_subject_t subject; + lv_timer_t * timer; +}; + +#if LV_USE_PERF_MONITOR +struct lv_sysmon_perf_info_t { + struct { + bool inited; + uint32_t refr_start; + uint32_t refr_interval_sum; + uint32_t refr_elaps_sum; + uint32_t refr_cnt; + uint32_t render_start; + uint32_t render_elaps_sum; /*Contains the flush time too*/ + uint32_t render_cnt; + uint32_t flush_in_render_start; + uint32_t flush_in_render_elaps_sum; + uint32_t flush_not_in_render_start; + uint32_t flush_not_in_render_elaps_sum; + uint32_t last_report_timestamp; + uint32_t render_in_progress : 1; + } measured; + + struct { + uint32_t fps; + uint32_t cpu; + uint32_t refr_avg_time; + uint32_t render_avg_time; /**< Pure rendering time without flush time*/ + uint32_t flush_avg_time; /**< Pure flushing time without rendering time*/ + uint32_t cpu_avg_total; + uint32_t fps_avg_total; + uint32_t run_cnt; + } calculated; + +}; +#endif + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/** + * Initialize built-in system monitor, such as performance and memory monitor. + */ +void lv_sysmon_builtin_init(void); + +/** + * DeInitialize built-in system monitor, such as performance and memory monitor. + */ +void lv_sysmon_builtin_deinit(void); + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_SYSMON */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SYSMON_PRIVATE_H*/ diff --git a/src/stdlib/builtin/lv_mem_core_builtin.c b/src/stdlib/builtin/lv_mem_core_builtin.c index b7b707de3..23a218154 100644 --- a/src/stdlib/builtin/lv_mem_core_builtin.c +++ b/src/stdlib/builtin/lv_mem_core_builtin.c @@ -86,10 +86,10 @@ void lv_mem_init(void) state.tlsf = lv_tlsf_create_with_pool((void *)LV_MEM_ADR, LV_MEM_SIZE); #endif - _lv_ll_init(&state.pool_ll, sizeof(lv_pool_t)); + lv_ll_init(&state.pool_ll, sizeof(lv_pool_t)); /*Record the first pool*/ - lv_pool_t * pool_p = _lv_ll_ins_tail(&state.pool_ll); + lv_pool_t * pool_p = lv_ll_ins_tail(&state.pool_ll); LV_ASSERT_MALLOC(pool_p); *pool_p = lv_tlsf_get_pool(state.tlsf); @@ -100,7 +100,7 @@ void lv_mem_init(void) void lv_mem_deinit(void) { - _lv_ll_clear(&state.pool_ll); + lv_ll_clear(&state.pool_ll); lv_tlsf_destroy(state.tlsf); #if LV_USE_OS lv_mutex_delete(&state.mutex); @@ -115,7 +115,7 @@ lv_mem_pool_t lv_mem_add_pool(void * mem, size_t bytes) return NULL; } - lv_pool_t * pool_p = _lv_ll_ins_tail(&state.pool_ll); + lv_pool_t * pool_p = lv_ll_ins_tail(&state.pool_ll); LV_ASSERT_MALLOC(pool_p); *pool_p = new_pool; @@ -125,9 +125,9 @@ lv_mem_pool_t lv_mem_add_pool(void * mem, size_t bytes) void lv_mem_remove_pool(lv_mem_pool_t pool) { lv_pool_t * pool_p; - _LV_LL_READ(&state.pool_ll, pool_p) { + LV_LL_READ(&state.pool_ll, pool_p) { if(*pool_p == pool) { - _lv_ll_remove(&state.pool_ll, pool_p); + lv_ll_remove(&state.pool_ll, pool_p); lv_free(pool_p); lv_tlsf_remove_pool(state.tlsf, pool); return; @@ -201,7 +201,7 @@ void lv_mem_monitor_core(lv_mem_monitor_t * mon_p) LV_TRACE_MEM("begin"); lv_pool_t * pool_p; - _LV_LL_READ(&state.pool_ll, pool_p) { + LV_LL_READ(&state.pool_ll, pool_p) { lv_tlsf_walk_pool(*pool_p, lv_mem_walker, mon_p); } @@ -233,7 +233,7 @@ lv_result_t lv_mem_test_core(void) } lv_pool_t * pool_p; - _LV_LL_READ(&state.pool_ll, pool_p) { + LV_LL_READ(&state.pool_ll, pool_p) { if(lv_tlsf_check_pool(*pool_p)) { LV_LOG_WARN("pool failed"); #if LV_USE_OS diff --git a/src/stdlib/builtin/lv_sprintf_builtin.c b/src/stdlib/builtin/lv_sprintf_builtin.c index d5fc55537..fc34db4d1 100644 --- a/src/stdlib/builtin/lv_sprintf_builtin.c +++ b/src/stdlib/builtin/lv_sprintf_builtin.c @@ -552,7 +552,7 @@ static size_t _etoa(out_fct_type out, char * buffer, size_t idx, size_t maxlen, #endif // PRINTF_SUPPORT_FLOAT // internal vsnprintf -static int _lv_vsnprintf(out_fct_type out, char * buffer, const size_t maxlen, const char * format, va_list va) +static int lv_vsnprintf_inner(out_fct_type out, char * buffer, const size_t maxlen, const char * format, va_list va) { unsigned int flags, width, precision, n; size_t idx = 0U; @@ -759,7 +759,7 @@ static int _lv_vsnprintf(out_fct_type out, char * buffer, const size_t maxlen, c va_list copy; va_copy(copy, *vaf->va); - idx += _lv_vsnprintf(out, buffer + idx, maxlen - idx, vaf->fmt, copy); + idx += lv_vsnprintf_inner(out, buffer + idx, maxlen - idx, vaf->fmt, copy); va_end(copy); } else { @@ -873,14 +873,14 @@ int lv_snprintf(char * buffer, size_t count, const char * format, ...) { va_list va; va_start(va, format); - const int ret = _lv_vsnprintf(_out_buffer, buffer, count, format, va); + const int ret = lv_vsnprintf_inner(_out_buffer, buffer, count, format, va); va_end(va); return ret; } int lv_vsnprintf(char * buffer, size_t count, const char * format, va_list va) { - return _lv_vsnprintf(_out_buffer, buffer, count, format, va); + return lv_vsnprintf_inner(_out_buffer, buffer, count, format, va); } #endif /*LV_STDLIB_BUILTIN*/ diff --git a/src/stdlib/builtin/lv_tlsf.c b/src/stdlib/builtin/lv_tlsf.c index 6048245c3..4232ae324 100644 --- a/src/stdlib/builtin/lv_tlsf.c +++ b/src/stdlib/builtin/lv_tlsf.c @@ -1,7 +1,7 @@ #include "../../lv_conf_internal.h" #if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN -#include "lv_tlsf.h" +#include "lv_tlsf_private.h" #include "../../stdlib/lv_string.h" #include "../../misc/lv_log.h" #include "../../misc/lv_assert.h" @@ -219,16 +219,16 @@ tlsf_decl int tlsf_fls_sizet(size_t size) */ /* Public constants: may be modified. */ -enum tlsf_public { +typedef enum { /* log2 of number of linear subdivisions of block sizes. Larger ** values require more memory in the control structure. Values of ** 4 or 5 are typical. */ SL_INDEX_COUNT_LOG2 = 5, -}; +} tlsf_public; /* Private constants: do not modify. */ -enum tlsf_private { +typedef enum { #if defined (TLSF_64BIT) /* All allocation sizes and addresses are aligned to 8 bytes. */ ALIGN_SIZE_LOG2 = 3, @@ -265,7 +265,7 @@ enum tlsf_private { FL_INDEX_COUNT = (FL_INDEX_MAX - FL_INDEX_SHIFT + 1), SMALL_BLOCK_SIZE = (1 << FL_INDEX_SHIFT), -}; +} tlsf_private; /* ** Cast and min/max macros. diff --git a/src/stdlib/builtin/lv_tlsf.h b/src/stdlib/builtin/lv_tlsf.h index 002e56e18..4127271db 100644 --- a/src/stdlib/builtin/lv_tlsf.h +++ b/src/stdlib/builtin/lv_tlsf.h @@ -54,16 +54,6 @@ extern "C" { typedef void * lv_tlsf_t; typedef void * lv_pool_t; -typedef struct { -#if LV_USE_OS - lv_mutex_t mutex; -#endif - lv_tlsf_t tlsf; - size_t cur_used; - size_t max_used; - lv_ll_t pool_ll; -} lv_tlsf_state_t; - /* Create/destroy a memory pool. */ lv_tlsf_t lv_tlsf_create(void * mem); lv_tlsf_t lv_tlsf_create_with_pool(void * mem, size_t bytes); diff --git a/src/stdlib/builtin/lv_tlsf_private.h b/src/stdlib/builtin/lv_tlsf_private.h new file mode 100644 index 000000000..036e9d73e --- /dev/null +++ b/src/stdlib/builtin/lv_tlsf_private.h @@ -0,0 +1,53 @@ +/** + * @file lv_tlsf_private.h + * + */ + +#ifndef LV_TLSF_PRIVATE_H +#define LV_TLSF_PRIVATE_H + +#if LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_tlsf.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { +#if LV_USE_OS + lv_mutex_t mutex; +#endif + lv_tlsf_t tlsf; + size_t cur_used; + size_t max_used; + lv_ll_t pool_ll; +} lv_tlsf_state_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_USE_STDLIB_MALLOC == LV_STDLIB_BUILTIN*/ + +#endif /*LV_TLSF_PRIVATE_H*/ diff --git a/src/stdlib/lv_mem.c b/src/stdlib/lv_mem.c index c1ab647e3..bfc887fff 100644 --- a/src/stdlib/lv_mem.c +++ b/src/stdlib/lv_mem.c @@ -5,7 +5,7 @@ /********************* * INCLUDES *********************/ -#include "lv_mem.h" +#include "lv_mem_private.h" #include "lv_string.h" #include "../misc/lv_assert.h" #include "../misc/lv_log.h" diff --git a/src/stdlib/lv_mem_private.h b/src/stdlib/lv_mem_private.h new file mode 100644 index 000000000..9e70ae1af --- /dev/null +++ b/src/stdlib/lv_mem_private.h @@ -0,0 +1,39 @@ +/** + * @file lv_mem_private.h + * + */ + +#ifndef LV_MEM_PRIVATE_H +#define LV_MEM_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_mem.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_MEM_PRIVATE_H*/ diff --git a/src/stdlib/lv_sprintf.h b/src/stdlib/lv_sprintf.h index a47b4307c..9def1ec32 100644 --- a/src/stdlib/lv_sprintf.h +++ b/src/stdlib/lv_sprintf.h @@ -3,8 +3,8 @@ * */ -#ifndef _LV_SPRINTF_H_ -#define _LV_SPRINTF_H_ +#ifndef LV_SPRINTF_H_ +#define LV_SPRINTF_H_ #if defined(__has_include) #if __has_include(LV_INTTYPES_INCLUDE) @@ -42,4 +42,4 @@ int lv_vsnprintf(char * buffer, size_t count, const char * format, va_list va); } /*extern "C"*/ #endif -#endif /* _LV_SPRINTF_H_*/ +#endif /* LV_SPRINTF_H_*/ diff --git a/src/themes/default/lv_theme_default.c b/src/themes/default/lv_theme_default.c index 7f3e2b05b..fa1266219 100644 --- a/src/themes/default/lv_theme_default.c +++ b/src/themes/default/lv_theme_default.c @@ -10,7 +10,7 @@ #if LV_USE_THEME_DEFAULT -#include "../lv_theme.h" +#include "../lv_theme_private.h" #include "../../misc/lv_color.h" #include "../../core/lv_global.h" @@ -24,7 +24,7 @@ typedef struct _my_theme_t my_theme_t; #define theme_def (*(my_theme_t **)(&LV_GLOBAL_DEFAULT()->theme_default)) #define MODE_DARK 1 -#define RADIUS_DEFAULT _LV_DPX_CALC(theme->disp_dpi, theme->disp_size == DISP_LARGE ? 12 : 8) +#define RADIUS_DEFAULT LV_DPX_CALC(theme->disp_dpi, theme->disp_size == DISP_LARGE ? 12 : 8) /*SCREEN*/ #define LIGHT_COLOR_SCR lv_palette_lighten(LV_PALETTE_GREY, 4) @@ -37,12 +37,12 @@ typedef struct _my_theme_t my_theme_t; #define DARK_COLOR_GREY lv_color_hex(0x2f3237) #define TRANSITION_TIME LV_THEME_DEFAULT_TRANSITION_TIME -#define BORDER_WIDTH _LV_DPX_CALC(theme->disp_dpi, 2) -#define OUTLINE_WIDTH _LV_DPX_CALC(theme->disp_dpi, 3) +#define BORDER_WIDTH LV_DPX_CALC(theme->disp_dpi, 2) +#define OUTLINE_WIDTH LV_DPX_CALC(theme->disp_dpi, 3) -#define PAD_DEF _LV_DPX_CALC(theme->disp_dpi, theme->disp_size == DISP_LARGE ? 24 : theme->disp_size == DISP_MEDIUM ? 20 : 16) -#define PAD_SMALL _LV_DPX_CALC(theme->disp_dpi, theme->disp_size == DISP_LARGE ? 14 : theme->disp_size == DISP_MEDIUM ? 12 : 10) -#define PAD_TINY _LV_DPX_CALC(theme->disp_dpi, theme->disp_size == DISP_LARGE ? 8 : theme->disp_size == DISP_MEDIUM ? 6 : 2) +#define PAD_DEF LV_DPX_CALC(theme->disp_dpi, theme->disp_size == DISP_LARGE ? 24 : theme->disp_size == DISP_MEDIUM ? 20 : 16) +#define PAD_SMALL LV_DPX_CALC(theme->disp_dpi, theme->disp_size == DISP_LARGE ? 14 : theme->disp_size == DISP_MEDIUM ? 12 : 10) +#define PAD_TINY LV_DPX_CALC(theme->disp_dpi, theme->disp_size == DISP_LARGE ? 8 : theme->disp_size == DISP_MEDIUM ? 6 : 2) /********************** * TYPEDEFS @@ -247,8 +247,8 @@ static void style_init(my_theme_t * theme) lv_style_set_bg_color(&theme->styles.scrollbar, sb_color); lv_style_set_radius(&theme->styles.scrollbar, LV_RADIUS_CIRCLE); - lv_style_set_pad_all(&theme->styles.scrollbar, _LV_DPX_CALC(theme->disp_dpi, 7)); - lv_style_set_width(&theme->styles.scrollbar, _LV_DPX_CALC(theme->disp_dpi, 5)); + lv_style_set_pad_all(&theme->styles.scrollbar, LV_DPX_CALC(theme->disp_dpi, 7)); + lv_style_set_width(&theme->styles.scrollbar, LV_DPX_CALC(theme->disp_dpi, 5)); lv_style_set_bg_opa(&theme->styles.scrollbar, LV_OPA_40); #if TRANSITION_TIME lv_style_set_transition(&theme->styles.scrollbar, &theme->trans_normal); @@ -278,7 +278,7 @@ static void style_init(my_theme_t * theme) lv_style_set_pad_row(&theme->styles.card, PAD_SMALL); lv_style_set_pad_column(&theme->styles.card, PAD_SMALL); lv_style_set_line_color(&theme->styles.card, lv_palette_main(LV_PALETTE_GREY)); - lv_style_set_line_width(&theme->styles.card, _LV_DPX_CALC(theme->disp_dpi, 1)); + lv_style_set_line_width(&theme->styles.card, LV_DPX_CALC(theme->disp_dpi, 1)); style_init_reset(&theme->styles.outline_primary); lv_style_set_outline_color(&theme->styles.outline_primary, theme->base.color_primary); @@ -293,20 +293,20 @@ static void style_init(my_theme_t * theme) style_init_reset(&theme->styles.btn); lv_style_set_radius(&theme->styles.btn, - _LV_DPX_CALC(theme->disp_dpi, theme->disp_size == DISP_LARGE ? 16 : theme->disp_size == DISP_MEDIUM ? 12 : 8)); + LV_DPX_CALC(theme->disp_dpi, theme->disp_size == DISP_LARGE ? 16 : theme->disp_size == DISP_MEDIUM ? 12 : 8)); lv_style_set_bg_opa(&theme->styles.btn, LV_OPA_COVER); lv_style_set_bg_color(&theme->styles.btn, theme->color_grey); if(!(theme->base.flags & MODE_DARK)) { lv_style_set_shadow_color(&theme->styles.btn, lv_palette_main(LV_PALETTE_GREY)); lv_style_set_shadow_width(&theme->styles.btn, LV_DPX(3)); lv_style_set_shadow_opa(&theme->styles.btn, LV_OPA_50); - lv_style_set_shadow_offset_y(&theme->styles.btn, _LV_DPX_CALC(theme->disp_dpi, LV_DPX(4))); + lv_style_set_shadow_offset_y(&theme->styles.btn, LV_DPX_CALC(theme->disp_dpi, LV_DPX(4))); } lv_style_set_text_color(&theme->styles.btn, theme->color_text); lv_style_set_pad_hor(&theme->styles.btn, PAD_DEF); lv_style_set_pad_ver(&theme->styles.btn, PAD_SMALL); - lv_style_set_pad_column(&theme->styles.btn, _LV_DPX_CALC(theme->disp_dpi, 5)); - lv_style_set_pad_row(&theme->styles.btn, _LV_DPX_CALC(theme->disp_dpi, 5)); + lv_style_set_pad_column(&theme->styles.btn, LV_DPX_CALC(theme->disp_dpi, 5)); + lv_style_set_pad_row(&theme->styles.btn, LV_DPX_CALC(theme->disp_dpi, 5)); lv_color_filter_dsc_init(&theme->dark_filter, dark_color_filter_cb); lv_color_filter_dsc_init(&theme->grey_filter, grey_filter_cb); @@ -333,11 +333,11 @@ static void style_init(my_theme_t * theme) lv_style_set_pad_gap(&theme->styles.pad_small, PAD_SMALL); style_init_reset(&theme->styles.pad_gap); - lv_style_set_pad_row(&theme->styles.pad_gap, _LV_DPX_CALC(theme->disp_dpi, 10)); - lv_style_set_pad_column(&theme->styles.pad_gap, _LV_DPX_CALC(theme->disp_dpi, 10)); + lv_style_set_pad_row(&theme->styles.pad_gap, LV_DPX_CALC(theme->disp_dpi, 10)); + lv_style_set_pad_column(&theme->styles.pad_gap, LV_DPX_CALC(theme->disp_dpi, 10)); style_init_reset(&theme->styles.line_space_large); - lv_style_set_text_line_space(&theme->styles.line_space_large, _LV_DPX_CALC(theme->disp_dpi, 20)); + lv_style_set_text_line_space(&theme->styles.line_space_large, LV_DPX_CALC(theme->disp_dpi, 20)); style_init_reset(&theme->styles.text_align_center); lv_style_set_text_align(&theme->styles.text_align_center, LV_TEXT_ALIGN_CENTER); @@ -393,14 +393,14 @@ static void style_init(my_theme_t * theme) #if LV_THEME_DEFAULT_GROW style_init_reset(&theme->styles.grow); - lv_style_set_transform_width(&theme->styles.grow, _LV_DPX_CALC(theme->disp_dpi, 3)); - lv_style_set_transform_height(&theme->styles.grow, _LV_DPX_CALC(theme->disp_dpi, 3)); + lv_style_set_transform_width(&theme->styles.grow, LV_DPX_CALC(theme->disp_dpi, 3)); + lv_style_set_transform_height(&theme->styles.grow, LV_DPX_CALC(theme->disp_dpi, 3)); #endif style_init_reset(&theme->styles.knob); lv_style_set_bg_color(&theme->styles.knob, theme->base.color_primary); lv_style_set_bg_opa(&theme->styles.knob, LV_OPA_COVER); - lv_style_set_pad_all(&theme->styles.knob, _LV_DPX_CALC(theme->disp_dpi, 6)); + lv_style_set_pad_all(&theme->styles.knob, LV_DPX_CALC(theme->disp_dpi, 6)); lv_style_set_radius(&theme->styles.knob, LV_RADIUS_CIRCLE); style_init_reset(&theme->styles.anim); @@ -412,7 +412,7 @@ static void style_init(my_theme_t * theme) #if LV_USE_ARC style_init_reset(&theme->styles.arc_indic); lv_style_set_arc_color(&theme->styles.arc_indic, theme->color_grey); - lv_style_set_arc_width(&theme->styles.arc_indic, _LV_DPX_CALC(theme->disp_dpi, 15)); + lv_style_set_arc_width(&theme->styles.arc_indic, LV_DPX_CALC(theme->disp_dpi, 15)); lv_style_set_arc_rounded(&theme->styles.arc_indic, true); style_init_reset(&theme->styles.arc_indic_primary); @@ -425,7 +425,7 @@ static void style_init(my_theme_t * theme) #endif #if LV_USE_CHECKBOX style_init_reset(&theme->styles.cb_marker); - lv_style_set_pad_all(&theme->styles.cb_marker, _LV_DPX_CALC(theme->disp_dpi, 3)); + lv_style_set_pad_all(&theme->styles.cb_marker, LV_DPX_CALC(theme->disp_dpi, 3)); lv_style_set_border_width(&theme->styles.cb_marker, BORDER_WIDTH); lv_style_set_border_color(&theme->styles.cb_marker, theme->base.color_primary); lv_style_set_bg_color(&theme->styles.cb_marker, theme->color_card); @@ -440,7 +440,7 @@ static void style_init(my_theme_t * theme) #if LV_USE_SWITCH style_init_reset(&theme->styles.switch_knob); - lv_style_set_pad_all(&theme->styles.switch_knob, - _LV_DPX_CALC(theme->disp_dpi, 4)); + lv_style_set_pad_all(&theme->styles.switch_knob, - LV_DPX_CALC(theme->disp_dpi, 4)); lv_style_set_bg_color(&theme->styles.switch_knob, lv_color_white()); #endif @@ -453,16 +453,16 @@ static void style_init(my_theme_t * theme) #if LV_USE_CHART style_init_reset(&theme->styles.chart_bg); lv_style_set_border_post(&theme->styles.chart_bg, false); - lv_style_set_pad_column(&theme->styles.chart_bg, _LV_DPX_CALC(theme->disp_dpi, 10)); + lv_style_set_pad_column(&theme->styles.chart_bg, LV_DPX_CALC(theme->disp_dpi, 10)); lv_style_set_line_color(&theme->styles.chart_bg, theme->color_grey); style_init_reset(&theme->styles.chart_series); - 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_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)); - int32_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)); + lv_style_set_pad_column(&theme->styles.chart_series, LV_DPX_CALC(theme->disp_dpi, 2)); style_init_reset(&theme->styles.chart_indic); lv_style_set_radius(&theme->styles.chart_indic, LV_RADIUS_CIRCLE); @@ -490,7 +490,7 @@ static void style_init(my_theme_t * theme) lv_style_set_pad_hor(&theme->styles.menu_cont, PAD_SMALL); lv_style_set_pad_ver(&theme->styles.menu_cont, PAD_SMALL); lv_style_set_pad_gap(&theme->styles.menu_cont, PAD_SMALL); - lv_style_set_border_width(&theme->styles.menu_cont, _LV_DPX_CALC(theme->disp_dpi, 1)); + lv_style_set_border_width(&theme->styles.menu_cont, LV_DPX_CALC(theme->disp_dpi, 1)); lv_style_set_border_opa(&theme->styles.menu_cont, LV_OPA_10); lv_style_set_border_color(&theme->styles.menu_cont, theme->color_text); lv_style_set_border_side(&theme->styles.menu_cont, LV_BORDER_SIDE_NONE); @@ -498,7 +498,7 @@ static void style_init(my_theme_t * theme) style_init_reset(&theme->styles.menu_sidebar_cont); lv_style_set_pad_all(&theme->styles.menu_sidebar_cont, 0); lv_style_set_pad_gap(&theme->styles.menu_sidebar_cont, 0); - lv_style_set_border_width(&theme->styles.menu_sidebar_cont, _LV_DPX_CALC(theme->disp_dpi, 1)); + lv_style_set_border_width(&theme->styles.menu_sidebar_cont, LV_DPX_CALC(theme->disp_dpi, 1)); lv_style_set_border_opa(&theme->styles.menu_sidebar_cont, LV_OPA_10); lv_style_set_border_color(&theme->styles.menu_sidebar_cont, theme->color_text); lv_style_set_border_side(&theme->styles.menu_sidebar_cont, LV_BORDER_SIDE_RIGHT); @@ -534,7 +534,7 @@ static void style_init(my_theme_t * theme) #if LV_USE_TABLE style_init_reset(&theme->styles.table_cell); - lv_style_set_border_width(&theme->styles.table_cell, _LV_DPX_CALC(theme->disp_dpi, 1)); + lv_style_set_border_width(&theme->styles.table_cell, LV_DPX_CALC(theme->disp_dpi, 1)); lv_style_set_border_color(&theme->styles.table_cell, theme->color_grey); lv_style_set_border_side(&theme->styles.table_cell, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM); #endif @@ -542,8 +542,8 @@ static void style_init(my_theme_t * theme) #if LV_USE_TEXTAREA style_init_reset(&theme->styles.ta_cursor); lv_style_set_border_color(&theme->styles.ta_cursor, theme->color_text); - lv_style_set_border_width(&theme->styles.ta_cursor, _LV_DPX_CALC(theme->disp_dpi, 2)); - lv_style_set_pad_left(&theme->styles.ta_cursor, - _LV_DPX_CALC(theme->disp_dpi, 1)); + lv_style_set_border_width(&theme->styles.ta_cursor, LV_DPX_CALC(theme->disp_dpi, 2)); + lv_style_set_pad_left(&theme->styles.ta_cursor, - LV_DPX_CALC(theme->disp_dpi, 1)); lv_style_set_border_side(&theme->styles.ta_cursor, LV_BORDER_SIDE_LEFT); lv_style_set_anim_duration(&theme->styles.ta_cursor, 400); @@ -559,7 +559,7 @@ static void style_init(my_theme_t * theme) lv_style_set_pad_gap(&theme->styles.calendar_btnm_bg, PAD_SMALL / 2); style_init_reset(&theme->styles.calendar_btnm_day); - lv_style_set_border_width(&theme->styles.calendar_btnm_day, _LV_DPX_CALC(theme->disp_dpi, 1)); + lv_style_set_border_width(&theme->styles.calendar_btnm_day, LV_DPX_CALC(theme->disp_dpi, 1)); lv_style_set_border_color(&theme->styles.calendar_btnm_day, theme->color_grey); lv_style_set_bg_color(&theme->styles.calendar_btnm_day, theme->color_card); lv_style_set_bg_opa(&theme->styles.calendar_btnm_day, LV_OPA_20); @@ -602,7 +602,7 @@ static void style_init(my_theme_t * theme) lv_style_set_clip_corner(&theme->styles.list_bg, true); style_init_reset(&theme->styles.list_btn); - lv_style_set_border_width(&theme->styles.list_btn, _LV_DPX_CALC(theme->disp_dpi, 1)); + lv_style_set_border_width(&theme->styles.list_btn, LV_DPX_CALC(theme->disp_dpi, 1)); lv_style_set_border_color(&theme->styles.list_btn, theme->color_grey); lv_style_set_border_side(&theme->styles.list_btn, LV_BORDER_SIDE_BOTTOM); lv_style_set_pad_all(&theme->styles.list_btn, PAD_SMALL); @@ -618,9 +618,9 @@ static void style_init(my_theme_t * theme) lv_style_set_bg_color(&theme->styles.led, lv_color_white()); lv_style_set_bg_grad_color(&theme->styles.led, lv_palette_main(LV_PALETTE_GREY)); lv_style_set_radius(&theme->styles.led, LV_RADIUS_CIRCLE); - lv_style_set_shadow_width(&theme->styles.led, _LV_DPX_CALC(theme->disp_dpi, 15)); + lv_style_set_shadow_width(&theme->styles.led, LV_DPX_CALC(theme->disp_dpi, 15)); lv_style_set_shadow_color(&theme->styles.led, lv_color_white()); - lv_style_set_shadow_spread(&theme->styles.led, _LV_DPX_CALC(theme->disp_dpi, 5)); + lv_style_set_shadow_spread(&theme->styles.led, LV_DPX_CALC(theme->disp_dpi, 5)); #endif #if LV_USE_SCALE diff --git a/src/themes/lv_theme.c b/src/themes/lv_theme.c index 352047539..5dcd6c6ae 100644 --- a/src/themes/lv_theme.c +++ b/src/themes/lv_theme.c @@ -6,6 +6,9 @@ /********************* * INCLUDES *********************/ +#include "lv_theme_private.h" +#include "../core/lv_obj_private.h" +#include "../core/lv_obj_class_private.h" #include "../../lvgl.h" /********************* diff --git a/src/themes/lv_theme.h b/src/themes/lv_theme.h index fc19f4c45..21cb09b11 100644 --- a/src/themes/lv_theme.h +++ b/src/themes/lv_theme.h @@ -25,19 +25,6 @@ extern "C" { typedef void (*lv_theme_apply_cb_t)(lv_theme_t *, lv_obj_t *); -struct _lv_theme_t { - lv_theme_apply_cb_t apply_cb; - lv_theme_t * parent; /**< Apply the current theme's style on top of this theme.*/ - void * user_data; - lv_display_t * disp; - lv_color_t color_primary; - lv_color_t color_secondary; - const lv_font_t * font_small; - const lv_font_t * font_normal; - const lv_font_t * font_large; - uint32_t flags; /*Any custom flag used by the theme*/ -}; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/themes/lv_theme_private.h b/src/themes/lv_theme_private.h new file mode 100644 index 000000000..d4b0cf1b0 --- /dev/null +++ b/src/themes/lv_theme_private.h @@ -0,0 +1,53 @@ +/** + * @file lv_theme_private.h + * + */ + +#ifndef LV_THEME_PRIVATE_H +#define LV_THEME_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_theme.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_theme_t { + lv_theme_apply_cb_t apply_cb; + lv_theme_t * parent; /**< Apply the current theme's style on top of this theme.*/ + void * user_data; + lv_display_t * disp; + lv_color_t color_primary; + lv_color_t color_secondary; + const lv_font_t * font_small; + const lv_font_t * font_normal; + const lv_font_t * font_large; + uint32_t flags; /*Any custom flag used by the theme*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_THEME_PRIVATE_H*/ diff --git a/src/themes/mono/lv_theme_mono.c b/src/themes/mono/lv_theme_mono.c index 6beaa9ac6..cd71ecb3d 100644 --- a/src/themes/mono/lv_theme_mono.c +++ b/src/themes/mono/lv_theme_mono.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "../lv_theme_private.h" #include "../../../lvgl.h" #if LV_USE_THEME_MONO diff --git a/src/themes/simple/lv_theme_simple.c b/src/themes/simple/lv_theme_simple.c index b7dac5b1c..8a325550f 100644 --- a/src/themes/simple/lv_theme_simple.c +++ b/src/themes/simple/lv_theme_simple.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "../lv_theme_private.h" #include "../../../lvgl.h" /*To see all the widgets*/ #if LV_USE_THEME_SIMPLE diff --git a/src/tick/lv_tick.c b/src/tick/lv_tick.c index 09fcd007a..21e22959d 100644 --- a/src/tick/lv_tick.c +++ b/src/tick/lv_tick.c @@ -6,7 +6,7 @@ /********************* * INCLUDES *********************/ -#include "lv_tick.h" +#include "lv_tick_private.h" #include "../misc/lv_types.h" #include "../core/lv_global.h" diff --git a/src/tick/lv_tick.h b/src/tick/lv_tick.h index ef65b967f..048b93a31 100644 --- a/src/tick/lv_tick.h +++ b/src/tick/lv_tick.h @@ -31,13 +31,6 @@ typedef uint32_t (*lv_tick_get_cb_t)(void); typedef void (*lv_delay_cb_t)(uint32_t ms); -typedef struct { - uint32_t sys_time; - volatile uint8_t sys_irq_flag; - lv_tick_get_cb_t tick_get_cb; - lv_delay_cb_t delay_cb; -} lv_tick_state_t; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/tick/lv_tick_private.h b/src/tick/lv_tick_private.h new file mode 100644 index 000000000..cf8ae9b09 --- /dev/null +++ b/src/tick/lv_tick_private.h @@ -0,0 +1,46 @@ +/** + * @file lv_tick_private.h + * + */ + +#ifndef LV_TICK_PRIVATE_H +#define LV_TICK_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_tick.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +typedef struct { + uint32_t sys_time; + volatile uint8_t sys_irq_flag; + lv_tick_get_cb_t tick_get_cb; + lv_delay_cb_t delay_cb; +} lv_tick_state_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TICK_PRIVATE_H*/ diff --git a/src/widgets/animimage/lv_animimage.c b/src/widgets/animimage/lv_animimage.c index 88ca98077..3c6ed50cd 100644 --- a/src/widgets/animimage/lv_animimage.c +++ b/src/widgets/animimage/lv_animimage.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_animimage.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_animimage_private.h" #if LV_USE_ANIMIMG != 0 /*Testing of dependencies*/ diff --git a/src/widgets/animimage/lv_animimage.h b/src/widgets/animimage/lv_animimage.h index 0e88a2635..d5d5b68fc 100644 --- a/src/widgets/animimage/lv_animimage.h +++ b/src/widgets/animimage/lv_animimage.h @@ -32,25 +32,10 @@ extern "C" { LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_animimg_class; -/*Data of the animimage*/ -typedef struct { - lv_image_t img; - lv_anim_t anim; - /*picture sequence */ - const void ** dsc; - int8_t pic_count; -} lv_animimg_t; - /*Image parts*/ -enum _lv_animimg_part_t { +typedef enum { LV_ANIM_IMAGE_PART_MAIN, -}; - -#ifdef DOXYGEN -typedef _lv_animimg_part_t lv_animimg_part_t; -#else -typedef uint8_t lv_animimg_part_t; -#endif +} lv_animimg_part_t; /********************** * GLOBAL PROTOTYPES diff --git a/src/widgets/animimage/lv_animimage_private.h b/src/widgets/animimage/lv_animimage_private.h new file mode 100644 index 000000000..89d6f49ef --- /dev/null +++ b/src/widgets/animimage/lv_animimage_private.h @@ -0,0 +1,55 @@ +/** + * @file lv_animimage_private.h + * + */ + +#ifndef LV_ANIMIMAGE_PRIVATE_H +#define LV_ANIMIMAGE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../image/lv_image_private.h" +#include "../../misc/lv_anim_private.h" +#include "lv_animimage.h" + +#if LV_USE_ANIMIMG != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of the animimage*/ +struct lv_animimg_t { + lv_image_t img; + lv_anim_t anim; + /*picture sequence */ + const void ** dsc; + int8_t pic_count; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_ANIMIMG != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ANIMIMAGE_PRIVATE_H*/ diff --git a/src/widgets/arc/lv_arc.c b/src/widgets/arc/lv_arc.c index 8bfe0c0ce..8ddd6aba6 100644 --- a/src/widgets/arc/lv_arc.c +++ b/src/widgets/arc/lv_arc.c @@ -6,7 +6,11 @@ /********************* * INCLUDES *********************/ -#include "lv_arc.h" +#include "../../misc/lv_area_private.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_event_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_arc_private.h" #if LV_USE_ARC != 0 #include "../../core/lv_group.h" @@ -646,14 +650,14 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_area_t a; /*Invalid if clicked inside*/ lv_area_set(&a, p.x - r, p.y - r, p.x + r, p.y + r); - if(_lv_area_is_point_on(&a, info->point, LV_RADIUS_CIRCLE)) { + if(lv_area_is_point_on(&a, info->point, LV_RADIUS_CIRCLE)) { info->res = false; return; } /*Valid if no clicked outside*/ lv_area_increase(&a, w + ext_click_area * 2, w + ext_click_area * 2); - info->res = _lv_area_is_point_on(&a, info->point, LV_RADIUS_CIRCLE); + info->res = lv_area_is_point_on(&a, info->point, LV_RADIUS_CIRCLE); } else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) { int32_t bg_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN); diff --git a/src/widgets/arc/lv_arc.h b/src/widgets/arc/lv_arc.h index bea60c6ef..f241745ff 100644 --- a/src/widgets/arc/lv_arc.h +++ b/src/widgets/arc/lv_arc.h @@ -26,37 +26,11 @@ extern "C" { /********************** * TYPEDEFS **********************/ -enum _lv_arc_mode_t { +typedef enum { LV_ARC_MODE_NORMAL, LV_ARC_MODE_SYMMETRICAL, LV_ARC_MODE_REVERSE -}; - -#ifdef DOXYGEN -typedef _lv_arc_mode_t lv_arc_mode_t; -#else -typedef uint8_t lv_arc_mode_t; -#endif /*DOXYGEN*/ - -typedef struct { - lv_obj_t obj; - int32_t rotation; - lv_value_precise_t indic_angle_start; - lv_value_precise_t indic_angle_end; - lv_value_precise_t bg_angle_start; - lv_value_precise_t bg_angle_end; - int32_t value; /*Current value of the arc*/ - int32_t min_value; /*Minimum value of the arc*/ - int32_t max_value; /*Maximum value of the arc*/ - uint32_t dragging : 1; - uint32_t type : 2; - uint32_t min_close : 1; /*1: the last pressed angle was closer to minimum end*/ - uint32_t in_out : 1; /* 1: The click was within the background arc angles. 0: Click outside */ - uint32_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/ - uint32_t last_tick; /*Last dragging event timestamp of the arc*/ - lv_value_precise_t last_angle; /*Last dragging angle of the arc*/ - int16_t knob_offset; /*knob offset from the main arc*/ -} lv_arc_t; +} lv_arc_mode_t; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_arc_class; diff --git a/src/widgets/arc/lv_arc_private.h b/src/widgets/arc/lv_arc_private.h new file mode 100644 index 000000000..864651dc6 --- /dev/null +++ b/src/widgets/arc/lv_arc_private.h @@ -0,0 +1,64 @@ +/** + * @file lv_arc_private.h + * + */ + +#ifndef LV_ARC_PRIVATE_H +#define LV_ARC_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_arc.h" + +#if LV_USE_ARC != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_arc_t { + lv_obj_t obj; + int32_t rotation; + lv_value_precise_t indic_angle_start; + lv_value_precise_t indic_angle_end; + lv_value_precise_t bg_angle_start; + lv_value_precise_t bg_angle_end; + int32_t value; /*Current value of the arc*/ + int32_t min_value; /*Minimum value of the arc*/ + int32_t max_value; /*Maximum value of the arc*/ + uint32_t dragging : 1; + uint32_t type : 2; + uint32_t min_close : 1; /*1: the last pressed angle was closer to minimum end*/ + uint32_t in_out : 1; /* 1: The click was within the background arc angles. 0: Click outside */ + uint32_t chg_rate; /*Drag angle rate of change of the arc (degrees/sec)*/ + uint32_t last_tick; /*Last dragging event timestamp of the arc*/ + lv_value_precise_t last_angle; /*Last dragging angle of the arc*/ + int16_t knob_offset; /*knob offset from the main arc*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_ARC != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ARC_PRIVATE_H*/ diff --git a/src/widgets/bar/lv_bar.c b/src/widgets/bar/lv_bar.c index c0327a4c5..6ca271b82 100644 --- a/src/widgets/bar/lv_bar.c +++ b/src/widgets/bar/lv_bar.c @@ -6,12 +6,16 @@ /********************* * INCLUDES *********************/ -#include "lv_bar.h" +#include "../../misc/lv_area_private.h" +#include "../../draw/lv_draw_mask_private.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_bar_private.h" #if LV_USE_BAR != 0 #include "../../draw/lv_draw.h" #include "../../misc/lv_assert.h" -#include "../../misc/lv_anim.h" +#include "../../misc/lv_anim_private.h" #include "../../misc/lv_math.h" /********************* @@ -49,8 +53,8 @@ static void lv_bar_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj); static void lv_bar_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_indic(lv_event_t * e); static void lv_bar_set_value_with_anim(lv_obj_t * obj, int32_t new_value, int32_t * value_ptr, - _lv_bar_anim_t * anim_info, lv_anim_enable_t en); -static void lv_bar_init_anim(lv_obj_t * bar, _lv_bar_anim_t * bar_anim); + lv_bar_anim_t * anim_info, lv_anim_enable_t en); +static void lv_bar_init_anim(lv_obj_t * bar, lv_bar_anim_t * bar_anim); static void lv_bar_anim(void * bar, int32_t value); static void lv_bar_anim_completed(lv_anim_t * a); @@ -509,7 +513,7 @@ static void draw_indic(lv_event_t * e) /*The indicator is fully drawn if it's larger than the bg*/ if((bg_left < 0 || bg_right < 0 || bg_top < 0 || bg_bottom < 0)) radius_issue = false; else if(indic_radius >= bg_radius) radius_issue = false; - else if(_lv_area_is_in(&indic_area, &bar_coords, bg_radius)) radius_issue = false; + else if(lv_area_is_in(&indic_area, &bar_coords, bg_radius)) radius_issue = false; if(radius_issue || mask_needed) { if(!radius_issue) { @@ -624,14 +628,14 @@ static void lv_bar_event(const lv_obj_class_t * class_p, lv_event_t * e) static void lv_bar_anim(void * var, int32_t value) { - _lv_bar_anim_t * bar_anim = var; + lv_bar_anim_t * bar_anim = var; bar_anim->anim_state = value; lv_obj_invalidate(bar_anim->bar); } static void lv_bar_anim_completed(lv_anim_t * a) { - _lv_bar_anim_t * var = a->var; + lv_bar_anim_t * var = a->var; lv_obj_t * obj = (lv_obj_t *)var->bar; lv_bar_t * bar = (lv_bar_t *)obj; @@ -644,7 +648,7 @@ static void lv_bar_anim_completed(lv_anim_t * a) } static void lv_bar_set_value_with_anim(lv_obj_t * obj, int32_t new_value, int32_t * value_ptr, - _lv_bar_anim_t * anim_info, lv_anim_enable_t en) + lv_bar_anim_t * anim_info, lv_anim_enable_t en) { if(en == LV_ANIM_OFF) { lv_anim_delete(anim_info, NULL); @@ -683,7 +687,7 @@ static void lv_bar_set_value_with_anim(lv_obj_t * obj, int32_t new_value, int32_ } } -static void lv_bar_init_anim(lv_obj_t * obj, _lv_bar_anim_t * bar_anim) +static void lv_bar_init_anim(lv_obj_t * obj, lv_bar_anim_t * bar_anim) { bar_anim->bar = obj; bar_anim->anim_start = 0; diff --git a/src/widgets/bar/lv_bar.h b/src/widgets/bar/lv_bar.h index 212abff28..93c88786f 100644 --- a/src/widgets/bar/lv_bar.h +++ b/src/widgets/bar/lv_bar.h @@ -28,48 +28,17 @@ extern "C" { /********************** * TYPEDEFS **********************/ -enum _lv_bar_mode_t { +typedef enum { LV_BAR_MODE_NORMAL, LV_BAR_MODE_SYMMETRICAL, LV_BAR_MODE_RANGE -}; -#ifdef DOXYGEN -typedef _lv_bar_mode_t lv_bar_mode_t; -#else -typedef uint8_t lv_bar_mode_t; -#endif /*DOXYGEN*/ - -enum _lv_bar_orientation_t { +} lv_bar_mode_t; + +typedef enum { LV_BAR_ORIENTATION_AUTO, LV_BAR_ORIENTATION_HORIZONTAL, LV_BAR_ORIENTATION_VERTICAL -}; -#ifdef DOXYGEN -typedef _lv_bar_orientation_t lv_bar_orientation_t; -#else -typedef uint8_t lv_bar_orientation_t; -#endif /*DOXYGEN*/ - -typedef struct { - lv_obj_t * bar; - int32_t anim_start; - int32_t anim_end; - int32_t anim_state; -} _lv_bar_anim_t; - -typedef struct { - lv_obj_t obj; - int32_t cur_value; /**< Current value of the bar*/ - int32_t min_value; /**< Minimum value of the bar*/ - int32_t max_value; /**< Maximum value of the bar*/ - int32_t start_value; /**< Start value of the bar*/ - lv_area_t indic_area; /**< Save the indicator area. Might be used by derived types*/ - bool val_reversed; /**< Whether value been reversed */ - _lv_bar_anim_t cur_value_anim; - _lv_bar_anim_t start_value_anim; - lv_bar_mode_t mode : 2; /**< Type of bar*/ - lv_bar_orientation_t orientation : 2; /**< Orientation of bar*/ -} lv_bar_t; +} lv_bar_orientation_t; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_bar_class; diff --git a/src/widgets/bar/lv_bar_private.h b/src/widgets/bar/lv_bar_private.h new file mode 100644 index 000000000..891d14a34 --- /dev/null +++ b/src/widgets/bar/lv_bar_private.h @@ -0,0 +1,66 @@ +/** + * @file lv_bar_private.h + * + */ + +#ifndef LV_BAR_PRIVATE_H +#define LV_BAR_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_bar.h" + +#if LV_USE_BAR != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_bar_anim_t { + lv_obj_t * bar; + int32_t anim_start; + int32_t anim_end; + int32_t anim_state; +}; + +struct lv_bar_t { + lv_obj_t obj; + int32_t cur_value; /**< Current value of the bar*/ + int32_t min_value; /**< Minimum value of the bar*/ + int32_t max_value; /**< Maximum value of the bar*/ + int32_t start_value; /**< Start value of the bar*/ + lv_area_t indic_area; /**< Save the indicator area. Might be used by derived types*/ + bool val_reversed; /**< Whether value been reversed */ + lv_bar_anim_t cur_value_anim; + lv_bar_anim_t start_value_anim; + lv_bar_mode_t mode : 2; /**< Type of bar*/ + lv_bar_orientation_t orientation : 2; /**< Orientation of bar*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_BAR != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BAR_PRIVATE_H*/ diff --git a/src/widgets/button/lv_button.c b/src/widgets/button/lv_button.c index 8f57aa409..b6cba65b5 100644 --- a/src/widgets/button/lv_button.c +++ b/src/widgets/button/lv_button.c @@ -7,7 +7,8 @@ * INCLUDES *********************/ -#include "lv_button.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_button_private.h" #if LV_USE_BUTTON != 0 /********************* diff --git a/src/widgets/button/lv_button.h b/src/widgets/button/lv_button.h index 85803e6f5..eb7a0a57c 100644 --- a/src/widgets/button/lv_button.h +++ b/src/widgets/button/lv_button.h @@ -22,14 +22,6 @@ extern "C" { * DEFINES *********************/ -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_obj_t obj; -} lv_button_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_button_class; /********************** diff --git a/src/widgets/button/lv_button_private.h b/src/widgets/button/lv_button_private.h new file mode 100644 index 000000000..ce310f32c --- /dev/null +++ b/src/widgets/button/lv_button_private.h @@ -0,0 +1,53 @@ +/** + * @file lv_button_private.h + * + */ + +#ifndef LV_BUTTON_PRIVATE_H +#define LV_BUTTON_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_button.h" + +#if LV_USE_BUTTON != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_button_t { + lv_obj_t obj; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_BUTTON != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BUTTON_PRIVATE_H*/ diff --git a/src/widgets/buttonmatrix/lv_buttonmatrix.c b/src/widgets/buttonmatrix/lv_buttonmatrix.c index 2b02670bd..a48b8e123 100644 --- a/src/widgets/buttonmatrix/lv_buttonmatrix.c +++ b/src/widgets/buttonmatrix/lv_buttonmatrix.c @@ -6,7 +6,10 @@ /********************* * INCLUDES *********************/ -#include "lv_buttonmatrix.h" +#include "../../misc/lv_area_private.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_buttonmatrix_private.h" #if LV_USE_BUTTONMATRIX != 0 #include "../../misc/lv_assert.h" @@ -775,9 +778,9 @@ static void draw_main(lv_event_t * e) #if LV_USE_ARABIC_PERSIAN_CHARS /*Get the size of the Arabic text and process it*/ - size_t len_ap = _lv_text_ap_calc_bytes_count(txt); + size_t len_ap = lv_text_ap_calc_bytes_count(txt); if(len_ap < sizeof(txt_ap)) { - _lv_text_ap_proc(txt, txt_ap); + lv_text_ap_proc(txt, txt_ap); txt = txt_ap; } #endif @@ -950,7 +953,7 @@ static uint32_t get_button_from_point(lv_obj_t * obj, lv_point_t * p) BTN_EXTRA_CLICK_AREA_MAX); /*-2 for rounding error*/ else btn_area.y2 += obj_cords.y1 + prow; - if(_lv_area_is_point_on(&btn_area, p, 0) != false) { + if(lv_area_is_point_on(&btn_area, p, 0) != false) { break; } } diff --git a/src/widgets/buttonmatrix/lv_buttonmatrix.h b/src/widgets/buttonmatrix/lv_buttonmatrix.h index 7ceaf29b2..c095eec35 100644 --- a/src/widgets/buttonmatrix/lv_buttonmatrix.h +++ b/src/widgets/buttonmatrix/lv_buttonmatrix.h @@ -31,8 +31,7 @@ LV_EXPORT_CONST_INT(LV_BUTTONMATRIX_BUTTON_NONE); /** Type to store button control bits (disabled, hidden etc.) * The first 3 bits are used to store the width*/ -enum _lv_buttonmatrix_ctrl_t { - _LV_BUTTONMATRIX_WIDTH = 0x000F, /**< Reserved to store the size units*/ +typedef enum { LV_BUTTONMATRIX_CTRL_HIDDEN = 0x0010, /**< Button hidden*/ LV_BUTTONMATRIX_CTRL_NO_REPEAT = 0x0020, /**< Do not repeat press this button.*/ LV_BUTTONMATRIX_CTRL_DISABLED = 0x0040, /**< Disable this button.*/ @@ -40,34 +39,16 @@ enum _lv_buttonmatrix_ctrl_t { LV_BUTTONMATRIX_CTRL_CHECKED = 0x0100, /**< Button is currently toggled (e.g. checked).*/ LV_BUTTONMATRIX_CTRL_CLICK_TRIG = 0x0200, /**< 1: Send LV_EVENT_VALUE_CHANGE on CLICK, 0: Send LV_EVENT_VALUE_CHANGE on PRESS*/ LV_BUTTONMATRIX_CTRL_POPOVER = 0x0400, /**< Show a popover when pressing this key*/ - _LV_BUTTONMATRIX_CTRL_RESERVED_1 = 0x0800, /**< Reserved for later use*/ - _LV_BUTTONMATRIX_CTRL_RESERVED_2 = 0x1000, /**< Reserved for later use*/ - _LV_BUTTONMATRIX_CTRL_RESERVED_3 = 0x2000, /**< Reserved for later use*/ + LV_BUTTONMATRIX_CTRL_RESERVED_1 = 0x0800, /**< Reserved for later use*/ + LV_BUTTONMATRIX_CTRL_RESERVED_2 = 0x1000, /**< Reserved for later use*/ + LV_BUTTONMATRIX_CTRL_RESERVED_3 = 0x2000, /**< Reserved for later use*/ LV_BUTTONMATRIX_CTRL_CUSTOM_1 = 0x4000, /**< Custom free to use flag*/ LV_BUTTONMATRIX_CTRL_CUSTOM_2 = 0x8000, /**< Custom free to use flag*/ -}; - -#ifdef DOXYGEN -typedef _lv_buttonmatrix_ctrl_t lv_buttonmatrix_ctrl_t; -#else -typedef uint32_t lv_buttonmatrix_ctrl_t; -#endif /*DOXYGEN*/ +} lv_buttonmatrix_ctrl_t; typedef bool (*lv_buttonmatrix_button_draw_cb_t)(lv_obj_t * btnm, uint32_t btn_id, const lv_area_t * draw_area, const lv_area_t * clip_area); -/*Data of button matrix*/ -typedef struct { - lv_obj_t obj; - const char ** map_p; /*Pointer to the current map*/ - lv_area_t * button_areas; /*Array of areas of buttons*/ - lv_buttonmatrix_ctrl_t * ctrl_bits; /*Array of control bytes*/ - uint32_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/ - uint32_t row_cnt; /*Number of rows in 'map_p'(Handled by the library)*/ - uint32_t btn_id_sel; /*Index of the active button (being pressed/released etc) or LV_BUTTONMATRIX_BUTTON_NONE*/ - uint32_t one_check : 1; /*Single button toggled at once*/ -} lv_buttonmatrix_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_buttonmatrix_class; /********************** diff --git a/src/widgets/buttonmatrix/lv_buttonmatrix_private.h b/src/widgets/buttonmatrix/lv_buttonmatrix_private.h new file mode 100644 index 000000000..fdacdf3da --- /dev/null +++ b/src/widgets/buttonmatrix/lv_buttonmatrix_private.h @@ -0,0 +1,57 @@ +/** + * @file lv_buttonmatrix_private.h + * + */ + +#ifndef LV_BUTTONMATRIX_PRIVATE_H +#define LV_BUTTONMATRIX_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_buttonmatrix.h" + +#if LV_USE_BUTTONMATRIX != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of button matrix*/ +struct lv_buttonmatrix_t { + lv_obj_t obj; + const char ** map_p; /*Pointer to the current map*/ + lv_area_t * button_areas; /*Array of areas of buttons*/ + lv_buttonmatrix_ctrl_t * ctrl_bits; /*Array of control bytes*/ + uint32_t btn_cnt; /*Number of button in 'map_p'(Handled by the library)*/ + uint32_t row_cnt; /*Number of rows in 'map_p'(Handled by the library)*/ + uint32_t btn_id_sel; /*Index of the active button (being pressed/released etc) or LV_BUTTONMATRIX_BUTTON_NONE*/ + uint32_t one_check : 1; /*Single button toggled at once*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_BUTTONMATRIX != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_BUTTONMATRIX_PRIVATE_H*/ diff --git a/src/widgets/calendar/lv_calendar.c b/src/widgets/calendar/lv_calendar.c index 96282aef9..ef78d9dec 100644 --- a/src/widgets/calendar/lv_calendar.c +++ b/src/widgets/calendar/lv_calendar.c @@ -6,7 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_calendar.h" +#include "../../draw/lv_draw_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_calendar_private.h" #include "../../../lvgl.h" #if LV_USE_CALENDAR diff --git a/src/widgets/calendar/lv_calendar.h b/src/widgets/calendar/lv_calendar.h index 3218c824b..2dbf10245 100644 --- a/src/widgets/calendar/lv_calendar.h +++ b/src/widgets/calendar/lv_calendar.h @@ -34,31 +34,6 @@ typedef struct { int8_t day; /** 1..31*/ } lv_calendar_date_t; -/*Data of calendar*/ -typedef struct { - lv_obj_t obj; - /*New data for this type*/ - lv_obj_t * btnm; - lv_calendar_date_t today; /**< Date of today*/ - lv_calendar_date_t showed_date; /**< Currently visible month (day is ignored)*/ - lv_calendar_date_t * highlighted_dates; /**< Apply different style on these days (pointer to user-defined array)*/ - size_t highlighted_dates_num; /**< Number of elements in `highlighted_days`*/ - const char * map[8 * 7]; -#ifdef LV_USE_CALENDAR_CHINESE - bool use_chinese_calendar; - - /* 7 * 6: A week has 7 days, and the calendar displays 6 weeks in total. - 20: Including the number of dates, line breaks, names for each day, - and reserving several spaces for addresses.*/ - char nums [7 * 6][20]; -#else - /* 7 * 6: A week has 7 days, and the calendar displays 6 weeks in total. - 6: Including the number of dates, and reserving several spaces for - addresses.*/ - char nums [7 * 6][4]; -#endif -} lv_calendar_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_calendar_class; /********************** diff --git a/src/widgets/calendar/lv_calendar_chinese.c b/src/widgets/calendar/lv_calendar_chinese.c index deb09de9d..81c844bf1 100644 --- a/src/widgets/calendar/lv_calendar_chinese.c +++ b/src/widgets/calendar/lv_calendar_chinese.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_calendar.h" +#include "lv_calendar_chinese_private.h" +#include "lv_calendar_private.h" #if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE /********************* diff --git a/src/widgets/calendar/lv_calendar_chinese.h b/src/widgets/calendar/lv_calendar_chinese.h index 4e469ed37..8d5b174ab 100644 --- a/src/widgets/calendar/lv_calendar_chinese.h +++ b/src/widgets/calendar/lv_calendar_chinese.h @@ -14,6 +14,7 @@ extern "C" { * INCLUDES *********************/ #include "../../core/lv_obj.h" +#include "lv_calendar.h" #if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE /********************* @@ -21,15 +22,6 @@ extern "C" { *********************/ /********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_calendar_date_t today; - bool leep_month; -} lv_calendar_chinese_t; - -/********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/widgets/calendar/lv_calendar_chinese_private.h b/src/widgets/calendar/lv_calendar_chinese_private.h new file mode 100644 index 000000000..5572259e2 --- /dev/null +++ b/src/widgets/calendar/lv_calendar_chinese_private.h @@ -0,0 +1,53 @@ +/** + * @file lv_calendar_chinese_private.h + * + */ + +#ifndef LV_CALENDAR_CHINESE_PRIVATE_H +#define LV_CALENDAR_CHINESE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_calendar_chinese.h" + +#if LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_calendar_chinese_t { + lv_calendar_date_t today; + bool leep_month; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_CALENDAR && LV_USE_CALENDAR_CHINESE */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CALENDAR_CHINESE_PRIVATE_H*/ diff --git a/src/widgets/calendar/lv_calendar_header_arrow.c b/src/widgets/calendar/lv_calendar_header_arrow.c index 3a8eeaa1a..09b201d04 100644 --- a/src/widgets/calendar/lv_calendar_header_arrow.c +++ b/src/widgets/calendar/lv_calendar_header_arrow.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "../../core/lv_obj_class_private.h" #include "lv_calendar_header_arrow.h" #if LV_USE_CALENDAR && LV_USE_CALENDAR_HEADER_ARROW diff --git a/src/widgets/calendar/lv_calendar_header_dropdown.c b/src/widgets/calendar/lv_calendar_header_dropdown.c index 8b22609de..41fe53a82 100644 --- a/src/widgets/calendar/lv_calendar_header_dropdown.c +++ b/src/widgets/calendar/lv_calendar_header_dropdown.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "../../core/lv_obj_class_private.h" #include "lv_calendar_header_dropdown.h" #if LV_USE_CALENDAR && LV_USE_CALENDAR_HEADER_DROPDOWN diff --git a/src/widgets/calendar/lv_calendar_private.h b/src/widgets/calendar/lv_calendar_private.h new file mode 100644 index 000000000..9150a9411 --- /dev/null +++ b/src/widgets/calendar/lv_calendar_private.h @@ -0,0 +1,70 @@ +/** + * @file lv_calendar_private.h + * + */ + +#ifndef LV_CALENDAR_PRIVATE_H +#define LV_CALENDAR_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_calendar.h" + +#if LV_USE_CALENDAR + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of calendar*/ +struct lv_calendar_t { + lv_obj_t obj; + /*New data for this type*/ + lv_obj_t * btnm; + lv_calendar_date_t today; /**< Date of today*/ + lv_calendar_date_t showed_date; /**< Currently visible month (day is ignored)*/ + lv_calendar_date_t * highlighted_dates; /**< Apply different style on these days (pointer to user-defined array)*/ + size_t highlighted_dates_num; /**< Number of elements in `highlighted_days`*/ + const char * map[8 * 7]; +#ifdef LV_USE_CALENDAR_CHINESE + bool use_chinese_calendar; + + /* 7 * 6: A week has 7 days, and the calendar displays 6 weeks in total. + 20: Including the number of dates, line breaks, names for each day, + and reserving several spaces for addresses.*/ + char nums [7 * 6][20]; +#else + /* 7 * 6: A week has 7 days, and the calendar displays 6 weeks in total. + 6: Including the number of dates, and reserving several spaces for + addresses.*/ + char nums [7 * 6][4]; +#endif +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_CALENDAR */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CALENDAR_PRIVATE_H*/ diff --git a/src/widgets/canvas/lv_canvas.c b/src/widgets/canvas/lv_canvas.c index b3823fc71..a34886588 100644 --- a/src/widgets/canvas/lv_canvas.c +++ b/src/widgets/canvas/lv_canvas.c @@ -6,11 +6,12 @@ /********************* * INCLUDES *********************/ -#include "lv_canvas.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_canvas_private.h" #if LV_USE_CANVAS != 0 #include "../../misc/lv_assert.h" #include "../../misc/lv_math.h" -#include "../../draw/lv_draw.h" +#include "../../draw/lv_draw_private.h" #include "../../core/lv_refr.h" #include "../../display/lv_display.h" #include "../../draw/sw/lv_draw_sw.h" @@ -392,6 +393,11 @@ void lv_canvas_finish_layer(lv_obj_t * canvas, lv_layer_t * layer) lv_obj_invalidate(canvas); } +uint32_t lv_canvas_buf_size(int32_t w, int32_t h, uint8_t bpp, uint8_t stride) +{ + return (uint32_t)LV_CANVAS_BUF_SIZE(w, h, bpp, stride); +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/widgets/canvas/lv_canvas.h b/src/widgets/canvas/lv_canvas.h index f581294e5..5123f164a 100644 --- a/src/widgets/canvas/lv_canvas.h +++ b/src/widgets/canvas/lv_canvas.h @@ -29,13 +29,6 @@ extern "C" { **********************/ LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_canvas_class; -/*Data of canvas*/ -typedef struct { - lv_image_t img; - lv_draw_buf_t * draw_buf; - lv_draw_buf_t static_buf; -} lv_canvas_t; - /********************** * GLOBAL PROTOTYPES **********************/ @@ -179,10 +172,7 @@ void lv_canvas_finish_layer(lv_obj_t * canvas, lv_layer_t * layer); /** * Just a wrapper to `LV_CANVAS_BUF_SIZE` for bindings. */ -static inline uint32_t lv_canvas_buf_size(int32_t w, int32_t h, uint8_t bpp, uint8_t stride) -{ - return (uint32_t)LV_CANVAS_BUF_SIZE(w, h, bpp, stride); -} +uint32_t lv_canvas_buf_size(int32_t w, int32_t h, uint8_t bpp, uint8_t stride); #endif /*LV_USE_CANVAS*/ diff --git a/src/widgets/canvas/lv_canvas_private.h b/src/widgets/canvas/lv_canvas_private.h new file mode 100644 index 000000000..13dc7ca74 --- /dev/null +++ b/src/widgets/canvas/lv_canvas_private.h @@ -0,0 +1,52 @@ +/** + * @file lv_canvas_private.h + * + */ + +#ifndef LV_CANVAS_PRIVATE_H +#define LV_CANVAS_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../image/lv_image_private.h" +#include "lv_canvas.h" + +#if LV_USE_CANVAS != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of canvas*/ +struct lv_canvas_t { + lv_image_t img; + lv_draw_buf_t * draw_buf; + lv_draw_buf_t static_buf; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_CANVAS != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CANVAS_PRIVATE_H*/ diff --git a/src/widgets/chart/lv_chart.c b/src/widgets/chart/lv_chart.c index 782b7c5a6..9b7dd9ed1 100644 --- a/src/widgets/chart/lv_chart.c +++ b/src/widgets/chart/lv_chart.c @@ -6,7 +6,11 @@ /********************* * INCLUDES *********************/ -#include "lv_chart.h" +#include "../../misc/lv_area_private.h" +#include "../../draw/lv_draw_private.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_chart_private.h" #if LV_USE_CHART != 0 #include "../../misc/lv_assert.h" @@ -81,7 +85,7 @@ void lv_chart_set_type(lv_obj_t * obj, lv_chart_type_t type) if(chart->type == LV_CHART_TYPE_SCATTER) { lv_chart_series_t * ser; - _LV_LL_READ_BACK(&chart->series_ll, ser) { + LV_LL_READ_BACK(&chart->series_ll, ser) { lv_free(ser->x_points); ser->x_points = NULL; } @@ -89,7 +93,7 @@ void lv_chart_set_type(lv_obj_t * obj, lv_chart_type_t type) if(type == LV_CHART_TYPE_SCATTER) { lv_chart_series_t * ser; - _LV_LL_READ_BACK(&chart->series_ll, ser) { + LV_LL_READ_BACK(&chart->series_ll, ser) { ser->x_points = lv_malloc(sizeof(lv_point_t) * chart->point_cnt); LV_ASSERT_MALLOC(ser->x_points); if(ser->x_points == NULL) return; @@ -112,7 +116,7 @@ void lv_chart_set_point_count(lv_obj_t * obj, uint32_t cnt) if(cnt < 1) cnt = 1; - _LV_LL_READ_BACK(&chart->series_ll, ser) { + LV_LL_READ_BACK(&chart->series_ll, ser) { if(chart->type == LV_CHART_TYPE_SCATTER) { if(!ser->x_ext_buf_assigned) new_points_alloc(obj, ser, cnt, &ser->x_points); } @@ -229,7 +233,7 @@ void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint3 p_out->x = lv_map(ser->x_points[id], chart->xmin[ser->x_axis_sec], chart->xmax[ser->x_axis_sec], 0, w); } else if(chart->type == LV_CHART_TYPE_BAR) { - uint32_t ser_cnt = _lv_ll_get_len(&chart->series_ll); + uint32_t ser_cnt = lv_ll_get_len(&chart->series_ll); int32_t ser_gap = lv_obj_get_style_pad_column(obj, LV_PART_ITEMS); /*Gap between the columns on adjacent X ticks*/ @@ -240,7 +244,7 @@ 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_w) * id) / (chart->point_cnt - 1); lv_chart_series_t * ser_i = NULL; uint32_t ser_idx = 0; - _LV_LL_READ_BACK(&chart->series_ll, ser_i) { + LV_LL_READ_BACK(&chart->series_ll, ser_i) { if(ser_i == ser) break; ser_idx++; } @@ -286,7 +290,7 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_cha lv_chart_t * chart = (lv_chart_t *)obj; /* Allocate space for a new series and add it to the chart series linked list */ - lv_chart_series_t * ser = _lv_ll_ins_tail(&chart->series_ll); + lv_chart_series_t * ser = lv_ll_ins_tail(&chart->series_ll); LV_ASSERT_MALLOC(ser); if(ser == NULL) return NULL; @@ -299,7 +303,7 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_cha LV_ASSERT_MALLOC(ser->x_points); if(NULL == ser->x_points) { lv_free(ser->y_points); - _lv_ll_remove(&chart->series_ll, ser); + lv_ll_remove(&chart->series_ll, ser); lv_free(ser); return NULL; } @@ -309,7 +313,7 @@ lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_cha } if(ser->y_points == NULL) { - _lv_ll_remove(&chart->series_ll, ser); + lv_ll_remove(&chart->series_ll, ser); lv_free(ser); return NULL; } @@ -342,7 +346,7 @@ void lv_chart_remove_series(lv_obj_t * obj, lv_chart_series_t * series) if(!series->y_ext_buf_assigned && series->y_points) lv_free(series->y_points); if(!series->x_ext_buf_assigned && series->x_points) lv_free(series->x_points); - _lv_ll_remove(&chart->series_ll, series); + lv_ll_remove(&chart->series_ll, series); lv_free(series); return; @@ -366,6 +370,15 @@ void lv_chart_set_series_color(lv_obj_t * chart, lv_chart_series_t * series, lv_ lv_chart_refresh(chart); } +lv_color_t lv_chart_get_series_color(lv_obj_t * chart, const lv_chart_series_t * series) +{ + LV_ASSERT_OBJ(chart, MY_CLASS); + LV_ASSERT_NULL(series); + LV_UNUSED(chart); + + return series->color; +} + void lv_chart_set_x_start_point(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t id) { LV_ASSERT_OBJ(obj, MY_CLASS); @@ -381,8 +394,8 @@ lv_chart_series_t * lv_chart_get_series_next(const lv_obj_t * obj, const lv_char LV_ASSERT_OBJ(obj, MY_CLASS); lv_chart_t * chart = (lv_chart_t *)obj; - if(ser == NULL) return _lv_ll_get_head(&chart->series_ll); - else return _lv_ll_get_next(&chart->series_ll, ser); + if(ser == NULL) return lv_ll_get_head(&chart->series_ll); + else return lv_ll_get_next(&chart->series_ll, ser); } /*===================== @@ -394,7 +407,7 @@ lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * obj, lv_color_t color, lv_di LV_ASSERT_OBJ(obj, MY_CLASS); lv_chart_t * chart = (lv_chart_t *)obj; - lv_chart_cursor_t * cursor = _lv_ll_ins_head(&chart->cursor_ll); + lv_chart_cursor_t * cursor = lv_ll_ins_head(&chart->cursor_ll); LV_ASSERT_MALLOC(cursor); if(cursor == NULL) return NULL; @@ -587,8 +600,8 @@ static void lv_chart_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_chart_t * chart = (lv_chart_t *)obj; - _lv_ll_init(&chart->series_ll, sizeof(lv_chart_series_t)); - _lv_ll_init(&chart->cursor_ll, sizeof(lv_chart_cursor_t)); + lv_ll_init(&chart->series_ll, sizeof(lv_chart_series_t)); + lv_ll_init(&chart->cursor_ll, sizeof(lv_chart_cursor_t)); chart->ymin[0] = 0; chart->xmin[0] = 0; @@ -617,24 +630,24 @@ static void lv_chart_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_chart_t * chart = (lv_chart_t *)obj; lv_chart_series_t * ser; while(chart->series_ll.head) { - ser = _lv_ll_get_head(&chart->series_ll); + ser = lv_ll_get_head(&chart->series_ll); if(!ser) continue; if(!ser->y_ext_buf_assigned) lv_free(ser->y_points); if(!ser->x_ext_buf_assigned) lv_free(ser->x_points); - _lv_ll_remove(&chart->series_ll, ser); + lv_ll_remove(&chart->series_ll, ser); lv_free(ser); } - _lv_ll_clear(&chart->series_ll); + lv_ll_clear(&chart->series_ll); lv_chart_cursor_t * cur; while(chart->cursor_ll.head) { - cur = _lv_ll_get_head(&chart->cursor_ll); - _lv_ll_remove(&chart->cursor_ll, cur); + cur = lv_ll_get_head(&chart->cursor_ll); + lv_ll_remove(&chart->cursor_ll, cur); lv_free(cur); } - _lv_ll_clear(&chart->cursor_ll); + lv_ll_clear(&chart->cursor_ll); LV_TRACE_OBJ_CREATE("finished"); } @@ -675,7 +688,7 @@ static void lv_chart_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_layer_t * layer = lv_event_get_layer(e); draw_div_lines(obj, layer); - if(_lv_ll_is_empty(&chart->series_ll) == false) { + if(lv_ll_is_empty(&chart->series_ll) == false) { if(chart->type == LV_CHART_TYPE_LINE) draw_series_line(obj, layer); else if(chart->type == LV_CHART_TYPE_BAR) draw_series_bar(obj, layer); else if(chart->type == LV_CHART_TYPE_SCATTER) draw_series_scatter(obj, layer); @@ -690,7 +703,7 @@ static void draw_div_lines(lv_obj_t * obj, lv_layer_t * layer) lv_chart_t * chart = (lv_chart_t *)obj; lv_area_t series_clip_area; - bool mask_ret = _lv_area_intersect(&series_clip_area, &obj->coords, &layer->_clip_area); + bool mask_ret = lv_area_intersect(&series_clip_area, &obj->coords, &layer->_clip_area); if(mask_ret == false) return; const lv_area_t clip_area_ori = layer->_clip_area; @@ -764,7 +777,7 @@ static void draw_div_lines(lv_obj_t * obj, lv_layer_t * layer) static void draw_series_line(lv_obj_t * obj, lv_layer_t * layer) { lv_area_t clip_area; - if(_lv_area_intersect(&clip_area, &obj->coords, &layer->_clip_area) == false) return; + if(lv_area_intersect(&clip_area, &obj->coords, &layer->_clip_area) == false) return; const lv_area_t clip_area_ori = layer->_clip_area; layer->_clip_area = clip_area; @@ -783,7 +796,7 @@ static void draw_series_line(lv_obj_t * obj, lv_layer_t * layer) lv_chart_series_t * ser; lv_area_t series_clip_area; - bool mask_ret = _lv_area_intersect(&series_clip_area, &obj->coords, &layer->_clip_area); + bool mask_ret = lv_area_intersect(&series_clip_area, &obj->coords, &layer->_clip_area); if(mask_ret == false) return; lv_draw_line_dsc_t line_dsc; @@ -804,10 +817,10 @@ static void draw_series_line(lv_obj_t * obj, lv_layer_t * layer) /*If there are at least as many points as pixels then draw only vertical lines*/ bool crowded_mode = (int32_t)chart->point_cnt >= w; - line_dsc.base.id1 = _lv_ll_get_len(&chart->series_ll) - 1; + line_dsc.base.id1 = lv_ll_get_len(&chart->series_ll) - 1; point_dsc_default.base.id1 = line_dsc.base.id1; /*Go through all data lines*/ - _LV_LL_READ_BACK(&chart->series_ll, ser) { + LV_LL_READ_BACK(&chart->series_ll, ser) { if(ser->hidden) { line_dsc.base.id1--; point_dsc_default.base.id1--; @@ -918,7 +931,7 @@ static void draw_series_scatter(lv_obj_t * obj, lv_layer_t * layer) { lv_area_t clip_area; - if(_lv_area_intersect(&clip_area, &obj->coords, &layer->_clip_area) == false) return; + if(lv_area_intersect(&clip_area, &obj->coords, &layer->_clip_area) == false) return; const lv_area_t clip_area_ori = layer->_clip_area; layer->_clip_area = clip_area; @@ -951,7 +964,7 @@ static void draw_series_scatter(lv_obj_t * obj, lv_layer_t * layer) if(line_dsc.width == 1) line_dsc.raw_end = 1; /*Go through all data lines*/ - _LV_LL_READ_BACK(&chart->series_ll, ser) { + LV_LL_READ_BACK(&chart->series_ll, ser) { if(ser->hidden) continue; line_dsc.color = ser->color; point_dsc_default.bg_color = ser->color; @@ -1038,7 +1051,7 @@ static void draw_series_scatter(lv_obj_t * obj, lv_layer_t * layer) static void draw_series_bar(lv_obj_t * obj, lv_layer_t * layer) { lv_area_t clip_area; - if(_lv_area_intersect(&clip_area, &obj->coords, &layer->_clip_area) == false) return; + if(lv_area_intersect(&clip_area, &obj->coords, &layer->_clip_area) == false) return; const lv_area_t clip_area_ori = layer->_clip_area; layer->_clip_area = clip_area; @@ -1053,7 +1066,7 @@ static void draw_series_bar(lv_obj_t * obj, lv_layer_t * layer) 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); + 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*/ 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*/ @@ -1080,7 +1093,7 @@ static void draw_series_bar(lv_obj_t * obj, lv_layer_t * layer) col_dsc.base.id1 = 0; /*Draw the current point of all data line*/ - _LV_LL_READ(&chart->series_ll, ser) { + LV_LL_READ(&chart->series_ll, ser) { if(ser->hidden) continue; int32_t start_point = chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0; @@ -1116,10 +1129,10 @@ static void draw_cursors(lv_obj_t * obj, lv_layer_t * layer) LV_ASSERT_OBJ(obj, MY_CLASS); lv_chart_t * chart = (lv_chart_t *)obj; - if(_lv_ll_is_empty(&chart->cursor_ll)) return; + if(lv_ll_is_empty(&chart->cursor_ll)) return; lv_area_t clip_area; - if(!_lv_area_intersect(&clip_area, &layer->_clip_area, &obj->coords)) return; + if(!lv_area_intersect(&clip_area, &layer->_clip_area, &obj->coords)) return; const lv_area_t clip_area_ori = layer->_clip_area; layer->_clip_area = clip_area; @@ -1141,7 +1154,7 @@ static void draw_cursors(lv_obj_t * obj, lv_layer_t * layer) 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) { + LV_LL_READ_BACK(&chart->cursor_ll, cursor) { lv_memcpy(&line_dsc, &line_dsc_ori, sizeof(lv_draw_line_dsc_t)); lv_memcpy(&point_dsc_tmp, &point_dsc_ori, sizeof(lv_draw_rect_dsc_t)); line_dsc.color = cursor->color; diff --git a/src/widgets/chart/lv_chart.h b/src/widgets/chart/lv_chart.h index a010bfda4..de2583146 100644 --- a/src/widgets/chart/lv_chart.h +++ b/src/widgets/chart/lv_chart.h @@ -33,89 +33,31 @@ LV_EXPORT_CONST_INT(LV_CHART_POINT_NONE); /** * Chart types */ -enum _lv_chart_type_t { +typedef enum { LV_CHART_TYPE_NONE, /**< Don't draw the series*/ LV_CHART_TYPE_LINE, /**< Connect the points with lines*/ LV_CHART_TYPE_BAR, /**< Draw columns*/ LV_CHART_TYPE_SCATTER, /**< Draw points and lines in 2D (x,y coordinates)*/ -}; - -#ifdef DOXYGEN -typedef _lv_chart_type_t lv_chart_type_t; -#else -typedef uint8_t lv_chart_type_t; -#endif /*DOXYGEN*/ +} lv_chart_type_t; /** * Chart update mode for `lv_chart_set_next` */ -enum _lv_chart_update_mode_t { +typedef enum { LV_CHART_UPDATE_MODE_SHIFT, /**< Shift old data to the left and add the new one the right*/ LV_CHART_UPDATE_MODE_CIRCULAR, /**< Add the new data in a circular way*/ -}; - -#ifdef DOXYGEN -typedef _lv_chart_update_mode_t lv_chart_update_mode_t; -#else -typedef uint8_t lv_chart_update_mode_t; -#endif /*DOXYGEN*/ +} lv_chart_update_mode_t; /** * Enumeration of the axis' */ -enum _lv_chart_axis_t { +typedef enum { LV_CHART_AXIS_PRIMARY_Y = 0x00, LV_CHART_AXIS_SECONDARY_Y = 0x01, LV_CHART_AXIS_PRIMARY_X = 0x02, LV_CHART_AXIS_SECONDARY_X = 0x04, - _LV_CHART_AXIS_LAST -}; - -#ifdef DOXYGEN -typedef _lv_chart_axis_t lv_chart_axis_t; -#else -typedef uint8_t lv_chart_axis_t; -#endif /*DOXYGEN*/ - -/** - * Descriptor a chart series - */ -typedef struct { - int32_t * x_points; - int32_t * y_points; - lv_color_t color; - uint32_t start_point; - uint32_t hidden : 1; - uint32_t x_ext_buf_assigned : 1; - uint32_t y_ext_buf_assigned : 1; - uint32_t x_axis_sec : 1; - uint32_t y_axis_sec : 1; -} lv_chart_series_t; - -typedef struct { - lv_point_t pos; - int32_t point_id; - lv_color_t color; - lv_chart_series_t * ser; - lv_dir_t dir; - uint32_t pos_set: 1; /*1: pos is set; 0: point_id is set*/ -} lv_chart_cursor_t; - -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)*/ - 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*/ - lv_chart_type_t type : 3; /**< Line or column chart*/ - lv_chart_update_mode_t update_mode : 1; -} lv_chart_t; + LV_CHART_AXIS_LAST +} lv_chart_axis_t; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_chart_class; @@ -241,6 +183,14 @@ void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hid void lv_chart_set_series_color(lv_obj_t * chart, lv_chart_series_t * series, lv_color_t color); /** + * Get the color of a series + * @param chart pointer to a chart object. + * @param series pointer to a series object + * @return the color of the series + */ +lv_color_t lv_chart_get_series_color(lv_obj_t * chart, const lv_chart_series_t * series); + +/** * Set the index of the x-axis start point in the data array. * This point will be considers the first (left) point and the other points will be drawn after it. * @param obj pointer to a chart object diff --git a/src/widgets/chart/lv_chart_private.h b/src/widgets/chart/lv_chart_private.h new file mode 100644 index 000000000..224050737 --- /dev/null +++ b/src/widgets/chart/lv_chart_private.h @@ -0,0 +1,85 @@ +/** + * @file lv_chart_private.h + * + */ + +#ifndef LV_CHART_PRIVATE_H +#define LV_CHART_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_chart.h" + +#if LV_USE_CHART != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Descriptor a chart series + */ +struct lv_chart_series_t { + int32_t * x_points; + int32_t * y_points; + lv_color_t color; + uint32_t start_point; + uint32_t hidden : 1; + uint32_t x_ext_buf_assigned : 1; + uint32_t y_ext_buf_assigned : 1; + uint32_t x_axis_sec : 1; + uint32_t y_axis_sec : 1; +}; + +struct lv_chart_cursor_t { + lv_point_t pos; + int32_t point_id; + lv_color_t color; + lv_chart_series_t * ser; + lv_dir_t dir; + uint32_t pos_set: 1; /*1: pos is set; 0: point_id is set*/ +}; + +struct lv_chart_t { + 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)*/ + 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*/ + lv_chart_type_t type : 3; /**< Line or column chart*/ + lv_chart_update_mode_t update_mode : 1; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_CHART != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CHART_PRIVATE_H*/ diff --git a/src/widgets/checkbox/lv_checkbox.c b/src/widgets/checkbox/lv_checkbox.c index ae42e7810..84715da61 100644 --- a/src/widgets/checkbox/lv_checkbox.c +++ b/src/widgets/checkbox/lv_checkbox.c @@ -6,7 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_checkbox.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_checkbox_private.h" #if LV_USE_CHECKBOX != 0 #include "../../misc/lv_assert.h" @@ -75,7 +77,7 @@ void lv_checkbox_set_text(lv_obj_t * obj, const char * txt) size_t len; #if LV_USE_ARABIC_PERSIAN_CHARS - len = _lv_text_ap_calc_bytes_count(txt) + 1; + len = lv_text_ap_calc_bytes_count(txt) + 1; #else len = lv_strlen(txt) + 1; #endif @@ -87,7 +89,7 @@ void lv_checkbox_set_text(lv_obj_t * obj, const char * txt) if(NULL == cb->txt) return; #if LV_USE_ARABIC_PERSIAN_CHARS - _lv_text_ap_proc(txt, cb->txt); + lv_text_ap_proc(txt, cb->txt); #else lv_strcpy(cb->txt, txt); #endif diff --git a/src/widgets/checkbox/lv_checkbox.h b/src/widgets/checkbox/lv_checkbox.h index 25ba35946..804ff600f 100644 --- a/src/widgets/checkbox/lv_checkbox.h +++ b/src/widgets/checkbox/lv_checkbox.h @@ -22,16 +22,6 @@ extern "C" { * DEFINES *********************/ -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_obj_t obj; - char * txt; - uint32_t static_txt : 1; -} lv_checkbox_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_checkbox_class; /********************** diff --git a/src/widgets/checkbox/lv_checkbox_private.h b/src/widgets/checkbox/lv_checkbox_private.h new file mode 100644 index 000000000..dabc05d18 --- /dev/null +++ b/src/widgets/checkbox/lv_checkbox_private.h @@ -0,0 +1,54 @@ +/** + * @file lv_checkbox_private.h + * + */ + +#ifndef LV_CHECKBOX_PRIVATE_H +#define LV_CHECKBOX_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_checkbox.h" + +#if LV_USE_CHECKBOX != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_checkbox_t { + lv_obj_t obj; + char * txt; + uint32_t static_txt : 1; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_CHECKBOX != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_CHECKBOX_PRIVATE_H*/ diff --git a/src/widgets/dropdown/lv_dropdown.c b/src/widgets/dropdown/lv_dropdown.c index 7a554bd32..38e136c6c 100644 --- a/src/widgets/dropdown/lv_dropdown.c +++ b/src/widgets/dropdown/lv_dropdown.c @@ -6,12 +6,14 @@ /********************* * INCLUDES *********************/ +#include "../../misc/lv_area_private.h" +#include "../../core/lv_obj_class_private.h" #include "../../core/lv_obj.h" -#include "lv_dropdown.h" +#include "lv_dropdown_private.h" #if LV_USE_DROPDOWN != 0 #include "../../misc/lv_assert.h" -#include "../../draw/lv_draw.h" +#include "../../draw/lv_draw_private.h" #include "../../core/lv_group.h" #include "../../indev/lv_indev.h" #include "../../display/lv_display.h" @@ -135,7 +137,7 @@ void lv_dropdown_set_options(lv_obj_t * obj, const char * options) #if LV_USE_ARABIC_PERSIAN_CHARS == 0 size_t len = lv_strlen(options) + 1; #else - size_t len = _lv_text_ap_calc_bytes_count(options) + 1; + size_t len = lv_text_ap_calc_bytes_count(options) + 1; #endif if(dropdown->options != NULL && dropdown->static_txt == 0) { @@ -151,7 +153,7 @@ void lv_dropdown_set_options(lv_obj_t * obj, const char * options) #if LV_USE_ARABIC_PERSIAN_CHARS == 0 lv_strcpy(dropdown->options, options); #else - _lv_text_ap_proc(options, dropdown->options); + lv_text_ap_proc(options, dropdown->options); #endif /*Now the text is dynamically allocated*/ @@ -211,7 +213,7 @@ void lv_dropdown_add_option(lv_obj_t * obj, const char * option, uint32_t pos) #if LV_USE_ARABIC_PERSIAN_CHARS == 0 size_t ins_len = lv_strlen(option) + 1; #else - size_t ins_len = _lv_text_ap_calc_bytes_count(option) + 1; + size_t ins_len = lv_text_ap_calc_bytes_count(option) + 1; #endif size_t new_len = ins_len + old_len + 2; /*+2 for terminating NULL and possible \n*/ @@ -244,7 +246,7 @@ void lv_dropdown_add_option(lv_obj_t * obj, const char * option, uint32_t pos) #if LV_USE_ARABIC_PERSIAN_CHARS == 0 lv_strcpy(ins_buf, option); #else - _lv_text_ap_proc(option, ins_buf); + lv_text_ap_proc(option, ins_buf); #endif if(pos < dropdown->option_cnt) lv_strcat(ins_buf, "\n"); @@ -920,7 +922,7 @@ static void draw_list(lv_event_t * e) * the selected option can be drawn on only the background*/ lv_area_t clip_area_core; bool has_common; - has_common = _lv_area_intersect(&clip_area_core, &layer->_clip_area, &dropdown->list->coords); + has_common = lv_area_intersect(&clip_area_core, &layer->_clip_area, &dropdown->list->coords); if(has_common) { const lv_area_t clip_area_ori = layer->_clip_area; layer->_clip_area = clip_area_core; @@ -1017,7 +1019,7 @@ static void draw_box_label(lv_obj_t * dropdown_obj, lv_layer_t * layer, uint32_t area_sel.x2 = list_obj->coords.x2; lv_area_t mask_sel; bool area_ok; - area_ok = _lv_area_intersect(&mask_sel, &layer->_clip_area, &area_sel); + area_ok = lv_area_intersect(&mask_sel, &layer->_clip_area, &area_sel); if(area_ok) { const lv_area_t clip_area_ori = layer->_clip_area; layer->_clip_area = mask_sel; diff --git a/src/widgets/dropdown/lv_dropdown.h b/src/widgets/dropdown/lv_dropdown.h index 614f5f192..528a458f2 100644 --- a/src/widgets/dropdown/lv_dropdown.h +++ b/src/widgets/dropdown/lv_dropdown.h @@ -31,30 +31,6 @@ extern "C" { #define LV_DROPDOWN_POS_LAST 0xFFFF LV_EXPORT_CONST_INT(LV_DROPDOWN_POS_LAST); -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_obj_t obj; - lv_obj_t * list; /**< The dropped down list*/ - const char * text; /**< Text to display on the dropdown's button*/ - const void * symbol; /**< Arrow or other icon when the drop-down list is closed*/ - char * options; /**< Options in a '\n' separated list*/ - uint32_t option_cnt; /**< Number of options*/ - uint32_t sel_opt_id; /**< Index of the currently selected option*/ - uint32_t sel_opt_id_orig; /**< Store the original index on focus*/ - uint32_t pr_opt_id; /**< Index of the currently pressed option*/ - lv_dir_t dir : 4; /**< Direction in which the list should open*/ - uint8_t static_txt : 1; /**< 1: Only a pointer is saved in `options`*/ - uint8_t selected_highlight: 1; /**< 1: Make the selected option highlighted in the list*/ -} lv_dropdown_t; - -typedef struct { - lv_obj_t obj; - lv_obj_t * dropdown; -} lv_dropdown_list_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_dropdown_class; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_dropdownlist_class; diff --git a/src/widgets/dropdown/lv_dropdown_private.h b/src/widgets/dropdown/lv_dropdown_private.h new file mode 100644 index 000000000..67d879aa1 --- /dev/null +++ b/src/widgets/dropdown/lv_dropdown_private.h @@ -0,0 +1,69 @@ +/** + * @file lv_dropdown_private.h + * + */ + +#ifndef LV_DROPDOWN_PRIVATE_H +#define LV_DROPDOWN_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_dropdown.h" + +#if LV_USE_DROPDOWN != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_dropdown_t { + lv_obj_t obj; + lv_obj_t * list; /**< The dropped down list*/ + const char * text; /**< Text to display on the dropdown's button*/ + const void * symbol; /**< Arrow or other icon when the drop-down list is closed*/ + char * options; /**< Options in a '\n' separated list*/ + uint32_t option_cnt; /**< Number of options*/ + uint32_t sel_opt_id; /**< Index of the currently selected option*/ + uint32_t sel_opt_id_orig; /**< Store the original index on focus*/ + uint32_t pr_opt_id; /**< Index of the currently pressed option*/ + uint8_t dir : 4; /**< Direction in which the list should open*/ + uint8_t static_txt : 1; /**< 1: Only a pointer is saved in `options`*/ + uint8_t selected_highlight: 1; /**< 1: Make the selected option highlighted in the list*/ +}; + +struct lv_dropdown_list_t { + lv_obj_t obj; + lv_obj_t * dropdown; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_DROPDOWN != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_DROPDOWN_PRIVATE_H*/ diff --git a/src/widgets/image/lv_image.c b/src/widgets/image/lv_image.c index a8af7a7d8..96122d867 100644 --- a/src/widgets/image/lv_image.c +++ b/src/widgets/image/lv_image.c @@ -6,7 +6,12 @@ /********************* * INCLUDES *********************/ -#include "lv_image.h" +#include "../../misc/lv_area_private.h" +#include "../../draw/lv_draw_image_private.h" +#include "../../draw/lv_draw_private.h" +#include "../../core/lv_obj_event_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_image_private.h" #if LV_USE_IMAGE != 0 #include "../../stdlib/lv_string.h" @@ -29,6 +34,10 @@ static void lv_image_event(const lv_obj_class_t * class_p, lv_event_t * e); static void draw_image(lv_event_t * e); static void scale_update(lv_obj_t * obj, int32_t scale_x, int32_t scale_y); static void update_align(lv_obj_t * obj); +#if LV_USE_OBJ_PROPERTY + static void lv_image_set_pivot_helper(lv_obj_t * obj, lv_point_t * pivot); + static lv_point_t lv_image_get_pivot_helper(lv_obj_t * obj); +#endif #if LV_USE_OBJ_PROPERTY static const lv_property_ops_t properties[] = { @@ -54,8 +63,8 @@ static const lv_property_ops_t properties[] = { }, { .id = LV_PROPERTY_IMAGE_PIVOT, - .setter = _lv_image_set_pivot, - .getter = _lv_image_get_pivot, + .setter = lv_image_set_pivot_helper, + .getter = lv_image_get_pivot_helper, }, { .id = LV_PROPERTY_IMAGE_SCALE, @@ -263,7 +272,7 @@ void lv_image_set_rotation(lv_obj_t * obj, int32_t angle) LV_ASSERT_OBJ(obj, MY_CLASS); lv_image_t * img = (lv_image_t *)obj; - if(img->align > _LV_IMAGE_ALIGN_AUTO_TRANSFORM) { + if(img->align > LV_IMAGE_ALIGN_AUTO_TRANSFORM) { angle = 0; } else { @@ -279,7 +288,7 @@ void lv_image_set_rotation(lv_obj_t * obj, int32_t angle) lv_area_t a; lv_point_t pivot_px; lv_image_get_pivot(obj, &pivot_px); - _lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); + lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -295,7 +304,7 @@ void lv_image_set_rotation(lv_obj_t * obj, int32_t angle) lv_obj_refresh_ext_draw_size(obj); lv_display_enable_invalidation(disp, true); - _lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); + lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -308,7 +317,7 @@ void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y) LV_ASSERT_OBJ(obj, MY_CLASS); lv_image_t * img = (lv_image_t *)obj; - if(img->align > _LV_IMAGE_ALIGN_AUTO_TRANSFORM) { + if(img->align > LV_IMAGE_ALIGN_AUTO_TRANSFORM) { x = 0; y = 0; } @@ -321,7 +330,7 @@ void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y) lv_area_t a; lv_point_t pivot_px; lv_image_get_pivot(obj, &pivot_px); - _lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); + lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -338,7 +347,7 @@ void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y) lv_display_enable_invalidation(disp, true); lv_image_get_pivot(obj, &pivot_px); - _lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); + lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; @@ -353,7 +362,7 @@ void lv_image_set_scale(lv_obj_t * obj, uint32_t zoom) lv_image_t * img = (lv_image_t *)obj; /*If scale is set internally, do no overwrite it*/ - if(img->align > _LV_IMAGE_ALIGN_AUTO_TRANSFORM) return; + if(img->align > LV_IMAGE_ALIGN_AUTO_TRANSFORM) return; if(zoom == img->scale_x && zoom == img->scale_y) return; @@ -369,7 +378,7 @@ void lv_image_set_scale_x(lv_obj_t * obj, uint32_t zoom) lv_image_t * img = (lv_image_t *)obj; /*If scale is set internally, do no overwrite it*/ - if(img->align > _LV_IMAGE_ALIGN_AUTO_TRANSFORM) return; + if(img->align > LV_IMAGE_ALIGN_AUTO_TRANSFORM) return; if(zoom == img->scale_x) return; @@ -385,7 +394,7 @@ void lv_image_set_scale_y(lv_obj_t * obj, uint32_t zoom) lv_image_t * img = (lv_image_t *)obj; /*If scale is set internally, do no overwrite it*/ - if(img->align > _LV_IMAGE_ALIGN_AUTO_TRANSFORM) return; + if(img->align > LV_IMAGE_ALIGN_AUTO_TRANSFORM) return; if(zoom == img->scale_y) return; @@ -628,7 +637,7 @@ static void lv_image_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_area_t a; 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->scale_x, img->scale_y, &pivot_px); + lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); *s = LV_MAX(*s, -a.x1); *s = LV_MAX(*s, -a.y1); *s = LV_MAX(*s, a.x2 - w); @@ -647,18 +656,18 @@ static void lv_image_event(const lv_obj_class_t * class_p, lv_event_t * e) 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->scale_x, img->scale_y, &pivot_px); + lv_image_buf_get_transformed_area(&coords, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); coords.x1 += obj->coords.x1; coords.y1 += obj->coords.y1; coords.x2 += obj->coords.x1; coords.y2 += obj->coords.y1; - info->res = _lv_area_is_point_on(&coords, info->point, 0); + info->res = lv_area_is_point_on(&coords, info->point, 0); } else { lv_area_t a; lv_obj_get_click_area(obj, &a); - info->res = _lv_area_is_point_on(&a, info->point, 0); + info->res = lv_area_is_point_on(&a, info->point, 0); } } else if(code == LV_EVENT_GET_SELF_SIZE) { @@ -702,7 +711,7 @@ static void draw_image(lv_event_t * e) } if(img->scale_x == LV_SCALE_NONE && img->scale_y == LV_SCALE_NONE) { - if(_lv_area_is_in(info->area, &obj->coords, 0) == false) { + if(lv_area_is_in(info->area, &obj->coords, 0) == false) { info->res = LV_COVER_RES_NOT_COVER; return; } @@ -711,14 +720,14 @@ static void draw_image(lv_event_t * e) lv_area_t a; lv_point_t pivot_px; lv_image_get_pivot(obj, &pivot_px); - _lv_image_buf_get_transformed_area(&a, lv_obj_get_width(obj), lv_obj_get_height(obj), 0, img->scale_x, img->scale_y, - &pivot_px); + lv_image_buf_get_transformed_area(&a, lv_obj_get_width(obj), lv_obj_get_height(obj), 0, img->scale_x, img->scale_y, + &pivot_px); a.x1 += obj->coords.x1; a.y1 += obj->coords.y1; a.x2 += obj->coords.x1; a.y2 += obj->coords.y1; - if(_lv_area_is_in(info->area, &a, 0) == false) { + if(lv_area_is_in(info->area, &a, 0) == false) { info->res = LV_COVER_RES_NOT_COVER; return; } @@ -759,12 +768,12 @@ static void draw_image(lv_event_t * e) draw_dsc.clip_radius = lv_obj_get_style_radius(obj, LV_PART_MAIN); lv_area_t coords; - if(img->align < _LV_IMAGE_ALIGN_AUTO_TRANSFORM) { + if(img->align < LV_IMAGE_ALIGN_AUTO_TRANSFORM) { lv_area_align(&obj->coords, &draw_dsc.image_area, img->align, img->offset.x, img->offset.y); coords = draw_dsc.image_area; } else if(img->align == LV_IMAGE_ALIGN_TILE) { - _lv_area_intersect(&layer->_clip_area, &layer->_clip_area, &obj->coords); + lv_area_intersect(&layer->_clip_area, &layer->_clip_area, &obj->coords); lv_area_move(&draw_dsc.image_area, img->offset.x, img->offset.y); lv_area_move(&draw_dsc.image_area, @@ -809,7 +818,7 @@ static void scale_update(lv_obj_t * obj, int32_t scale_x, int32_t scale_y) lv_area_t a; lv_point_t pivot_px; lv_image_get_pivot(obj, &pivot_px); - _lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); + lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); a.x1 += obj->coords.x1 - 1; a.y1 += obj->coords.y1 - 1; a.x2 += obj->coords.x1 + 1; @@ -826,7 +835,7 @@ static void scale_update(lv_obj_t * obj, int32_t scale_x, int32_t scale_y) lv_obj_refresh_ext_draw_size(obj); lv_display_enable_invalidation(disp, true); - _lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); + lv_image_buf_get_transformed_area(&a, w, h, img->rotation, img->scale_x, img->scale_y, &pivot_px); a.x1 += obj->coords.x1 - 1; a.y1 += obj->coords.y1 - 1; a.x2 += obj->coords.x1 + 1; @@ -851,4 +860,19 @@ static void update_align(lv_obj_t * obj) } } + +#if LV_USE_OBJ_PROPERTY +static void lv_image_set_pivot_helper(lv_obj_t * obj, lv_point_t * pivot) +{ + lv_image_set_pivot(obj, pivot->x, pivot->y); +} + +static lv_point_t lv_image_get_pivot_helper(lv_obj_t * obj) +{ + lv_point_t pivot; + lv_image_get_pivot(obj, &pivot); + return pivot; +} +#endif + #endif diff --git a/src/widgets/image/lv_image.h b/src/widgets/image/lv_image.h index 8c45ee941..5c2d12a67 100644 --- a/src/widgets/image/lv_image.h +++ b/src/widgets/image/lv_image.h @@ -34,33 +34,12 @@ extern "C" { * TYPEDEFS **********************/ -/** - * Data of image - */ -typedef struct { - lv_obj_t obj; - const void * src; /**< Image source: Pointer to an array or a file or a symbol*/ - const lv_image_dsc_t * bitmap_mask_src; /**< Pointer to an A8 bitmap mask */ - lv_point_t offset; - 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 scale_x; /**< 256 means no zoom, 512 double size, 128 half size*/ - uint32_t scale_y; /**< 256 means no zoom, 512 double size, 128 half size*/ - lv_point_t pivot; /**< Rotation center of the image*/ - uint32_t src_type : 2; /**< See: lv_image_src_t*/ - uint32_t cf : 5; /**< Color format from `lv_color_format_t`*/ - uint32_t antialias : 1; /**< Apply anti-aliasing in transformations (rotate, zoom)*/ - uint32_t align: 4; /**< Image size mode when image size and object size is different. See lv_image_align_t*/ - uint32_t blend_mode: 4; /**< Element of `lv_blend_mode_t`*/ -} lv_image_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_image_class; /** * Image size mode, when image size and object size is different */ -enum _lv_image_align_t { +typedef enum { LV_IMAGE_ALIGN_DEFAULT = 0, LV_IMAGE_ALIGN_TOP_LEFT, LV_IMAGE_ALIGN_TOP_MID, @@ -71,19 +50,13 @@ enum _lv_image_align_t { LV_IMAGE_ALIGN_LEFT_MID, LV_IMAGE_ALIGN_RIGHT_MID, LV_IMAGE_ALIGN_CENTER, - _LV_IMAGE_ALIGN_AUTO_TRANSFORM, + LV_IMAGE_ALIGN_AUTO_TRANSFORM, LV_IMAGE_ALIGN_STRETCH, LV_IMAGE_ALIGN_TILE, -}; - -#ifdef DOXYGEN -typedef _lv_image_align_t lv_image_align_t; -#else -typedef uint8_t lv_image_align_t; -#endif /*DOXYGEN*/ +} lv_image_align_t; #if LV_USE_OBJ_PROPERTY -enum _lv_image_property_t { +enum lv_image_property_t { LV_PROPERTY_ID(IMAGE, SRC, LV_PROPERTY_TYPE_IMGSRC, 0), LV_PROPERTY_ID(IMAGE, OFFSET_X, LV_PROPERTY_TYPE_INT, 1), LV_PROPERTY_ID(IMAGE, OFFSET_Y, LV_PROPERTY_TYPE_INT, 2), @@ -161,14 +134,6 @@ void lv_image_set_rotation(lv_obj_t * obj, int32_t angle); void lv_image_set_pivot(lv_obj_t * obj, int32_t x, int32_t y); /** - * Set pivot to accept lv_point_t * directly - */ -static inline void _lv_image_set_pivot(lv_obj_t * obj, lv_point_t * pivot) -{ - lv_image_set_pivot(obj, pivot->x, pivot->y); -} - -/** * Set the zoom factor of the image. * Note that indexed and alpha only images can't be transformed. * @param obj pointer to an image object @@ -281,16 +246,6 @@ int32_t lv_image_get_rotation(lv_obj_t * obj); void lv_image_get_pivot(lv_obj_t * obj, lv_point_t * pivot); /** - * Get pivot to return lv_point_t directly - */ -static inline lv_point_t _lv_image_get_pivot(lv_obj_t * obj) -{ - lv_point_t pivot; - lv_image_get_pivot(obj, &pivot); - return pivot; -} - -/** * Get the zoom factor of the image. * @param obj pointer to an image object * @return zoom factor (256: no zoom) diff --git a/src/widgets/image/lv_image_private.h b/src/widgets/image/lv_image_private.h new file mode 100644 index 000000000..e880f5d68 --- /dev/null +++ b/src/widgets/image/lv_image_private.h @@ -0,0 +1,66 @@ +/** + * @file lv_image_private.h + * + */ + +#ifndef LV_IMAGE_PRIVATE_H +#define LV_IMAGE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_image.h" + +#if LV_USE_IMAGE != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/** + * Data of image + */ +struct lv_image_t { + lv_obj_t obj; + const void * src; /**< Image source: Pointer to an array or a file or a symbol*/ + const lv_image_dsc_t * bitmap_mask_src; /**< Pointer to an A8 bitmap mask */ + lv_point_t offset; + 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 scale_x; /**< 256 means no zoom, 512 double size, 128 half size*/ + uint32_t scale_y; /**< 256 means no zoom, 512 double size, 128 half size*/ + lv_point_t pivot; /**< Rotation center of the image*/ + uint32_t src_type : 2; /**< See: lv_image_src_t*/ + uint32_t cf : 5; /**< Color format from `lv_color_format_t`*/ + uint32_t antialias : 1; /**< Apply anti-aliasing in transformations (rotate, zoom)*/ + uint32_t align: 4; /**< Image size mode when image size and object size is different. See lv_image_align_t*/ + uint32_t blend_mode: 4; /**< Element of `lv_blend_mode_t`*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_IMAGE != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_IMAGE_PRIVATE_H*/ diff --git a/src/widgets/imagebutton/lv_imagebutton.c b/src/widgets/imagebutton/lv_imagebutton.c index dcecf9534..7a76c4ebd 100644 --- a/src/widgets/imagebutton/lv_imagebutton.c +++ b/src/widgets/imagebutton/lv_imagebutton.c @@ -7,7 +7,12 @@ * INCLUDES *********************/ -#include "lv_imagebutton.h" +#include "../../misc/lv_area_private.h" +#include "../../draw/lv_draw_private.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_event_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_imagebutton_private.h" #if LV_USE_IMAGEBUTTON != 0 @@ -231,7 +236,7 @@ static void draw_main(lv_event_t * e) coords_part.y2 = coords.y2; lv_area_t clip_area_center; - if(_lv_area_intersect(&clip_area_center, &coords_part, &layer->_clip_area)) { + if(lv_area_intersect(&clip_area_center, &coords_part, &layer->_clip_area)) { lv_area_t clip_area_ori = layer->_clip_area; layer->_clip_area = clip_area_center; img_dsc.src = src_info->img_src; diff --git a/src/widgets/imagebutton/lv_imagebutton.h b/src/widgets/imagebutton/lv_imagebutton.h index 1f91eb682..ed6dc3a5e 100644 --- a/src/widgets/imagebutton/lv_imagebutton.h +++ b/src/widgets/imagebutton/lv_imagebutton.h @@ -27,25 +27,12 @@ typedef enum { LV_IMAGEBUTTON_STATE_CHECKED_RELEASED, LV_IMAGEBUTTON_STATE_CHECKED_PRESSED, LV_IMAGEBUTTON_STATE_CHECKED_DISABLED, - _LV_IMAGEBUTTON_STATE_NUM, + LV_IMAGEBUTTON_STATE_NUM, } lv_imagebutton_state_t; -typedef struct { - const void * img_src; - lv_image_header_t header; -} lv_imagebutton_src_info_t; - /********************** * TYPEDEFS **********************/ -/*Data of image button*/ -typedef struct { - lv_obj_t obj; - lv_imagebutton_src_info_t src_mid[_LV_IMAGEBUTTON_STATE_NUM]; /*Store center images to each state*/ - lv_imagebutton_src_info_t src_left[_LV_IMAGEBUTTON_STATE_NUM]; /*Store left side images to each state*/ - lv_imagebutton_src_info_t src_right[_LV_IMAGEBUTTON_STATE_NUM]; /*Store right side images to each state*/ -} lv_imagebutton_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_imagebutton_class; /********************** diff --git a/src/widgets/imagebutton/lv_imagebutton_private.h b/src/widgets/imagebutton/lv_imagebutton_private.h new file mode 100644 index 000000000..8dc5d42b0 --- /dev/null +++ b/src/widgets/imagebutton/lv_imagebutton_private.h @@ -0,0 +1,57 @@ +/** + * @file lv_imagebutton_private.h + * + */ + +#ifndef LV_IMAGEBUTTON_PRIVATE_H +#define LV_IMAGEBUTTON_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_imagebutton.h" + +#if LV_USE_IMAGEBUTTON != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_imagebutton_src_info_t { + const void * img_src; + lv_image_header_t header; +}; + +/*Data of image button*/ +struct lv_imagebutton_t { + lv_obj_t obj; + lv_imagebutton_src_info_t src_mid[LV_IMAGEBUTTON_STATE_NUM]; /*Store center images to each state*/ + lv_imagebutton_src_info_t src_left[LV_IMAGEBUTTON_STATE_NUM]; /*Store left side images to each state*/ + lv_imagebutton_src_info_t src_right[LV_IMAGEBUTTON_STATE_NUM]; /*Store right side images to each state*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_IMAGEBUTTON != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_IMAGEBUTTON_PRIVATE_H*/ diff --git a/src/widgets/keyboard/lv_keyboard.c b/src/widgets/keyboard/lv_keyboard.c index a2bd3bb9a..801186a13 100644 --- a/src/widgets/keyboard/lv_keyboard.c +++ b/src/widgets/keyboard/lv_keyboard.c @@ -7,7 +7,8 @@ /********************* * INCLUDES *********************/ -#include "lv_keyboard.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_keyboard_private.h" #if LV_USE_KEYBOARD #include "../textarea/lv_textarea.h" @@ -206,7 +207,7 @@ void lv_keyboard_set_textarea(lv_obj_t * obj, lv_obj_t * ta) /*Show the cursor of the new Text area if cursor management is enabled*/ if(keyboard->ta) { - lv_obj_add_flag(obj, LV_STATE_FOCUSED); + lv_obj_add_state(obj, LV_STATE_FOCUSED); } } @@ -373,6 +374,21 @@ void lv_keyboard_def_event_cb(lv_event_t * e) } } +const char ** lv_keyboard_get_map_array(const lv_obj_t * kb) +{ + return lv_buttonmatrix_get_map(kb); +} + +uint32_t lv_keyboard_get_selected_button(const lv_obj_t * obj) +{ + return lv_buttonmatrix_get_selected_button(obj); +} + +const char * lv_keyboard_get_button_text(const lv_obj_t * obj, uint32_t btn_id) +{ + return lv_buttonmatrix_get_button_text(obj, btn_id); +} + /********************** * STATIC FUNCTIONS **********************/ diff --git a/src/widgets/keyboard/lv_keyboard.h b/src/widgets/keyboard/lv_keyboard.h index 3b916c7e1..4f90d5814 100644 --- a/src/widgets/keyboard/lv_keyboard.h +++ b/src/widgets/keyboard/lv_keyboard.h @@ -36,7 +36,7 @@ extern "C" { **********************/ /** Current keyboard mode.*/ -enum _lv_keyboard_mode_t { +typedef enum { LV_KEYBOARD_MODE_TEXT_LOWER, LV_KEYBOARD_MODE_TEXT_UPPER, LV_KEYBOARD_MODE_SPECIAL, @@ -48,21 +48,7 @@ enum _lv_keyboard_mode_t { #if LV_USE_ARABIC_PERSIAN_CHARS == 1 LV_KEYBOARD_MODE_TEXT_ARABIC #endif -}; - -#ifdef DOXYGEN -typedef _lv_keyboard_mode_t lv_keyboard_mode_t; -#else -typedef uint8_t lv_keyboard_mode_t; -#endif /*DOXYGEN*/ - -/*Data of keyboard*/ -typedef struct { - lv_buttonmatrix_t btnm; - lv_obj_t * ta; /*Pointer to the assigned text area*/ - lv_keyboard_mode_t mode; /*Key map type*/ - uint8_t popovers : 1; /*Show button titles in popovers on press*/ -} lv_keyboard_t; +} lv_keyboard_mode_t; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_keyboard_class; @@ -144,10 +130,7 @@ bool lv_buttonmatrix_get_popovers(const lv_obj_t * obj); * @param kb pointer to a keyboard object * @return the current map */ -static inline const char ** lv_keyboard_get_map_array(const lv_obj_t * kb) -{ - return lv_buttonmatrix_get_map(kb); -} +const char ** lv_keyboard_get_map_array(const lv_obj_t * kb); /** * Get the index of the lastly "activated" button by the user (pressed, released, focused etc) @@ -155,10 +138,7 @@ static inline const char ** lv_keyboard_get_map_array(const lv_obj_t * kb) * @param obj pointer to button matrix object * @return index of the last released button (LV_BUTTONMATRIX_BUTTON_NONE: if unset) */ -static inline uint32_t lv_keyboard_get_selected_button(const lv_obj_t * obj) -{ - return lv_buttonmatrix_get_selected_button(obj); -} +uint32_t lv_keyboard_get_selected_button(const lv_obj_t * obj); /** * Get the button's text @@ -166,10 +146,7 @@ static inline uint32_t lv_keyboard_get_selected_button(const lv_obj_t * obj) * @param btn_id the index a button not counting new line characters. * @return text of btn_index` button */ -static inline const char * lv_keyboard_get_button_text(const lv_obj_t * obj, uint32_t btn_id) -{ - return lv_buttonmatrix_get_button_text(obj, btn_id); -} +const char * lv_keyboard_get_button_text(const lv_obj_t * obj, uint32_t btn_id); /*===================== * Other functions diff --git a/src/widgets/keyboard/lv_keyboard_private.h b/src/widgets/keyboard/lv_keyboard_private.h new file mode 100644 index 000000000..8bb206ab2 --- /dev/null +++ b/src/widgets/keyboard/lv_keyboard_private.h @@ -0,0 +1,53 @@ +/** + * @file lv_keyboard_private.h + * + */ + +#ifndef LV_KEYBOARD_PRIVATE_H +#define LV_KEYBOARD_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../buttonmatrix/lv_buttonmatrix_private.h" +#include "lv_keyboard.h" + +#if LV_USE_KEYBOARD + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of keyboard*/ +struct lv_keyboard_t { + lv_buttonmatrix_t btnm; + lv_obj_t * ta; /*Pointer to the assigned text area*/ + lv_keyboard_mode_t mode; /*Key map type*/ + uint8_t popovers : 1; /*Show button titles in popovers on press*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_KEYBOARD */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_KEYBOARD_PRIVATE_H*/ diff --git a/src/widgets/label/lv_label.c b/src/widgets/label/lv_label.c index a358f763a..c99ade155 100644 --- a/src/widgets/label/lv_label.c +++ b/src/widgets/label/lv_label.c @@ -6,16 +6,20 @@ /********************* * INCLUDES *********************/ -#include "lv_label.h" +#include "../../misc/lv_area_private.h" +#include "../../misc/lv_anim_private.h" +#include "../../draw/lv_draw_label_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_label_private.h" #if LV_USE_LABEL != 0 -#include "../../core/lv_obj.h" +#include "../../core/lv_obj_private.h" #include "../../misc/lv_assert.h" #include "../../core/lv_group.h" #include "../../display/lv_display.h" -#include "../../draw/lv_draw.h" +#include "../../draw/lv_draw_private.h" #include "../../misc/lv_color.h" #include "../../misc/lv_math.h" -#include "../../misc/lv_bidi.h" +#include "../../misc/lv_bidi_private.h" #include "../../misc/lv_text_ap.h" #include "../../misc/lv_text_private.h" #include "../../stdlib/lv_sprintf.h" @@ -147,7 +151,7 @@ void lv_label_set_text(lv_obj_t * obj, const char * text) if(label->text == NULL) return; #if LV_USE_ARABIC_PERSIAN_CHARS - _lv_text_ap_proc(label->text, label->text); + lv_text_ap_proc(label->text, label->text); #endif } @@ -357,7 +361,7 @@ void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t uint32_t visual_byte_pos; #if LV_USE_BIDI lv_base_dir_t base_dir = lv_obj_get_style_base_dir(obj, LV_PART_MAIN); - if(base_dir == LV_BASE_DIR_AUTO) base_dir = _lv_bidi_detect_base_dir(txt); + if(base_dir == LV_BASE_DIR_AUTO) base_dir = lv_bidi_detect_base_dir(txt); char * mutable_bidi_txt = NULL; /*Handle Bidi*/ @@ -369,8 +373,8 @@ void lv_label_get_letter_pos(const lv_obj_t * obj, uint32_t char_id, lv_point_t uint32_t line_char_id = lv_text_encoded_get_char_id(&txt[line_start], byte_id - line_start); bool is_rtl; - uint32_t visual_char_pos = _lv_bidi_get_visual_pos(&txt[line_start], &mutable_bidi_txt, new_line_start - line_start, - base_dir, line_char_id, &is_rtl); + uint32_t visual_char_pos = lv_bidi_get_visual_pos(&txt[line_start], &mutable_bidi_txt, new_line_start - line_start, + base_dir, line_char_id, &is_rtl); bidi_txt = mutable_bidi_txt; if(is_rtl) visual_char_pos++; @@ -452,7 +456,7 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in, bool bidi_txt = lv_malloc(new_line_start - line_start + 1); txt_len = new_line_start - line_start; if(new_line_start > 0 && txt[new_line_start - 1] == '\0' && txt_len > 0) txt_len--; - _lv_bidi_process_paragraph(txt + line_start, bidi_txt, txt_len, lv_obj_get_style_base_dir(obj, LV_PART_MAIN), NULL, 0); + lv_bidi_process_paragraph(txt + line_start, bidi_txt, txt_len, lv_obj_get_style_base_dir(obj, LV_PART_MAIN), NULL, 0); } else #endif @@ -500,8 +504,8 @@ uint32_t lv_label_get_letter_on(const lv_obj_t * obj, lv_point_t * pos_in, bool } else { bool is_rtl; - logical_pos = _lv_bidi_get_logical_pos(&txt[line_start], NULL, - txt_len, lv_obj_get_style_base_dir(obj, LV_PART_MAIN), cid, &is_rtl); + logical_pos = lv_bidi_get_logical_pos(&txt[line_start], NULL, + txt_len, lv_obj_get_style_base_dir(obj, LV_PART_MAIN), cid, &is_rtl); if(is_rtl) logical_pos++; } lv_free(bidi_txt); @@ -811,7 +815,7 @@ static void draw_main(lv_event_t * e) } lv_area_t txt_clip; - bool is_common = _lv_area_intersect(&txt_clip, &txt_coords, &layer->_clip_area); + bool is_common = lv_area_intersect(&txt_clip, &txt_coords, &layer->_clip_area); if(!is_common) { return; } @@ -934,7 +938,7 @@ static void lv_label_refr_text(lv_obj_t * obj) lv_base_dir_t base_dir = lv_obj_get_style_base_dir(obj, LV_PART_MAIN); if(base_dir == LV_BASE_DIR_AUTO) - base_dir = _lv_bidi_detect_base_dir(label->text); + base_dir = lv_bidi_detect_base_dir(label->text); if(base_dir == LV_BASE_DIR_RTL) { start = lv_area_get_width(&txt_coords) - size.x; @@ -1041,7 +1045,7 @@ static void lv_label_refr_text(lv_obj_t * obj) lv_base_dir_t base_dir = lv_obj_get_style_base_dir(obj, LV_PART_MAIN); if(base_dir == LV_BASE_DIR_AUTO) - base_dir = _lv_bidi_detect_base_dir(label->text); + base_dir = lv_bidi_detect_base_dir(label->text); if(base_dir == LV_BASE_DIR_RTL) { start = -size.x - lv_font_get_glyph_width(font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT; @@ -1276,7 +1280,7 @@ static size_t get_text_length(const char * text) { size_t len = 0; #if LV_USE_ARABIC_PERSIAN_CHARS - len = _lv_text_ap_calc_bytes_count(text); + len = lv_text_ap_calc_bytes_count(text); #else len = lv_strlen(text) + 1; #endif @@ -1287,7 +1291,7 @@ static size_t get_text_length(const char * text) static void copy_text_to_label(lv_label_t * label, const char * text) { #if LV_USE_ARABIC_PERSIAN_CHARS - _lv_text_ap_proc(text, label->text); + lv_text_ap_proc(text, label->text); #else lv_strcpy(label->text, text); #endif diff --git a/src/widgets/label/lv_label.h b/src/widgets/label/lv_label.h index f0143d502..86964f33f 100644 --- a/src/widgets/label/lv_label.h +++ b/src/widgets/label/lv_label.h @@ -45,19 +45,13 @@ LV_EXPORT_CONST_INT(LV_LABEL_TEXT_SELECTION_OFF); **********************/ /** Long mode behaviors. Used in 'lv_label_ext_t'*/ -enum _lv_label_long_mode_t { +typedef enum { LV_LABEL_LONG_WRAP, /**< Keep the object width, wrap lines longer than object width and expand the object height*/ LV_LABEL_LONG_DOT, /**< Keep the size and write dots at the end if the text is too long*/ LV_LABEL_LONG_SCROLL, /**< Keep the size and roll the text back and forth*/ LV_LABEL_LONG_SCROLL_CIRCULAR, /**< Keep the size and roll the text circularly*/ LV_LABEL_LONG_CLIP, /**< Keep the size and clip the text out of it*/ -}; - -#ifdef DOXYGEN -typedef _lv_label_long_mode_t lv_label_long_mode_t; -#else -typedef uint8_t lv_label_long_mode_t; -#endif /*DOXYGEN*/ +} lv_label_long_mode_t; #if LV_USE_OBJ_PROPERTY enum { @@ -69,33 +63,6 @@ enum { }; #endif -typedef struct { - lv_obj_t obj; - char * text; - union { - char * tmp_ptr; /*Pointer to the allocated memory containing the character replaced by dots*/ - char tmp[LV_LABEL_DOT_NUM + 1]; /*Directly store the characters if <=4 characters*/ - } dot; - uint32_t dot_end; /*The real text length, used in dot mode*/ - -#if LV_LABEL_LONG_TXT_HINT - lv_draw_label_hint_t hint; -#endif - -#if LV_LABEL_TEXT_SELECTION - uint32_t sel_start; - uint32_t sel_end; -#endif - - lv_point_t size_cache; /*Text size cache*/ - lv_point_t offset; /*Text draw position offset*/ - lv_label_long_mode_t long_mode : 3; /*Determine what to do with the long texts*/ - uint8_t static_txt : 1; /*Flag to indicate the text is static*/ - uint8_t expand : 1; /*Ignore real width (used by the library with LV_LABEL_LONG_SCROLL)*/ - uint8_t dot_tmp_alloc : 1; /*1: dot is allocated, 0: dot directly holds up to 4 chars*/ - uint8_t invalid_size_cache : 1; /*1: Recalculate size and update cache*/ -} lv_label_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_label_class; /********************** diff --git a/src/widgets/label/lv_label_private.h b/src/widgets/label/lv_label_private.h new file mode 100644 index 000000000..84652a903 --- /dev/null +++ b/src/widgets/label/lv_label_private.h @@ -0,0 +1,73 @@ +/** + * @file lv_label_private.h + * + */ + +#ifndef LV_LABEL_PRIVATE_H +#define LV_LABEL_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../draw/lv_draw_label_private.h" +#include "../../core/lv_obj_private.h" +#include "lv_label.h" + +#if LV_USE_LABEL != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_label_t { + lv_obj_t obj; + char * text; + union { + char * tmp_ptr; /*Pointer to the allocated memory containing the character replaced by dots*/ + char tmp[LV_LABEL_DOT_NUM + 1]; /*Directly store the characters if <=4 characters*/ + } dot; + uint32_t dot_end; /*The real text length, used in dot mode*/ + +#if LV_LABEL_LONG_TXT_HINT + lv_draw_label_hint_t hint; +#endif + +#if LV_LABEL_TEXT_SELECTION + uint32_t sel_start; + uint32_t sel_end; +#endif + + lv_point_t size_cache; /*Text size cache*/ + lv_point_t offset; /*Text draw position offset*/ + lv_label_long_mode_t long_mode : 3; /*Determine what to do with the long texts*/ + uint8_t static_txt : 1; /*Flag to indicate the text is static*/ + uint8_t expand : 1; /*Ignore real width (used by the library with LV_LABEL_LONG_SCROLL)*/ + uint8_t dot_tmp_alloc : 1; /*1: dot is allocated, 0: dot directly holds up to 4 chars*/ + uint8_t invalid_size_cache : 1; /*1: Recalculate size and update cache*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_LABEL != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LABEL_PRIVATE_H*/ diff --git a/src/widgets/led/lv_led.c b/src/widgets/led/lv_led.c index bf5db77c5..d42daabcb 100644 --- a/src/widgets/led/lv_led.c +++ b/src/widgets/led/lv_led.c @@ -6,7 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_led.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_led_private.h" #if LV_USE_LED #include "../../misc/lv_assert.h" diff --git a/src/widgets/led/lv_led.h b/src/widgets/led/lv_led.h index f1ac52d87..c085a97f6 100644 --- a/src/widgets/led/lv_led.h +++ b/src/widgets/led/lv_led.h @@ -34,13 +34,6 @@ extern "C" { * TYPEDEFS **********************/ -/*Data of led*/ -typedef struct { - lv_obj_t obj; - lv_color_t color; - uint8_t bright; /**< Current brightness of the LED (0..255)*/ -} lv_led_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_led_class; /********************** diff --git a/src/widgets/led/lv_led_private.h b/src/widgets/led/lv_led_private.h new file mode 100644 index 000000000..448069dde --- /dev/null +++ b/src/widgets/led/lv_led_private.h @@ -0,0 +1,51 @@ +/** + * @file lv_led_private.h + * + */ + +#ifndef LV_LED_PRIVATE_H +#define LV_LED_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_led.h" + +#if LV_USE_LED + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of led*/ +struct lv_led_t { + lv_obj_t obj; + lv_color_t color; + uint8_t bright; /**< Current brightness of the LED (0..255)*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_LED */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LED_PRIVATE_H*/ diff --git a/src/widgets/line/lv_line.c b/src/widgets/line/lv_line.c index fd384722f..d5a37aa68 100644 --- a/src/widgets/line/lv_line.c +++ b/src/widgets/line/lv_line.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_line.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_line_private.h" #if LV_USE_LINE != 0 #include "../../misc/lv_assert.h" diff --git a/src/widgets/line/lv_line.h b/src/widgets/line/lv_line.h index eac2482ed..d6a1d603e 100644 --- a/src/widgets/line/lv_line.h +++ b/src/widgets/line/lv_line.h @@ -24,18 +24,6 @@ extern "C" { * TYPEDEFS **********************/ -/*Data of line*/ -typedef struct { - lv_obj_t obj; - union { - const lv_point_precise_t * constant; - lv_point_precise_t * mut; - } point_array; /**< Pointer to an array with the points of the line*/ - uint32_t point_num; /**< Number of points in 'point_array'*/ - uint32_t y_inv : 1; /**< 1: y == 0 will be on the bottom*/ - uint32_t point_array_is_mutable : 1; /**< whether the point array is const or mutable*/ -} lv_line_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_line_class; /********************** diff --git a/src/widgets/line/lv_line_private.h b/src/widgets/line/lv_line_private.h new file mode 100644 index 000000000..900ea3a04 --- /dev/null +++ b/src/widgets/line/lv_line_private.h @@ -0,0 +1,57 @@ +/** + * @file lv_line_private.h + * + */ + +#ifndef LV_LINE_PRIVATE_H +#define LV_LINE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_line.h" + +#if LV_USE_LINE != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of line*/ +struct lv_line_t { + lv_obj_t obj; + union { + const lv_point_precise_t * constant; + lv_point_precise_t * mut; + } point_array; /**< Pointer to an array with the points of the line*/ + uint32_t point_num; /**< Number of points in 'point_array'*/ + uint32_t y_inv : 1; /**< 1: y == 0 will be on the bottom*/ + uint32_t point_array_is_mutable : 1; /**< whether the point array is const or mutable*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_LINE != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LINE_PRIVATE_H*/ diff --git a/src/widgets/list/lv_list.c b/src/widgets/list/lv_list.c index 5288c66e0..3556ef1dc 100644 --- a/src/widgets/list/lv_list.c +++ b/src/widgets/list/lv_list.c @@ -6,6 +6,7 @@ /********************* * INCLUDES *********************/ +#include "../../core/lv_obj_class_private.h" #include "lv_list.h" #include "../../layouts/flex/lv_flex.h" #include "../../display/lv_display.h" diff --git a/src/widgets/lottie/lv_lottie.c b/src/widgets/lottie/lv_lottie.c index ea803d48d..bc0bed586 100644 --- a/src/widgets/lottie/lv_lottie.c +++ b/src/widgets/lottie/lv_lottie.c @@ -15,8 +15,9 @@ #include "../../libs/thorvg/thorvg_capi.h" #endif +#include "lv_lottie_private.h" #include "../../misc/lv_timer.h" -#include "lv_lottie.h" +#include "../../core/lv_obj_class_private.h" /********************* * DEFINES diff --git a/src/widgets/lottie/lv_lottie.h b/src/widgets/lottie/lv_lottie.h index 5108621ba..1ccfe164a 100644 --- a/src/widgets/lottie/lv_lottie.h +++ b/src/widgets/lottie/lv_lottie.h @@ -25,7 +25,7 @@ extern "C" { #error "lv_lottie: ThorVG is required. Enable it in lv_conf.h (LV_USE_THORVG_INTERNAL/EXTERNAL 1)" #endif -#include "../../widgets/canvas/lv_canvas.h" +#include "../../draw/lv_draw_buf.h" /********************* * DEFINES @@ -35,21 +35,6 @@ extern "C" { * TYPEDEFS **********************/ -#ifndef __THORVG_CAPI_H__ /*To avoid redefinition of typedef warning*/ -typedef struct _Tvg_Paint Tvg_Paint; -typedef struct _Tvg_Canvas Tvg_Canvas; -typedef struct _Tvg_Animation Tvg_Animation; -#endif - -typedef struct { - lv_canvas_t canvas; - Tvg_Paint * tvg_paint; - Tvg_Canvas * tvg_canvas; - Tvg_Animation * tvg_anim; - lv_anim_t * anim; - int32_t last_rendered_time; -} lv_lottie_t; - /********************** * GLOBAL PROTOTYPES **********************/ diff --git a/src/widgets/lottie/lv_lottie_private.h b/src/widgets/lottie/lv_lottie_private.h new file mode 100644 index 000000000..1fec92d37 --- /dev/null +++ b/src/widgets/lottie/lv_lottie_private.h @@ -0,0 +1,59 @@ +/** + * @file lv_lottie_private.h + * + */ + +#ifndef LV_LOTTIE_PRIVATE_H +#define LV_LOTTIE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#if LV_USE_LOTTIE + +#include "lv_lottie.h" +#include "../canvas/lv_canvas_private.h" + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +#ifndef __THORVG_CAPI_H__ /*To avoid redefinition of typedef warning*/ +typedef struct _Tvg_Paint Tvg_Paint; +typedef struct _Tvg_Canvas Tvg_Canvas; +typedef struct _Tvg_Animation Tvg_Animation; +#endif + +typedef struct { + lv_canvas_t canvas; + Tvg_Paint * tvg_paint; + Tvg_Canvas * tvg_canvas; + Tvg_Animation * tvg_anim; + lv_anim_t * anim; + int32_t last_rendered_time; +} lv_lottie_t; + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /*LV_LOTTIE_H*/ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_LOTTIE_PRIVATE_H*/ diff --git a/src/widgets/menu/lv_menu.c b/src/widgets/menu/lv_menu.c index e21bdcd18..8b2ea05b8 100644 --- a/src/widgets/menu/lv_menu.c +++ b/src/widgets/menu/lv_menu.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_menu.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_menu_private.h" #if LV_USE_MENU @@ -15,7 +16,7 @@ *********************/ #define MY_CLASS (&lv_menu_class) -#include "../../core/lv_obj.h" +#include "../../core/lv_obj_private.h" #include "../../layouts/lv_layout.h" #include "../../stdlib/lv_string.h" #include "../label/lv_label.h" @@ -170,14 +171,14 @@ void lv_menu_refr(lv_obj_t * obj) lv_ll_t * history_ll = &(menu->history_ll); /* The current menu */ - lv_menu_history_t * act_hist = _lv_ll_get_head(history_ll); + lv_menu_history_t * act_hist = lv_ll_get_head(history_ll); lv_obj_t * page = NULL; if(act_hist != NULL) { page = act_hist->page; /* Delete the current item from the history */ - _lv_ll_remove(history_ll, act_hist); + lv_ll_remove(history_ll, act_hist); lv_free(act_hist); menu->cur_depth--; } @@ -204,7 +205,7 @@ void lv_menu_set_page(lv_obj_t * obj, lv_obj_t * page) if(page != NULL) { /* Add a new node */ lv_ll_t * history_ll = &(menu->history_ll); - lv_menu_history_t * new_node = _lv_ll_ins_head(history_ll); + lv_menu_history_t * new_node = lv_ll_ins_head(history_ll); LV_ASSERT_MALLOC(new_node); new_node->page = page; menu->cur_depth++; @@ -506,7 +507,7 @@ void lv_menu_clear_history(lv_obj_t * obj) lv_menu_t * menu = (lv_menu_t *)obj; lv_ll_t * history_ll = &(menu->history_ll); - _lv_ll_clear(history_ll); + lv_ll_clear(history_ll); menu->cur_depth = 0; } @@ -531,7 +532,7 @@ static void lv_menu_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) menu->prev_depth = 0; menu->sidebar_generated = false; - _lv_ll_init(&(menu->history_ll), sizeof(lv_menu_history_t)); + lv_ll_init(&(menu->history_ll), sizeof(lv_menu_history_t)); menu->storage = lv_obj_create(obj); lv_obj_add_flag(menu->storage, LV_OBJ_FLAG_HIDDEN); @@ -590,7 +591,7 @@ static void lv_menu_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_menu_t * menu = (lv_menu_t *)obj; lv_ll_t * history_ll = &(menu->history_ll); - _lv_ll_clear(history_ll); + lv_ll_clear(history_ll); LV_TRACE_OBJ_CREATE("finished"); } @@ -770,20 +771,20 @@ static void lv_menu_back_event_cb(lv_event_t * e) lv_ll_t * history_ll = &(menu->history_ll); /* The current menu */ - lv_menu_history_t * act_hist = _lv_ll_get_head(history_ll); + lv_menu_history_t * act_hist = lv_ll_get_head(history_ll); /* The previous menu */ - lv_menu_history_t * prev_hist = _lv_ll_get_next(history_ll, act_hist); + lv_menu_history_t * prev_hist = lv_ll_get_next(history_ll, act_hist); if(prev_hist != NULL) { /* Previous menu exists */ /* Delete the current item from the history */ - _lv_ll_remove(history_ll, act_hist); + lv_ll_remove(history_ll, act_hist); lv_free(act_hist); menu->cur_depth--; /* Create the previous menu. * Remove it from the history because `lv_menu_set_page` will add it again */ - _lv_ll_remove(history_ll, prev_hist); + lv_ll_remove(history_ll, prev_hist); menu->cur_depth--; lv_menu_set_page(&(menu->obj), prev_hist->page); diff --git a/src/widgets/menu/lv_menu.h b/src/widgets/menu/lv_menu.h index c187ff134..4fe3766f7 100644 --- a/src/widgets/menu/lv_menu.h +++ b/src/widgets/menu/lv_menu.h @@ -28,73 +28,16 @@ extern "C" { /********************** * TYPEDEFS **********************/ -enum _lv_menu_mode_header_t { +typedef enum { LV_MENU_HEADER_TOP_FIXED, /* Header is positioned at the top */ LV_MENU_HEADER_TOP_UNFIXED, /* Header is positioned at the top and can be scrolled out of view*/ LV_MENU_HEADER_BOTTOM_FIXED /* Header is positioned at the bottom */ -}; +} lv_menu_mode_header_t; -#ifdef DOXYGEN -typedef _lv_menu_mode_header_t lv_menu_mode_header_t; -#else -typedef uint8_t lv_menu_mode_header_t; -#endif /*DOXYGEN*/ - -enum _lv_menu_mode_root_back_button_t { +typedef enum { LV_MENU_ROOT_BACK_BUTTON_DISABLED, LV_MENU_ROOT_BACK_BUTTON_ENABLED -}; - -#ifdef DOXYGEN -typedef _lv_menu_mode_root_back_button_t lv_menu_mode_root_back_button_t; -#else -typedef uint8_t lv_menu_mode_root_back_button_t; -#endif /*DOXYGEN*/ - -typedef struct /// @cond -/** - * Tells Doxygen to ignore a duplicate declaration - */ - lv_menu_load_page_event_data_t -/// @endcond -{ - lv_obj_t * menu; - lv_obj_t * page; -} lv_menu_load_page_event_data_t ; - -typedef struct { - lv_obj_t * page; -} lv_menu_history_t; - -typedef struct { - lv_obj_t obj; - lv_obj_t * storage; /* a pointer to obj that is the parent of all pages not displayed */ - lv_obj_t * main; - lv_obj_t * main_page; - lv_obj_t * main_header; - lv_obj_t * - main_header_back_btn; /* a pointer to obj that on click triggers back btn event handler, can be same as 'main_header' */ - lv_obj_t * main_header_title; - lv_obj_t * sidebar; - lv_obj_t * sidebar_page; - lv_obj_t * sidebar_header; - lv_obj_t * - sidebar_header_back_btn; /* a pointer to obj that on click triggers back btn event handler, can be same as 'sidebar_header' */ - lv_obj_t * sidebar_header_title; - lv_obj_t * selected_tab; - lv_ll_t history_ll; - uint8_t cur_depth; - uint8_t prev_depth; - uint8_t sidebar_generated : 1; - lv_menu_mode_header_t mode_header : 2; - lv_menu_mode_root_back_button_t mode_root_back_btn : 1; -} lv_menu_t; - -typedef struct { - lv_obj_t obj; - char * title; - bool static_title; -} lv_menu_page_t; +} lv_menu_mode_root_back_button_t; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_class; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_menu_page_class; diff --git a/src/widgets/menu/lv_menu_private.h b/src/widgets/menu/lv_menu_private.h new file mode 100644 index 000000000..997fa862e --- /dev/null +++ b/src/widgets/menu/lv_menu_private.h @@ -0,0 +1,84 @@ +/** + * @file lv_menu_private.h + * + */ + +#ifndef LV_MENU_PRIVATE_H +#define LV_MENU_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_menu.h" + +#if LV_USE_MENU + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_menu_load_page_event_data_t { + lv_obj_t * menu; + lv_obj_t * page; +}; + +struct lv_menu_history_t { + lv_obj_t * page; +}; + +struct lv_menu_t { + lv_obj_t obj; + lv_obj_t * storage; /* a pointer to obj that is the parent of all pages not displayed */ + lv_obj_t * main; + lv_obj_t * main_page; + lv_obj_t * main_header; + lv_obj_t * + main_header_back_btn; /* a pointer to obj that on click triggers back btn event handler, can be same as 'main_header' */ + lv_obj_t * main_header_title; + lv_obj_t * sidebar; + lv_obj_t * sidebar_page; + lv_obj_t * sidebar_header; + lv_obj_t * + sidebar_header_back_btn; /* a pointer to obj that on click triggers back btn event handler, can be same as 'sidebar_header' */ + lv_obj_t * sidebar_header_title; + lv_obj_t * selected_tab; + lv_ll_t history_ll; + uint8_t cur_depth; + uint8_t prev_depth; + uint8_t sidebar_generated : 1; + lv_menu_mode_header_t mode_header : 2; + lv_menu_mode_root_back_button_t mode_root_back_btn : 1; +}; + +struct lv_menu_page_t { + lv_obj_t obj; + char * title; + bool static_title; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_MENU */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_MENU_PRIVATE_H*/ diff --git a/src/widgets/msgbox/lv_msgbox.c b/src/widgets/msgbox/lv_msgbox.c index 70edc51dd..8a9997726 100644 --- a/src/widgets/msgbox/lv_msgbox.c +++ b/src/widgets/msgbox/lv_msgbox.c @@ -6,7 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_msgbox.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_msgbox_private.h" #if LV_USE_MSGBOX #include "../label/lv_label.h" diff --git a/src/widgets/msgbox/lv_msgbox.h b/src/widgets/msgbox/lv_msgbox.h index e2f863ae9..5605b8028 100644 --- a/src/widgets/msgbox/lv_msgbox.h +++ b/src/widgets/msgbox/lv_msgbox.h @@ -30,18 +30,6 @@ extern "C" { * DEFINES *********************/ -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_obj_t obj; - lv_obj_t * header; - lv_obj_t * content; - lv_obj_t * footer; - lv_obj_t * title; -} lv_msgbox_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_class; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_header_class; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_content_class; diff --git a/src/widgets/msgbox/lv_msgbox_private.h b/src/widgets/msgbox/lv_msgbox_private.h new file mode 100644 index 000000000..ebf660170 --- /dev/null +++ b/src/widgets/msgbox/lv_msgbox_private.h @@ -0,0 +1,56 @@ +/** + * @file lv_msgbox_private.h + * + */ + +#ifndef LV_MSGBOX_PRIVATE_H +#define LV_MSGBOX_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_msgbox.h" + +#if LV_USE_MSGBOX + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_msgbox_t { + lv_obj_t obj; + lv_obj_t * header; + lv_obj_t * content; + lv_obj_t * footer; + lv_obj_t * title; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_MSGBOX */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_MSGBOX_PRIVATE_H*/ diff --git a/src/widgets/property/lv_obj_property_names.h b/src/widgets/property/lv_obj_property_names.h index f308bd27d..317a22ae0 100644 --- a/src/widgets/property/lv_obj_property_names.h +++ b/src/widgets/property/lv_obj_property_names.h @@ -13,6 +13,6 @@ extern const lv_property_name_t lv_image_property_names[11]; extern const lv_property_name_t lv_label_property_names[4]; extern const lv_property_name_t lv_obj_property_names[73]; - extern const lv_property_name_t lv_style_property_names[111]; + extern const lv_property_name_t lv_style_property_names[112]; #endif #endif diff --git a/src/widgets/property/lv_style_properties.c b/src/widgets/property/lv_style_properties.c index 9fc3cf4bf..22ef3e257 100644 --- a/src/widgets/property/lv_style_properties.c +++ b/src/widgets/property/lv_style_properties.c @@ -14,7 +14,7 @@ * Generated code from properties.py */ /* *INDENT-OFF* */ -const lv_property_name_t lv_style_property_names[111] = { +const lv_property_name_t lv_style_property_names[112] = { {"align", LV_PROPERTY_STYLE_ALIGN,}, {"anim", LV_PROPERTY_STYLE_ANIM,}, {"anim_duration", LV_PROPERTY_STYLE_ANIM_DURATION,}, @@ -67,6 +67,7 @@ const lv_property_name_t lv_style_property_names[111] = { {"image_opa", LV_PROPERTY_STYLE_IMAGE_OPA,}, {"image_recolor", LV_PROPERTY_STYLE_IMAGE_RECOLOR,}, {"image_recolor_opa", LV_PROPERTY_STYLE_IMAGE_RECOLOR_OPA,}, + {"last_built_in_prop", LV_PROPERTY_STYLE_LAST_BUILT_IN_PROP,}, {"layout", LV_PROPERTY_STYLE_LAYOUT,}, {"length", LV_PROPERTY_STYLE_LENGTH,}, {"line_color", LV_PROPERTY_STYLE_LINE_COLOR,}, diff --git a/src/widgets/property/lv_style_properties.h b/src/widgets/property/lv_style_properties.h index 720b13d8b..146f35ad7 100644 --- a/src/widgets/property/lv_style_properties.h +++ b/src/widgets/property/lv_style_properties.h @@ -64,6 +64,7 @@ enum { LV_PROPERTY_ID(STYLE, IMAGE_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_OPA), LV_PROPERTY_ID(STYLE, IMAGE_RECOLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_IMAGE_RECOLOR), LV_PROPERTY_ID(STYLE, IMAGE_RECOLOR_OPA, LV_PROPERTY_TYPE_INT, LV_STYLE_IMAGE_RECOLOR_OPA), + LV_PROPERTY_ID(STYLE, LAST_BUILT_IN_PROP, LV_PROPERTY_TYPE_INT, LV_STYLE_LAST_BUILT_IN_PROP), LV_PROPERTY_ID(STYLE, LAYOUT, LV_PROPERTY_TYPE_INT, LV_STYLE_LAYOUT), LV_PROPERTY_ID(STYLE, LENGTH, LV_PROPERTY_TYPE_INT, LV_STYLE_LENGTH), LV_PROPERTY_ID(STYLE, LINE_COLOR, LV_PROPERTY_TYPE_COLOR, LV_STYLE_LINE_COLOR), diff --git a/src/widgets/roller/lv_roller.c b/src/widgets/roller/lv_roller.c index 34b559841..1d3dbc689 100644 --- a/src/widgets/roller/lv_roller.c +++ b/src/widgets/roller/lv_roller.c @@ -6,12 +6,17 @@ /********************* * INCLUDES *********************/ -#include "lv_roller.h" +#include "../label/lv_label_private.h" +#include "../../misc/lv_area_private.h" +#include "../../misc/lv_anim_private.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_roller_private.h" #if LV_USE_ROLLER != 0 #include "../../misc/lv_assert.h" #include "../../misc/lv_text_private.h" -#include "../../draw/lv_draw.h" +#include "../../draw/lv_draw_private.h" #include "../../core/lv_group.h" #include "../../indev/lv_indev.h" #include "../../indev/lv_indev_scroll.h" @@ -457,7 +462,7 @@ static void draw_main(lv_event_t * e) get_sel_area(obj, &sel_area); lv_area_t mask_sel; bool area_ok; - area_ok = _lv_area_intersect(&mask_sel, &layer->_clip_area, &sel_area); + area_ok = lv_area_intersect(&mask_sel, &layer->_clip_area, &sel_area); if(area_ok) { lv_obj_t * label = get_label(obj); @@ -525,7 +530,7 @@ static void draw_label(lv_event_t * e) *To solve this limit the clip area to the "plain" roller.*/ const lv_area_t clip_area_ori = layer->_clip_area; lv_area_t roller_clip_area; - if(!_lv_area_intersect(&roller_clip_area, &layer->_clip_area, &roller->coords)) return; + if(!lv_area_intersect(&roller_clip_area, &layer->_clip_area, &roller->coords)) return; layer->_clip_area = roller_clip_area; lv_area_t sel_area; @@ -536,7 +541,7 @@ static void draw_label(lv_event_t * e) clip2.y1 = label_obj->coords.y1; clip2.x2 = label_obj->coords.x2; clip2.y2 = sel_area.y1; - if(_lv_area_intersect(&clip2, &layer->_clip_area, &clip2)) { + if(lv_area_intersect(&clip2, &layer->_clip_area, &clip2)) { const lv_area_t clip_area_ori2 = layer->_clip_area; layer->_clip_area = clip2; label_draw_dsc.text = lv_label_get_text(label_obj); @@ -548,7 +553,7 @@ static void draw_label(lv_event_t * e) clip2.y1 = sel_area.y2; clip2.x2 = label_obj->coords.x2; clip2.y2 = label_obj->coords.y2; - if(_lv_area_intersect(&clip2, &layer->_clip_area, &clip2)) { + if(lv_area_intersect(&clip2, &layer->_clip_area, &clip2)) { const lv_area_t clip_area_ori2 = layer->_clip_area; layer->_clip_area = clip2; label_draw_dsc.text = lv_label_get_text(label_obj); diff --git a/src/widgets/roller/lv_roller.h b/src/widgets/roller/lv_roller.h index ff75f246f..5deb57f64 100644 --- a/src/widgets/roller/lv_roller.h +++ b/src/widgets/roller/lv_roller.h @@ -33,26 +33,10 @@ extern "C" { **********************/ /** Roller mode.*/ -enum _lv_roller_mode_t { +typedef enum { LV_ROLLER_MODE_NORMAL, /**< Normal mode (roller ends at the end of the options).*/ LV_ROLLER_MODE_INFINITE, /**< Infinite mode (roller can be scrolled forever).*/ -}; - -#ifdef DOXYGEN -typedef _lv_roller_mode_t lv_roller_mode_t; -#else -typedef uint8_t lv_roller_mode_t; -#endif /*DOXYGEN*/ - -typedef struct { - lv_obj_t obj; - uint32_t option_cnt; /**< Number of options*/ - uint32_t sel_opt_id; /**< Index of the current option*/ - uint32_t sel_opt_id_ori; /**< Store the original index on focus*/ - uint32_t inf_page_cnt; /**< Number of extra pages added to make the roller look infinite */ - lv_roller_mode_t mode : 1; - uint32_t moved : 1; -} lv_roller_t; +} lv_roller_mode_t; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_roller_class; diff --git a/src/widgets/roller/lv_roller_private.h b/src/widgets/roller/lv_roller_private.h new file mode 100644 index 000000000..f648d70e7 --- /dev/null +++ b/src/widgets/roller/lv_roller_private.h @@ -0,0 +1,54 @@ +/** + * @file lv_roller_private.h + * + */ + +#ifndef LV_ROLLER_PRIVATE_H +#define LV_ROLLER_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_roller.h" + +#if LV_USE_ROLLER != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_roller_t { + lv_obj_t obj; + uint32_t option_cnt; /**< Number of options*/ + uint32_t sel_opt_id; /**< Index of the current option*/ + uint32_t sel_opt_id_ori; /**< Store the original index on focus*/ + uint32_t inf_page_cnt; /**< Number of extra pages added to make the roller look infinite */ + lv_roller_mode_t mode : 1; + uint32_t moved : 1; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_ROLLER != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_ROLLER_PRIVATE_H*/ diff --git a/src/widgets/scale/lv_scale.c b/src/widgets/scale/lv_scale.c index 24ee644e5..b6de17e90 100644 --- a/src/widgets/scale/lv_scale.c +++ b/src/widgets/scale/lv_scale.c @@ -6,7 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_scale.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_scale_private.h" #if LV_USE_SCALE != 0 #include "../../core/lv_group.h" @@ -325,7 +327,7 @@ lv_scale_section_t * lv_scale_add_section(lv_obj_t * obj) LV_ASSERT_OBJ(obj, MY_CLASS); lv_scale_t * scale = (lv_scale_t *)obj; - lv_scale_section_t * section = _lv_ll_ins_head(&scale->section_ll); + lv_scale_section_t * section = lv_ll_ins_head(&scale->section_ll); LV_ASSERT_MALLOC(section); if(section == NULL) return NULL; @@ -434,7 +436,7 @@ static void lv_scale_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_scale_t * scale = (lv_scale_t *)obj; - _lv_ll_init(&scale->section_ll, sizeof(lv_scale_section_t)); + lv_ll_init(&scale->section_ll, sizeof(lv_scale_section_t)); scale->total_tick_count = LV_SCALE_TOTAL_TICK_COUNT_DEFAULT; scale->major_tick_every = LV_SCALE_MAJOR_TICK_EVERY_DEFAULT; @@ -464,11 +466,11 @@ static void lv_scale_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_scale_t * scale = (lv_scale_t *)obj; lv_scale_section_t * section; while(scale->section_ll.head) { - section = _lv_ll_get_head(&scale->section_ll); - _lv_ll_remove(&scale->section_ll, section); + section = lv_ll_get_head(&scale->section_ll); + lv_ll_remove(&scale->section_ll, section); lv_free(section); } - _lv_ll_clear(&scale->section_ll); + lv_ll_clear(&scale->section_ll); LV_TRACE_OBJ_CREATE("finished"); } @@ -568,7 +570,7 @@ static void scale_draw_indicator(lv_obj_t * obj, lv_event_t * event) /* Overwrite label and tick properties if tick value is within section range */ lv_scale_section_t * section; - _LV_LL_READ_BACK(&scale->section_ll, section) { + LV_LL_READ_BACK(&scale->section_ll, section) { if(section->minor_range <= tick_value && section->major_range >= tick_value) { if(is_major_tick) { scale_set_indicator_label_properties(obj, &label_dsc, section->indicator_style); @@ -704,7 +706,7 @@ static void scale_calculate_main_compensation(lv_obj_t * obj) /* Overwrite label and tick properties if tick value is within section range */ lv_scale_section_t * section; - _LV_LL_READ_BACK(&scale->section_ll, section) { + LV_LL_READ_BACK(&scale->section_ll, section) { if(section->minor_range <= tick_value && section->major_range >= tick_value) { if(is_major_tick) { scale_set_line_properties(obj, &major_tick_dsc, section->indicator_style, LV_PART_INDICATOR); @@ -808,7 +810,7 @@ static void scale_draw_main(lv_obj_t * obj, lv_event_t * event) lv_draw_line(layer, &line_dsc); lv_scale_section_t * section; - _LV_LL_READ_BACK(&scale->section_ll, section) { + LV_LL_READ_BACK(&scale->section_ll, section) { lv_draw_line_dsc_t section_line_dsc; lv_draw_line_dsc_init(§ion_line_dsc); lv_obj_init_draw_line_dsc(obj, LV_PART_MAIN, §ion_line_dsc); @@ -873,7 +875,7 @@ static void scale_draw_main(lv_obj_t * obj, lv_event_t * event) lv_draw_arc(layer, &arc_dsc); lv_scale_section_t * section; - _LV_LL_READ_BACK(&scale->section_ll, section) { + LV_LL_READ_BACK(&scale->section_ll, section) { lv_draw_arc_dsc_t main_arc_section_dsc; lv_draw_arc_dsc_init(&main_arc_section_dsc); lv_obj_init_draw_arc_dsc(obj, LV_PART_MAIN, &main_arc_section_dsc); @@ -1158,11 +1160,11 @@ static void scale_set_line_properties(lv_obj_t * obj, lv_draw_line_dsc_t * line_ { if(section_style) { lv_style_value_t value; - lv_result_t res; + lv_style_res_t res; /* Line width */ res = lv_style_get_prop(section_style, LV_STYLE_LINE_WIDTH, &value); - if(res == LV_RESULT_OK) { + if(res == LV_STYLE_RES_FOUND) { line_dsc->width = (int32_t)value.num; } else { @@ -1171,7 +1173,7 @@ static void scale_set_line_properties(lv_obj_t * obj, lv_draw_line_dsc_t * line_ /* Line color */ res = lv_style_get_prop(section_style, LV_STYLE_LINE_COLOR, &value); - if(res == LV_RESULT_OK) { + if(res == LV_STYLE_RES_FOUND) { line_dsc->color = value.color; } else { @@ -1180,7 +1182,7 @@ static void scale_set_line_properties(lv_obj_t * obj, lv_draw_line_dsc_t * line_ /* Line opa */ res = lv_style_get_prop(section_style, LV_STYLE_LINE_OPA, &value); - if(res == LV_RESULT_OK) { + if(res == LV_STYLE_RES_FOUND) { line_dsc->opa = (lv_opa_t)value.num; } else { @@ -1207,11 +1209,11 @@ static void scale_set_arc_properties(lv_obj_t * obj, lv_draw_arc_dsc_t * arc_dsc { if(section_style) { lv_style_value_t value; - lv_result_t res; + lv_style_res_t res; /* Line width */ res = lv_style_get_prop(section_style, LV_STYLE_ARC_WIDTH, &value); - if(res == LV_RESULT_OK) { + if(res == LV_STYLE_RES_FOUND) { arc_dsc->width = (int32_t)value.num; } else { @@ -1220,7 +1222,7 @@ static void scale_set_arc_properties(lv_obj_t * obj, lv_draw_arc_dsc_t * arc_dsc /* Line color */ res = lv_style_get_prop(section_style, LV_STYLE_ARC_COLOR, &value); - if(res == LV_RESULT_OK) { + if(res == LV_STYLE_RES_FOUND) { arc_dsc->color = value.color; } else { @@ -1229,7 +1231,7 @@ static void scale_set_arc_properties(lv_obj_t * obj, lv_draw_arc_dsc_t * arc_dsc /* Line opa */ res = lv_style_get_prop(section_style, LV_STYLE_ARC_OPA, &value); - if(res == LV_RESULT_OK) { + if(res == LV_STYLE_RES_FOUND) { arc_dsc->opa = (lv_opa_t)value.num; } else { @@ -1257,11 +1259,11 @@ static void scale_set_indicator_label_properties(lv_obj_t * obj, lv_draw_label_d { if(indicator_section_style) { lv_style_value_t value; - lv_result_t res; + lv_style_res_t res; /* Text color */ res = lv_style_get_prop(indicator_section_style, LV_STYLE_TEXT_COLOR, &value); - if(res == LV_RESULT_OK) { + if(res == LV_STYLE_RES_FOUND) { label_dsc->color = value.color; } else { @@ -1270,7 +1272,7 @@ static void scale_set_indicator_label_properties(lv_obj_t * obj, lv_draw_label_d /* Text opa */ res = lv_style_get_prop(indicator_section_style, LV_STYLE_TEXT_OPA, &value); - if(res == LV_RESULT_OK) { + if(res == LV_STYLE_RES_FOUND) { label_dsc->opa = (lv_opa_t)value.num; } else { @@ -1279,7 +1281,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) { + if(res == LV_STYLE_RES_FOUND) { label_dsc->letter_space = (int32_t)value.num; } else { @@ -1288,7 +1290,7 @@ static void scale_set_indicator_label_properties(lv_obj_t * obj, lv_draw_label_d /* Text font */ res = lv_style_get_prop(indicator_section_style, LV_STYLE_TEXT_FONT, &value); - if(res == LV_RESULT_OK) { + if(res == LV_STYLE_RES_FOUND) { label_dsc->font = (const lv_font_t *)value.ptr; } else { @@ -1321,7 +1323,7 @@ static void scale_find_section_tick_idx(lv_obj_t * obj) const int32_t tick_value = lv_map(tick_idx, 0U, total_tick_count - 1, min_out, max_out); lv_scale_section_t * section; - _LV_LL_READ_BACK(&scale->section_ll, section) { + LV_LL_READ_BACK(&scale->section_ll, section) { if(section->minor_range <= tick_value && section->major_range >= tick_value) { if(LV_SCALE_TICK_IDX_DEFAULT_ID == section->first_tick_idx_in_section) { section->first_tick_idx_in_section = tick_idx; @@ -1434,7 +1436,7 @@ static void scale_store_section_line_tick_width_compensation(lv_obj_t * obj, con lv_scale_t * scale = (lv_scale_t *) obj; lv_scale_section_t * section; - _LV_LL_READ_BACK(&scale->section_ll, section) { + LV_LL_READ_BACK(&scale->section_ll, section) { if(section->minor_range <= tick_value && section->major_range >= tick_value) { if(is_major_tick) { scale_set_line_properties(obj, major_tick_dsc, section->indicator_style, LV_PART_INDICATOR); diff --git a/src/widgets/scale/lv_scale.h b/src/widgets/scale/lv_scale.h index d453b0237..c569cd535 100644 --- a/src/widgets/scale/lv_scale.h +++ b/src/widgets/scale/lv_scale.h @@ -44,53 +44,15 @@ LV_EXPORT_CONST_INT(LV_SCALE_LABEL_ENABLED_DEFAULT); /** * Scale mode */ -enum { +typedef enum { LV_SCALE_MODE_HORIZONTAL_TOP = 0x00U, LV_SCALE_MODE_HORIZONTAL_BOTTOM = 0x01U, LV_SCALE_MODE_VERTICAL_LEFT = 0x02U, LV_SCALE_MODE_VERTICAL_RIGHT = 0x04U, LV_SCALE_MODE_ROUND_INNER = 0x08U, LV_SCALE_MODE_ROUND_OUTER = 0x10U, - _LV_SCALE_MODE_LAST -}; -typedef uint32_t lv_scale_mode_t; - -typedef struct { - lv_style_t * main_style; - lv_style_t * indicator_style; - lv_style_t * items_style; - 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; - 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; - -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_scale_mode_t mode; - int32_t range_min; - int32_t range_max; - uint32_t total_tick_count : 15; - uint32_t major_tick_every : 15; - uint32_t label_enabled : 1; - uint32_t post_draw : 1; - uint32_t draw_ticks_on_top : 1; - /* Round scale */ - uint32_t angle_range; - int32_t rotation; - /* Private properties */ - int32_t custom_label_cnt; - int32_t last_tick_width; - int32_t first_tick_width; -} lv_scale_t; + LV_SCALE_MODE_LAST +} lv_scale_mode_t; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_scale_class; diff --git a/src/widgets/scale/lv_scale_private.h b/src/widgets/scale/lv_scale_private.h new file mode 100644 index 000000000..cc9363f76 --- /dev/null +++ b/src/widgets/scale/lv_scale_private.h @@ -0,0 +1,81 @@ +/** + * @file lv_scale_private.h + * + */ + +#ifndef LV_SCALE_PRIVATE_H +#define LV_SCALE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_scale.h" + +#if LV_USE_SCALE != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_scale_section_t { + lv_style_t * main_style; + lv_style_t * indicator_style; + lv_style_t * items_style; + 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; + 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; +}; + +struct lv_scale_t { + lv_obj_t obj; + lv_ll_t section_ll; /**< Linked list for the sections (stores lv_scale_section_t)*/ + const char ** txt_src; + lv_scale_mode_t mode; + int32_t range_min; + int32_t range_max; + uint32_t total_tick_count : 15; + uint32_t major_tick_every : 15; + uint32_t label_enabled : 1; + uint32_t post_draw : 1; + uint32_t draw_ticks_on_top : 1; + /* Round scale */ + uint32_t angle_range; + int32_t rotation; + /* Private properties */ + int32_t custom_label_cnt; + int32_t last_tick_width; + int32_t first_tick_width; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_SCALE != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SCALE_PRIVATE_H*/ diff --git a/src/widgets/slider/lv_slider.c b/src/widgets/slider/lv_slider.c index 2cce03ab2..31297577e 100644 --- a/src/widgets/slider/lv_slider.c +++ b/src/widgets/slider/lv_slider.c @@ -6,7 +6,11 @@ /********************* * INCLUDES *********************/ -#include "lv_slider.h" +#include "../../misc/lv_area_private.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_event_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_slider_private.h" #if LV_USE_SLIDER != 0 #include "../../misc/lv_assert.h" @@ -79,6 +83,59 @@ bool lv_slider_is_dragged(const lv_obj_t * obj) return slider->dragging; } +void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim) +{ + lv_bar_set_value(obj, value, anim); +} + +void lv_slider_set_left_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim) +{ + lv_bar_set_start_value(obj, value, anim); +} + +void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max) +{ + lv_bar_set_range(obj, min, max); +} + +void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode) +{ + lv_bar_set_mode(obj, (lv_bar_mode_t)mode); +} + +int32_t lv_slider_get_value(const lv_obj_t * obj) +{ + return lv_bar_get_value(obj); +} + +int32_t lv_slider_get_left_value(const lv_obj_t * obj) +{ + return lv_bar_get_start_value(obj); +} + +int32_t lv_slider_get_min_value(const lv_obj_t * obj) +{ + return lv_bar_get_min_value(obj); +} + +int32_t lv_slider_get_max_value(const lv_obj_t * obj) +{ + return lv_bar_get_max_value(obj); +} + +lv_slider_mode_t lv_slider_get_mode(lv_obj_t * slider) +{ + lv_bar_mode_t mode = lv_bar_get_mode(slider); + if(mode == LV_BAR_MODE_SYMMETRICAL) return LV_SLIDER_MODE_SYMMETRICAL; + else if(mode == LV_BAR_MODE_RANGE) return LV_SLIDER_MODE_RANGE; + else return LV_SLIDER_MODE_NORMAL; +} + +bool lv_slider_is_symmetrical(lv_obj_t * obj) +{ + return lv_bar_is_symmetrical(obj); +} + /********************** * STATIC FUNCTIONS **********************/ @@ -123,13 +180,13 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_area_t a; lv_area_copy(&a, &slider->right_knob_area); lv_area_increase(&a, ext_click_area, ext_click_area); - info->res = _lv_area_is_point_on(&a, info->point, 0); + info->res = lv_area_is_point_on(&a, info->point, 0); /*There's still a chance that there is a hit if there is another knob*/ if((info->res == false) && (type == LV_SLIDER_MODE_RANGE)) { lv_area_copy(&a, &slider->left_knob_area); lv_area_increase(&a, ext_click_area, ext_click_area); - info->res = _lv_area_is_point_on(&a, info->point, 0); + info->res = lv_area_is_point_on(&a, info->point, 0); } } else if(code == LV_EVENT_PRESSED) { diff --git a/src/widgets/slider/lv_slider.h b/src/widgets/slider/lv_slider.h index 6c83c14f0..5f08a5c58 100644 --- a/src/widgets/slider/lv_slider.h +++ b/src/widgets/slider/lv_slider.h @@ -29,27 +29,11 @@ extern "C" { /********************** * TYPEDEFS **********************/ -enum _lv_slider_mode_t { +typedef enum { LV_SLIDER_MODE_NORMAL = LV_BAR_MODE_NORMAL, LV_SLIDER_MODE_SYMMETRICAL = LV_BAR_MODE_SYMMETRICAL, LV_SLIDER_MODE_RANGE = LV_BAR_MODE_RANGE -}; - -#ifdef DOXYGEN -typedef _lv_slider_mode_t lv_slider_mode_t; -#else -typedef uint8_t lv_slider_mode_t; -#endif /*DOXYGEN*/ - -typedef struct { - lv_bar_t bar; /*Add the ancestor's type first*/ - lv_area_t left_knob_area; - lv_area_t right_knob_area; - lv_point_t pressed_point; - int32_t * value_to_set; /*Which bar value to set*/ - uint8_t dragging : 1; /*1: the slider is being dragged*/ - uint8_t left_knob_focus : 1; /*1: with encoder now the right knob can be adjusted*/ -} lv_slider_t; +} lv_slider_mode_t; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_slider_class; @@ -74,10 +58,7 @@ lv_obj_t * lv_slider_create(lv_obj_t * parent); * @param value the new value * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately */ -static inline void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim) -{ - lv_bar_set_value(obj, value, anim); -} +void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim); /** * Set a new value for the left knob of a slider @@ -85,10 +66,7 @@ static inline void lv_slider_set_value(lv_obj_t * obj, int32_t value, lv_anim_en * @param value new value * @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately */ -static inline void lv_slider_set_left_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim) -{ - lv_bar_set_start_value(obj, value, anim); -} +void lv_slider_set_left_value(lv_obj_t * obj, int32_t value, lv_anim_enable_t anim); /** * Set minimum and the maximum values of a bar @@ -96,20 +74,14 @@ static inline void lv_slider_set_left_value(lv_obj_t * obj, int32_t value, lv_an * @param min minimum value * @param max maximum value */ -static inline void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max) -{ - lv_bar_set_range(obj, min, max); -} +void lv_slider_set_range(lv_obj_t * obj, int32_t min, int32_t max); /** * Set the mode of slider. * @param obj pointer to a slider object * @param mode the mode of the slider. See ::lv_slider_mode_t */ -static inline void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode) -{ - lv_bar_set_mode(obj, (lv_bar_mode_t)mode); -} +void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode); /*===================== * Getter functions @@ -120,40 +92,28 @@ static inline void lv_slider_set_mode(lv_obj_t * obj, lv_slider_mode_t mode) * @param obj pointer to a slider object * @return the value of the main knob of the slider */ -static inline int32_t lv_slider_get_value(const lv_obj_t * obj) -{ - return lv_bar_get_value(obj); -} +int32_t lv_slider_get_value(const lv_obj_t * obj); /** * Get the value of the left knob of a slider * @param obj pointer to a slider object * @return the value of the left knob of the slider */ -static inline int32_t lv_slider_get_left_value(const lv_obj_t * obj) -{ - return lv_bar_get_start_value(obj); -} +int32_t lv_slider_get_left_value(const lv_obj_t * obj); /** * Get the minimum value of a slider * @param obj pointer to a slider object * @return the minimum value of the slider */ -static inline int32_t lv_slider_get_min_value(const lv_obj_t * obj) -{ - return lv_bar_get_min_value(obj); -} +int32_t lv_slider_get_min_value(const lv_obj_t * obj); /** * Get the maximum value of a slider * @param obj pointer to a slider object * @return the maximum value of the slider */ -static inline int32_t lv_slider_get_max_value(const lv_obj_t * obj) -{ - return lv_bar_get_max_value(obj); -} +int32_t lv_slider_get_max_value(const lv_obj_t * obj); /** * Give the slider is being dragged or not @@ -167,23 +127,14 @@ bool lv_slider_is_dragged(const lv_obj_t * obj); * @param slider pointer to a slider object * @return see ::lv_slider_mode_t */ -static inline lv_slider_mode_t lv_slider_get_mode(lv_obj_t * slider) -{ - lv_bar_mode_t mode = lv_bar_get_mode(slider); - if(mode == LV_BAR_MODE_SYMMETRICAL) return LV_SLIDER_MODE_SYMMETRICAL; - else if(mode == LV_BAR_MODE_RANGE) return LV_SLIDER_MODE_RANGE; - else return LV_SLIDER_MODE_NORMAL; -} +lv_slider_mode_t lv_slider_get_mode(lv_obj_t * slider); /** * Give the slider is in symmetrical mode or not * @param obj pointer to slider object * @return true: in symmetrical mode false : not in */ -static inline bool lv_slider_is_symmetrical(lv_obj_t * obj) -{ - return lv_bar_is_symmetrical(obj); -} +bool lv_slider_is_symmetrical(lv_obj_t * obj); /********************** * MACROS diff --git a/src/widgets/slider/lv_slider_private.h b/src/widgets/slider/lv_slider_private.h new file mode 100644 index 000000000..ad1d7e792 --- /dev/null +++ b/src/widgets/slider/lv_slider_private.h @@ -0,0 +1,55 @@ +/** + * @file lv_slider_private.h + * + */ + +#ifndef LV_SLIDER_PRIVATE_H +#define LV_SLIDER_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../bar/lv_bar_private.h" +#include "lv_slider.h" + +#if LV_USE_SLIDER != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_slider_t { + lv_bar_t bar; /*Add the ancestor's type first*/ + lv_area_t left_knob_area; + lv_area_t right_knob_area; + lv_point_t pressed_point; + int32_t * value_to_set; /*Which bar value to set*/ + uint8_t dragging : 1; /*1: the slider is being dragged*/ + uint8_t left_knob_focus : 1; /*1: with encoder now the right knob can be adjusted*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_SLIDER != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SLIDER_PRIVATE_H*/ diff --git a/src/widgets/span/lv_span.c b/src/widgets/span/lv_span.c index df38d4431..5e5291008 100644 --- a/src/widgets/span/lv_span.c +++ b/src/widgets/span/lv_span.c @@ -6,7 +6,10 @@ /********************* * INCLUDES *********************/ -#include "lv_span.h" +#include "../../misc/lv_area_private.h" +#include "../../draw/lv_draw_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_span_private.h" #if LV_USE_SPAN != 0 @@ -51,7 +54,7 @@ static const lv_font_t * lv_span_get_style_text_font(lv_obj_t * par, lv_span_t * 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); +static lv_blend_mode_t lv_span_get_style_text_blend_mode(lv_obj_t * par, lv_span_t * span); 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); @@ -117,7 +120,7 @@ lv_span_t * lv_spangroup_new_span(lv_obj_t * obj) LV_ASSERT_OBJ(obj, MY_CLASS); lv_spangroup_t * spans = (lv_spangroup_t *)obj; - lv_span_t * span = _lv_ll_ins_tail(&spans->child_ll); + lv_span_t * span = lv_ll_ins_tail(&spans->child_ll); LV_ASSERT_MALLOC(span); lv_style_init(&span->style); @@ -139,9 +142,9 @@ void lv_spangroup_delete_span(lv_obj_t * obj, lv_span_t * span) LV_ASSERT_OBJ(obj, MY_CLASS); lv_spangroup_t * spans = (lv_spangroup_t *)obj; lv_span_t * cur_span; - _LV_LL_READ(&spans->child_ll, cur_span) { + LV_LL_READ(&spans->child_ll, cur_span) { if(cur_span == span) { - _lv_ll_remove(&spans->child_ll, cur_span); + lv_ll_remove(&spans->child_ll, cur_span); if(cur_span->txt && cur_span->static_flag == 0) { lv_free(cur_span->txt); cur_span->txt = NULL; @@ -211,7 +214,7 @@ void lv_spangroup_set_overflow(lv_obj_t * obj, lv_span_overflow_t overflow) LV_ASSERT_OBJ(obj, MY_CLASS); lv_spangroup_t * spans = (lv_spangroup_t *)obj; if(spans->overflow == overflow) return; - if(overflow >= _LV_SPAN_OVERFLOW_LAST) return; + if(overflow >= LV_SPAN_OVERFLOW_LAST) return; spans->overflow = overflow; lv_obj_invalidate(obj); } @@ -232,7 +235,7 @@ void lv_spangroup_set_mode(lv_obj_t * obj, lv_span_mode_t mode) LV_ASSERT_OBJ(obj, MY_CLASS); lv_spangroup_t * spans = (lv_spangroup_t *)obj; - if(mode >= _LV_SPAN_MODE_LAST) return; + if(mode >= LV_SPAN_MODE_LAST) return; spans->mode = mode; lv_spangroup_refr_mode(obj); @@ -250,6 +253,11 @@ void lv_spangroup_set_max_lines(lv_obj_t * obj, int32_t lines) * Getter functions *====================*/ +lv_style_t * lv_span_get_style(lv_span_t * span) +{ + return &span->style; +} + lv_span_t * lv_spangroup_get_child(const lv_obj_t * obj, int32_t id) { if(obj == NULL) { @@ -275,11 +283,11 @@ lv_span_t * lv_spangroup_get_child(const lv_obj_t * obj, int32_t id) return (lv_span_t *) cur_node; } if(traverse_forwards) { - cur_node = (lv_ll_node_t *) _lv_ll_get_next(linked_list, cur_node); + cur_node = (lv_ll_node_t *) lv_ll_get_next(linked_list, cur_node); cur_idx++; } else { - cur_node = (lv_ll_node_t *) _lv_ll_get_prev(linked_list, cur_node); + cur_node = (lv_ll_node_t *) lv_ll_get_prev(linked_list, cur_node); cur_idx--; } } @@ -297,7 +305,7 @@ uint32_t lv_spangroup_get_span_count(const lv_obj_t * obj) LV_ASSERT_OBJ(obj, MY_CLASS); lv_spangroup_t * spans = (lv_spangroup_t *)obj; - return _lv_ll_get_len(&(spans->child_ll)); + return lv_ll_get_len(&(spans->child_ll)); } lv_text_align_t lv_spangroup_get_align(lv_obj_t * obj) @@ -374,7 +382,7 @@ int32_t lv_spangroup_get_max_line_height(lv_obj_t * obj) int32_t max_line_h = 0; lv_span_t * cur_span; - _LV_LL_READ(&spans->child_ll, cur_span) { + LV_LL_READ(&spans->child_ll, cur_span) { const lv_font_t * font = lv_span_get_style_text_font(obj, cur_span); int32_t line_h = lv_font_get_line_height(font); if(line_h > max_line_h) { @@ -390,14 +398,14 @@ uint32_t lv_spangroup_get_expand_width(lv_obj_t * obj, uint32_t max_width) LV_ASSERT_OBJ(obj, MY_CLASS); lv_spangroup_t * spans = (lv_spangroup_t *)obj; - if(_lv_ll_get_head(&spans->child_ll) == NULL) { + if(lv_ll_get_head(&spans->child_ll) == NULL) { return 0; } uint32_t width = LV_COORD_IS_PCT(spans->indent) ? 0 : spans->indent; lv_span_t * cur_span; int32_t letter_space = 0; - _LV_LL_READ(&spans->child_ll, cur_span) { + 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); uint32_t j = 0; @@ -421,7 +429,7 @@ 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; - if(_lv_ll_get_head(&spans->child_ll) == NULL || width <= 0) { + if(lv_ll_get_head(&spans->child_ll) == NULL || width <= 0) { return 0; } @@ -436,7 +444,7 @@ int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width) lv_point_t txt_pos; lv_point_set(&txt_pos, 0, indent); /* first line need add indent */ - lv_span_t * cur_span = _lv_ll_get_head(&spans->child_ll); + lv_span_t * cur_span = lv_ll_get_head(&spans->child_ll); const char * cur_txt = cur_span->txt; span_text_check(&cur_txt); uint32_t cur_txt_ofs = 0; @@ -454,7 +462,7 @@ int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width) while(1) { /* switch to the next span when current is end */ if(cur_txt[cur_txt_ofs] == '\0') { - cur_span = _lv_ll_get_next(&spans->child_ll, cur_span); + cur_span = lv_ll_get_next(&spans->child_ll, cur_span); if(cur_span == NULL) break; cur_txt = cur_span->txt; span_text_check(&cur_txt); @@ -480,7 +488,7 @@ int32_t lv_spangroup_get_expand_height(lv_obj_t * obj, int32_t width) /* break word deal width */ if(isfill && next_ofs > 0 && snippet_cnt > 0) { int32_t drawn_width = use_width; - if(_lv_ll_get_next(&spans->child_ll, cur_span) == NULL) { + if(lv_ll_get_next(&spans->child_ll, cur_span) == NULL) { drawn_width -= snippet.letter_space; } if(max_w < drawn_width) { @@ -534,7 +542,7 @@ static void lv_spangroup_constructor(const lv_obj_class_t * class_p, lv_obj_t * { LV_UNUSED(class_p); lv_spangroup_t * spans = (lv_spangroup_t *)obj; - _lv_ll_init(&spans->child_ll, sizeof(lv_span_t)); + lv_ll_init(&spans->child_ll, sizeof(lv_span_t)); spans->indent = 0; spans->lines = -1; spans->mode = LV_SPAN_MODE_EXPAND; @@ -548,16 +556,16 @@ static void lv_spangroup_destructor(const lv_obj_class_t * class_p, lv_obj_t * o { LV_UNUSED(class_p); lv_spangroup_t * spans = (lv_spangroup_t *)obj; - lv_span_t * cur_span = _lv_ll_get_head(&spans->child_ll); + lv_span_t * cur_span = lv_ll_get_head(&spans->child_ll); while(cur_span) { - _lv_ll_remove(&spans->child_ll, cur_span); + lv_ll_remove(&spans->child_ll, cur_span); if(cur_span->txt && cur_span->static_flag == 0) { lv_free(cur_span->txt); cur_span->txt = NULL; } lv_style_reset(&cur_span->style); lv_free(cur_span); - cur_span = _lv_ll_get_head(&spans->child_ll); + cur_span = lv_ll_get_head(&spans->child_ll); } } @@ -688,8 +696,8 @@ static const lv_font_t * lv_span_get_style_text_font(lv_obj_t * par, lv_span_t * { const lv_font_t * font; lv_style_value_t value; - lv_result_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_FONT, &value); - if(res != LV_RESULT_OK) { + lv_style_res_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_FONT, &value); + if(res != LV_STYLE_RES_FOUND) { font = lv_obj_get_style_text_font(par, LV_PART_MAIN); } else { @@ -702,8 +710,8 @@ static int32_t lv_span_get_style_text_letter_space(lv_obj_t * par, lv_span_t * s { 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) { + lv_style_res_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_LETTER_SPACE, &value); + if(res != LV_STYLE_RES_FOUND) { letter_space = lv_obj_get_style_text_letter_space(par, LV_PART_MAIN); } else { @@ -715,8 +723,8 @@ static int32_t lv_span_get_style_text_letter_space(lv_obj_t * par, lv_span_t * s static lv_color_t lv_span_get_style_text_color(lv_obj_t * par, lv_span_t * span) { lv_style_value_t value; - lv_result_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_COLOR, &value); - if(res != LV_RESULT_OK) { + lv_style_res_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_COLOR, &value); + if(res != LV_STYLE_RES_FOUND) { value.color = lv_obj_get_style_text_color(par, LV_PART_MAIN); } return value.color; @@ -726,8 +734,8 @@ static lv_opa_t lv_span_get_style_text_opa(lv_obj_t * par, lv_span_t * span) { lv_opa_t opa; lv_style_value_t value; - lv_result_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_OPA, &value); - if(res != LV_RESULT_OK) { + lv_style_res_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_OPA, &value); + if(res != LV_STYLE_RES_FOUND) { opa = (lv_opa_t)lv_obj_get_style_text_opa(par, LV_PART_MAIN); } else { @@ -740,8 +748,8 @@ static lv_blend_mode_t lv_span_get_style_text_blend_mode(lv_obj_t * par, lv_span { lv_blend_mode_t mode; lv_style_value_t value; - lv_result_t res = lv_style_get_prop(&span->style, LV_STYLE_BLEND_MODE, &value); - if(res != LV_RESULT_OK) { + lv_style_res_t res = lv_style_get_prop(&span->style, LV_STYLE_BLEND_MODE, &value); + if(res != LV_STYLE_RES_FOUND) { mode = (lv_blend_mode_t)lv_obj_get_style_blend_mode(par, LV_PART_MAIN); } else { @@ -754,8 +762,8 @@ static int32_t lv_span_get_style_text_decor(lv_obj_t * par, lv_span_t * span) { int32_t decor; lv_style_value_t value; - lv_result_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_DECOR, &value); - if(res != LV_RESULT_OK) { + lv_style_res_t res = lv_style_get_prop(&span->style, LV_STYLE_TEXT_DECOR, &value); + if(res != LV_STYLE_RES_FOUND) { decor = (lv_text_decor_t)lv_obj_get_style_text_decor(par, LV_PART_MAIN);; } else { @@ -804,13 +812,13 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) lv_spangroup_t * spans = (lv_spangroup_t *)obj; /* return if not span */ - if(_lv_ll_get_head(&spans->child_ll) == NULL) { + if(lv_ll_get_head(&spans->child_ll) == NULL) { return; } /* return if no draw area */ lv_area_t clip_area; - if(!_lv_area_intersect(&clip_area, &coords, &layer->_clip_area)) return; + if(!lv_area_intersect(&clip_area, &coords, &layer->_clip_area)) return; const lv_area_t clip_area_ori = layer->_clip_area; layer->_clip_area = clip_area; @@ -827,7 +835,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) txt_pos.y = coords.y1; txt_pos.x = coords.x1 + indent; /* first line need add indent */ - lv_span_t * cur_span = _lv_ll_get_head(&spans->child_ll); + lv_span_t * cur_span = lv_ll_get_head(&spans->child_ll); const char * cur_txt = cur_span->txt; span_text_check(&cur_txt); uint32_t cur_txt_ofs = 0; @@ -850,7 +858,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) while(1) { /* switch to the next span when current is end */ if(cur_txt[cur_txt_ofs] == '\0') { - cur_span = _lv_ll_get_next(&spans->child_ll, cur_span); + cur_span = lv_ll_get_next(&spans->child_ll, cur_span); if(cur_span == NULL) break; cur_txt = cur_span->txt; span_text_check(&cur_txt); @@ -876,7 +884,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) if(isfill) { if(next_ofs > 0 && lv_get_snippet_count() > 0) { int32_t drawn_width = use_width; - if(_lv_ll_get_next(&spans->child_ll, cur_span) == NULL) { + if(lv_ll_get_next(&spans->child_ll, cur_span) == NULL) { drawn_width -= snippet.letter_space; } /* To prevent infinite loops, the lv_text_get_next_line() may return incomplete words, */ @@ -925,7 +933,7 @@ static void lv_draw_span(lv_obj_t * obj, lv_layer_t * layer) 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); + lv_span_t * next_span = lv_ll_get_next(&spans->child_ll, last_snippet->span); if(next_span) { /* have the next line */ next_line_h = lv_font_get_line_height(lv_span_get_style_text_font(obj, next_span)) + line_space; } diff --git a/src/widgets/span/lv_span.h b/src/widgets/span/lv_span.h index 0b0386913..2eed5888b 100644 --- a/src/widgets/span/lv_span.h +++ b/src/widgets/span/lv_span.h @@ -28,50 +28,18 @@ extern "C" { /********************** * TYPEDEFS **********************/ -enum _lv_span_overflow_t { +typedef enum { LV_SPAN_OVERFLOW_CLIP, LV_SPAN_OVERFLOW_ELLIPSIS, - _LV_SPAN_OVERFLOW_LAST, /**< Fence member*/ -}; + LV_SPAN_OVERFLOW_LAST, /**< Fence member*/ +} lv_span_overflow_t; -#ifdef DOXYGEN -typedef _lv_span_overflow_t lv_span_overflow_t; -#else -typedef uint32_t lv_span_overflow_t; -#endif /*DOXYGEN*/ - -enum _lv_span_mode_t { +typedef enum { LV_SPAN_MODE_FIXED, /**< fixed the obj size*/ LV_SPAN_MODE_EXPAND, /**< Expand the object size to the text size*/ LV_SPAN_MODE_BREAK, /**< Keep width, break the too long lines and expand height*/ - _LV_SPAN_MODE_LAST /**< Fence member*/ -}; - -#ifdef DOXYGEN -typedef _lv_span_mode_t lv_span_mode_t; -#else -typedef uint32_t lv_span_mode_t; -#endif /*DOXYGEN*/ - -typedef struct { - char * txt; /* a pointer to display text */ - lv_obj_t * spangroup; /* a pointer to spangroup */ - lv_style_t style; /* display text style */ - uint32_t static_flag : 1;/* the text is static flag */ -} lv_span_t; - -/** Data of label*/ -typedef struct { - lv_obj_t obj; - int32_t lines; - 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 */ - uint32_t refresh : 1; /* the spangroup need refresh cache_w and cache_h */ -} lv_spangroup_t; + LV_SPAN_MODE_LAST /**< Fence member*/ +} lv_span_mode_t; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spangroup_class; @@ -162,6 +130,13 @@ void lv_spangroup_set_max_lines(lv_obj_t * obj, int32_t lines); *====================*/ /** + * Get a pointer to the style of a span + * @param span pointer to the span + * @return pointer to the style. valid as long as the span is valid +*/ +lv_style_t * lv_span_get_style(lv_span_t * span); + +/** * Get a spangroup child by its index. * * @param obj The spangroup object diff --git a/src/widgets/span/lv_span_private.h b/src/widgets/span/lv_span_private.h new file mode 100644 index 000000000..1fb031fe3 --- /dev/null +++ b/src/widgets/span/lv_span_private.h @@ -0,0 +1,65 @@ +/** + * @file lv_span_private.h + * + */ + +#ifndef LV_SPAN_PRIVATE_H +#define LV_SPAN_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_span.h" + +#if LV_USE_SPAN != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_span_t { + char * txt; /* a pointer to display text */ + lv_obj_t * spangroup; /* a pointer to spangroup */ + lv_style_t style; /* display text style */ + uint32_t static_flag : 1;/* the text is static flag */ +}; + +/** Data of label*/ +struct lv_spangroup_t { + lv_obj_t obj; + int32_t lines; + 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 */ + uint32_t refresh : 1; /* the spangroup need refresh cache_w and cache_h */ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_SPAN != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SPAN_PRIVATE_H*/ diff --git a/src/widgets/spinbox/lv_spinbox.c b/src/widgets/spinbox/lv_spinbox.c index 667c310b3..5ee9f465b 100644 --- a/src/widgets/spinbox/lv_spinbox.c +++ b/src/widgets/spinbox/lv_spinbox.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_spinbox.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_spinbox_private.h" #if LV_USE_SPINBOX #include "../../misc/lv_assert.h" diff --git a/src/widgets/spinbox/lv_spinbox.h b/src/widgets/spinbox/lv_spinbox.h index 267026f2e..ae3fdb0c4 100644 --- a/src/widgets/spinbox/lv_spinbox.h +++ b/src/widgets/spinbox/lv_spinbox.h @@ -31,20 +31,6 @@ extern "C" { * TYPEDEFS **********************/ -/*Data of spinbox*/ -typedef struct { - lv_textarea_t ta; /*Ext. of ancestor*/ - /*New data for this type*/ - int32_t value; - int32_t range_max; - int32_t range_min; - int32_t step; - uint32_t digit_count : 4; - uint32_t dec_point_pos : 4; /*if 0, there is no separator and the number is an integer*/ - uint32_t rollover : 1; /* Set to true for rollover functionality*/ - uint32_t digit_step_dir : 2; /* the direction the digit will step on encoder button press when editing*/ -} lv_spinbox_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_spinbox_class; /********************** diff --git a/src/widgets/spinbox/lv_spinbox_private.h b/src/widgets/spinbox/lv_spinbox_private.h new file mode 100644 index 000000000..50333a8cb --- /dev/null +++ b/src/widgets/spinbox/lv_spinbox_private.h @@ -0,0 +1,59 @@ +/** + * @file lv_spinbox_private.h + * + */ + +#ifndef LV_SPINBOX_PRIVATE_H +#define LV_SPINBOX_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../textarea/lv_textarea_private.h" +#include "lv_spinbox.h" + +#if LV_USE_SPINBOX + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of spinbox*/ +struct lv_spinbox_t { + lv_textarea_t ta; /*Ext. of ancestor*/ + /*New data for this type*/ + int32_t value; + int32_t range_max; + int32_t range_min; + int32_t step; + uint32_t digit_count : 4; + uint32_t dec_point_pos : 4; /*if 0, there is no separator and the number is an integer*/ + uint32_t rollover : 1; /* Set to true for rollover functionality*/ + uint32_t digit_step_dir : 2; /* the direction the digit will step on encoder button press when editing*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_SPINBOX */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SPINBOX_PRIVATE_H*/ diff --git a/src/widgets/spinner/lv_spinner.c b/src/widgets/spinner/lv_spinner.c index 9b1daa8ef..18cb0050f 100644 --- a/src/widgets/spinner/lv_spinner.c +++ b/src/widgets/spinner/lv_spinner.c @@ -6,6 +6,8 @@ /********************* * INCLUDES *********************/ +#include "../../misc/lv_anim_private.h" +#include "../../core/lv_obj_class_private.h" #include "../../lvgl.h" #if LV_USE_SPINNER diff --git a/src/widgets/switch/lv_switch.c b/src/widgets/switch/lv_switch.c index f1973e9c4..8aa6bbe4e 100644 --- a/src/widgets/switch/lv_switch.c +++ b/src/widgets/switch/lv_switch.c @@ -6,13 +6,15 @@ /********************* * INCLUDES *********************/ -#include "lv_switch.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_switch_private.h" #if LV_USE_SWITCH != 0 #include "../../misc/lv_assert.h" #include "../../misc/lv_math.h" -#include "../../misc/lv_anim.h" +#include "../../misc/lv_anim_private.h" #include "../../indev/lv_indev.h" #include "../../display/lv_display.h" @@ -127,7 +129,7 @@ static void lv_switch_event(const lv_obj_class_t * class_p, lv_event_t * e) /*The smaller size is the knob diameter*/ 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_SWITCH_KNOB_EXT_AREA_CORRECTION; knob_size += lv_obj_calculate_ext_draw_size(obj, LV_PART_KNOB); int32_t * s = lv_event_get_param(e); diff --git a/src/widgets/switch/lv_switch.h b/src/widgets/switch/lv_switch.h index da14450aa..989a3dd1b 100644 --- a/src/widgets/switch/lv_switch.h +++ b/src/widgets/switch/lv_switch.h @@ -24,16 +24,7 @@ extern "C" { *********************/ /** Switch knob extra area correction factor */ -#define _LV_SWITCH_KNOB_EXT_AREA_CORRECTION 2 - -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_obj_t obj; - int32_t anim_state; -} lv_switch_t; +#define LV_SWITCH_KNOB_EXT_AREA_CORRECTION 2 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_switch_class; diff --git a/src/widgets/switch/lv_switch_private.h b/src/widgets/switch/lv_switch_private.h new file mode 100644 index 000000000..7f43d37b1 --- /dev/null +++ b/src/widgets/switch/lv_switch_private.h @@ -0,0 +1,53 @@ +/** + * @file lv_switch_private.h + * + */ + +#ifndef LV_SWITCH_PRIVATE_H +#define LV_SWITCH_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_switch.h" + +#if LV_USE_SWITCH != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_switch_t { + lv_obj_t obj; + int32_t anim_state; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_SWITCH != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_SWITCH_PRIVATE_H*/ diff --git a/src/widgets/table/lv_table.c b/src/widgets/table/lv_table.c index 733fe04f7..a55c0fc7e 100644 --- a/src/widgets/table/lv_table.c +++ b/src/widgets/table/lv_table.c @@ -6,7 +6,10 @@ /********************* * INCLUDES *********************/ -#include "lv_table.h" +#include "../../misc/lv_area_private.h" +#include "../../core/lv_obj_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_table_private.h" #if LV_USE_TABLE != 0 #include "../../indev/lv_indev.h" @@ -15,7 +18,7 @@ #include "../../misc/lv_text_ap.h" #include "../../misc/lv_math.h" #include "../../stdlib/lv_sprintf.h" -#include "../../draw/lv_draw.h" +#include "../../draw/lv_draw_private.h" #include "../../stdlib/lv_string.h" /********************* @@ -166,14 +169,14 @@ void lv_table_set_cell_value_fmt(lv_obj_t * obj, uint32_t row, uint32_t col, con lv_vsnprintf(raw_txt, len + 1, fmt, ap2); /*Get the size of the Arabic text and process it*/ - size_t len_ap = _lv_text_ap_calc_bytes_count(raw_txt); + size_t len_ap = lv_text_ap_calc_bytes_count(raw_txt); table->cell_data[cell] = lv_realloc(table->cell_data[cell], sizeof(lv_table_cell_t) + len_ap + 1); LV_ASSERT_MALLOC(table->cell_data[cell]); if(table->cell_data[cell] == NULL) { va_end(ap2); return; } - _lv_text_ap_proc(raw_txt, table->cell_data[cell]->txt); + lv_text_ap_proc(raw_txt, table->cell_data[cell]->txt); lv_free(raw_txt); #else @@ -671,7 +674,7 @@ static void draw_main(lv_event_t * e) lv_table_t * table = (lv_table_t *)obj; lv_layer_t * layer = lv_event_get_layer(e); lv_area_t clip_area; - if(!_lv_area_intersect(&clip_area, &obj->coords, &layer->_clip_area)) return; + if(!lv_area_intersect(&clip_area, &obj->coords, &layer->_clip_area)) return; const lv_area_t clip_area_ori = layer->_clip_area; layer->_clip_area = clip_area; @@ -837,7 +840,7 @@ static void draw_main(lv_event_t * e) lv_area_t label_clip_area; bool label_mask_ok; - label_mask_ok = _lv_area_intersect(&label_clip_area, &clip_area, &cell_area); + label_mask_ok = lv_area_intersect(&label_clip_area, &clip_area, &cell_area); if(label_mask_ok) { layer->_clip_area = label_clip_area; label_dsc_act.text = table->cell_data[cell]->txt; @@ -1037,7 +1040,7 @@ static size_t get_cell_txt_len(const char * txt) size_t retval = 0; #if LV_USE_ARABIC_PERSIAN_CHARS - retval = sizeof(lv_table_cell_t) + _lv_text_ap_calc_bytes_count(txt) + 1; + retval = sizeof(lv_table_cell_t) + lv_text_ap_calc_bytes_count(txt) + 1; #else retval = sizeof(lv_table_cell_t) + lv_strlen(txt) + 1; #endif @@ -1049,7 +1052,7 @@ static size_t get_cell_txt_len(const char * txt) static void copy_cell_txt(lv_table_cell_t * dst, const char * txt) { #if LV_USE_ARABIC_PERSIAN_CHARS - _lv_text_ap_proc(txt, dst->txt); + lv_text_ap_proc(txt, dst->txt); #else lv_strcpy(dst->txt, txt); #endif diff --git a/src/widgets/table/lv_table.h b/src/widgets/table/lv_table.h index c257996ee..0d615a1b1 100644 --- a/src/widgets/table/lv_table.h +++ b/src/widgets/table/lv_table.h @@ -33,39 +33,14 @@ LV_EXPORT_CONST_INT(LV_TABLE_CELL_NONE); * TYPEDEFS **********************/ -enum _lv_table_cell_ctrl_t { +typedef enum { LV_TABLE_CELL_CTRL_MERGE_RIGHT = 1 << 0, LV_TABLE_CELL_CTRL_TEXT_CROP = 1 << 1, LV_TABLE_CELL_CTRL_CUSTOM_1 = 1 << 4, LV_TABLE_CELL_CTRL_CUSTOM_2 = 1 << 5, LV_TABLE_CELL_CTRL_CUSTOM_3 = 1 << 6, LV_TABLE_CELL_CTRL_CUSTOM_4 = 1 << 7, -}; - -#ifdef DOXYGEN -typedef _lv_table_cell_ctrl_t lv_table_cell_ctrl_t; -#else -typedef uint32_t lv_table_cell_ctrl_t; -#endif /*DOXYGEN*/ - -/*Data of cell*/ -typedef struct { - lv_table_cell_ctrl_t ctrl; - void * user_data; /**< Custom user data*/ - char txt[1]; /**< Variable length array*/ -} lv_table_cell_t; - -/*Data of table*/ -typedef struct { - lv_obj_t obj; - uint32_t col_cnt; - uint32_t row_cnt; - lv_table_cell_t ** cell_data; - int32_t * row_h; - int32_t * col_w; - uint32_t col_act; - uint32_t row_act; -} lv_table_t; +} lv_table_cell_ctrl_t; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_table_class; diff --git a/src/widgets/table/lv_table_private.h b/src/widgets/table/lv_table_private.h new file mode 100644 index 000000000..410db7092 --- /dev/null +++ b/src/widgets/table/lv_table_private.h @@ -0,0 +1,63 @@ +/** + * @file lv_table_private.h + * + */ + +#ifndef LV_TABLE_PRIVATE_H +#define LV_TABLE_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "lv_table.h" + +#if LV_USE_TABLE != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of cell*/ +struct lv_table_cell_t { + lv_table_cell_ctrl_t ctrl; + void * user_data; /**< Custom user data*/ + char txt[1]; /**< Variable length array*/ +}; + +/*Data of table*/ +struct lv_table_t { + lv_obj_t obj; + uint32_t col_cnt; + uint32_t row_cnt; + lv_table_cell_t ** cell_data; + int32_t * row_h; + int32_t * col_w; + uint32_t col_act; + uint32_t row_act; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_TABLE != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TABLE_PRIVATE_H*/ diff --git a/src/widgets/tabview/lv_tabview.c b/src/widgets/tabview/lv_tabview.c index e6bd36805..29e3e2e27 100644 --- a/src/widgets/tabview/lv_tabview.c +++ b/src/widgets/tabview/lv_tabview.c @@ -6,6 +6,8 @@ /********************* * INCLUDES *********************/ +#include "lv_tabview_private.h" +#include "../../core/lv_obj_class_private.h" #include "../../lvgl.h" #if LV_USE_TABVIEW @@ -168,6 +170,11 @@ void lv_tabview_set_tab_bar_position(lv_obj_t * obj, lv_dir_t dir) case LV_DIR_RIGHT: lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW_REVERSE); break; + case LV_DIR_HOR: + case LV_DIR_VER: + case LV_DIR_ALL: + case LV_DIR_NONE: + break; } lv_obj_t * tab_bar = lv_tabview_get_tab_bar(obj); @@ -192,6 +199,11 @@ void lv_tabview_set_tab_bar_position(lv_obj_t * obj, lv_dir_t dir) lv_obj_set_scroll_snap_x(cont, LV_SCROLL_SNAP_NONE); lv_obj_set_scroll_snap_y(cont, LV_SCROLL_SNAP_CENTER); break; + case LV_DIR_HOR: + case LV_DIR_VER: + case LV_DIR_ALL: + case LV_DIR_NONE: + break; } bool was_ver = tabview->tab_pos & LV_DIR_VER; diff --git a/src/widgets/tabview/lv_tabview.h b/src/widgets/tabview/lv_tabview.h index edb464d8d..e5cb0c3ae 100644 --- a/src/widgets/tabview/lv_tabview.h +++ b/src/widgets/tabview/lv_tabview.h @@ -22,16 +22,6 @@ extern "C" { * DEFINES *********************/ -/********************** - * TYPEDEFS - **********************/ - -typedef struct { - lv_obj_t obj; - uint32_t tab_cur; - lv_dir_t tab_pos; -} lv_tabview_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tabview_class; /********************** diff --git a/src/widgets/tabview/lv_tabview_private.h b/src/widgets/tabview/lv_tabview_private.h new file mode 100644 index 000000000..b08c96820 --- /dev/null +++ b/src/widgets/tabview/lv_tabview_private.h @@ -0,0 +1,55 @@ +/** + * @file lv_tabview_private.h + * + */ + +#ifndef LV_TABVIEW_PRIVATE_H +#define LV_TABVIEW_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_tabview.h" + +#if LV_USE_TABVIEW + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ + +struct lv_tabview_t { + lv_obj_t obj; + uint32_t tab_cur; + lv_dir_t tab_pos; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_TABVIEW */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TABVIEW_PRIVATE_H*/ diff --git a/src/widgets/textarea/lv_textarea.c b/src/widgets/textarea/lv_textarea.c index 51574677e..2aa64501e 100644 --- a/src/widgets/textarea/lv_textarea.c +++ b/src/widgets/textarea/lv_textarea.c @@ -6,7 +6,9 @@ /********************* * INCLUDES *********************/ -#include "lv_textarea.h" +#include "../label/lv_label_private.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_textarea_private.h" #if LV_USE_TEXTAREA != 0 #include "../../core/lv_group.h" @@ -14,7 +16,7 @@ #include "../../indev/lv_indev.h" #include "../../draw/lv_draw.h" #include "../../misc/lv_assert.h" -#include "../../misc/lv_anim.h" +#include "../../misc/lv_anim_private.h" #include "../../misc/lv_text_private.h" #include "../../misc/lv_math.h" #include "../../stdlib/lv_string.h" diff --git a/src/widgets/textarea/lv_textarea.h b/src/widgets/textarea/lv_textarea.h index ab90c63bd..b3007a1a5 100644 --- a/src/widgets/textarea/lv_textarea.h +++ b/src/widgets/textarea/lv_textarea.h @@ -33,36 +33,6 @@ LV_EXPORT_CONST_INT(LV_TEXTAREA_CURSOR_LAST); * TYPEDEFS **********************/ -/*Data of text area*/ -typedef struct { - lv_obj_t obj; - lv_obj_t * label; /*Label of the text area*/ - char * placeholder_txt; /*Place holder label. only visible if text is an empty string*/ - char * pwd_tmp; /*Used to store the original text in password mode*/ - char * pwd_bullet; /*Replacement characters displayed in password mode*/ - const char * accepted_chars; /*Only these characters will be accepted. NULL: accept all*/ - 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 { - 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 ...)*/ - lv_area_t area; /*Cursor area relative to the Text Area*/ - uint32_t txt_byte_pos; /*Byte index of the letter after (on) the cursor*/ - uint8_t show : 1; /*Cursor is visible now or not (Handled by the library)*/ - uint8_t click_pos : 1; /*1: Enable positioning the cursor by clicking the text area*/ - } cursor; -#if LV_LABEL_TEXT_SELECTION - uint32_t sel_start; /*Temporary values for text selection*/ - uint32_t sel_end; - uint8_t text_sel_in_prog : 1; /*User is in process of selecting*/ - uint8_t text_sel_en : 1; /*Text can be selected on this text area*/ -#endif - uint8_t pwd_mode : 1; /*Replace characters with '*'*/ - uint8_t one_line : 1; /*One line mode (ignore line breaks)*/ -} lv_textarea_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_textarea_class; enum { diff --git a/src/widgets/textarea/lv_textarea_private.h b/src/widgets/textarea/lv_textarea_private.h new file mode 100644 index 000000000..e453de758 --- /dev/null +++ b/src/widgets/textarea/lv_textarea_private.h @@ -0,0 +1,75 @@ +/** + * @file lv_textarea_private.h + * + */ + +#ifndef LV_TEXTAREA_PRIVATE_H +#define LV_TEXTAREA_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_textarea.h" + +#if LV_USE_TEXTAREA != 0 + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/*Data of text area*/ +struct lv_textarea_t { + lv_obj_t obj; + lv_obj_t * label; /*Label of the text area*/ + char * placeholder_txt; /*Place holder label. only visible if text is an empty string*/ + char * pwd_tmp; /*Used to store the original text in password mode*/ + char * pwd_bullet; /*Replacement characters displayed in password mode*/ + const char * accepted_chars; /*Only these characters will be accepted. NULL: accept all*/ + 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 { + 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 ...)*/ + lv_area_t area; /*Cursor area relative to the Text Area*/ + uint32_t txt_byte_pos; /*Byte index of the letter after (on) the cursor*/ + uint8_t show : 1; /*Cursor is visible now or not (Handled by the library)*/ + uint8_t click_pos : 1; /*1: Enable positioning the cursor by clicking the text area*/ + } cursor; +#if LV_LABEL_TEXT_SELECTION + uint32_t sel_start; /*Temporary values for text selection*/ + uint32_t sel_end; + uint8_t text_sel_in_prog : 1; /*User is in process of selecting*/ + uint8_t text_sel_en : 1; /*Text can be selected on this text area*/ +#endif + uint8_t pwd_mode : 1; /*Replace characters with '*'*/ + uint8_t one_line : 1; /*One line mode (ignore line breaks)*/ +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_TEXTAREA != 0 */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TEXTAREA_PRIVATE_H*/ diff --git a/src/widgets/tileview/lv_tileview.c b/src/widgets/tileview/lv_tileview.c index 400ca15c7..86a5db3c3 100644 --- a/src/widgets/tileview/lv_tileview.c +++ b/src/widgets/tileview/lv_tileview.c @@ -6,7 +6,8 @@ /********************* * INCLUDES *********************/ -#include "lv_tileview.h" +#include "../../core/lv_obj_class_private.h" +#include "lv_tileview_private.h" #include "../../indev/lv_indev.h" #include "../../indev/lv_indev_private.h" #if LV_USE_TILEVIEW diff --git a/src/widgets/tileview/lv_tileview.h b/src/widgets/tileview/lv_tileview.h index 6413a1b15..d373a2684 100644 --- a/src/widgets/tileview/lv_tileview.h +++ b/src/widgets/tileview/lv_tileview.h @@ -21,19 +21,6 @@ extern "C" { * DEFINES *********************/ -/********************** - * TYPEDEFS - **********************/ -typedef struct { - lv_obj_t obj; - lv_obj_t * tile_act; -} lv_tileview_t; - -typedef struct { - lv_obj_t obj; - lv_dir_t dir; -} lv_tileview_tile_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tileview_class; LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tileview_tile_class; diff --git a/src/widgets/tileview/lv_tileview_private.h b/src/widgets/tileview/lv_tileview_private.h new file mode 100644 index 000000000..5c91a409e --- /dev/null +++ b/src/widgets/tileview/lv_tileview_private.h @@ -0,0 +1,58 @@ +/** + * @file lv_tileview_private.h + * + */ + +#ifndef LV_TILEVIEW_PRIVATE_H +#define LV_TILEVIEW_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_tileview.h" + +#if LV_USE_TILEVIEW + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ +struct lv_tileview_t { + lv_obj_t obj; + lv_obj_t * tile_act; +}; + +struct lv_tileview_tile_t { + lv_obj_t obj; + lv_dir_t dir; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_TILEVIEW */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_TILEVIEW_PRIVATE_H*/ diff --git a/src/widgets/win/lv_win.c b/src/widgets/win/lv_win.c index 437b3af48..508d2f010 100644 --- a/src/widgets/win/lv_win.c +++ b/src/widgets/win/lv_win.c @@ -6,6 +6,8 @@ /********************* * INCLUDES *********************/ +#include "lv_win_private.h" +#include "../../core/lv_obj_class_private.h" #include "../../lvgl.h" #if LV_USE_WIN diff --git a/src/widgets/win/lv_win.h b/src/widgets/win/lv_win.h index 0f6d5a4ce..8191bd116 100644 --- a/src/widgets/win/lv_win.h +++ b/src/widgets/win/lv_win.h @@ -14,18 +14,12 @@ extern "C" { * INCLUDES *********************/ #include "../../lv_conf_internal.h" +#include "../../core/lv_obj.h" #if LV_USE_WIN /********************* * DEFINES *********************/ -/********************** - * TYPEDEFS - **********************/ -typedef struct { - lv_obj_t obj; -} lv_win_t; - LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_win_class; /********************** diff --git a/src/widgets/win/lv_win_private.h b/src/widgets/win/lv_win_private.h new file mode 100644 index 000000000..015224712 --- /dev/null +++ b/src/widgets/win/lv_win_private.h @@ -0,0 +1,52 @@ +/** + * @file lv_win_private.h + * + */ + +#ifndef LV_WIN_PRIVATE_H +#define LV_WIN_PRIVATE_H + +#ifdef __cplusplus +extern "C" { +#endif + +/********************* + * INCLUDES + *********************/ + +#include "../../core/lv_obj_private.h" +#include "lv_win.h" + +#if LV_USE_WIN + +/********************* + * DEFINES + *********************/ + +/********************** + * TYPEDEFS + **********************/ + +/********************** + * TYPEDEFS + **********************/ +struct lv_win_t { + lv_obj_t obj; +}; + + +/********************** + * GLOBAL PROTOTYPES + **********************/ + +/********************** + * MACROS + **********************/ + +#endif /* LV_USE_WIN */ + +#ifdef __cplusplus +} /*extern "C"*/ +#endif + +#endif /*LV_WIN_PRIVATE_H*/ |