Merge branch 'dev-7.0' into hamidrm-dev-7.0

This commit is contained in:
Gabor Kiss-Vamosi
2020-04-25 16:06:33 +02:00
79 changed files with 676 additions and 525 deletions
+17
View File
@@ -0,0 +1,17 @@
name: C/C++ CI
on:
push:
branches: [ dev-7.0 ]
pull_request:
branches: [ dev-7.0 ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run tests
run: cd tests; python ./build.py
+1 -1
View File
@@ -93,7 +93,7 @@ You can use the [Simulators](https://docs.littlevgl.com/en/html/get-started/pc-s
1. [Download](https://littlevgl.com/download) or [Clone](https://github.com/littlevgl/lvgl) the library
2. Copy the `lvgl` folder into your project
3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`.
3. Copy `lvgl/lv_conf_template.h` as `lv_conf.h` next to the `lvgl` folder and set at least `LV_HOR_RES_MAX`, `LV_VER_RES_MAX` and `LV_COLOR_DEPTH`. Don't forget to **change the `#if 0` statement near the top of the file to `#if 1`**, otherwise you will get compilation errors.
4. Include `lvgl/lvgl.h` where you need to use LittlevGL related functions.
5. Call `lv_tick_inc(x)` every `x` milliseconds **in a Timer or Task** (`x` should be between 1 and 10). It is required for the internal timing of LittlevGL.
6. Call `lv_init()`
-16
View File
@@ -1,16 +0,0 @@
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
trigger:
- dev-7.0
pool:
vmImage: 'ubuntu-latest'
steps:
- script: |
cd tests
python build.py
displayName: 'Build'
+4 -4
View File
@@ -56,7 +56,7 @@
/* Dot Per Inch: used to initialize default sizes.
* E.g. a button with width = LV_DPI / 2 -> half inch wide
* (Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI 100 /*[px]*/
#define LV_DPI 130 /*[px]*/
/* The the real width of the display changes some default values:
* default object sizes, layout of examples, etc.
@@ -65,9 +65,9 @@
* The 4th is extra large which has no upper limit so not listed here
* The upper limit of the categories are set below in 0.1 inch unit.
*/
#define LV_DISP_SMALL_LIMIT 20
#define LV_DISP_MEDIUM_LIMIT 45
#define LV_DISP_LARGE_LIMIT 65
#define LV_DISP_SMALL_LIMIT 30
#define LV_DISP_MEDIUM_LIMIT 50
#define LV_DISP_LARGE_LIMIT 70
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
typedef int16_t lv_coord_t;
+5
View File
@@ -31,6 +31,11 @@ extern "C" {
* V6.0 COMPATIBILITY
*--------------------*/
static inline void lv_task_once(lv_task_t *task)
{
lv_task_set_repeat_count(task, 1);
}
#if LV_USE_CHART
#define lv_chart_get_point_cnt lv_chart_get_point_count
+4 -4
View File
@@ -86,7 +86,7 @@
* E.g. a button with width = LV_DPI / 2 -> half inch wide
* (Not so important, you can adjust it to modify default sizes and spaces)*/
#ifndef LV_DPI
#define LV_DPI 100 /*[px]*/
#define LV_DPI 130 /*[px]*/
#endif
/* The the real width of the display changes some default values:
@@ -97,13 +97,13 @@
* The upper limit of the categories are set below in 0.1 inch unit.
*/
#ifndef LV_DISP_SMALL_LIMIT
#define LV_DISP_SMALL_LIMIT 20
#define LV_DISP_SMALL_LIMIT 30
#endif
#ifndef LV_DISP_MEDIUM_LIMIT
#define LV_DISP_MEDIUM_LIMIT 45
#define LV_DISP_MEDIUM_LIMIT 50
#endif
#ifndef LV_DISP_LARGE_LIMIT
#define LV_DISP_LARGE_LIMIT 65
#define LV_DISP_LARGE_LIMIT 70
#endif
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
+2 -1
View File
@@ -63,6 +63,7 @@ bool lv_debug_check_obj_type(const lv_obj_t * obj, const char * obj_type)
uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM; i++) {
if(types.type[i] == NULL) break;
if(strcmp(types.type[i], obj_type) == 0) return true;
}
@@ -159,7 +160,7 @@ void lv_debug_log_error(const char * msg, uint64_t value)
char * bufp = buf;
/*Add the function name*/
memcpy(bufp, msg, msg_len);
lv_memcpy(bufp, msg, msg_len);
bufp += msg_len;
/*Add value in hey*/
+1 -1
View File
@@ -152,7 +152,7 @@ static inline void lv_scr_load(lv_obj_t * scr)
* 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(n) LV_MATH_MAX(((LV_DPI * (n)) / 160), 1)
#define LV_DPX(n) LV_MATH_MAX(((LV_DPI * (n) + 80) / 160), 1) /*+80 for rounding*/
#ifdef __cplusplus
} /* extern "C" */
+2 -65
View File
@@ -73,7 +73,7 @@ lv_group_t * lv_group_create(void)
group->wrap = 1;
#if LV_USE_USER_DATA
memset(&group->user_data, 0, sizeof(lv_group_user_data_t));
lv_memset_00(&group->user_data, sizeof(lv_group_user_data_t));
#endif
return group;
@@ -303,28 +303,6 @@ lv_res_t lv_group_send_data(lv_group_t * group, uint32_t c)
return res;
}
/**
* Set a function for a group which will modify the object's style if it is in focus
* @param group pointer to a group
* @param style_mod_cb the style modifier function pointer
*/
void lv_group_set_style_mod_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_cb)
{
group->style_mod_cb = style_mod_cb;
if(group->obj_focus != NULL) lv_obj_invalidate(*group->obj_focus);
}
/**
* Set a function for a group which will modify the object's style if it is in focus in edit mode
* @param group pointer to a group
* @param style_mod_func the style modifier function pointer
*/
void lv_group_set_style_mod_edit_cb(lv_group_t * group, lv_group_style_mod_cb_t style_mod_edit_cb)
{
group->style_mod_edit_cb = style_mod_edit_cb;
if(group->obj_focus != NULL) lv_obj_invalidate(*group->obj_focus);
}
/**
* Set a function for a group which will be called when a new object is focused
* @param group pointer to a group
@@ -342,6 +320,7 @@ void lv_group_set_focus_cb(lv_group_t * group, lv_group_focus_cb_t focus_cb)
*/
void lv_group_set_editing(lv_group_t * group, bool edit)
{
if(group == NULL) return;
uint8_t en_val = edit ? 1 : 0;
if(en_val == group->editing) return; /*Do not set the same mode again*/
@@ -383,26 +362,6 @@ void lv_group_set_wrap(lv_group_t * group, bool en)
group->wrap = en ? 1 : 0;
}
/**
* Modify a style with the set 'style_mod' function. The input style remains unchanged.
* @param group pointer to group
* @param style pointer to a style to modify
* @return a copy of the input style but modified with the 'style_mod' function
*/
lv_style_t * lv_group_mod_style(lv_group_t * group, const lv_style_t * style)
{
/*Load the current style. It will be modified by the callback*/
lv_style_copy(&group->style_tmp, style);
if(group->editing) {
if(group->style_mod_edit_cb) group->style_mod_edit_cb(group, &group->style_tmp);
}
else {
if(group->style_mod_cb) group->style_mod_cb(group, &group->style_tmp);
}
return &group->style_tmp;
}
/**
* Get the focused object or NULL if there isn't one
* @param group pointer to a group
@@ -428,28 +387,6 @@ lv_group_user_data_t * lv_group_get_user_data(lv_group_t * group)
}
#endif
/**
* Get a the style modifier function of a group
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_cb_t lv_group_get_style_mod_cb(const lv_group_t * group)
{
if(!group) return NULL;
return group->style_mod_cb;
}
/**
* Get a the style modifier function of a group in edit mode
* @param group pointer to a group
* @return pointer to the style modifier function
*/
lv_group_style_mod_cb_t lv_group_get_style_mod_edit_cb(const lv_group_t * group)
{
if(!group) return NULL;
return group->style_mod_edit_cb;
}
/**
* Get the focus callback function of a group
* @param group pointer to a group
-3
View File
@@ -55,10 +55,7 @@ typedef 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_style_mod_cb_t style_mod_cb; /**< A function to modifies the style of the focused object*/
lv_group_style_mod_cb_t style_mod_edit_cb; /**< A function which modifies the style of the edited object*/
lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/
lv_style_t style_tmp; /**< Stores the modified style of the focused object */
#if LV_USE_USER_DATA
lv_group_user_data_t user_data;
#endif
+63 -38
View File
@@ -60,13 +60,13 @@ typedef struct {
lv_color_t _color;
lv_style_int_t _int;
lv_opa_t _opa;
lv_style_fptr_dptr_t _ptr;
_lv_style_fptr_dptr_t _ptr;
} start_value;
union {
lv_color_t _color;
lv_style_int_t _int;
lv_opa_t _opa;
lv_style_fptr_dptr_t _ptr;
_lv_style_fptr_dptr_t _ptr;
} end_value;
} lv_style_trans_t;
@@ -209,7 +209,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
LV_ASSERT_MEM(new_obj);
if(new_obj == NULL) return NULL;
memset(new_obj, 0x00, sizeof(lv_obj_t));
lv_memset_00(new_obj, sizeof(lv_obj_t));
#if LV_USE_BIDI
new_obj->base_dir = LV_BIDI_BASE_DIR_DEF;
@@ -232,7 +232,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
LV_ASSERT_MEM(new_obj);
if(new_obj == NULL) return NULL;
memset(new_obj, 0x00, sizeof(lv_obj_t));
lv_memset_00(new_obj, sizeof(lv_obj_t));
new_obj->parent = parent;
@@ -265,7 +265,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
new_obj->ext_draw_pad = 0;
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
memset(&new_obj->ext_click_pad, 0, sizeof(new_obj->ext_click_pad));
lv_memset_00(&new_obj->ext_click_pad, sizeof(new_obj->ext_click_pad));
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
new_obj->ext_click_pad_hor = 0;
new_obj->ext_click_pad_ver = 0;
@@ -282,7 +282,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
/*Init. user date*/
#if LV_USE_USER_DATA
memset(&new_obj->user_data, 0, sizeof(lv_obj_user_data_t));
lv_memset_00(&new_obj->user_data, sizeof(lv_obj_user_data_t));
#endif
@@ -328,7 +328,7 @@ lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy)
/*Set user data*/
#if LV_USE_USER_DATA
memcpy(&new_obj->user_data, &copy->user_data, sizeof(lv_obj_user_data_t));
lv_memcpy(&new_obj->user_data, &copy->user_data, sizeof(lv_obj_user_data_t));
#endif
/*Copy realign*/
@@ -800,9 +800,35 @@ void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h)
lv_obj_set_size(obj, lv_obj_get_width(obj), h);
}
/**
* Set the width reduced by the left and right padding.
* @param obj pointer to an object
* @param w the width without paddings
*/
void lv_obj_set_width_fit(lv_obj_t * obj, lv_coord_t w)
{
lv_style_int_t pleft = lv_obj_get_style_pad_left(obj, LV_OBJ_PART_MAIN);
lv_style_int_t pright = lv_obj_get_style_pad_right(obj, LV_OBJ_PART_MAIN);
lv_obj_set_width(obj, w - pleft - pright);
}
/**
* Set the height reduced by the top and bottom padding.
* @param obj pointer to an object
* @param h the height without paddings
*/
void lv_obj_set_height_fit(lv_obj_t * obj, lv_coord_t h)
{
lv_style_int_t ptop = lv_obj_get_style_pad_top(obj, LV_OBJ_PART_MAIN);
lv_style_int_t pbottom = lv_obj_get_style_pad_bottom(obj, LV_OBJ_PART_MAIN);
lv_obj_set_width(obj, h - ptop - pbottom);
}
/**
* Set the width of an object by taking the left and right margin into account.
* The object heigwidthht will be `obj_w = w - margon_left - margin_right`
* The object width will be `obj_w = w - margon_left - margin_right`
* @param obj pointer to an object
* @param w new height including margins
*/
@@ -834,10 +860,10 @@ void lv_obj_set_height_margin(lv_obj_t * obj, lv_coord_t h)
* @param obj pointer to an object to align
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
* @param align type of alignment (see 'lv_align_t' enum)
* @param x_mod x coordinate shift after alignment
* @param y_mod y coordinate shift after alignment
* @param x_ofs x coordinate offset after alignment
* @param y_ofs y coordinate offset after alignment
*/
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod)
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
@@ -852,8 +878,8 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
lv_obj_t * par = lv_obj_get_parent(obj);
lv_coord_t par_abs_x = par->coords.x1;
lv_coord_t par_abs_y = par->coords.y1;
new_pos.x += x_mod;
new_pos.y += y_mod;
new_pos.x += x_ofs;
new_pos.y += y_ofs;
new_pos.x -= par_abs_x;
new_pos.y -= par_abs_y;
@@ -862,8 +888,8 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
#if LV_USE_OBJ_REALIGN
/*Save the last align parameters to use them in `lv_obj_realign`*/
obj->realign.align = align;
obj->realign.xofs = x_mod;
obj->realign.yofs = y_mod;
obj->realign.xofs = x_ofs;
obj->realign.yofs = y_ofs;
obj->realign.base = base;
obj->realign.origo_align = 0;
#endif
@@ -874,10 +900,10 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
* @param obj pointer to an object to align
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
* @param align type of alignment (see 'lv_align_t' enum)
* @param x_mod x coordinate shift after alignment
* @param y_mod y coordinate shift after alignment
* @param x_ofs x coordinate offset after alignment
* @param y_ofs y coordinate offset after alignment
*/
void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod)
void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
@@ -1005,8 +1031,8 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align,
lv_coord_t base_abs_y = base->coords.y1;
lv_coord_t par_abs_x = par->coords.x1;
lv_coord_t par_abs_y = par->coords.y1;
new_x += x_mod + base_abs_x;
new_y += y_mod + base_abs_y;
new_x += x_ofs + base_abs_x;
new_y += y_ofs + base_abs_y;
new_x -= par_abs_x;
new_y -= par_abs_y;
@@ -1015,8 +1041,8 @@ void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align,
#if LV_USE_OBJ_REALIGN
/*Save the last align parameters to use them in `lv_obj_realign`*/
obj->realign.align = align;
obj->realign.xofs = x_mod;
obj->realign.yofs = y_mod;
obj->realign.xofs = x_ofs;
obj->realign.yofs = y_ofs;
obj->realign.base = base;
obj->realign.origo_align = 1;
#endif
@@ -1235,7 +1261,7 @@ void _lv_obj_set_style_local_opa(lv_obj_t * obj, uint8_t part, lv_style_property
* For example: `lv_obj_style_get_border_opa()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, lv_style_fptr_dptr_t value)
void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t part, lv_style_property_t prop, _lv_style_fptr_dptr_t value)
{
lv_style_list_t * style_dsc = lv_obj_get_style_list(obj, part);
lv_style_list_set_local_ptr(style_dsc, prop, value);
@@ -1267,7 +1293,7 @@ bool _lv_obj_remove_style_local_prop(lv_obj_t * obj, uint8_t part, lv_style_prop
/**
* Notify an object (and its children) about its style is modified
* @param obj pointer to an object
* @param prop `LV_STYLE_PROP_ALL` or an `LV_STYLE_...` property. It is used the optimize what needs to be refreshed.
* @param prop `LV_STYLE_PROP_ALL` or an `LV_STYLE_...` property. It is used to optimize what needs to be refreshed.
*/
void lv_obj_refresh_style(lv_obj_t * obj, lv_style_property_t prop)
{
@@ -1332,9 +1358,8 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_property_t prop)
lv_obj_invalidate(obj);
if(prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_INHERIT_MASK))
/*Send style change signals*/
refresh_children_style(obj);
/*Send style change signals*/
if(prop == LV_STYLE_PROP_ALL || (prop & LV_STYLE_INHERIT_MASK)) refresh_children_style(obj);
}
else {
lv_obj_invalidate(obj);
@@ -2513,14 +2538,14 @@ lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prop
* For example: `lv_obj_style_get_border_opa()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
lv_style_fptr_dptr_t _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop)
_lv_style_fptr_dptr_t _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop)
{
lv_style_property_t prop_ori = prop;
lv_style_attr_t attr;
attr.full = prop_ori >> 8;
lv_style_fptr_dptr_t value_act;
_lv_style_fptr_dptr_t value_act;
lv_res_t res = LV_RES_INV;
const lv_obj_t * parent = obj;
while(parent) {
@@ -2546,7 +2571,7 @@ lv_style_fptr_dptr_t _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, l
/*Handle unset values*/
prop = prop & (~LV_STYLE_STATE_MASK);
lv_style_fptr_dptr_t fd;
_lv_style_fptr_dptr_t fd;
fd.dptr = NULL;
fd.fptr = NULL;
switch(prop) {
@@ -2556,7 +2581,7 @@ lv_style_fptr_dptr_t _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, l
return fd;
#if LV_USE_ANIMATION
case LV_STYLE_TRANSITION_PATH:
fd.fptr = (lv_style_prop_cb_t)lv_anim_path_linear;
fd.fptr = (_lv_style_prop_xcb_t)lv_anim_path_linear;
return fd;
#endif
}
@@ -2826,8 +2851,8 @@ void lv_obj_get_type(const lv_obj_t * obj, lv_obj_type_t * buf)
lv_obj_type_t tmp;
memset(buf, 0, sizeof(lv_obj_type_t));
memset(&tmp, 0, sizeof(lv_obj_type_t));
lv_memset_00(buf, sizeof(lv_obj_type_t));
lv_memset_00(&tmp, sizeof(lv_obj_type_t));
obj->signal_cb((lv_obj_t *)obj, LV_SIGNAL_GET_TYPE, &tmp);
@@ -2878,7 +2903,7 @@ void lv_obj_set_user_data(lv_obj_t * obj, lv_obj_user_data_t data)
{
LV_ASSERT_OBJ(obj, LV_OBJX_NAME);
memcpy(&obj->user_data, &data, sizeof(lv_obj_user_data_t));
lv_memcpy(&obj->user_data, &data, sizeof(lv_obj_user_data_t));
}
#endif
@@ -3770,12 +3795,12 @@ static lv_style_trans_t * trans_create(lv_obj_t * obj, lv_style_property_t prop,
else { /*Ptr*/
obj->state = prev_state;
style_list->skip_trans = 1;
lv_style_fptr_dptr_t fd1 = _lv_obj_get_style_ptr(obj, part, prop);
_lv_style_fptr_dptr_t fd1 = _lv_obj_get_style_ptr(obj, part, prop);
obj->state = new_state;
lv_style_fptr_dptr_t fd2 = _lv_obj_get_style_ptr(obj, part, prop);
_lv_style_fptr_dptr_t fd2 = _lv_obj_get_style_ptr(obj, part, prop);
style_list->skip_trans = 0;
if(memcmp(&fd1, &fd2, sizeof(lv_style_fptr_dptr_t)) == 0) return NULL;
if(memcmp(&fd1, &fd2, sizeof(_lv_style_fptr_dptr_t)) == 0) return NULL;
obj->state = prev_state;
fd1 = _lv_obj_get_style_ptr(obj, part, prop);
obj->state = new_state;
@@ -3853,7 +3878,7 @@ static void trans_anim_cb(lv_style_trans_t * tr, lv_anim_value_t v)
_lv_style_set_opa(style, tr->prop, x);
}
else {
lv_style_fptr_dptr_t x;
_lv_style_fptr_dptr_t x;
if(v < 128) x = tr->start_value._ptr;
else x = tr->end_value._ptr;
_lv_style_set_ptr(style, tr->prop, x);
+31 -16
View File
@@ -426,9 +426,23 @@ void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w);
*/
void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h);
/**
* Set the width reduced by the left and right padding.
* @param obj pointer to an object
* @param w the width without paddings
*/
void lv_obj_set_width_fit(lv_obj_t * obj, lv_coord_t w);
/**
* Set the height reduced by the top and bottom padding.
* @param obj pointer to an object
* @param h the height without paddings
*/
void lv_obj_set_height_fit(lv_obj_t * obj, lv_coord_t h);
/**
* Set the width of an object by taking the left and right margin into account.
* The object heigwidthht will be `obj_w = w - margon_left - margin_right`
* The object width will be `obj_w = w - margon_left - margin_right`
* @param obj pointer to an object
* @param w new height including margins
*/
@@ -447,20 +461,20 @@ void lv_obj_set_height_margin(lv_obj_t * obj, lv_coord_t h);
* @param obj pointer to an object to align
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
* @param align type of alignment (see 'lv_align_t' enum)
* @param x_mod x coordinate shift after alignment
* @param y_mod y coordinate shift after alignment
* @param x_ofs x coordinate offset after alignment
* @param y_ofs y coordinate offset after alignment
*/
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod);
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
/**
* Align an object to an other object.
* @param obj pointer to an object to align
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
* @param align type of alignment (see 'lv_align_t' enum)
* @param x_mod x coordinate shift after alignment
* @param y_mod y coordinate shift after alignment
* @param x_ofs x coordinate offset after alignment
* @param y_ofs y coordinate offset after alignment
*/
void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod);
void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
/**
* Realign the object based on the last `lv_obj_align` parameters.
@@ -520,8 +534,9 @@ void lv_obj_clean_style_list(lv_obj_t * obj, uint8_t part);
void lv_obj_reset_style_list(lv_obj_t * obj, uint8_t part);
/**
* Notify an object about its style is modified
* Notify an object (and its children) about its style is modified
* @param obj pointer to an object
* @param prop `LV_STYLE_PROP_ALL` or an `LV_STYLE_...` property. It is used to optimize what needs to be refreshed.
*/
void lv_obj_refresh_style(lv_obj_t * obj, lv_style_property_t prop);
@@ -586,7 +601,7 @@ void _lv_obj_set_style_local_opa(lv_obj_t * obj, uint8_t type, lv_style_property
* For example: `lv_obj_style_get_border_opa()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_style_fptr_dptr_t value);
void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, _lv_style_fptr_dptr_t value);
/**
* Set a local style property of a part of an object in a given state.
@@ -601,9 +616,9 @@ void _lv_obj_set_style_local_ptr(lv_obj_t * obj, uint8_t type, lv_style_property
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline void _lv_obj_set_style_local_func_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop,
lv_style_prop_cb_t value)
_lv_style_prop_xcb_t value)
{
lv_style_fptr_dptr_t fd;
_lv_style_fptr_dptr_t fd;
fd.fptr = value;
fd.dptr = NULL;
_lv_obj_set_style_local_ptr(obj, type, prop, fd);
@@ -623,7 +638,7 @@ static inline void _lv_obj_set_style_local_func_ptr(lv_obj_t * obj, uint8_t type
static inline void _lv_obj_set_style_local_data_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop,
const void * value)
{
lv_style_fptr_dptr_t fd;
_lv_style_fptr_dptr_t fd;
fd.fptr = NULL;
fd.dptr = value;
_lv_obj_set_style_local_ptr(obj, type, prop, fd);
@@ -1133,7 +1148,7 @@ lv_opa_t _lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t part, lv_style_prop
* For example: `lv_obj_style_get_border_opa()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
lv_style_fptr_dptr_t _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
_lv_style_fptr_dptr_t _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop);
/**
* Get a style property of a part of an object in the object's current state.
@@ -1149,10 +1164,10 @@ lv_style_fptr_dptr_t _lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t part, l
* For example: `lv_obj_style_get_trasition_path()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline lv_style_prop_cb_t _lv_obj_get_style_func_ptr(const lv_obj_t * obj, uint8_t part,
static inline _lv_style_prop_xcb_t _lv_obj_get_style_func_ptr(const lv_obj_t * obj, uint8_t part,
lv_style_property_t prop)
{
lv_style_fptr_dptr_t fd;
_lv_style_fptr_dptr_t fd;
fd = _lv_obj_get_style_ptr(obj, part, prop);
return fd.fptr;
}
@@ -1173,7 +1188,7 @@ static inline lv_style_prop_cb_t _lv_obj_get_style_func_ptr(const lv_obj_t * ob
*/
static inline const void * _lv_obj_get_style_data_ptr(const lv_obj_t * obj, uint8_t part, lv_style_property_t prop)
{
lv_style_fptr_dptr_t fd;
_lv_style_fptr_dptr_t fd;
fd = _lv_obj_get_style_ptr(obj, part, prop);
return fd.dptr;
}
+3 -3
View File
@@ -59,9 +59,9 @@ extern "C" {
*/
#ifdef __cplusplus
#define FUNC_PTR_CAST(v) reinterpret_cast<lv_style_prop_cb_t>(v)
#define FUNC_PTR_CAST(v) reinterpret_cast<_lv_style_prop_xcb_t>(v)
#else
#define FUNC_PTR_CAST(v) (lv_style_prop_cb_t)v
#define FUNC_PTR_CAST(v) (_lv_style_prop_xcb_t)v
#endif
#define _OBJ_GET_STYLE_scalar(prop_name, func_name, value_type, style_type) \
@@ -221,7 +221,7 @@ _LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PROP_6, transition_prop_6, lv_style_int
#if LV_USE_ANIMATION
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, lv_anim_path_cb_t, _func_ptr, func_ptr)
#else
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, lv_style_prop_cb_t, _func_ptr,
_LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_PATH, transition_path, _lv_style_prop_xcb_t, _func_ptr,
func_ptr) /*For compatibility*/
#endif
_LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int, scalar)
+1 -1
View File
@@ -225,7 +225,7 @@ void lv_disp_refr_task(lv_task_t * task)
uint32_t line_length = lv_area_get_width(&disp_refr->inv_areas[a]) * sizeof(lv_color_t);
for(y = disp_refr->inv_areas[a].y1; y <= disp_refr->inv_areas[a].y2; y++) {
memcpy(buf_act + start_offs, buf_ina + start_offs, line_length);
lv_memcpy(buf_act + start_offs, buf_ina + start_offs, line_length);
start_offs += hres * sizeof(lv_color_t);
}
}
+40 -40
View File
@@ -60,7 +60,7 @@ static lv_style_t * get_alloc_local_style(lv_style_list_t * list);
*/
void lv_style_init(lv_style_t * style)
{
memset(style, 0x00, sizeof(lv_style_t));
lv_memset_00(style, sizeof(lv_style_t));
#if LV_USE_ASSERT_STYLE
style->sentinel = LV_DEBUG_STYLE_SENTINEL_VALUE;
#endif
@@ -81,9 +81,8 @@ void lv_style_copy(lv_style_t * style_dest, const lv_style_t * style_src)
if(style_src->map == NULL) return;
uint16_t size = lv_style_get_mem_size(style_src);
style_dest->map = lv_mem_alloc(size);
memcpy(style_dest->map, style_src->map, size);
lv_memcpy(style_dest->map, style_src->map, size);
}
/**
@@ -113,7 +112,7 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_property_t prop)
if((prop & 0xF) < LV_STYLE_ID_COLOR) prop_size += sizeof(lv_style_int_t);
else if((prop & 0xF) < LV_STYLE_ID_OPA) prop_size += sizeof(lv_color_t);
else if((prop & 0xF) < LV_STYLE_ID_PTR) prop_size += sizeof(lv_opa_t);
else prop_size += sizeof(lv_style_fptr_dptr_t);
else prop_size += sizeof(_lv_style_fptr_dptr_t);
/*Move the props to fill the space of the property to delete*/
uint32_t i;
@@ -136,7 +135,7 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_property_t prop)
*/
void lv_style_list_init(lv_style_list_t * list)
{
memset(list, 0x00, sizeof(lv_style_list_t));
lv_memset_00(list, sizeof(lv_style_list_t));
#if LV_USE_ASSERT_STYLE
list->sentinel = LV_DEBUG_STYLE_LIST_SENTINEL_VALUE;
#endif
@@ -160,24 +159,24 @@ void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * lis
if(list_src->has_local == 0) {
if(list_src->has_trans) {
list_dest->style_list = lv_mem_alloc((list_src->style_cnt - 1) * sizeof(lv_style_t *));
memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
lv_memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
list_dest->style_cnt = list_src->style_cnt - 1;
}
else {
list_dest->style_list = lv_mem_alloc(list_src->style_cnt * sizeof(lv_style_t *));
memcpy(list_dest->style_list, list_src->style_list, list_src->style_cnt * sizeof(lv_style_t *));
lv_memcpy(list_dest->style_list, list_src->style_list, list_src->style_cnt * sizeof(lv_style_t *));
list_dest->style_cnt = list_src->style_cnt;
}
}
else {
if(list_src->has_trans) {
list_dest->style_list = lv_mem_alloc((list_src->style_cnt - 2) * sizeof(lv_style_t *));
memcpy(list_dest->style_list, list_src->style_list + 2, (list_src->style_cnt - 2) * sizeof(lv_style_t *));
lv_memcpy(list_dest->style_list, list_src->style_list + 2, (list_src->style_cnt - 2) * sizeof(lv_style_t *));
list_dest->style_cnt = list_src->style_cnt - 2;
}
else {
list_dest->style_list = lv_mem_alloc((list_src->style_cnt - 1) * sizeof(lv_style_t *));
memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
lv_memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
list_dest->style_cnt = list_src->style_cnt - 1;
}
@@ -342,7 +341,7 @@ uint16_t lv_style_get_mem_size(const lv_style_t * style)
if((style->map[i] & 0xF) < LV_STYLE_ID_COLOR) i += sizeof(lv_style_int_t);
else if((style->map[i] & 0xF) < LV_STYLE_ID_OPA) i += sizeof(lv_color_t);
else if((style->map[i] & 0xF) < LV_STYLE_ID_PTR) i += sizeof(lv_opa_t);
else i += sizeof(lv_style_fptr_dptr_t);
else i += sizeof(_lv_style_fptr_dptr_t);
i += sizeof(lv_style_property_t);
}
@@ -374,7 +373,7 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
attr_goal.full = (prop >> 8) & 0xFFU;
if(attr_found.bits.state == attr_goal.bits.state) {
memcpy(style->map + id + sizeof(lv_style_property_t), &value, sizeof(lv_style_int_t));
lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &value, sizeof(lv_style_int_t));
return;
}
}
@@ -391,9 +390,9 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
LV_ASSERT_MEM(style->map);
if(style == NULL) return;
memcpy(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
memcpy(style->map + size - sizeof(lv_style_int_t) - end_mark_size, &value, sizeof(lv_style_int_t));
memcpy(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
lv_memcpy_small(style->map + size - sizeof(lv_style_int_t) - end_mark_size, &value, sizeof(lv_style_int_t));
lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
}
/**
@@ -420,7 +419,7 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
attr_goal.full = (prop >> 8) & 0xFFU;
if(attr_found.bits.state == attr_goal.bits.state) {
memcpy(style->map + id + sizeof(lv_style_property_t), &color, sizeof(lv_color_t));
lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &color, sizeof(lv_color_t));
return;
}
}
@@ -438,9 +437,9 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
LV_ASSERT_MEM(style->map);
if(style == NULL) return;
memcpy(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
memcpy(style->map + size - sizeof(lv_color_t) - end_mark_size, &color, sizeof(lv_color_t));
memcpy(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
lv_memcpy_small(style->map + size - sizeof(lv_color_t) - end_mark_size, &color, sizeof(lv_color_t));
lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
}
/**
@@ -467,7 +466,7 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
attr_goal.full = (prop >> 8) & 0xFFU;
if(attr_found.bits.state == attr_goal.bits.state) {
memcpy(style->map + id + sizeof(lv_style_property_t), &opa, sizeof(lv_opa_t));
lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &opa, sizeof(lv_opa_t));
return;
}
}
@@ -485,9 +484,9 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
LV_ASSERT_MEM(style->map);
if(style == NULL) return;
memcpy(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
memcpy(style->map + size - sizeof(lv_opa_t) - end_mark_size, &opa, sizeof(lv_opa_t));
memcpy(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
lv_memcpy_small(style->map + size - sizeof(lv_opa_t) - end_mark_size, &opa, sizeof(lv_opa_t));
lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
}
/**
@@ -500,7 +499,7 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
* For example: `lv_style_set_border_width()`
* @note for performance reasons it's not checked if the property is really has pointer type
*/
void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, lv_style_fptr_dptr_t p)
void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, _lv_style_fptr_dptr_t p)
{
LV_ASSERT_STYLE(style);
@@ -514,27 +513,27 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, lv_style_fp
attr_goal.full = (prop >> 8) & 0xFFU;
if(attr_found.bits.state == attr_goal.bits.state) {
memcpy(style->map + id + sizeof(lv_style_property_t), &p, sizeof(lv_style_fptr_dptr_t));
lv_memcpy_small(style->map + id + sizeof(lv_style_property_t), &p, sizeof(_lv_style_fptr_dptr_t));
return;
}
}
/*Add new property if not exists yet*/
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(lv_style_fptr_dptr_t));
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(_lv_style_fptr_dptr_t));
lv_style_property_t end_mark = _LV_STYLE_CLOSEING_PROP;
uint8_t end_mark_size = sizeof(end_mark);
uint16_t size = lv_style_get_mem_size(style);
if(size == 0) size += end_mark_size;
size += sizeof(lv_style_property_t) + sizeof(lv_style_fptr_dptr_t);
size += sizeof(lv_style_property_t) + sizeof(_lv_style_fptr_dptr_t);
style->map = lv_mem_realloc(style->map, size);
LV_ASSERT_MEM(style->map);
if(style == NULL) return;
memcpy(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
memcpy(style->map + size - sizeof(lv_style_fptr_dptr_t) - end_mark_size, &p, sizeof(lv_style_fptr_dptr_t));
memcpy(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
lv_memcpy_small(style->map + size - sizeof(_lv_style_fptr_dptr_t) - end_mark_size, &p, sizeof(_lv_style_fptr_dptr_t));
lv_memcpy_small(style->map + size - end_mark_size, &end_mark, sizeof(end_mark));
}
/**
@@ -554,12 +553,13 @@ int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, vo
if(style == NULL) return -1;
if(style->map == NULL) return -1;
int32_t id = get_property_index(style, prop);
if(id < 0) {
return -1;
}
else {
memcpy(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_style_int_t));
lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_style_int_t));
lv_style_attr_t attr_act;
attr_act.full = style->map[id + 1];
@@ -590,12 +590,13 @@ int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, vo
if(style == NULL) return -1;
if(style->map == NULL) return -1;
int32_t id = get_property_index(style, prop);
if(id < 0) {
return -1;
}
else {
memcpy(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_opa_t));
lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_opa_t));
lv_style_attr_t attr_act;
attr_act.full = style->map[id + 1];
@@ -629,7 +630,7 @@ int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop,
return -1;
}
else {
memcpy(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_color_t));
lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_color_t));
lv_style_attr_t attr_act;
attr_act.full = style->map[id + 1];
@@ -655,15 +656,16 @@ int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop,
*/
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void * v_res)
{
lv_style_fptr_dptr_t * res = (lv_style_fptr_dptr_t *)v_res;
_lv_style_fptr_dptr_t * res = (_lv_style_fptr_dptr_t *)v_res;
if(style == NULL) return -1;
if(style->map == NULL) return -1;
int32_t id = get_property_index(style, prop);
if(id < 0) {
return -1;
}
else {
memcpy(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(lv_style_fptr_dptr_t));
lv_memcpy_small(res, &style->map[id + sizeof(lv_style_property_t)], sizeof(_lv_style_fptr_dptr_t));
lv_style_attr_t attr_act;
attr_act.full = style->map[id + 1];
@@ -789,7 +791,7 @@ void lv_style_list_set_local_color(lv_style_list_t * list, lv_style_property_t p
* @param value the value to set
* @note for performance reasons it's not checked if the property really has pointer type
*/
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, lv_style_fptr_dptr_t value)
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, _lv_style_fptr_dptr_t value)
{
LV_ASSERT_STYLE_LIST(list);
@@ -962,7 +964,7 @@ lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop,
* LV_RES_INV: there was NO matching property in the list
* @note for performance reasons it's not checked if the property really has pointer type
*/
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, lv_style_fptr_dptr_t * res)
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, _lv_style_fptr_dptr_t * res)
{
LV_ASSERT_STYLE_LIST(list);
@@ -975,7 +977,7 @@ lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop,
int16_t weight = -1;
lv_style_fptr_dptr_t value_act;
_lv_style_fptr_dptr_t value_act;
value_act.dptr = NULL;
value_act.fptr = NULL;
@@ -1020,7 +1022,6 @@ lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop,
*/
static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop)
{
LV_ASSERT_STYLE(style);
if(style->map == NULL) return -1;
@@ -1058,7 +1059,7 @@ static inline int32_t get_property_index(const lv_style_t * style, lv_style_prop
if((style->map[i] & 0xF) < LV_STYLE_ID_COLOR) i += sizeof(lv_style_int_t);
else if((style->map[i] & 0xF) < LV_STYLE_ID_OPA) i += sizeof(lv_color_t);
else if((style->map[i] & 0xF) < LV_STYLE_ID_PTR) i += sizeof(lv_opa_t);
else i += sizeof(lv_style_fptr_dptr_t);
else i += sizeof(_lv_style_fptr_dptr_t);
i += sizeof(lv_style_property_t);
}
@@ -1091,4 +1092,3 @@ static lv_style_t * get_alloc_local_style(lv_style_list_t * list)
return local_style;
}
+19 -17
View File
@@ -216,12 +216,14 @@ typedef struct {
typedef int16_t lv_style_int_t;
typedef void(*lv_style_prop_cb_t)(void);
/*A helper general function pointer*/
typedef void(*_lv_style_prop_xcb_t)(void);
/*A helper type to handle data pointers and function pointer is the same way.*/
typedef union {
lv_style_prop_cb_t fptr;
_lv_style_prop_xcb_t fptr;
const void * dptr;
} lv_style_fptr_dptr_t;
} _lv_style_fptr_dptr_t;
typedef struct {
@@ -371,7 +373,7 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
* For example: `lv_style_set_border_width()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, lv_style_fptr_dptr_t p);
void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, _lv_style_fptr_dptr_t p);
/**
* Set a function pointer typed property in a style.
@@ -383,9 +385,9 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, lv_style_fp
* For example: `lv_style_set_border_width()`
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline void _lv_style_set_func_ptr(lv_style_t * style, lv_style_property_t prop, lv_style_prop_cb_t p)
static inline void _lv_style_set_func_ptr(lv_style_t * style, lv_style_property_t prop, _lv_style_prop_xcb_t p)
{
lv_style_fptr_dptr_t fd;
_lv_style_fptr_dptr_t fd;
fd.dptr = NULL;
fd.fptr = p;
_lv_style_set_ptr(style, prop, fd);
@@ -403,7 +405,7 @@ static inline void _lv_style_set_func_ptr(lv_style_t * style, lv_style_property_
*/
static inline void _lv_style_set_data_ptr(lv_style_t * style, lv_style_property_t prop, const void * p)
{
lv_style_fptr_dptr_t fd;
_lv_style_fptr_dptr_t fd;
fd.fptr = NULL;
fd.dptr = p;
_lv_style_set_ptr(style, prop, fd);
@@ -485,12 +487,12 @@ int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, vo
*/
static inline int16_t _lv_style_get_func_ptr(const lv_style_t * style, lv_style_property_t prop, void * res)
{
lv_style_fptr_dptr_t fd_res;
_lv_style_fptr_dptr_t fd_res;
fd_res.dptr = NULL;
fd_res.fptr = NULL;
lv_res_t r = _lv_style_get_ptr(style, prop, &fd_res);
lv_style_prop_cb_t * res2 = (lv_style_prop_cb_t *)res;
_lv_style_prop_xcb_t * res2 = (_lv_style_prop_xcb_t *)res;
*res2 = fd_res.fptr;
return r;
}
@@ -510,7 +512,7 @@ static inline int16_t _lv_style_get_func_ptr(const lv_style_t * style, lv_style_
*/
static inline int16_t _lv_style_get_data_ptr(const lv_style_t * style, lv_style_property_t prop, void * res)
{
lv_style_fptr_dptr_t fd_res;
_lv_style_fptr_dptr_t fd_res;
fd_res.dptr = NULL;
fd_res.fptr = NULL;
lv_res_t r = _lv_style_get_ptr(style, prop, &fd_res);
@@ -580,7 +582,7 @@ void lv_style_list_set_local_opa(lv_style_list_t * list, lv_style_property_t pro
* @param value the value to set
* @note for performance reasons it's not checked if the property really has pointer type
*/
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, lv_style_fptr_dptr_t value);
void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t prop, _lv_style_fptr_dptr_t value);
/**
* Set a local pointer typed property in a style list.
@@ -591,9 +593,9 @@ void lv_style_list_set_local_ptr(lv_style_list_t * list, lv_style_property_t pro
* @note for performance reasons it's not checked if the property really has pointer type
*/
static inline void lv_style_list_set_local_func_ptr(lv_style_list_t * list, lv_style_property_t prop,
lv_style_prop_cb_t value)
_lv_style_prop_xcb_t value)
{
lv_style_fptr_dptr_t fd;
_lv_style_fptr_dptr_t fd;
fd.dptr = NULL;
fd.fptr = value;
lv_style_list_set_local_ptr(list, prop, fd);
@@ -610,7 +612,7 @@ static inline void lv_style_list_set_local_func_ptr(lv_style_list_t * list, lv_s
static inline void lv_style_list_set_local_data_ptr(lv_style_list_t * list, lv_style_property_t prop,
const void * value)
{
lv_style_fptr_dptr_t fd;
_lv_style_fptr_dptr_t fd;
fd.fptr = NULL;
fd.dptr = value;
lv_style_list_set_local_ptr(list, prop, fd);
@@ -667,7 +669,7 @@ lv_res_t lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop,
* @note for performance reasons it's not checked if the property really has pointer type
* @note Do not use this function directly. Use `lv_style_list_get_func_ptr` or `lv_style_list_get_data_ptr`
*/
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, lv_style_fptr_dptr_t * res);
lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop, _lv_style_fptr_dptr_t * res);
/**
@@ -683,7 +685,7 @@ lv_res_t lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop,
*/
static inline lv_res_t lv_style_list_get_func_ptr(lv_style_list_t * list, lv_style_property_t prop, void (**res)(void))
{
lv_style_fptr_dptr_t fd_res;
_lv_style_fptr_dptr_t fd_res;
fd_res.dptr = NULL;
fd_res.fptr = NULL;
lv_res_t r = lv_style_list_get_ptr(list, prop, &fd_res);
@@ -705,7 +707,7 @@ static inline lv_res_t lv_style_list_get_func_ptr(lv_style_list_t * list, lv_sty
*/
static inline lv_res_t lv_style_list_get_data_ptr(lv_style_list_t * list, lv_style_property_t prop, const void ** res)
{
lv_style_fptr_dptr_t fd_res;
_lv_style_fptr_dptr_t fd_res;
fd_res.dptr = NULL;
fd_res.fptr = NULL;
lv_res_t r = lv_style_list_get_ptr(list, prop, &fd_res);
+1 -1
View File
@@ -860,11 +860,11 @@ static inline lv_color_t color_blend_true_color_additive(lv_color_t fg, lv_color
fg.ch.red = LV_MATH_MIN(tmp, 255);
#endif
tmp = bg.ch.green + fg.ch.green;
#if LV_COLOR_DEPTH == 8
fg.ch.green = LV_MATH_MIN(tmp, 7);
#elif LV_COLOR_DEPTH == 16
#if LV_COLOR_16_SWAP == 0
tmp = bg.ch.green + fg.ch.green;
fg.ch.green = LV_MATH_MIN(tmp, 63);
#else
tmp = (bg.ch.green_h << 3) + bg.ch.green_l + (fg.ch.green_h << 3) + fg.ch.green_l;
+1 -1
View File
@@ -48,7 +48,7 @@ static void show_error(const lv_area_t * coords, const lv_area_t * clip_area, co
void lv_draw_img_dsc_init(lv_draw_img_dsc_t * dsc)
{
memset(dsc, 0x00, sizeof(lv_draw_img_dsc_t));
lv_memset_00(dsc, sizeof(lv_draw_img_dsc_t));
dsc->recolor = LV_COLOR_BLACK;
dsc->opa = LV_OPA_COVER;
dsc->zoom = LV_IMG_ZOOM_NONE;
+2 -2
View File
@@ -82,7 +82,7 @@ static const uint8_t bpp8_opa_table[256] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11
void lv_draw_label_dsc_init(lv_draw_label_dsc_t * dsc)
{
memset(dsc, 0x00, sizeof(lv_draw_label_dsc_t));
lv_memset_00(dsc, sizeof(lv_draw_label_dsc_t));
dsc->opa = LV_OPA_COVER;
dsc->color = LV_COLOR_BLACK;
dsc->font = LV_THEME_DEFAULT_FONT_NORMAL;
@@ -275,7 +275,7 @@ void lv_draw_label(const lv_area_t * coords, const lv_area_t * mask, lv_draw_lab
/*Get the parameter*/
if(i - par_start == LABEL_RECOLOR_PAR_LENGTH + 1) {
char buf[LABEL_RECOLOR_PAR_LENGTH + 1];
memcpy(buf, &bidi_txt[par_start], LABEL_RECOLOR_PAR_LENGTH);
lv_memcpy_small(buf, &bidi_txt[par_start], LABEL_RECOLOR_PAR_LENGTH);
buf[LABEL_RECOLOR_PAR_LENGTH] = '\0';
int r, g, b;
r = (hex_char_to_num(buf[0]) << 4) + hex_char_to_num(buf[1]);
+1 -1
View File
@@ -45,7 +45,7 @@ static void draw_line_ver(const lv_point_t * point1, const lv_point_t * point2,
void lv_draw_line_dsc_init(lv_draw_line_dsc_t * dsc)
{
memset(dsc, 0x00, sizeof(lv_draw_line_dsc_t));
lv_memset_00(dsc, sizeof(lv_draw_line_dsc_t));
dsc->width = 1;
dsc->opa = LV_OPA_COVER;
dsc->color = LV_COLOR_BLACK;
+5 -5
View File
@@ -210,7 +210,7 @@ void lv_draw_mask_line_points_init(lv_draw_mask_line_param_t * param, lv_coord_t
param->flat = (LV_MATH_ABS(p2x - p1x) > LV_MATH_ABS(p2y - p1y)) ? 1 : 0;
param->yx_steep = 0;
param->xy_steep = 0;
param->dsc.cb = (lv_draw_mask_cb_t)lv_draw_mask_line;
param->dsc.cb = (lv_draw_mask_xcb_t)lv_draw_mask_line;
param->dsc.type = LV_DRAW_MASK_TYPE_LINE;
int32_t dx = p2x - p1x;
@@ -328,7 +328,7 @@ void lv_draw_mask_angle_init(lv_draw_mask_angle_param_t * param, lv_coord_t vert
param->cfg.end_angle = end_angle;
param->cfg.vertex_p.x = vertex_x;
param->cfg.vertex_p.y = vertex_y;
param->dsc.cb = (lv_draw_mask_cb_t)lv_draw_mask_angle;
param->dsc.cb = (lv_draw_mask_xcb_t)lv_draw_mask_angle;
param->dsc.type = LV_DRAW_MASK_TYPE_ANGLE;
if(start_angle >= 0 && start_angle < 180) {
@@ -375,7 +375,7 @@ void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area
lv_area_copy(&param->cfg.rect, rect);
param->cfg.radius = radius;
param->cfg.outer = inv ? 1 : 0;
param->dsc.cb = (lv_draw_mask_cb_t)lv_draw_mask_radius;
param->dsc.cb = (lv_draw_mask_xcb_t)lv_draw_mask_radius;
param->dsc.type = LV_DRAW_MASK_TYPE_RADIUS;
param->y_prev = INT32_MIN;
param->y_prev_x.f = 0;
@@ -401,7 +401,7 @@ void lv_draw_mask_fade_init(lv_draw_mask_fade_param_t * param, const lv_area_t *
param->cfg.opa_bottom = opa_bottom;
param->cfg.y_top = y_top;
param->cfg.y_bottom = y_bottom;
param->dsc.cb = (lv_draw_mask_cb_t)lv_draw_mask_fade;
param->dsc.cb = (lv_draw_mask_xcb_t)lv_draw_mask_fade;
param->dsc.type = LV_DRAW_MASK_TYPE_FADE;
}
@@ -416,7 +416,7 @@ void lv_draw_mask_map_init(lv_draw_mask_map_param_t * param, const lv_area_t * c
{
lv_area_copy(&param->cfg.coords, coords);
param->cfg.map = map;
param->dsc.cb = (lv_draw_mask_cb_t)lv_draw_mask_map;
param->dsc.cb = (lv_draw_mask_xcb_t)lv_draw_mask_map;
param->dsc.type = LV_DRAW_MASK_TYPE_MAP;
}
+6 -2
View File
@@ -53,13 +53,17 @@ enum {
LV_DRAW_MASK_LINE_SIDE_BOTTOM,
};
typedef lv_draw_mask_res_t (*lv_draw_mask_cb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
/**
* A common callback type for every mask type.
* Used internally by the library.
*/
typedef lv_draw_mask_res_t (*lv_draw_mask_xcb_t)(lv_opa_t * mask_buf, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t len,
void * p);
typedef uint8_t lv_draw_mask_line_side_t;
typedef struct {
lv_draw_mask_cb_t cb;
lv_draw_mask_xcb_t cb;
lv_draw_mask_type_t type;
} lv_draw_mask_common_dsc_t;
+7 -5
View File
@@ -59,7 +59,7 @@ static int32_t sh_cache_r = -1;
void lv_draw_rect_dsc_init(lv_draw_rect_dsc_t * dsc)
{
memset(dsc, 0x00, sizeof(lv_draw_rect_dsc_t));
lv_memset_00(dsc, sizeof(lv_draw_rect_dsc_t));
dsc->bg_color = LV_COLOR_WHITE;
dsc->bg_grad_color = LV_COLOR_BLACK;
dsc->border_color = LV_COLOR_BLACK;
@@ -274,10 +274,12 @@ static void draw_bg(const lv_area_t * coords, const lv_area_t * clip, lv_draw_re
grad_color, mask_buf, mask_res, opa, dsc->bg_blend_mode);
/*Center part*/
fill_area2.x1 = coords_bg.x1 + rout;
fill_area2.x2 = coords_bg.x2 - rout;
lv_blend_fill(clip, &fill_area2,
grad_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
if(dsc->bg_grad_dir == LV_GRAD_DIR_VER) {
fill_area2.x1 = coords_bg.x1 + rout;
fill_area2.x2 = coords_bg.x2 - rout;
lv_blend_fill(clip, &fill_area2,
grad_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, opa, dsc->bg_blend_mode);
}
/*Right part*/
fill_area2.x1 = coords_bg.x2 - rout + 1;
+9 -9
View File
@@ -59,7 +59,7 @@ lv_color_t lv_img_buf_get_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t
dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
memcpy(&p_color, &buf_u8[px], sizeof(lv_color_t));
lv_memcpy_small(&p_color, &buf_u8[px], sizeof(lv_color_t));
#if LV_COLOR_SIZE == 32
p_color.ch.alpha = 0xFF; /*Only the color should be get so use a deafult alpha value*/
#endif
@@ -246,12 +246,12 @@ void lv_img_buf_set_px_color(lv_img_dsc_t * dsc, lv_coord_t x, lv_coord_t y, lv_
if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR || dsc->header.cf == LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED) {
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
memcpy(&buf_u8[px], &c, px_size);
lv_memcpy_small(&buf_u8[px], &c, px_size);
}
else if(dsc->header.cf == LV_IMG_CF_TRUE_COLOR_ALPHA) {
uint8_t px_size = lv_img_cf_get_px_size(dsc->header.cf) >> 3;
uint32_t px = dsc->header.w * y * px_size + x * px_size;
memcpy(&buf_u8[px], &c, px_size - 1); /*-1 to not overwrite the alpha value*/
lv_memcpy_small(&buf_u8[px], &c, px_size - 1); /*-1 to not overwrite the alpha value*/
}
else if(dsc->header.cf == LV_IMG_CF_INDEXED_1BIT) {
buf_u8 += sizeof(lv_color32_t) * 2; /*Skip the palette*/
@@ -319,7 +319,7 @@ void lv_img_buf_set_palette(lv_img_dsc_t * dsc, uint8_t id, lv_color_t c)
lv_color32_t c32;
c32.full = lv_color_to32(c);
uint8_t * buf = (uint8_t *)dsc->data;
memcpy(&buf[id * sizeof(c32)], &c32, sizeof(c32));
lv_memcpy_small(&buf[id * sizeof(c32)], &c32, sizeof(c32));
}
/**
@@ -507,12 +507,12 @@ bool lv_img_buf_transform(lv_img_transform_dsc_t * dsc, lv_coord_t x, lv_coord_t
px_size = LV_COLOR_SIZE >> 3;
pxi = dsc->cfg.src_w * ys_int * px_size + xs_int * px_size;
memcpy(&dsc->res.color, &src_u8[pxi], px_size);
lv_memcpy_small(&dsc->res.color, &src_u8[pxi], px_size);
}
else {
px_size = LV_IMG_PX_SIZE_ALPHA_BYTE;
pxi = dsc->cfg.src_w * ys_int * px_size + xs_int * px_size;
memcpy(&dsc->res.color, &src_u8[pxi], px_size - 1);
lv_memcpy_small(&dsc->res.color, &src_u8[pxi], px_size - 1);
dsc->res.opa = src_u8[pxi + px_size - 1];
}
}
@@ -669,9 +669,9 @@ static inline bool transform_anti_alias(lv_img_transform_dsc_t * dsc)
lv_opa_t a11 = 0;
if(dsc->tmp.native_color) {
memcpy(&c01, &src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn], sizeof(lv_color_t));
memcpy(&c10, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn], sizeof(lv_color_t));
memcpy(&c11, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size * xn],
lv_memcpy_small(&c01, &src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn], sizeof(lv_color_t));
lv_memcpy_small(&c10, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn], sizeof(lv_color_t));
lv_memcpy_small(&c11, &src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size * xn],
sizeof(lv_color_t));
if(dsc->tmp.has_alpha) {
a10 = src_u8[dsc->tmp.pxi + dsc->tmp.px_size * xn + dsc->tmp.px_size - 1];
+6 -6
View File
@@ -130,8 +130,8 @@ lv_img_cache_entry_t * lv_img_cache_open(const void * src, lv_color_t color)
if(open_res == LV_RES_INV) {
LV_LOG_WARN("Image draw cannot open the image resource");
lv_img_decoder_close(&cached_src->dec_dsc);
memset(&cached_src->dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));
memset(cached_src, 0, sizeof(lv_img_cache_entry_t));
lv_memset_00(&cached_src->dec_dsc, sizeof(lv_img_decoder_dsc_t));
lv_memset_00(cached_src, sizeof(lv_img_cache_entry_t));
cached_src->life = INT32_MIN; /*Make the empty entry very "weak" to force its use */
return NULL;
}
@@ -175,8 +175,8 @@ void lv_img_cache_set_size(uint16_t new_entry_cnt)
/*Clean the cache*/
uint16_t i;
for(i = 0; i < entry_cnt; i++) {
memset(&LV_GC_ROOT(_lv_img_cache_array)[i].dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));
memset(&LV_GC_ROOT(_lv_img_cache_array)[i], 0, sizeof(lv_img_cache_entry_t));
lv_memset_00(&LV_GC_ROOT(_lv_img_cache_array)[i].dec_dsc, sizeof(lv_img_decoder_dsc_t));
lv_memset_00(&LV_GC_ROOT(_lv_img_cache_array)[i], sizeof(lv_img_cache_entry_t));
}
}
@@ -197,8 +197,8 @@ void lv_img_cache_invalidate_src(const void * src)
lv_img_decoder_close(&cache[i].dec_dsc);
}
memset(&cache[i].dec_dsc, 0, sizeof(lv_img_decoder_dsc_t));
memset(&cache[i], 0, sizeof(lv_img_cache_entry_t));
lv_memset_00(&cache[i].dec_dsc, sizeof(lv_img_decoder_dsc_t));
lv_memset_00(&cache[i], sizeof(lv_img_cache_entry_t));
}
}
}
+5 -5
View File
@@ -151,7 +151,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_co
}
if(res == LV_RES_INV) {
memset(dsc, 0, sizeof(lv_img_decoder_dsc_t));
lv_memset_00(dsc, sizeof(lv_img_decoder_dsc_t));
}
return res;
@@ -201,7 +201,7 @@ lv_img_decoder_t * lv_img_decoder_create(void)
LV_ASSERT_MEM(decoder);
if(decoder == NULL) return NULL;
memset(decoder, 0, sizeof(lv_img_decoder_t));
lv_memset_00(decoder, sizeof(lv_img_decoder_t));
return decoder;
}
@@ -341,7 +341,7 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
LV_LOG_ERROR("img_decoder_built_in_open: out of memory");
return LV_RES_INV;
}
memset(dsc->user_data, 0, sizeof(lv_img_decoder_built_in_data_t));
lv_memset_00(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
}
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
@@ -353,7 +353,7 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
return LV_RES_INV;
}
memcpy(user_data->f, &f, sizeof(f));
lv_memcpy_small(user_data->f, &f, sizeof(f));
#else
LV_LOG_WARN("Image built-in decoder cannot read file because LV_USE_FILESYSTEM = 0");
@@ -399,7 +399,7 @@ lv_res_t lv_img_decoder_built_in_open(lv_img_decoder_t * decoder, lv_img_decoder
lv_img_decoder_built_in_close(decoder, dsc);
return LV_RES_INV;
}
memset(dsc->user_data, 0, sizeof(lv_img_decoder_built_in_data_t));
lv_memset_00(dsc->user_data, sizeof(lv_img_decoder_built_in_data_t));
}
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
+9 -1
View File
@@ -6,11 +6,19 @@ CSRCS += lv_font_montserrat_16.c
CSRCS += lv_font_montserrat_18.c
CSRCS += lv_font_montserrat_20.c
CSRCS += lv_font_montserrat_22.c
CSRCS += lv_font_montserrat_14.c
CSRCS += lv_font_montserrat_24.c
CSRCS += lv_font_montserrat_26.c
CSRCS += lv_font_montserrat_28.c
CSRCS += lv_font_montserrat_30.c
CSRCS += lv_font_montserrat_32.c
CSRCS += lv_font_montserrat_34.c
CSRCS += lv_font_montserrat_36.c
CSRCS += lv_font_montserrat_38.c
CSRCS += lv_font_montserrat_40.c
CSRCS += lv_font_montserrat_42.c
CSRCS += lv_font_montserrat_44.c
CSRCS += lv_font_montserrat_46.c
CSRCS += lv_font_montserrat_48.c
CSRCS += lv_font_montserrat_12_subpx.c
CSRCS += lv_font_montserrat_28_compressed.c
CSRCS += lv_font_unscii_8.c
+5 -5
View File
@@ -56,7 +56,7 @@ static lv_disp_t * disp_def;
*/
void lv_disp_drv_init(lv_disp_drv_t * driver)
{
memset(driver, 0, sizeof(lv_disp_drv_t));
lv_memset_00(driver, sizeof(lv_disp_drv_t));
driver->flush_cb = NULL;
driver->hor_res = LV_HOR_RES_MAX;
@@ -103,7 +103,7 @@ void lv_disp_drv_init(lv_disp_drv_t * driver)
*/
void lv_disp_buf_init(lv_disp_buf_t * disp_buf, void * buf1, void * buf2, uint32_t size_in_px_cnt)
{
memset(disp_buf, 0, sizeof(lv_disp_buf_t));
lv_memset_00(disp_buf, sizeof(lv_disp_buf_t));
disp_buf->buf1 = buf1;
disp_buf->buf2 = buf2;
@@ -125,9 +125,9 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
return NULL;
}
memcpy(&disp->driver, driver, sizeof(lv_disp_drv_t));
memset(&disp->inv_area_joined, 0, sizeof(disp->inv_area_joined));
memset(&disp->inv_areas, 0, sizeof(disp->inv_areas));
lv_memcpy(&disp->driver, driver, sizeof(lv_disp_drv_t));
lv_memset_00(&disp->inv_area_joined, sizeof(disp->inv_area_joined));
lv_memset_00(&disp->inv_areas, sizeof(disp->inv_areas));
lv_ll_init(&disp->scr_ll, sizeof(lv_obj_t));
disp->last_activity_time = 0;
+4 -4
View File
@@ -52,10 +52,10 @@ typedef struct {
void * buf_act;
uint32_t size; /*In pixel count*/
lv_area_t area;
volatile uint32_t flushing :1;
volatile uint32_t flushing_last :1;
volatile uint32_t last_area :1;
volatile uint32_t last_part :1;
volatile int flushing; /*1: flushing is in progress. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
volatile int flushing_last; /*1: It was the last chunk to flush. (It can't be a bitfield because when it's cleared from IRQ Read-Modify-Write issue might occur)*/
volatile uint32_t last_area :1; /*1: the last area is being rendered*/
volatile uint32_t last_part :1; /*1: the last part of the current area is being rendered*/
} lv_disp_buf_t;
/**
+4 -4
View File
@@ -51,7 +51,7 @@
*/
void lv_indev_drv_init(lv_indev_drv_t * driver)
{
memset(driver, 0, sizeof(lv_indev_drv_t));
lv_memset_00(driver, sizeof(lv_indev_drv_t));
driver->type = LV_INDEV_TYPE_NONE;
driver->drag_limit = LV_INDEV_DEF_DRAG_LIMIT;
@@ -84,8 +84,8 @@ lv_indev_t * lv_indev_drv_register(lv_indev_drv_t * driver)
return NULL;
}
memset(indev, 0, sizeof(lv_indev_t));
memcpy(&indev->driver, driver, sizeof(lv_indev_drv_t));
lv_memset_00(indev, sizeof(lv_indev_t));
lv_memcpy(&indev->driver, driver, sizeof(lv_indev_drv_t));
indev->proc.reset_query = 1;
indev->cursor = NULL;
@@ -131,7 +131,7 @@ bool lv_indev_read(lv_indev_t * indev, lv_indev_data_t * data)
{
bool cont = false;
memset(data, 0, sizeof(lv_indev_data_t));
lv_memset_00(data, sizeof(lv_indev_data_t));
/* For touchpad sometimes users don't the last pressed coordinate on release.
* So be sure a coordinates are initialized to the last point */
+3 -3
View File
@@ -77,7 +77,7 @@ void lv_anim_core_init(void)
*/
void lv_anim_init(lv_anim_t * a)
{
memset(a, 0, sizeof(lv_anim_t));
lv_memset_00(a, sizeof(lv_anim_t));
a->time = 500;
a->start = 0;
a->end = 100;
@@ -107,7 +107,7 @@ void lv_anim_start(lv_anim_t * a)
/*Initialize the animation descriptor*/
a->time_orig = a->time;
memcpy(new_anim, a, sizeof(lv_anim_t));
lv_memcpy(new_anim, a, sizeof(lv_anim_t));
/*Set the start value*/
if(new_anim->early_apply) {
@@ -502,7 +502,7 @@ static bool anim_ready_handler(lv_anim_t * a)
/*Create copy from the animation and delete the animation from the list.
* This way the `ready_cb` will see the animations like it's animation is ready deleted*/
lv_anim_t a_tmp;
memcpy(&a_tmp, a, sizeof(lv_anim_t));
lv_memcpy(&a_tmp, a, sizeof(lv_anim_t));
lv_ll_remove(&LV_GC_ROOT(_lv_anim_ll), a);
lv_mem_free(a);
/*Flag that the list has changed */
+2 -1
View File
@@ -17,6 +17,7 @@ extern "C" {
#include <string.h>
#include <stdbool.h>
#include <stdint.h>
#include "lv_mem.h"
/*********************
* DEFINES
@@ -98,7 +99,7 @@ void lv_area_set(lv_area_t * area_p, lv_coord_t x1, lv_coord_t y1, lv_coord_t x2
*/
inline static void lv_area_copy(lv_area_t * dest, const lv_area_t * src)
{
memcpy(dest, src, sizeof(lv_area_t));
lv_memcpy_small(dest, src, sizeof(lv_area_t));
}
/**
+1 -1
View File
@@ -57,7 +57,7 @@ lv_res_t lv_async_call(lv_async_cb_t async_xcb, void * user_data)
/* Set the task's user data */
task->user_data = info;
lv_task_once(task);
lv_task_set_repeat_count(task, 1);
return LV_RES_OK;
}
+5 -5
View File
@@ -316,7 +316,7 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
if(rd) {
if(base_dir == LV_BIDI_DIR_LTR) {
if(str_out) {
memcpy(&str_out[wr], str_in, rd);
lv_memcpy(&str_out[wr], str_in, rd);
wr += rd;
}
if(pos_conv_out) {
@@ -339,7 +339,7 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
if(base_dir == LV_BIDI_DIR_LTR) {
if(run_dir == LV_BIDI_DIR_LTR) {
if(str_out) memcpy(&str_out[wr], &str_in[rd], run_len);
if(str_out) lv_memcpy(&str_out[wr], &str_in[rd], run_len);
if(pos_conv_out) fill_pos_conv(&pos_conv_out[pos_conv_wr], pos_conv_run_len, pos_conv_rd);
}
else rtl_reverse(str_out ? &str_out[wr] : NULL, &str_in[rd], run_len, pos_conv_out ? &pos_conv_out[pos_conv_wr] : NULL,
@@ -351,7 +351,7 @@ void lv_bidi_process_paragraph(const char * str_in, char * str_out, uint32_t len
wr -= run_len;
pos_conv_wr -= pos_conv_run_len;
if(run_dir == LV_BIDI_DIR_LTR) {
if(str_out) memcpy(&str_out[wr], &str_in[rd], run_len);
if(str_out) lv_memcpy(&str_out[wr], &str_in[rd], run_len);
if(pos_conv_out) fill_pos_conv(&pos_conv_out[pos_conv_wr], pos_conv_run_len, pos_conv_rd);
}
else rtl_reverse(str_out ? &str_out[wr] : NULL, &str_in[rd], run_len, pos_conv_out ? &pos_conv_out[pos_conv_wr] : NULL,
@@ -528,7 +528,7 @@ static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t *
pos_conv_first_weak = 0;
}
if(dest) memcpy(&dest[wr], &src[first_weak], last_weak - first_weak + 1);
if(dest) lv_memcpy(&dest[wr], &src[first_weak], last_weak - first_weak + 1);
if(pos_conv_out) fill_pos_conv(&pos_conv_out[pos_conv_wr], pos_conv_last_weak - pos_conv_first_weak + 1,
pos_conv_rd_base + pos_conv_first_weak);
wr += last_weak - first_weak + 1;
@@ -548,7 +548,7 @@ static void rtl_reverse(char * dest, const char * src, uint32_t len, uint16_t *
}
/*Just store the letter*/
else {
if(dest) memcpy(&dest[wr], &src[i], letter_size);
if(dest) lv_memcpy(&dest[wr], &src[i], letter_size);
if(pos_conv_out) pos_conv_out[pos_conv_wr] = SET_RTL_POS(pos_conv_rd_base + pos_conv_i, true);
wr += letter_size;
pos_conv_wr++;
+2 -2
View File
@@ -475,7 +475,7 @@ lv_fs_res_t lv_fs_free_space(char letter, uint32_t * total_p, uint32_t * free_p)
*/
void lv_fs_drv_init(lv_fs_drv_t * drv)
{
memset(drv, 0, sizeof(lv_fs_drv_t));
lv_memset_00(drv, sizeof(lv_fs_drv_t));
}
/**
@@ -491,7 +491,7 @@ void lv_fs_drv_register(lv_fs_drv_t * drv_p)
LV_ASSERT_MEM(new_drv);
if(new_drv == NULL) return;
memcpy(new_drv, drv_p, sizeof(lv_fs_drv_t));
lv_memcpy(new_drv, drv_p, sizeof(lv_fs_drv_t));
}
/**
+1 -1
View File
@@ -44,7 +44,7 @@
void lv_gc_clear_roots(void)
{
#define LV_CLEAR_ROOT(root_type, root_name) memset(&LV_GC_ROOT(root_name), 0, sizeof(LV_GC_ROOT(root_name)));
#define LV_CLEAR_ROOT(root_type, root_name) lv_memset_00(&LV_GC_ROOT(root_name), sizeof(LV_GC_ROOT(root_name)));
LV_ITERATE_ROOTS(LV_CLEAR_ROOT)
}
+6 -6
View File
@@ -299,7 +299,7 @@ void * lv_ll_get_next(const lv_ll_t * ll_p, const void * n_act)
if(ll_p != NULL) {
const lv_ll_node_t * n_act_d = n_act;
memcpy(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *));
lv_memcpy_small(&next, n_act_d + LL_NEXT_P_OFFSET(ll_p), sizeof(void *));
}
return next;
@@ -317,7 +317,7 @@ void * lv_ll_get_prev(const lv_ll_t * ll_p, const void * n_act)
if(ll_p != NULL) {
const lv_ll_node_t * n_act_d = n_act;
memcpy(&prev, n_act_d + LL_PREV_P_OFFSET(ll_p), sizeof(void *));
lv_memcpy_small(&prev, n_act_d + LL_PREV_P_OFFSET(ll_p), sizeof(void *));
}
return prev;
@@ -404,9 +404,9 @@ static void node_set_prev(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * pre
uint32_t node_p_size = sizeof(lv_ll_node_t *);
if(prev)
memcpy(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size);
lv_memcpy_small(act + LL_PREV_P_OFFSET(ll_p), &prev, node_p_size);
else
memset(act + LL_PREV_P_OFFSET(ll_p), 0, node_p_size);
lv_memset_00(act + LL_PREV_P_OFFSET(ll_p), node_p_size);
}
/**
@@ -421,7 +421,7 @@ static void node_set_next(lv_ll_t * ll_p, lv_ll_node_t * act, lv_ll_node_t * nex
uint32_t node_p_size = sizeof(lv_ll_node_t *);
if(next)
memcpy(act + LL_NEXT_P_OFFSET(ll_p), &next, node_p_size);
lv_memcpy_small(act + LL_NEXT_P_OFFSET(ll_p), &next, node_p_size);
else
memset(act + LL_NEXT_P_OFFSET(ll_p), 0, node_p_size);
lv_memset_00(act + LL_NEXT_P_OFFSET(ll_p), node_p_size);
}
+5 -3
View File
@@ -382,8 +382,11 @@ lv_res_t lv_mem_test(void)
lv_mem_ent_t * e;
e = ent_get_next(NULL);
while(e) {
if((e->header.s.used && e->header.s.d_size > LV_MEM_SIZE) ||
(e->header.s.used == 0 && e->header.s.d_size > LV_MEM_SIZE)) {
if(e->header.s.d_size > LV_MEM_SIZE) {
return LV_RES_INV;
}
uint8_t * e8 = (uint8_t*) e;
if(e8 + e->header.s.d_size > work_mem + LV_MEM_SIZE) {
return LV_RES_INV;
}
e = ent_get_next(e);
@@ -530,7 +533,6 @@ void lv_mem_buf_free_all(void)
/**
* Same as `memcpy` but optimized for 4 byte operation.
* `dst` and `src` should be word aligned else normal `memcpy` will be used
* @param dst pointer to the destination buffer
* @param src pointer to the source buffer
* @param len number of byte to copy
+19 -1
View File
@@ -135,13 +135,31 @@ void lv_mem_buf_free_all(void);
/**
* Same as `memcpy` but optimized for 4 byte operation.
* `dst` and `src` should be word aligned else normal `memcpy` will be used
* @param dst pointer to the destination buffer
* @param src pointer to the source buffer
* @param len number of byte to copy
*/
void * lv_memcpy(void * dst, const void * src, size_t len);
/**
* Same as `memcpy` but optimized to copy only a few bytes.
* @param dst pointer to the destination buffer
* @param src pointer to the source buffer
* @param len number of byte to copy
*/
static inline void * lv_memcpy_small(void * dst, const void * src, size_t len)
{
uint8_t * d8 = (uint8_t *)dst;
const uint8_t * s8 = (const uint8_t *)src;
while(len) {
*d8 = *s8; d8++; s8++;
len--;
}
return dst;
}
/**
* Same as `memset` but optimized for 4 byte operation.
* `dst` should be word aligned else normal `memcpy` will be used
+10 -6
View File
@@ -236,7 +236,7 @@ lv_task_t * lv_task_create_basic(void)
new_task->task_cb = NULL;
new_task->prio = DEF_PRIO;
new_task->once = 0;
new_task->repeat_count = -1;
new_task->last_run = lv_tick_get();
new_task->user_data = NULL;
@@ -341,12 +341,13 @@ void lv_task_ready(lv_task_t * task)
}
/**
* Delete the lv_task after one call
* Set the number of times a task will repeat.
* @param task pointer to a lv_task.
* @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times
*/
void lv_task_once(lv_task_t * task)
void lv_task_set_repeat_count(lv_task_t * task, int32_t repeat_count)
{
task->once = 1;
task->repeat_count = repeat_count;
}
/**
@@ -398,9 +399,12 @@ static bool lv_task_exec(lv_task_t * task)
/*Delete if it was a one shot lv_task*/
if(task_deleted == false) { /*The task might be deleted by itself as well*/
if(task->once != 0) {
lv_task_del(task);
if(task->repeat_count > 0) {
task->repeat_count--;
}
if(task->repeat_count == 0) {
lv_task_del(task);
}
}
exec = true;
}
+4 -3
View File
@@ -64,8 +64,8 @@ typedef struct _lv_task_t {
void * user_data; /**< Custom user data */
int32_t repeat_count; /**< 1: Task times; -1 : infinity; 0 : stop ; n>0: residual times */
uint8_t prio : 3; /**< Task priority */
uint8_t once : 1; /**< 1: one shot task */
} lv_task_t;
/**********************
@@ -140,10 +140,11 @@ void lv_task_set_period(lv_task_t * task, uint32_t period);
void lv_task_ready(lv_task_t * task);
/**
* Delete the lv_task after one call
* Set the number of times a task will repeat.
* @param task pointer to a lv_task.
* @param repeat_count -1 : infinity; 0 : stop ; n>0: residual times
*/
void lv_task_once(lv_task_t * task);
void lv_task_set_repeat_count(lv_task_t * task, int32_t repeat_count);
/**
* Reset a lv_task.
+2 -2
View File
@@ -445,7 +445,7 @@ void lv_txt_ins(char * txt_buf, uint32_t pos, const char * ins_txt)
}
/* Copy the text into the new space*/
memcpy(txt_buf + pos, ins_txt, ins_len);
lv_memcpy_small(txt_buf + pos, ins_txt, ins_len);
}
/**
@@ -537,7 +537,7 @@ static uint32_t lv_txt_utf8_conv_wc(uint32_t c)
if((c & 0x80) != 0) {
uint32_t swapped;
uint8_t c8[4];
memcpy(c8, &c, 4);
lv_memcpy_small(c8, &c, 4);
swapped = (c8[0] << 24) + (c8[1] << 16) + (c8[2] << 8) + (c8[3]);
uint8_t i;
for(i = 0; i < 4; i++) {
+28 -9
View File
@@ -17,20 +17,26 @@ extern "C" {
/*********************
* DEFINES
*********************/
// Check windows
#ifdef _WIN64
#if __STDC_VERSION__ >= 199901L // If c99 or newer, use stdint.h to determine arch size
#include <stdint.h>
#endif
// If __UINTPTR_MAX__ or UINTPTR_MAX are available, use them to determine arch size
#if defined(__UINTPTR_MAX__) && __UINTPTR_MAX__ > 0xFFFFFFFF
#define LV_ARCH_64
#endif
/* Check GCC */
#ifdef __GNUC__
#if defined(__x86_64__) || defined(__ppc64__)
#elif defined(UINTPTR_MAX) && UINTPTR_MAX > 0xFFFFFFFF
#define LV_ARCH_64
#endif
// Otherwise use compiler-dependent means to determine arch size
#elif defined(_WIN64) || defined(__x86_64__) || defined(__ppc64__) || defined (__aarch64__)
#define LV_ARCH_64
#endif
#define LV_UNUNSED(x) (void)x;
/**********************
* TYPEDEFS
**********************/
@@ -45,12 +51,24 @@ enum {
};
typedef uint8_t lv_res_t;
#if __STDC_VERSION__ >= 199901L
// If c99 or newer, use the definition of uintptr_t directly from <stdint.h>
typedef uintptr_t lv_uintptr_t;
#else
// Otherwise, use the arch size determination
#ifdef LV_ARCH_64
typedef uint64_t lv_uintptr_t;
#else
typedef uint32_t lv_uintptr_t;
#endif
#endif
/**********************
* GLOBAL PROTOTYPES
**********************/
@@ -64,3 +82,4 @@ typedef uint32_t lv_uintptr_t;
#endif
#endif /*LV_TYPES_H*/
+1 -1
View File
@@ -109,7 +109,7 @@ uint32_t lv_theme_get_flags(void)
void lv_theme_apply(lv_obj_t * obj, lv_theme_style_t name)
{
act_theme->apply_cb(obj, name);
act_theme->apply_xcb(obj, name);
}
+1 -1
View File
@@ -144,7 +144,7 @@ typedef enum {
} lv_theme_style_t;
typedef struct {
void (*apply_cb)(lv_obj_t *, lv_theme_style_t);
void (*apply_xcb)(lv_obj_t *, lv_theme_style_t);
lv_color_t color_primary;
lv_color_t color_secondary;
const lv_font_t * font_small;
+1 -1
View File
@@ -62,7 +62,7 @@ lv_theme_t * lv_theme_empty_init(lv_color_t color_primary, lv_color_t color_seco
lv_style_init(&opa_cover);
lv_style_set_bg_opa(&opa_cover, LV_STATE_DEFAULT, LV_OPA_COVER);
theme.apply_cb = lv_theme_empty_apply;
theme.apply_xcb = lv_theme_empty_apply;
return &theme;
}
+36 -13
View File
@@ -63,7 +63,7 @@
#define COLOR_BG_SEC_TEXT_DIS (IS_LIGHT ? lv_color_hex(0xaaaaaa) : lv_color_hex(0xa5a8ad))
#define TRANSITION_TIME 150
#define BORDER_WIDTH LV_DPX(3)
#define BORDER_WIDTH LV_DPX(2)
#define IS_LIGHT (theme.flags & LV_THEME_MATERIAL_FLAG_LIGHT)
/**********************
@@ -146,6 +146,9 @@ static lv_style_t pad_small;
#if LV_USE_PAGE
static lv_style_t sb;
#if LV_USE_ANIMATION
static lv_style_t edge_flash;
#endif
#endif
#if LV_USE_ROLLER
@@ -200,6 +203,7 @@ static void basic_init(void)
lv_style_set_bg_color(&bg, LV_STATE_DEFAULT, COLOR_BG);
lv_style_set_border_color(&bg, LV_STATE_DEFAULT, COLOR_BG_BORDER);
lv_style_set_border_color(&bg, LV_STATE_FOCUSED, theme.color_primary);
lv_style_set_border_color(&bg, LV_STATE_EDITED, theme.color_secondary);
lv_style_set_border_width(&bg, LV_STATE_DEFAULT, BORDER_WIDTH);
lv_style_set_border_post(&bg, LV_STATE_DEFAULT, true);
lv_style_set_text_font(&bg, LV_STATE_DEFAULT, theme.font_normal);
@@ -289,6 +293,7 @@ static void basic_init(void)
lv_style_set_outline_opa(&btn, LV_STATE_DEFAULT, LV_OPA_0);
lv_style_set_outline_opa(&btn, LV_STATE_FOCUSED, LV_OPA_50);
lv_style_set_outline_color(&btn, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_outline_color(&btn, LV_STATE_EDITED, theme.color_secondary);
lv_style_set_transition_time(&btn, LV_STATE_DEFAULT, TRANSITION_TIME);
lv_style_set_transition_prop_4(&btn, LV_STATE_DEFAULT, LV_STYLE_BORDER_OPA);
lv_style_set_transition_prop_5(&btn, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR);
@@ -337,6 +342,7 @@ static void bar_init(void)
lv_style_set_bg_color(&bar_bg, LV_STATE_DEFAULT, COLOR_BG_SEC);
lv_style_set_value_color(&bar_bg, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x31404f) : LV_COLOR_WHITE);
lv_style_set_outline_color(&bar_bg, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_outline_color(&bar_bg, LV_STATE_EDITED, theme.color_secondary);
lv_style_set_outline_opa(&bar_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_style_set_outline_opa(&bar_bg, LV_STATE_FOCUSED, LV_OPA_50);
lv_style_set_outline_width(&bar_bg, LV_STATE_DEFAULT, 3);
@@ -570,6 +576,7 @@ static void cpicker_init(void)
lv_style_set_border_width(&cpicker_indic, LV_STATE_DEFAULT, 2);
lv_style_set_border_color(&cpicker_indic, LV_STATE_DEFAULT, LV_COLOR_GRAY);
lv_style_set_border_color(&cpicker_indic, LV_STATE_FOCUSED, theme.color_primary);
lv_style_set_border_color(&cpicker_indic, LV_STATE_EDITED, theme.color_secondary);
lv_style_set_pad_left(&cpicker_indic, LV_STATE_DEFAULT,LV_DPX(13));
lv_style_set_pad_right(&cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
lv_style_set_pad_top(&cpicker_indic, LV_STATE_DEFAULT, LV_DPX(13));
@@ -612,6 +619,7 @@ static void keyboard_init(void)
lv_style_set_border_width(&kb_bg, LV_STATE_DEFAULT, LV_DPX(4));
lv_style_set_border_side(&kb_bg, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP);
lv_style_set_border_color(&kb_bg, LV_STATE_DEFAULT, IS_LIGHT ? COLOR_BG_TEXT : LV_COLOR_BLACK);
lv_style_set_border_color(&kb_bg, LV_STATE_EDITED, theme.color_secondary);
lv_style_set_pad_left(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
lv_style_set_pad_right(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
lv_style_set_pad_top(&kb_bg, LV_STATE_DEFAULT, LV_DPX(10));
@@ -641,6 +649,11 @@ static void page_init(void)
lv_style_set_pad_right(&sb, LV_STATE_DEFAULT, LV_DPX(7));
lv_style_set_pad_bottom(&sb, LV_STATE_DEFAULT, LV_DPX(7));
#if LV_USE_ANIMATION
style_init_reset(&edge_flash);
lv_style_set_bg_opa(&edge_flash, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&edge_flash, LV_STATE_DEFAULT, lv_color_hex3(0x888));
#endif
#endif
}
@@ -774,10 +787,12 @@ static void tabview_init(void)
lv_style_set_pad_top(&tabview_btns, LV_STATE_DEFAULT, LV_DPX(20));
lv_style_set_pad_bottom(&tabview_btns, LV_STATE_DEFAULT, LV_DPX(20));
lv_style_set_text_color(&tabview_btns, LV_STATE_FOCUSED, theme.color_primary);
lv_style_set_text_color(&tabview_btns, LV_STATE_EDITED, theme.color_secondary);
style_init_reset(&tabview_indic);
lv_style_set_bg_opa(&tabview_indic, LV_STATE_DEFAULT, LV_OPA_COVER);
lv_style_set_bg_color(&tabview_indic, LV_STATE_DEFAULT, theme.color_primary);
lv_style_set_bg_color(&tabview_indic, LV_STATE_EDITED, theme.color_secondary);
lv_style_set_size(&tabview_indic, LV_STATE_DEFAULT, LV_DPX(5));
lv_style_set_radius(&tabview_indic, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE);
@@ -878,7 +893,7 @@ lv_theme_t * lv_theme_material_init(lv_color_t color_primary, lv_color_t color_s
table_init();
win_init();
theme.apply_cb = lv_theme_material_apply;
theme.apply_xcb = lv_theme_material_apply;
inited = true;
@@ -1095,13 +1110,19 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
lv_style_list_add_style(list, &bg);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
lv_style_list_add_style(list, &pad_inner);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRLBAR);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRLBAR);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
lv_style_list_add_style(list, &sb);
#if LV_USE_ANIMATION
lv_obj_clean_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_EDGE_FLASH);
lv_style_list_add_style(list, &edge_flash);
#endif
break;
#endif
#if LV_USE_TABVIEW
@@ -1128,8 +1149,8 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_TABVIEW_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
lv_style_list_add_style(list, &tabview_page_scrl);
break;
@@ -1145,9 +1166,11 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_SCRLBAR);
lv_style_list_add_style(list, &sb);
#if LV_USE_ANIMATION
lv_obj_clean_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
list = lv_obj_get_style_list(obj, LV_TILEVIEW_PART_EDGE_FLASH);
lv_style_list_add_style(list, &btn);
lv_style_list_add_style(list, &edge_flash);
#endif
break;
#endif
@@ -1265,12 +1288,12 @@ void lv_theme_material_apply(lv_obj_t * obj, lv_theme_style_t name)
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
lv_style_list_add_style(list, &scr);
lv_obj_clean_style_list(obj, LV_WIN_PART_SCRLBAR);
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCRLBAR);
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
lv_style_list_add_style(list, &sb);
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCRL);
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCRL);
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
lv_style_list_add_style(list, &tabview_page_scrl);
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
+11 -11
View File
@@ -527,7 +527,7 @@ lv_theme_t * lv_theme_mono_init(lv_color_t color_primary, lv_color_t color_secon
table_init();
win_init();
theme.apply_cb = lv_theme_mono_apply;
theme.apply_xcb = lv_theme_mono_apply;
return &theme;
}
@@ -760,12 +760,12 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
list = lv_obj_get_style_list(obj, LV_PAGE_PART_BG);
lv_style_list_add_style(list, &style_bg);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
lv_style_list_add_style(list, &style_pad_inner);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRLBAR);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRLBAR);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLBAR);
lv_style_list_add_style(list, &style_sb);
break;
#endif
@@ -794,8 +794,8 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
case LV_THEME_TABVIEW_PAGE:
lv_obj_clean_style_list(obj, LV_PAGE_PART_BG);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCRL);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCRL);
lv_obj_clean_style_list(obj, LV_PAGE_PART_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_PAGE_PART_SCROLLABLE);
lv_style_list_add_style(list, &style_pad_normal);
break;
@@ -939,12 +939,12 @@ void lv_theme_mono_apply(lv_obj_t * obj, lv_theme_style_t name)
list = lv_obj_get_style_list(obj, LV_WIN_PART_BG);
lv_style_list_add_style(list, &style_bg);
lv_obj_clean_style_list(obj, LV_WIN_PART_SCRLBAR);
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCRLBAR);
lv_obj_clean_style_list(obj, LV_WIN_PART_SCROLLBAR);
list = lv_obj_get_style_list(obj, LV_WIN_PART_SCROLLBAR);
lv_style_list_add_style(list, &style_sb);
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCRL);
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCRL);
lv_obj_clean_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
list = lv_obj_get_style_list(obj, LV_WIN_PART_CONTENT_SCROLLABLE);
lv_style_list_add_style(list, &style_bg);
lv_obj_clean_style_list(obj, LV_WIN_PART_HEADER);
+1 -1
View File
@@ -382,7 +382,7 @@ lv_theme_t * lv_theme_template_init(lv_color_t color_primary, lv_color_t color_s
table_init();
win_init();
theme.apply_cb = lv_theme_material_apply;
theme.apply_xcb = lv_theme_material_apply;
return &theme;
}
+17 -19
View File
@@ -137,27 +137,26 @@ void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state)
switch(state) {
case LV_BTN_STATE_RELEASED:
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED);
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
break;
case LV_BTN_STATE_PRESSED:
lv_obj_clear_state(btn, LV_STATE_CHECKED | LV_STATE_DISABLED);
lv_obj_clear_state(btn, LV_STATE_CHECKED);
lv_obj_add_state(btn, LV_STATE_PRESSED);
break;
case LV_BTN_STATE_CHECKED_RELEASED:
lv_obj_add_state(btn, LV_STATE_CHECKED);
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_DISABLED);
lv_obj_clear_state(btn, LV_STATE_PRESSED);
break;
case LV_BTN_STATE_CHECKED_PRESSED:
lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED);
lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
break;
case LV_BTN_STATE_DISABLED:
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
lv_obj_add_state(btn, LV_STATE_DISABLED);
break;
case LV_BTN_STATE_ACTIVE:
lv_obj_clear_state(btn, LV_STATE_DISABLED);
break;
}
// /*Make the state change happen immediately, without transition*/
// btn->prev_state = btn->state;
}
/**
@@ -185,26 +184,25 @@ void lv_btn_toggle(lv_obj_t * btn)
/**
* Get the current state of the button
* @param btn pointer to a button object
* @return the state of the button (from lv_btn_state_t enum)
* @return the state of the button (from lv_btn_state_t enum).
* If the button is in disabled state `LV_BTN_STATE_DISABLED` will be ORed to the other button states.
*/
lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn)
{
LV_ASSERT_OBJ(btn, LV_OBJX_NAME);
lv_state_t state = lv_obj_get_state(btn, LV_BTN_PART_MAIN);
lv_state_t obj_state = lv_obj_get_state(btn, LV_BTN_PART_MAIN);
lv_btn_state_t btn_state = 0;
if(obj_state & LV_STATE_DISABLED) btn_state = LV_BTN_STATE_DISABLED;
if(state & LV_STATE_DISABLED) {
return LV_BTN_STATE_DISABLED;
}
else if(state & LV_STATE_CHECKED) {
if(state & LV_STATE_PRESSED) return LV_BTN_STATE_CHECKED_PRESSED;
else return LV_BTN_STATE_CHECKED_RELEASED;
if(obj_state & LV_STATE_CHECKED) {
if(obj_state & LV_STATE_PRESSED) return btn_state | LV_BTN_STATE_CHECKED_PRESSED;
else return btn_state | LV_BTN_STATE_CHECKED_RELEASED;
}
else {
if(state & LV_STATE_PRESSED) return LV_BTN_STATE_PRESSED;
else return LV_BTN_STATE_RELEASED;
if(obj_state & LV_STATE_PRESSED) return btn_state | LV_BTN_STATE_PRESSED;
else return btn_state | LV_BTN_STATE_RELEASED;
}
}
/**

Some files were not shown because too many files have changed in this diff Show More