mirror of
https://github.com/lvgl/lvgl.git
synced 2024-12-02 22:24:02 +08:00
parent
8abd060a8a
commit
d67dd943ca
@ -126,14 +126,13 @@ lv_obj_t * lv_disp_get_layer_sys(lv_disp_t * disp)
|
||||
*/
|
||||
void lv_disp_set_theme(lv_disp_t * disp, lv_theme_t * th)
|
||||
{
|
||||
if(disp == NULL) disp = lv_disp_get_default();
|
||||
if(disp == NULL) disp = lv_disp_get_default();
|
||||
disp->theme = th;
|
||||
|
||||
if(disp->screen_cnt == 3 &&
|
||||
lv_obj_get_child_cnt(disp->screens[0]) == 0 &&
|
||||
lv_obj_get_child_cnt(disp->screens[1]) == 0 &&
|
||||
lv_obj_get_child_cnt(disp->screens[2]) == 0)
|
||||
{
|
||||
lv_obj_get_child_cnt(disp->screens[0]) == 0 &&
|
||||
lv_obj_get_child_cnt(disp->screens[1]) == 0 &&
|
||||
lv_obj_get_child_cnt(disp->screens[2]) == 0) {
|
||||
lv_theme_apply(disp->screens[0]);
|
||||
}
|
||||
}
|
||||
@ -144,7 +143,7 @@ void lv_disp_set_theme(lv_disp_t * disp, lv_theme_t * th)
|
||||
*/
|
||||
lv_theme_t * lv_disp_get_theme(lv_disp_t * disp)
|
||||
{
|
||||
if(disp == NULL) disp = lv_disp_get_default();
|
||||
if(disp == NULL) disp = lv_disp_get_default();
|
||||
return disp->theme;
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,11 @@
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
typedef struct _lv_event_dsc_t{
|
||||
typedef struct _lv_event_dsc_t {
|
||||
lv_event_cb_t cb;
|
||||
void * user_data;
|
||||
lv_event_code_t filter :8;
|
||||
}lv_event_dsc_t;
|
||||
lv_event_code_t filter : 8;
|
||||
} lv_event_dsc_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
@ -39,9 +39,9 @@ static lv_event_t * event_head;
|
||||
* MACROS
|
||||
**********************/
|
||||
#if LV_LOG_TRACE_EVENT
|
||||
# define EVENT_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#define EVENT_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#else
|
||||
# define EVENT_TRACE(...)
|
||||
#define EVENT_TRACE(...)
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@ -147,13 +147,15 @@ void _lv_event_mark_deleted(lv_obj_t * obj)
|
||||
}
|
||||
|
||||
|
||||
struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data)
|
||||
struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter,
|
||||
void * user_data)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_obj_allocate_spec_attr(obj);
|
||||
|
||||
obj->spec_attr->event_dsc_cnt++;
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
LV_ASSERT_MALLOC(obj->spec_attr->event_dsc);
|
||||
|
||||
obj->spec_attr->event_dsc[obj->spec_attr->event_dsc_cnt - 1].cb = event_cb;
|
||||
@ -172,11 +174,12 @@ bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
|
||||
for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) {
|
||||
if(event_cb == NULL || obj->spec_attr->event_dsc[i].cb == event_cb) {
|
||||
/*Shift the remaining event handlers forward*/
|
||||
for(; i < (obj->spec_attr->event_dsc_cnt-1); i++) {
|
||||
obj->spec_attr->event_dsc[i] = obj->spec_attr->event_dsc[i+1];
|
||||
for(; i < (obj->spec_attr->event_dsc_cnt - 1); i++) {
|
||||
obj->spec_attr->event_dsc[i] = obj->spec_attr->event_dsc[i + 1];
|
||||
}
|
||||
obj->spec_attr->event_dsc_cnt--;
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
LV_ASSERT_MALLOC(obj->spec_attr->event_dsc);
|
||||
return true;
|
||||
}
|
||||
@ -194,14 +197,14 @@ bool lv_obj_remove_event_cb_with_user_data(lv_obj_t * obj, lv_event_cb_t event_c
|
||||
int32_t i = 0;
|
||||
for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) {
|
||||
if((event_cb == NULL || obj->spec_attr->event_dsc[i].cb) &&
|
||||
obj->spec_attr->event_dsc[i].user_data == user_data)
|
||||
{
|
||||
obj->spec_attr->event_dsc[i].user_data == user_data) {
|
||||
/*Shift the remaining event handlers forward*/
|
||||
for(; i < (obj->spec_attr->event_dsc_cnt-1); i++) {
|
||||
obj->spec_attr->event_dsc[i] = obj->spec_attr->event_dsc[i+1];
|
||||
for(; i < (obj->spec_attr->event_dsc_cnt - 1); i++) {
|
||||
obj->spec_attr->event_dsc[i] = obj->spec_attr->event_dsc[i + 1];
|
||||
}
|
||||
obj->spec_attr->event_dsc_cnt--;
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
LV_ASSERT_MALLOC(obj->spec_attr->event_dsc);
|
||||
return true;
|
||||
}
|
||||
@ -221,11 +224,12 @@ bool lv_obj_remove_event_dsc(lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc)
|
||||
for(i = 0; i < obj->spec_attr->event_dsc_cnt; i++) {
|
||||
if(&obj->spec_attr->event_dsc[i] == event_dsc) {
|
||||
/*Shift the remaining event handlers forward*/
|
||||
for(; i < (obj->spec_attr->event_dsc_cnt-1); i++) {
|
||||
obj->spec_attr->event_dsc[i] = obj->spec_attr->event_dsc[i+1];
|
||||
for(; i < (obj->spec_attr->event_dsc_cnt - 1); i++) {
|
||||
obj->spec_attr->event_dsc[i] = obj->spec_attr->event_dsc[i + 1];
|
||||
}
|
||||
obj->spec_attr->event_dsc_cnt--;
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc, obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
obj->spec_attr->event_dsc = lv_mem_realloc(obj->spec_attr->event_dsc,
|
||||
obj->spec_attr->event_dsc_cnt * sizeof(lv_event_dsc_t));
|
||||
LV_ASSERT_MALLOC(obj->spec_attr->event_dsc);
|
||||
return true;
|
||||
}
|
||||
@ -239,24 +243,24 @@ lv_indev_t * lv_event_get_indev(lv_event_t * e)
|
||||
{
|
||||
|
||||
if(e->code == LV_EVENT_PRESSED ||
|
||||
e->code == LV_EVENT_PRESSING ||
|
||||
e->code == LV_EVENT_PRESS_LOST ||
|
||||
e->code == LV_EVENT_SHORT_CLICKED ||
|
||||
e->code == LV_EVENT_LONG_PRESSED ||
|
||||
e->code == LV_EVENT_LONG_PRESSED_REPEAT ||
|
||||
e->code == LV_EVENT_CLICKED ||
|
||||
e->code == LV_EVENT_RELEASED ||
|
||||
e->code == LV_EVENT_SCROLL_BEGIN ||
|
||||
e->code == LV_EVENT_SCROLL_END ||
|
||||
e->code == LV_EVENT_SCROLL ||
|
||||
e->code == LV_EVENT_GESTURE ||
|
||||
e->code == LV_EVENT_KEY ||
|
||||
e->code == LV_EVENT_FOCUSED ||
|
||||
e->code == LV_EVENT_DEFOCUSED ||
|
||||
e->code == LV_EVENT_LEAVE)
|
||||
{
|
||||
e->code == LV_EVENT_PRESSING ||
|
||||
e->code == LV_EVENT_PRESS_LOST ||
|
||||
e->code == LV_EVENT_SHORT_CLICKED ||
|
||||
e->code == LV_EVENT_LONG_PRESSED ||
|
||||
e->code == LV_EVENT_LONG_PRESSED_REPEAT ||
|
||||
e->code == LV_EVENT_CLICKED ||
|
||||
e->code == LV_EVENT_RELEASED ||
|
||||
e->code == LV_EVENT_SCROLL_BEGIN ||
|
||||
e->code == LV_EVENT_SCROLL_END ||
|
||||
e->code == LV_EVENT_SCROLL ||
|
||||
e->code == LV_EVENT_GESTURE ||
|
||||
e->code == LV_EVENT_KEY ||
|
||||
e->code == LV_EVENT_FOCUSED ||
|
||||
e->code == LV_EVENT_DEFOCUSED ||
|
||||
e->code == LV_EVENT_LEAVE) {
|
||||
return lv_event_get_param(e);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
return NULL;
|
||||
}
|
||||
@ -264,11 +268,11 @@ lv_indev_t * lv_event_get_indev(lv_event_t * e)
|
||||
|
||||
lv_obj_draw_part_dsc_t * lv_event_get_draw_part_dsc(lv_event_t * e)
|
||||
{
|
||||
if(e->code == LV_EVENT_DRAW_PART_BEGIN||
|
||||
e->code == LV_EVENT_DRAW_PART_END)
|
||||
{
|
||||
if(e->code == LV_EVENT_DRAW_PART_BEGIN ||
|
||||
e->code == LV_EVENT_DRAW_PART_END) {
|
||||
return lv_event_get_param(e);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
return NULL;
|
||||
}
|
||||
@ -277,14 +281,14 @@ lv_obj_draw_part_dsc_t * lv_event_get_draw_part_dsc(lv_event_t * e)
|
||||
const lv_area_t * lv_event_get_clip_area(lv_event_t * e)
|
||||
{
|
||||
if(e->code == LV_EVENT_DRAW_MAIN ||
|
||||
e->code == LV_EVENT_DRAW_MAIN_BEGIN ||
|
||||
e->code == LV_EVENT_DRAW_MAIN_END ||
|
||||
e->code == LV_EVENT_DRAW_POST ||
|
||||
e->code == LV_EVENT_DRAW_POST_BEGIN ||
|
||||
e->code == LV_EVENT_DRAW_POST_END)
|
||||
{
|
||||
e->code == LV_EVENT_DRAW_MAIN_BEGIN ||
|
||||
e->code == LV_EVENT_DRAW_MAIN_END ||
|
||||
e->code == LV_EVENT_DRAW_POST ||
|
||||
e->code == LV_EVENT_DRAW_POST_BEGIN ||
|
||||
e->code == LV_EVENT_DRAW_POST_END) {
|
||||
return lv_event_get_param(e);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
return NULL;
|
||||
}
|
||||
@ -294,7 +298,8 @@ const lv_area_t * lv_event_get_old_size(lv_event_t * e)
|
||||
{
|
||||
if(e->code == LV_EVENT_SIZE_CHANGED) {
|
||||
return lv_event_get_param(e);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
return NULL;
|
||||
}
|
||||
@ -306,7 +311,8 @@ uint32_t lv_event_get_key(lv_event_t * e)
|
||||
uint32_t * k = lv_event_get_param(e);
|
||||
if(k) return *k;
|
||||
else return 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
return 0;
|
||||
}
|
||||
@ -316,7 +322,8 @@ lv_anim_t * lv_event_get_scroll_anim(lv_event_t * e)
|
||||
{
|
||||
if(e->code == LV_EVENT_SCROLL_BEGIN) {
|
||||
return lv_event_get_param(e);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
return 0;
|
||||
}
|
||||
@ -327,7 +334,8 @@ void lv_event_set_ext_draw_size(lv_event_t * e, lv_coord_t size)
|
||||
if(e->code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
||||
lv_coord_t * cur_size = lv_event_get_param(e);
|
||||
*cur_size = LV_MAX(*cur_size, size);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
}
|
||||
}
|
||||
@ -336,7 +344,8 @@ lv_point_t * lv_event_get_self_size_info(lv_event_t * e)
|
||||
{
|
||||
if(e->code == LV_EVENT_GET_SELF_SIZE) {
|
||||
return lv_event_get_param(e);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
return 0;
|
||||
}
|
||||
@ -346,7 +355,8 @@ lv_hit_test_info_t * lv_event_get_hit_test_info(lv_event_t * e)
|
||||
{
|
||||
if(e->code == LV_EVENT_HIT_TEST) {
|
||||
return lv_event_get_param(e);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
return 0;
|
||||
}
|
||||
@ -357,7 +367,8 @@ const lv_area_t * lv_event_get_cover_area(lv_event_t * e)
|
||||
if(e->code == LV_EVENT_COVER_CHECK) {
|
||||
lv_cover_check_info_t * p = lv_event_get_param(e);
|
||||
return p->area;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
return NULL;
|
||||
}
|
||||
@ -368,7 +379,8 @@ void lv_event_set_cover_res(lv_event_t * e, lv_cover_res_t res)
|
||||
if(e->code == LV_EVENT_COVER_CHECK) {
|
||||
lv_cover_check_info_t * p = lv_event_get_param(e);
|
||||
if(res > p->res) p->res = res; /*Save only "stronger" results*/
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LV_LOG_WARN("Not interpreted with this event code");
|
||||
}
|
||||
}
|
||||
@ -429,25 +441,25 @@ static lv_res_t event_send_core(lv_event_t * e)
|
||||
static bool event_is_bubbled(lv_event_code_t e)
|
||||
{
|
||||
switch(e) {
|
||||
case LV_EVENT_HIT_TEST:
|
||||
case LV_EVENT_COVER_CHECK:
|
||||
case LV_EVENT_REFR_EXT_DRAW_SIZE:
|
||||
case LV_EVENT_DRAW_MAIN_BEGIN:
|
||||
case LV_EVENT_DRAW_MAIN:
|
||||
case LV_EVENT_DRAW_MAIN_END:
|
||||
case LV_EVENT_DRAW_POST_BEGIN:
|
||||
case LV_EVENT_DRAW_POST:
|
||||
case LV_EVENT_DRAW_POST_END:
|
||||
case LV_EVENT_DRAW_PART_BEGIN:
|
||||
case LV_EVENT_DRAW_PART_END:
|
||||
case LV_EVENT_REFRESH:
|
||||
case LV_EVENT_DELETE:
|
||||
case LV_EVENT_CHILD_CHANGED:
|
||||
case LV_EVENT_SIZE_CHANGED:
|
||||
case LV_EVENT_STYLE_CHANGED:
|
||||
case LV_EVENT_GET_SELF_SIZE:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
case LV_EVENT_HIT_TEST:
|
||||
case LV_EVENT_COVER_CHECK:
|
||||
case LV_EVENT_REFR_EXT_DRAW_SIZE:
|
||||
case LV_EVENT_DRAW_MAIN_BEGIN:
|
||||
case LV_EVENT_DRAW_MAIN:
|
||||
case LV_EVENT_DRAW_MAIN_END:
|
||||
case LV_EVENT_DRAW_POST_BEGIN:
|
||||
case LV_EVENT_DRAW_POST:
|
||||
case LV_EVENT_DRAW_POST_END:
|
||||
case LV_EVENT_DRAW_PART_BEGIN:
|
||||
case LV_EVENT_DRAW_PART_END:
|
||||
case LV_EVENT_REFRESH:
|
||||
case LV_EVENT_DELETE:
|
||||
case LV_EVENT_CHILD_CHANGED:
|
||||
case LV_EVENT_SIZE_CHANGED:
|
||||
case LV_EVENT_STYLE_CHANGED:
|
||||
case LV_EVENT_GET_SELF_SIZE:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ typedef enum {
|
||||
LV_EVENT_GET_SELF_SIZE, /**< Get the internal size of a widget*/
|
||||
|
||||
_LV_EVENT_LAST /** Number of default events*/
|
||||
}lv_event_code_t;
|
||||
} lv_event_code_t;
|
||||
|
||||
typedef struct _lv_event_t {
|
||||
struct _lv_obj_t * target;
|
||||
@ -88,8 +88,8 @@ typedef struct _lv_event_t {
|
||||
void * user_data;
|
||||
void * param;
|
||||
struct _lv_event_t * prev;
|
||||
uint8_t deleted :1;
|
||||
}lv_event_t;
|
||||
uint8_t deleted : 1;
|
||||
} lv_event_t;
|
||||
|
||||
/**
|
||||
* @brief Event callback.
|
||||
@ -209,7 +209,8 @@ void _lv_event_mark_deleted(struct _lv_obj_t * obj);
|
||||
* @param user_data custom data data will be available in `event_cb`
|
||||
* @return a pointer the event descriptor. Can be used in ::lv_obj_remove_event_dsc
|
||||
*/
|
||||
struct _lv_event_dsc_t * lv_obj_add_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data);
|
||||
struct _lv_event_dsc_t * lv_obj_add_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter,
|
||||
void * user_data);
|
||||
|
||||
/**
|
||||
* Remove an event handler function for an object.
|
||||
@ -226,7 +227,8 @@ bool lv_obj_remove_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb);
|
||||
* @param event_user_data the user_data specified in ::lv_obj_add_event_cb
|
||||
* @return true if any event handlers were removed
|
||||
*/
|
||||
bool lv_obj_remove_event_cb_with_user_data(struct _lv_obj_t * obj, lv_event_cb_t event_cb, const void * event_user_data);
|
||||
bool lv_obj_remove_event_cb_with_user_data(struct _lv_obj_t * obj, lv_event_cb_t event_cb,
|
||||
const void * event_user_data);
|
||||
|
||||
/**
|
||||
* DEPRACTED because doesn't work if multiple event handlers are added to an object.
|
||||
|
@ -79,7 +79,7 @@ void lv_group_del(lv_group_t * group)
|
||||
/*Remove the objects from the group*/
|
||||
lv_obj_t ** obj;
|
||||
_LV_LL_READ(&group->obj_ll, obj) {
|
||||
if((*obj)->spec_attr) (*obj)->spec_attr->group_p = NULL;
|
||||
if((*obj)->spec_attr)(*obj)->spec_attr->group_p = NULL;
|
||||
}
|
||||
|
||||
_lv_ll_clear(&(group->obj_ll));
|
||||
@ -149,8 +149,8 @@ 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) {
|
||||
if((*obj_i) == obj1) (*obj_i) = obj2;
|
||||
else if((*obj_i) == obj2) (*obj_i) = obj1;
|
||||
if((*obj_i) == obj1)(*obj_i) = obj2;
|
||||
else if((*obj_i) == obj2)(*obj_i) = obj1;
|
||||
}
|
||||
|
||||
if(*g1->obj_focus == obj1) lv_group_focus_obj(obj2);
|
||||
@ -211,7 +211,7 @@ 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) {
|
||||
if((*obj)->spec_attr) (*obj)->spec_attr->group_p = NULL;
|
||||
if((*obj)->spec_attr)(*obj)->spec_attr->group_p = NULL;
|
||||
}
|
||||
|
||||
_lv_ll_clear(&(group->obj_ll));
|
||||
|
@ -76,7 +76,7 @@ typedef struct _lv_group_t {
|
||||
typedef enum {
|
||||
LV_GROUP_REFOCUS_POLICY_NEXT = 0,
|
||||
LV_GROUP_REFOCUS_POLICY_PREV = 1
|
||||
}lv_group_refocus_policy_t;
|
||||
} lv_group_refocus_policy_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
@ -52,9 +52,9 @@ static lv_obj_t * indev_obj_act = NULL;
|
||||
* MACROS
|
||||
**********************/
|
||||
#if LV_LOG_TRACE_INDEV
|
||||
# define INDEV_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#define INDEV_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#else
|
||||
# define INDEV_TRACE(...)
|
||||
#define INDEV_TRACE(...)
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@ -326,7 +326,7 @@ lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point)
|
||||
*/
|
||||
static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
{
|
||||
lv_disp_t *disp = i->driver->disp;
|
||||
lv_disp_t * disp = i->driver->disp;
|
||||
/*Save the raw points so they can be used again in _lv_indev_read*/
|
||||
i->proc.types.pointer.last_raw_point.x = data->point.x;
|
||||
i->proc.types.pointer.last_raw_point.y = data->point.y;
|
||||
@ -343,9 +343,11 @@ static void indev_pointer_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
|
||||
/*Simple sanity check*/
|
||||
if(data->point.x < 0) LV_LOG_WARN("X is %d which is smaller than zero", data->point.x);
|
||||
if(data->point.x >= lv_disp_get_hor_res(i->driver->disp)) LV_LOG_WARN("X is %d which is greater than hor. res", data->point.x);
|
||||
if(data->point.x >= lv_disp_get_hor_res(i->driver->disp)) LV_LOG_WARN("X is %d which is greater than hor. res",
|
||||
data->point.x);
|
||||
if(data->point.y < 0) LV_LOG_WARN("Y is %d which is smaller than zero", data->point.y);
|
||||
if(data->point.y >= lv_disp_get_ver_res(i->driver->disp)) LV_LOG_WARN("Y is %d which is greater than hor. res", data->point.y);
|
||||
if(data->point.y >= lv_disp_get_ver_res(i->driver->disp)) LV_LOG_WARN("Y is %d which is greater than hor. res",
|
||||
data->point.y);
|
||||
|
||||
/*Move the cursor if set and moved*/
|
||||
if(i->cursor != NULL &&
|
||||
@ -672,7 +674,8 @@ static void indev_encoder_proc(lv_indev_t * i, lv_indev_data_t * data)
|
||||
|
||||
|
||||
lv_group_send_data(g, LV_KEY_ENTER);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_obj_clear_state(indev_obj_act, LV_STATE_PRESSED); /*Remove the pressed state manually*/
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ static lv_coord_t find_snap_point_y(const lv_obj_t * obj, lv_coord_t min, lv_coo
|
||||
static void scroll_limit_diff(_lv_indev_proc_t * proc, lv_coord_t * diff_x, lv_coord_t * diff_y);
|
||||
static lv_coord_t scroll_throw_predict_y(_lv_indev_proc_t * proc);
|
||||
static lv_coord_t scroll_throw_predict_x(_lv_indev_proc_t * proc);
|
||||
static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_t scroll_start, lv_coord_t scroll_end, lv_dir_t dir);
|
||||
static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_t scroll_start, lv_coord_t scroll_end,
|
||||
lv_dir_t dir);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -68,7 +69,8 @@ void _lv_indev_scroll_handler(_lv_indev_proc_t * proc)
|
||||
lv_coord_t sr = lv_obj_get_scroll_right(scroll_obj);
|
||||
lv_coord_t sl = lv_obj_get_scroll_left(scroll_obj);
|
||||
diff_x = elastic_diff(scroll_obj, proc->types.pointer.vect.x, sl, sr, LV_DIR_HOR);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_coord_t st = lv_obj_get_scroll_top(scroll_obj);
|
||||
lv_coord_t sb = lv_obj_get_scroll_bottom(scroll_obj);
|
||||
diff_y = elastic_diff(scroll_obj, proc->types.pointer.vect.y, st, sb, LV_DIR_VER);
|
||||
@ -113,12 +115,13 @@ void _lv_indev_scroll_throw_handler(_lv_indev_proc_t * proc)
|
||||
/*If no snapping "throw"*/
|
||||
if(align_y == LV_SCROLL_SNAP_NONE) {
|
||||
proc->types.pointer.scroll_throw_vect.y =
|
||||
proc->types.pointer.scroll_throw_vect.y * (100 - scroll_throw) / 100;
|
||||
proc->types.pointer.scroll_throw_vect.y * (100 - scroll_throw) / 100;
|
||||
|
||||
lv_coord_t sb = lv_obj_get_scroll_bottom(scroll_obj);
|
||||
lv_coord_t st = lv_obj_get_scroll_top(scroll_obj);
|
||||
|
||||
proc->types.pointer.scroll_throw_vect.y = elastic_diff(scroll_obj, proc->types.pointer.scroll_throw_vect.y, st, sb, LV_DIR_VER);
|
||||
proc->types.pointer.scroll_throw_vect.y = elastic_diff(scroll_obj, proc->types.pointer.scroll_throw_vect.y, st, sb,
|
||||
LV_DIR_VER);
|
||||
|
||||
lv_obj_scroll_by(scroll_obj, 0, proc->types.pointer.scroll_throw_vect.y, LV_ANIM_OFF);
|
||||
}
|
||||
@ -136,12 +139,13 @@ void _lv_indev_scroll_throw_handler(_lv_indev_proc_t * proc)
|
||||
/*If no snapping "throw"*/
|
||||
if(align_x == LV_SCROLL_SNAP_NONE) {
|
||||
proc->types.pointer.scroll_throw_vect.x =
|
||||
proc->types.pointer.scroll_throw_vect.x * (100 - scroll_throw) / 100;
|
||||
proc->types.pointer.scroll_throw_vect.x * (100 - scroll_throw) / 100;
|
||||
|
||||
lv_coord_t sl = lv_obj_get_scroll_left(scroll_obj);
|
||||
lv_coord_t sr = lv_obj_get_scroll_right(scroll_obj);
|
||||
|
||||
proc->types.pointer.scroll_throw_vect.x = elastic_diff(scroll_obj, proc->types.pointer.scroll_throw_vect.x, sl ,sr, LV_DIR_HOR);
|
||||
proc->types.pointer.scroll_throw_vect.x = elastic_diff(scroll_obj, proc->types.pointer.scroll_throw_vect.x, sl, sr,
|
||||
LV_DIR_HOR);
|
||||
|
||||
lv_obj_scroll_by(scroll_obj, proc->types.pointer.scroll_throw_vect.x, 0, LV_ANIM_OFF);
|
||||
}
|
||||
@ -176,7 +180,7 @@ void _lv_indev_scroll_throw_handler(_lv_indev_proc_t * proc)
|
||||
if(align_x == LV_SCROLL_SNAP_NONE) {
|
||||
lv_coord_t sl = lv_obj_get_scroll_left(scroll_obj);
|
||||
lv_coord_t sr = lv_obj_get_scroll_right(scroll_obj);
|
||||
if (sl > 0 || sr > 0) {
|
||||
if(sl > 0 || sr > 0) {
|
||||
if(sl < 0) {
|
||||
lv_obj_scroll_by(scroll_obj, sl, 0, LV_ANIM_ON);
|
||||
}
|
||||
@ -205,14 +209,14 @@ lv_coord_t lv_indev_scroll_throw_predict(lv_indev_t * indev, lv_dir_t dir)
|
||||
if(indev == NULL) return 0;
|
||||
lv_coord_t v;
|
||||
switch(dir) {
|
||||
case LV_DIR_VER:
|
||||
v = indev->proc.types.pointer.scroll_throw_vect_ori.y;
|
||||
break;
|
||||
case LV_DIR_HOR:
|
||||
v = indev->proc.types.pointer.scroll_throw_vect_ori.x;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
case LV_DIR_VER:
|
||||
v = indev->proc.types.pointer.scroll_throw_vect_ori.y;
|
||||
break;
|
||||
case LV_DIR_HOR:
|
||||
v = indev->proc.types.pointer.scroll_throw_vect_ori.x;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
lv_coord_t scroll_throw = indev->driver->scroll_throw;
|
||||
@ -292,17 +296,15 @@ static lv_obj_t * find_scroll_obj(_lv_indev_proc_t * proc)
|
||||
*is propagated to this object it can show at least elastic scroll effect.
|
||||
*But if not hor/ver scrollable do not scroll it at all (so it's not a good candidate)*/
|
||||
if((st > 0 || sb > 0) &&
|
||||
((up_en && proc->types.pointer.scroll_sum.y >= scroll_limit) ||
|
||||
(down_en && proc->types.pointer.scroll_sum.y <= - scroll_limit)))
|
||||
{
|
||||
((up_en && proc->types.pointer.scroll_sum.y >= scroll_limit) ||
|
||||
(down_en && proc->types.pointer.scroll_sum.y <= - scroll_limit))) {
|
||||
obj_candidate = obj_act;
|
||||
dir_candidate = LV_DIR_VER;
|
||||
}
|
||||
|
||||
if((sl > 0 || sr > 0) &&
|
||||
((left_en && proc->types.pointer.scroll_sum.x >= scroll_limit) ||
|
||||
(right_en && proc->types.pointer.scroll_sum.x <= - scroll_limit)))
|
||||
{
|
||||
((left_en && proc->types.pointer.scroll_sum.x >= scroll_limit) ||
|
||||
(right_en && proc->types.pointer.scroll_sum.x <= - scroll_limit))) {
|
||||
obj_candidate = obj_act;
|
||||
dir_candidate = LV_DIR_HOR;
|
||||
}
|
||||
@ -314,10 +316,9 @@ static lv_obj_t * find_scroll_obj(_lv_indev_proc_t * proc)
|
||||
|
||||
/*If the object really can be scrolled into the current direction the use it.*/
|
||||
if((left_en && proc->types.pointer.scroll_sum.x >= scroll_limit) ||
|
||||
(right_en && proc->types.pointer.scroll_sum.x <= - scroll_limit) ||
|
||||
(up_en && proc->types.pointer.scroll_sum.y >= scroll_limit) ||
|
||||
(down_en && proc->types.pointer.scroll_sum.y <= - scroll_limit))
|
||||
{
|
||||
(right_en && proc->types.pointer.scroll_sum.x <= - scroll_limit) ||
|
||||
(up_en && proc->types.pointer.scroll_sum.y >= scroll_limit) ||
|
||||
(down_en && proc->types.pointer.scroll_sum.y <= - scroll_limit)) {
|
||||
proc->types.pointer.scroll_dir = hor_en ? LV_DIR_HOR : LV_DIR_VER;
|
||||
break;
|
||||
}
|
||||
@ -350,45 +351,45 @@ static void init_scroll_limits(_lv_indev_proc_t * proc)
|
||||
/*With STOP limit the scrolling to the perv and next snap point*/
|
||||
else {
|
||||
switch(lv_obj_get_scroll_snap_y(obj)) {
|
||||
case LV_SCROLL_SNAP_START:
|
||||
proc->types.pointer.scroll_area.y1 = find_snap_point_y(obj, obj->coords.y1 + 1, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.y2 = find_snap_point_y(obj, LV_COORD_MIN, obj->coords.y1 - 1, 0);
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
proc->types.pointer.scroll_area.y1 = find_snap_point_y(obj, obj->coords.y2, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.y2 = find_snap_point_y(obj, LV_COORD_MIN, obj->coords.y2, 0);
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER: {
|
||||
lv_coord_t y_mid = obj->coords.y1 + lv_area_get_height(&obj->coords) / 2;
|
||||
proc->types.pointer.scroll_area.y1 = find_snap_point_y(obj, y_mid + 1, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.y2 = find_snap_point_y(obj, LV_COORD_MIN, y_mid - 1, 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
proc->types.pointer.scroll_area.y1 = LV_COORD_MIN;
|
||||
proc->types.pointer.scroll_area.y2 = LV_COORD_MAX;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_START:
|
||||
proc->types.pointer.scroll_area.y1 = find_snap_point_y(obj, obj->coords.y1 + 1, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.y2 = find_snap_point_y(obj, LV_COORD_MIN, obj->coords.y1 - 1, 0);
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
proc->types.pointer.scroll_area.y1 = find_snap_point_y(obj, obj->coords.y2, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.y2 = find_snap_point_y(obj, LV_COORD_MIN, obj->coords.y2, 0);
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER: {
|
||||
lv_coord_t y_mid = obj->coords.y1 + lv_area_get_height(&obj->coords) / 2;
|
||||
proc->types.pointer.scroll_area.y1 = find_snap_point_y(obj, y_mid + 1, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.y2 = find_snap_point_y(obj, LV_COORD_MIN, y_mid - 1, 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
proc->types.pointer.scroll_area.y1 = LV_COORD_MIN;
|
||||
proc->types.pointer.scroll_area.y2 = LV_COORD_MAX;
|
||||
break;
|
||||
}
|
||||
|
||||
switch(lv_obj_get_scroll_snap_x(obj)) {
|
||||
case LV_SCROLL_SNAP_START:
|
||||
proc->types.pointer.scroll_area.x1 = find_snap_point_x(obj, obj->coords.x1, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.x2 = find_snap_point_x(obj, LV_COORD_MIN, obj->coords.x1, 0);
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
proc->types.pointer.scroll_area.x1 = find_snap_point_x(obj, obj->coords.x2, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.x2 = find_snap_point_x(obj, LV_COORD_MIN, obj->coords.x2, 0);
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER: {
|
||||
lv_coord_t x_mid = obj->coords.x1 + lv_area_get_width(&obj->coords) / 2;
|
||||
proc->types.pointer.scroll_area.x1 = find_snap_point_x(obj, x_mid + 1, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.x2 = find_snap_point_x(obj, LV_COORD_MIN, x_mid - 1, 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
proc->types.pointer.scroll_area.x1 = LV_COORD_MIN;
|
||||
proc->types.pointer.scroll_area.x2 = LV_COORD_MAX;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_START:
|
||||
proc->types.pointer.scroll_area.x1 = find_snap_point_x(obj, obj->coords.x1, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.x2 = find_snap_point_x(obj, LV_COORD_MIN, obj->coords.x1, 0);
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
proc->types.pointer.scroll_area.x1 = find_snap_point_x(obj, obj->coords.x2, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.x2 = find_snap_point_x(obj, LV_COORD_MIN, obj->coords.x2, 0);
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER: {
|
||||
lv_coord_t x_mid = obj->coords.x1 + lv_area_get_width(&obj->coords) / 2;
|
||||
proc->types.pointer.scroll_area.x1 = find_snap_point_x(obj, x_mid + 1, LV_COORD_MAX, 0);
|
||||
proc->types.pointer.scroll_area.x2 = find_snap_point_x(obj, LV_COORD_MIN, x_mid - 1, 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
proc->types.pointer.scroll_area.x1 = LV_COORD_MIN;
|
||||
proc->types.pointer.scroll_area.x2 = LV_COORD_MAX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -427,20 +428,20 @@ static lv_coord_t find_snap_point_x(const lv_obj_t * obj, lv_coord_t min, lv_coo
|
||||
lv_coord_t x_child = 0;
|
||||
lv_coord_t x_parent = 0;
|
||||
switch(align) {
|
||||
case LV_SCROLL_SNAP_START:
|
||||
x_child = child->coords.x1;
|
||||
x_parent = obj->coords.x1 + pad_left;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
x_child = child->coords.x2;
|
||||
x_parent = obj->coords.x2 - pad_right;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
x_child = child->coords.x1 + lv_area_get_width(&child->coords) / 2;
|
||||
x_parent = obj->coords.x1 + pad_left + (lv_area_get_width(&obj->coords) - pad_left - pad_right) / 2;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
case LV_SCROLL_SNAP_START:
|
||||
x_child = child->coords.x1;
|
||||
x_parent = obj->coords.x1 + pad_left;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
x_child = child->coords.x2;
|
||||
x_parent = obj->coords.x2 - pad_right;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
x_child = child->coords.x1 + lv_area_get_width(&child->coords) / 2;
|
||||
x_parent = obj->coords.x1 + pad_left + (lv_area_get_width(&obj->coords) - pad_left - pad_right) / 2;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
x_child += ofs;
|
||||
@ -451,7 +452,7 @@ static lv_coord_t find_snap_point_x(const lv_obj_t * obj, lv_coord_t min, lv_coo
|
||||
}
|
||||
}
|
||||
|
||||
return dist == LV_COORD_MAX ? 0: -dist;
|
||||
return dist == LV_COORD_MAX ? 0 : -dist;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -482,20 +483,20 @@ static lv_coord_t find_snap_point_y(const lv_obj_t * obj, lv_coord_t min, lv_coo
|
||||
lv_coord_t y_child = 0;
|
||||
lv_coord_t y_parent = 0;
|
||||
switch(align) {
|
||||
case LV_SCROLL_SNAP_START:
|
||||
y_child = child->coords.y1;
|
||||
y_parent = obj->coords.y1 + pad_top;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
y_child = child->coords.y2;
|
||||
y_parent = obj->coords.y2 - pad_bottom;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
y_child = child->coords.y1 + lv_area_get_height(&child->coords) / 2;
|
||||
y_parent = obj->coords.y1 + pad_top + (lv_area_get_height(&obj->coords) - pad_top - pad_bottom) / 2;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
case LV_SCROLL_SNAP_START:
|
||||
y_child = child->coords.y1;
|
||||
y_parent = obj->coords.y1 + pad_top;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
y_child = child->coords.y2;
|
||||
y_parent = obj->coords.y2 - pad_bottom;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
y_child = child->coords.y1 + lv_area_get_height(&child->coords) / 2;
|
||||
y_parent = obj->coords.y1 + pad_top + (lv_area_get_height(&obj->coords) - pad_top - pad_bottom) / 2;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
y_child += ofs;
|
||||
@ -513,7 +514,7 @@ static void scroll_limit_diff(_lv_indev_proc_t * proc, lv_coord_t * diff_x, lv_c
|
||||
{
|
||||
if(diff_y) {
|
||||
if(proc->types.pointer.scroll_sum.y + *diff_y < proc->types.pointer.scroll_area.y1) {
|
||||
*diff_y = proc->types.pointer.scroll_area.y1 - proc->types.pointer.scroll_sum.y;
|
||||
*diff_y = proc->types.pointer.scroll_area.y1 - proc->types.pointer.scroll_sum.y;
|
||||
}
|
||||
|
||||
if(proc->types.pointer.scroll_sum.y + *diff_y > proc->types.pointer.scroll_area.y2) {
|
||||
@ -565,7 +566,8 @@ static lv_coord_t scroll_throw_predict_x(_lv_indev_proc_t * proc)
|
||||
return move;
|
||||
}
|
||||
|
||||
static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_t scroll_start, lv_coord_t scroll_end, lv_dir_t dir)
|
||||
static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_t scroll_start, lv_coord_t scroll_end,
|
||||
lv_dir_t dir)
|
||||
{
|
||||
if(lv_obj_has_flag(scroll_obj, LV_OBJ_FLAG_SCROLL_ELASTIC)) {
|
||||
/*If there is snapping in the current direction don't use the elastic factor because
|
||||
@ -582,36 +584,37 @@ static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_
|
||||
lv_coord_t pad_right = lv_obj_get_style_pad_right(scroll_obj, LV_PART_MAIN);
|
||||
|
||||
switch(snap) {
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
snap_point = pad_left + (lv_area_get_width(&scroll_obj->coords) - pad_left - pad_right) / 2 + scroll_obj->coords.x1;
|
||||
act_obj_point = lv_area_get_width(&act_obj->coords) / 2 + act_obj->coords.x1;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_START:
|
||||
snap_point = scroll_obj->coords.x1 + pad_left;
|
||||
act_obj_point = act_obj->coords.x1;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
snap_point = scroll_obj->coords.x2 - pad_right;
|
||||
act_obj_point = act_obj->coords.x2;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
snap_point = pad_left + (lv_area_get_width(&scroll_obj->coords) - pad_left - pad_right) / 2 + scroll_obj->coords.x1;
|
||||
act_obj_point = lv_area_get_width(&act_obj->coords) / 2 + act_obj->coords.x1;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_START:
|
||||
snap_point = scroll_obj->coords.x1 + pad_left;
|
||||
act_obj_point = act_obj->coords.x1;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
snap_point = scroll_obj->coords.x2 - pad_right;
|
||||
act_obj_point = act_obj->coords.x2;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_coord_t pad_top = lv_obj_get_style_pad_top(scroll_obj, LV_PART_MAIN);
|
||||
lv_coord_t pad_bottom = lv_obj_get_style_pad_bottom(scroll_obj, LV_PART_MAIN);
|
||||
|
||||
switch(snap) {
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
snap_point = pad_top + (lv_area_get_height(&scroll_obj->coords) - pad_top - pad_bottom) / 2 + scroll_obj->coords.y1;
|
||||
act_obj_point = lv_area_get_height(&act_obj->coords) / 2 + act_obj->coords.y1;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_START:
|
||||
snap_point = scroll_obj->coords.y1 + pad_top;
|
||||
act_obj_point = act_obj->coords.y1;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
snap_point = scroll_obj->coords.y2 - pad_bottom;
|
||||
act_obj_point = act_obj->coords.y2;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
snap_point = pad_top + (lv_area_get_height(&scroll_obj->coords) - pad_top - pad_bottom) / 2 + scroll_obj->coords.y1;
|
||||
act_obj_point = lv_area_get_height(&act_obj->coords) / 2 + act_obj->coords.y1;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_START:
|
||||
snap_point = scroll_obj->coords.y1 + pad_top;
|
||||
act_obj_point = act_obj->coords.y1;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
snap_point = scroll_obj->coords.y2 - pad_bottom;
|
||||
act_obj_point = act_obj->coords.y2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -631,7 +634,8 @@ static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_
|
||||
if(diff > 0) diff += ELASTIC_SLOWNESS_FACTOR / 2;
|
||||
return diff / ELASTIC_SLOWNESS_FACTOR;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/*Scroll back to the boundary if required*/
|
||||
if(scroll_end + diff < 0) diff = - scroll_end;
|
||||
if(scroll_start - diff < 0) diff = scroll_start;
|
||||
|
@ -142,13 +142,16 @@ void lv_init(void)
|
||||
}
|
||||
|
||||
uint32_t endianess_test = 0x11223344;
|
||||
uint8_t * endianess_test_p = (uint8_t*) &endianess_test;
|
||||
uint8_t * endianess_test_p = (uint8_t *) &endianess_test;
|
||||
bool big_endian = endianess_test_p[0] == 0x11 ? true : false;
|
||||
|
||||
if(big_endian) {
|
||||
LV_ASSERT_MSG(LV_BIG_ENDIAN_SYSTEM == 1, "It's a big endian system but LV_BIG_ENDIAN_SYSTEM is not enabled in lv_conf.h");
|
||||
} else {
|
||||
LV_ASSERT_MSG(LV_BIG_ENDIAN_SYSTEM == 0, "It's a little endian system but LV_BIG_ENDIAN_SYSTEM is enabled in lv_conf.h");
|
||||
LV_ASSERT_MSG(LV_BIG_ENDIAN_SYSTEM == 1,
|
||||
"It's a big endian system but LV_BIG_ENDIAN_SYSTEM is not enabled in lv_conf.h");
|
||||
}
|
||||
else {
|
||||
LV_ASSERT_MSG(LV_BIG_ENDIAN_SYSTEM == 0,
|
||||
"It's a little endian system but LV_BIG_ENDIAN_SYSTEM is enabled in lv_conf.h");
|
||||
}
|
||||
|
||||
#if LV_USE_ASSERT_MEM_INTEGRITY
|
||||
@ -460,7 +463,7 @@ static void lv_obj_draw(lv_event_t * e)
|
||||
|
||||
if(_lv_area_is_in(info->area, &coords, r) == false) {
|
||||
info->res = LV_COVER_RES_NOT_COVER;
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
if(lv_obj_get_style_bg_opa(obj, LV_PART_MAIN) < LV_OPA_MAX) {
|
||||
@ -628,7 +631,8 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc
|
||||
dsc->border_width = lv_obj_get_style_border_width(obj, LV_PART_SCROLLBAR);
|
||||
if(dsc->border_width > 0) {
|
||||
dsc->border_color = lv_obj_get_style_border_color(obj, LV_PART_SCROLLBAR);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
dsc->border_opa = LV_OPA_TRANSP;
|
||||
}
|
||||
}
|
||||
@ -640,7 +644,8 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc
|
||||
if(dsc->shadow_width > 0) {
|
||||
dsc->shadow_spread = lv_obj_get_style_shadow_spread(obj, LV_PART_SCROLLBAR);
|
||||
dsc->shadow_color = lv_obj_get_style_shadow_color(obj, LV_PART_SCROLLBAR);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
dsc->shadow_opa = LV_OPA_TRANSP;
|
||||
}
|
||||
}
|
||||
@ -652,10 +657,11 @@ static lv_res_t scrollbar_init_draw_dsc(lv_obj_t * obj, lv_draw_rect_dsc_t * dsc
|
||||
dsc->shadow_opa = (dsc->bg_opa * opa) >> 8;
|
||||
}
|
||||
|
||||
if(dsc->bg_opa != LV_OPA_TRANSP || dsc->border_opa != LV_OPA_TRANSP || dsc->shadow_opa != LV_OPA_TRANSP ) {
|
||||
if(dsc->bg_opa != LV_OPA_TRANSP || dsc->border_opa != LV_OPA_TRANSP || dsc->shadow_opa != LV_OPA_TRANSP) {
|
||||
dsc->radius = lv_obj_get_style_radius(obj, LV_PART_SCROLLBAR);
|
||||
return LV_RES_OK;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
#else
|
||||
@ -873,7 +879,7 @@ static void lv_obj_set_state(lv_obj_t * obj, lv_state_t new_state)
|
||||
}
|
||||
}
|
||||
|
||||
for(i = 0;i < tsi; i++) {
|
||||
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]);
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ typedef enum {
|
||||
LV_OBJ_DRAW_PART_RECTANGLE, /**< The main rectangle*/
|
||||
LV_OBJ_DRAW_PART_BORDER_POST,/**< The border if style_border_post = true*/
|
||||
LV_OBJ_DRAW_PART_SCROLLBAR, /**< The scrollbar*/
|
||||
}lv_obj_draw_part_type_t;
|
||||
} lv_obj_draw_part_type_t;
|
||||
|
||||
#include "lv_obj_tree.h"
|
||||
#include "lv_obj_pos.h"
|
||||
@ -157,12 +157,12 @@ typedef struct {
|
||||
lv_coord_t ext_click_pad; /**< Extra click padding in all direction*/
|
||||
lv_coord_t ext_draw_size; /**< EXTend the size in every direction for drawing.*/
|
||||
|
||||
lv_scrollbar_mode_t scrollbar_mode :2; /**< How to display scrollbars*/
|
||||
lv_scrollbar_mode_t scrollbar_mode : 2; /**< How to display scrollbars*/
|
||||
lv_scroll_snap_t scroll_snap_x : 2; /**< Where to align the snappable children horizontally*/
|
||||
lv_scroll_snap_t scroll_snap_y : 2; /**< Where to align the snappable children vertically*/
|
||||
lv_dir_t scroll_dir :4; /**< The allowed scroll direction(s)*/
|
||||
lv_dir_t scroll_dir : 4; /**< The allowed scroll direction(s)*/
|
||||
uint8_t event_dsc_cnt; /**< Number of event callbacks stored in `event_dsc` array*/
|
||||
}_lv_obj_spec_attr_t;
|
||||
} _lv_obj_spec_attr_t;
|
||||
|
||||
typedef struct _lv_obj_t {
|
||||
const lv_obj_class_t * class_p;
|
||||
@ -175,13 +175,13 @@ typedef struct _lv_obj_t {
|
||||
lv_area_t coords;
|
||||
lv_obj_flag_t flags;
|
||||
lv_state_t state;
|
||||
uint16_t layout_inv :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;
|
||||
}lv_obj_t;
|
||||
uint16_t layout_inv : 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;
|
||||
} lv_obj_t;
|
||||
|
||||
|
||||
/**********************
|
||||
@ -379,9 +379,9 @@ static inline lv_coord_t lv_obj_dpx(const lv_obj_t * obj, lv_coord_t n)
|
||||
|
||||
#if LV_USE_ASSERT_OBJ
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_class) \
|
||||
LV_ASSERT_MSG(obj_p != NULL, "The object is NULL"); \
|
||||
LV_ASSERT_MSG(lv_obj_has_class(obj_p, obj_class) == true, "Incompatible object type."); \
|
||||
LV_ASSERT_MSG(lv_obj_is_valid(obj_p) == true, "The object is invalid, deleted or corrupted?");
|
||||
LV_ASSERT_MSG(obj_p != NULL, "The object is NULL"); \
|
||||
LV_ASSERT_MSG(lv_obj_has_class(obj_p, obj_class) == true, "Incompatible object type."); \
|
||||
LV_ASSERT_MSG(lv_obj_is_valid(obj_p) == true, "The object is invalid, deleted or corrupted?");
|
||||
|
||||
# else
|
||||
# define LV_ASSERT_OBJ(obj_p, obj_class) do{}while(0)
|
||||
|
@ -63,7 +63,8 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
|
||||
disp->screens = lv_mem_alloc(sizeof(lv_obj_t *));
|
||||
disp->screens[0] = obj;
|
||||
disp->screen_cnt = 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
disp->screen_cnt++;
|
||||
disp->screens = lv_mem_realloc(disp->screens, sizeof(lv_obj_t *) * disp->screen_cnt);
|
||||
disp->screens[disp->screen_cnt - 1] = obj;
|
||||
@ -87,9 +88,11 @@ lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * pa
|
||||
parent->spec_attr->children = lv_mem_alloc(sizeof(lv_obj_t *));
|
||||
parent->spec_attr->children[0] = obj;
|
||||
parent->spec_attr->child_cnt = 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
parent->spec_attr->child_cnt++;
|
||||
parent->spec_attr->children = lv_mem_realloc(parent->spec_attr->children, sizeof(lv_obj_t *) * parent->spec_attr->child_cnt);
|
||||
parent->spec_attr->children = lv_mem_realloc(parent->spec_attr->children,
|
||||
sizeof(lv_obj_t *) * parent->spec_attr->child_cnt);
|
||||
parent->spec_attr->children[parent->spec_attr->child_cnt - 1] = obj;
|
||||
}
|
||||
}
|
||||
|
@ -33,13 +33,13 @@ typedef enum {
|
||||
LV_OBJ_CLASS_EDITABLE_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/
|
||||
LV_OBJ_CLASS_EDITABLE_TRUE,
|
||||
LV_OBJ_CLASS_EDITABLE_FALSE,
|
||||
}lv_obj_class_editable_t;
|
||||
} lv_obj_class_editable_t;
|
||||
|
||||
typedef enum {
|
||||
LV_OBJ_CLASS_GROUP_DEF_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/
|
||||
LV_OBJ_CLASS_GROUP_DEF_TRUE,
|
||||
LV_OBJ_CLASS_GROUP_DEF_FALSE,
|
||||
}lv_obj_class_group_def_t;
|
||||
} lv_obj_class_group_def_t;
|
||||
|
||||
typedef void (*lv_obj_class_event_cb_t)(struct _lv_obj_class_t * class_p, struct _lv_event_t * e);
|
||||
/**
|
||||
@ -53,13 +53,14 @@ typedef struct _lv_obj_class_t {
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
#endif
|
||||
void (*event_cb)(const struct _lv_obj_class_t * class_p, struct _lv_event_t * e); /**< Widget type specific event function*/
|
||||
void (*event_cb)(const struct _lv_obj_class_t * class_p,
|
||||
struct _lv_event_t * e); /**< Widget type specific event function*/
|
||||
lv_coord_t width_def;
|
||||
lv_coord_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;
|
||||
}lv_obj_class_t;
|
||||
} lv_obj_class_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
@ -95,9 +95,10 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
|
||||
draw_dsc->bg_img_opa = lv_obj_get_style_bg_img_opa(obj, part);
|
||||
if(draw_dsc->bg_img_opa > LV_OPA_MIN) {
|
||||
if(lv_img_src_get_type(draw_dsc->bg_img_src) == LV_IMG_SRC_SYMBOL) {
|
||||
draw_dsc->bg_img_symbol_font= lv_obj_get_style_text_font(obj, part);
|
||||
draw_dsc->bg_img_symbol_font = lv_obj_get_style_text_font(obj, part);
|
||||
draw_dsc->bg_img_recolor = lv_obj_get_style_text_color_filtered(obj, part);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
draw_dsc->bg_img_recolor = lv_obj_get_style_bg_img_recolor_filtered(obj, part);
|
||||
draw_dsc->bg_img_recolor_opa = lv_obj_get_style_bg_img_recolor_opa(obj, part);
|
||||
draw_dsc->bg_img_tiled = lv_obj_get_style_bg_img_tiled(obj, part);
|
||||
@ -167,13 +168,14 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t
|
||||
draw_dsc->bg_img_opa = lv_obj_get_style_bg_img_opa(obj, part);
|
||||
if(draw_dsc->bg_img_opa > LV_OPA_MIN) {
|
||||
if(lv_img_src_get_type(draw_dsc->bg_img_src) == LV_IMG_SRC_SYMBOL) {
|
||||
draw_dsc->bg_img_symbol_font= lv_obj_get_style_text_font(obj, part);
|
||||
draw_dsc->bg_img_recolor = lv_obj_get_style_text_color_filtered(obj, part);
|
||||
} else {
|
||||
draw_dsc->bg_img_recolor = lv_obj_get_style_bg_img_recolor_filtered(obj, part);
|
||||
draw_dsc->bg_img_recolor_opa = lv_obj_get_style_bg_img_recolor_opa(obj, part);
|
||||
draw_dsc->bg_img_tiled = lv_obj_get_style_bg_img_tiled(obj, part);
|
||||
}
|
||||
draw_dsc->bg_img_symbol_font = lv_obj_get_style_text_font(obj, part);
|
||||
draw_dsc->bg_img_recolor = lv_obj_get_style_text_color_filtered(obj, part);
|
||||
}
|
||||
else {
|
||||
draw_dsc->bg_img_recolor = lv_obj_get_style_bg_img_recolor_filtered(obj, part);
|
||||
draw_dsc->bg_img_recolor_opa = lv_obj_get_style_bg_img_recolor_opa(obj, part);
|
||||
draw_dsc->bg_img_tiled = lv_obj_get_style_bg_img_tiled(obj, part);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,28 +31,34 @@ typedef enum {
|
||||
LV_COVER_RES_COVER = 0,
|
||||
LV_COVER_RES_NOT_COVER = 1,
|
||||
LV_COVER_RES_MASKED = 2,
|
||||
}lv_cover_res_t;
|
||||
} lv_cover_res_t;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
const lv_area_t * clip_area; /**< The current clip area, required if you need to draw something in the event*/
|
||||
const struct _lv_obj_class_t * class_p; /**< The class that sent the event */
|
||||
uint32_t type; /**< The type if part being draw. Element of `lv_<name>_draw_part_type_t` */
|
||||
lv_area_t * draw_area; /**< The area of the part being drawn*/
|
||||
lv_draw_rect_dsc_t * rect_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for rectangle-like parts*/
|
||||
lv_draw_label_dsc_t * label_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for text-like parts*/
|
||||
lv_draw_line_dsc_t * line_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for line-like parts*/
|
||||
lv_draw_img_dsc_t * img_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for image-like parts*/
|
||||
lv_draw_arc_dsc_t * arc_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for arc-like parts*/
|
||||
const lv_point_t * p1; /**< A point calculated during drawing. E.g. a point of chart or the center of an arc.*/
|
||||
lv_draw_rect_dsc_t *
|
||||
rect_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for rectangle-like parts*/
|
||||
lv_draw_label_dsc_t *
|
||||
label_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for text-like parts*/
|
||||
lv_draw_line_dsc_t *
|
||||
line_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for line-like parts*/
|
||||
lv_draw_img_dsc_t *
|
||||
img_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for image-like parts*/
|
||||
lv_draw_arc_dsc_t *
|
||||
arc_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for arc-like parts*/
|
||||
const lv_point_t *
|
||||
p1; /**< A point calculated during drawing. E.g. a point of chart or the center of an arc.*/
|
||||
const lv_point_t * p2; /**< A point calculated during drawing. E.g. a point of chart.*/
|
||||
const char * text; /**< A text calculated during drawing. Can be modified. E.g. tick labels on a chart axis.*/
|
||||
const char *
|
||||
text; /**< A text calculated during drawing. Can be modified. E.g. tick labels on a chart axis.*/
|
||||
uint32_t part; /**< The current part for which the event is sent*/
|
||||
uint32_t id; /**< The index of the part. E.g. a button's index on button matrix or table cell index.*/
|
||||
lv_coord_t radius; /**< E.g. the radius of an arc (not the corner radius).*/
|
||||
int32_t value; /**< A value calculated during drawing. E.g. Chart's tick line value.*/
|
||||
const void * sub_part_ptr; /**< A pointer the identifies something in the part. E.g. chart series. */
|
||||
}lv_obj_draw_part_dsc_t;
|
||||
} lv_obj_draw_part_dsc_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
@ -96,7 +96,8 @@ bool lv_obj_refr_size(lv_obj_t * obj)
|
||||
bool w_content = false;
|
||||
if(obj->w_layout) {
|
||||
w = lv_obj_get_width(obj);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
w = lv_obj_get_style_width(obj, LV_PART_MAIN);
|
||||
w_content = w == LV_SIZE_CONTENT ? true : false;
|
||||
|
||||
@ -122,7 +123,8 @@ bool lv_obj_refr_size(lv_obj_t * obj)
|
||||
bool h_content = false;
|
||||
if(obj->h_layout) {
|
||||
h = lv_obj_get_height(obj);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
h = lv_obj_get_style_height(obj, LV_PART_MAIN);
|
||||
h_content = h == LV_SIZE_CONTENT ? true : false;
|
||||
|
||||
@ -357,112 +359,113 @@ void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv
|
||||
}
|
||||
|
||||
switch(align) {
|
||||
case LV_ALIGN_CENTER:
|
||||
x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2 + bleft;
|
||||
y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2 + btop;
|
||||
break;
|
||||
case LV_ALIGN_TOP_LEFT:
|
||||
x = bleft;
|
||||
y = btop;
|
||||
break;
|
||||
case LV_ALIGN_TOP_MID:
|
||||
x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2 + bleft;
|
||||
y = btop;
|
||||
break;
|
||||
case LV_ALIGN_CENTER:
|
||||
x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2 + bleft;
|
||||
y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2 + btop;
|
||||
break;
|
||||
case LV_ALIGN_TOP_LEFT:
|
||||
x = bleft;
|
||||
y = btop;
|
||||
break;
|
||||
case LV_ALIGN_TOP_MID:
|
||||
x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2 + bleft;
|
||||
y = btop;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_TOP_RIGHT:
|
||||
x = lv_obj_get_content_width(base) - lv_obj_get_width(obj) + bleft;
|
||||
y = btop;
|
||||
break;
|
||||
case LV_ALIGN_TOP_RIGHT:
|
||||
x = lv_obj_get_content_width(base) - lv_obj_get_width(obj) + bleft;
|
||||
y = btop;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_BOTTOM_LEFT:
|
||||
x = bleft;
|
||||
y = lv_obj_get_content_height(base) - lv_obj_get_height(obj) + btop;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_MID:
|
||||
x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2 + bleft;
|
||||
y = lv_obj_get_content_height(base) - lv_obj_get_height(obj) + btop;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_LEFT:
|
||||
x = bleft;
|
||||
y = lv_obj_get_content_height(base) - lv_obj_get_height(obj) + btop;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_MID:
|
||||
x = lv_obj_get_content_width(base) / 2 - lv_obj_get_width(obj) / 2 + bleft;
|
||||
y = lv_obj_get_content_height(base) - lv_obj_get_height(obj) + btop;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_BOTTOM_RIGHT:
|
||||
x = lv_obj_get_content_width(base) - lv_obj_get_width(obj) + bleft;
|
||||
y = lv_obj_get_content_height(base) - lv_obj_get_height(obj) + btop;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_RIGHT:
|
||||
x = lv_obj_get_content_width(base) - lv_obj_get_width(obj) + bleft;
|
||||
y = lv_obj_get_content_height(base) - lv_obj_get_height(obj) + btop;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_LEFT_MID:
|
||||
x = bleft;
|
||||
y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2 + btop;
|
||||
break;
|
||||
case LV_ALIGN_LEFT_MID:
|
||||
x = bleft;
|
||||
y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2 + btop;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_RIGHT_MID:
|
||||
x = lv_obj_get_content_width(base) - lv_obj_get_width(obj) + bleft;
|
||||
y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2 + btop;
|
||||
break;
|
||||
case LV_ALIGN_RIGHT_MID:
|
||||
x = lv_obj_get_content_width(base) - lv_obj_get_width(obj) + bleft;
|
||||
y = lv_obj_get_content_height(base) / 2 - lv_obj_get_height(obj) / 2 + btop;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_TOP_LEFT:
|
||||
x = 0;
|
||||
y = -lv_obj_get_height(obj);
|
||||
break;
|
||||
case LV_ALIGN_OUT_TOP_LEFT:
|
||||
x = 0;
|
||||
y = -lv_obj_get_height(obj);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_TOP_MID:
|
||||
x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2;
|
||||
y = -lv_obj_get_height(obj);
|
||||
break;
|
||||
case LV_ALIGN_OUT_TOP_MID:
|
||||
x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2;
|
||||
y = -lv_obj_get_height(obj);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_TOP_RIGHT:
|
||||
x = lv_obj_get_width(base) - lv_obj_get_width(obj);
|
||||
y = -lv_obj_get_height(obj);
|
||||
break;
|
||||
case LV_ALIGN_OUT_TOP_RIGHT:
|
||||
x = lv_obj_get_width(base) - lv_obj_get_width(obj);
|
||||
y = -lv_obj_get_height(obj);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_BOTTOM_LEFT:
|
||||
x = 0;
|
||||
y = lv_obj_get_height(base);
|
||||
break;
|
||||
case LV_ALIGN_OUT_BOTTOM_LEFT:
|
||||
x = 0;
|
||||
y = lv_obj_get_height(base);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_BOTTOM_MID:
|
||||
x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2;
|
||||
y = lv_obj_get_height(base);
|
||||
break;
|
||||
case LV_ALIGN_OUT_BOTTOM_MID:
|
||||
x = lv_obj_get_width(base) / 2 - lv_obj_get_width(obj) / 2;
|
||||
y = lv_obj_get_height(base);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_BOTTOM_RIGHT:
|
||||
x = lv_obj_get_width(base) - lv_obj_get_width(obj);
|
||||
y = lv_obj_get_height(base);
|
||||
break;
|
||||
case LV_ALIGN_OUT_BOTTOM_RIGHT:
|
||||
x = lv_obj_get_width(base) - lv_obj_get_width(obj);
|
||||
y = lv_obj_get_height(base);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_LEFT_TOP:
|
||||
x = -lv_obj_get_width(obj);
|
||||
y = 0;
|
||||
break;
|
||||
case LV_ALIGN_OUT_LEFT_TOP:
|
||||
x = -lv_obj_get_width(obj);
|
||||
y = 0;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_LEFT_MID:
|
||||
x = -lv_obj_get_width(obj);
|
||||
y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2;
|
||||
break;
|
||||
case LV_ALIGN_OUT_LEFT_MID:
|
||||
x = -lv_obj_get_width(obj);
|
||||
y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_LEFT_BOTTOM:
|
||||
x = -lv_obj_get_width(obj);
|
||||
y = lv_obj_get_height(base) - lv_obj_get_height(obj);
|
||||
break;
|
||||
case LV_ALIGN_OUT_LEFT_BOTTOM:
|
||||
x = -lv_obj_get_width(obj);
|
||||
y = lv_obj_get_height(base) - lv_obj_get_height(obj);
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_RIGHT_TOP:
|
||||
x = lv_obj_get_width(base);
|
||||
y = 0;
|
||||
break;
|
||||
case LV_ALIGN_OUT_RIGHT_TOP:
|
||||
x = lv_obj_get_width(base);
|
||||
y = 0;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_RIGHT_MID:
|
||||
x = lv_obj_get_width(base);
|
||||
y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2;
|
||||
break;
|
||||
case LV_ALIGN_OUT_RIGHT_MID:
|
||||
x = lv_obj_get_width(base);
|
||||
y = lv_obj_get_height(base) / 2 - lv_obj_get_height(obj) / 2;
|
||||
break;
|
||||
|
||||
case LV_ALIGN_OUT_RIGHT_BOTTOM:
|
||||
x = lv_obj_get_width(base);
|
||||
y = lv_obj_get_height(base) - lv_obj_get_height(obj);
|
||||
break;
|
||||
case LV_ALIGN_OUT_RIGHT_BOTTOM:
|
||||
x = lv_obj_get_width(base);
|
||||
y = lv_obj_get_height(base) - lv_obj_get_height(obj);
|
||||
break;
|
||||
}
|
||||
|
||||
if(lv_obj_get_style_base_dir(parent, LV_PART_MAIN) == LV_BASE_DIR_RTL) {
|
||||
x += x_ofs + base->coords.x1 - parent->coords.x1 + lv_obj_get_scroll_right(parent) - pleft;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
x += x_ofs + base->coords.x1 - parent->coords.x1 + lv_obj_get_scroll_left(parent) - pleft;
|
||||
}
|
||||
y += y_ofs + base->coords.y1 - parent->coords.y1 + lv_obj_get_scroll_top(parent) - ptop;
|
||||
@ -581,14 +584,14 @@ void lv_obj_get_content_coords(const lv_obj_t * obj, lv_area_t * area)
|
||||
lv_coord_t lv_obj_get_self_width(const lv_obj_t * obj)
|
||||
{
|
||||
lv_point_t p = {0, LV_COORD_MIN};
|
||||
lv_event_send((lv_obj_t * )obj, LV_EVENT_GET_SELF_SIZE, &p);
|
||||
lv_event_send((lv_obj_t *)obj, LV_EVENT_GET_SELF_SIZE, &p);
|
||||
return p.x;
|
||||
}
|
||||
|
||||
lv_coord_t lv_obj_get_self_height(const lv_obj_t * obj)
|
||||
{
|
||||
lv_point_t p = {LV_COORD_MIN, 0};
|
||||
lv_event_send((lv_obj_t * )obj, LV_EVENT_GET_SELF_SIZE, &p);
|
||||
lv_event_send((lv_obj_t *)obj, LV_EVENT_GET_SELF_SIZE, &p);
|
||||
return p.y;
|
||||
}
|
||||
|
||||
@ -646,36 +649,36 @@ void lv_obj_refr_pos(lv_obj_t * obj)
|
||||
else {
|
||||
|
||||
switch(align) {
|
||||
case LV_ALIGN_TOP_MID:
|
||||
x += pw / 2 - w / 2;
|
||||
break;
|
||||
case LV_ALIGN_TOP_RIGHT:
|
||||
x += pw - w;
|
||||
break;
|
||||
case LV_ALIGN_LEFT_MID:
|
||||
y += ph / 2 - h / 2;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_LEFT:
|
||||
y += ph - h;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_MID:
|
||||
x += pw / 2 - w / 2;
|
||||
y += ph - h;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_RIGHT:
|
||||
x += pw - w;
|
||||
y += ph - h;
|
||||
break;
|
||||
case LV_ALIGN_RIGHT_MID:
|
||||
x += pw - w;
|
||||
y += ph / 2 - h / 2;
|
||||
break;
|
||||
case LV_ALIGN_CENTER:
|
||||
x += pw / 2 - w / 2;
|
||||
y += ph / 2 - h / 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case LV_ALIGN_TOP_MID:
|
||||
x += pw / 2 - w / 2;
|
||||
break;
|
||||
case LV_ALIGN_TOP_RIGHT:
|
||||
x += pw - w;
|
||||
break;
|
||||
case LV_ALIGN_LEFT_MID:
|
||||
y += ph / 2 - h / 2;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_LEFT:
|
||||
y += ph - h;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_MID:
|
||||
x += pw / 2 - w / 2;
|
||||
y += ph - h;
|
||||
break;
|
||||
case LV_ALIGN_BOTTOM_RIGHT:
|
||||
x += pw - w;
|
||||
y += ph - h;
|
||||
break;
|
||||
case LV_ALIGN_RIGHT_MID:
|
||||
x += pw - w;
|
||||
y += ph / 2 - h / 2;
|
||||
break;
|
||||
case LV_ALIGN_CENTER:
|
||||
x += pw / 2 - w / 2;
|
||||
y += ph / 2 - h / 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
lv_obj_move_to(obj, x, y);
|
||||
}
|
||||
@ -693,7 +696,8 @@ void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
|
||||
if(lv_obj_has_flag(obj, LV_OBJ_FLAG_FLOATING)) {
|
||||
x += pad_left + parent->coords.x1;
|
||||
y += pad_top + parent->coords.y1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
x += pad_left + parent->coords.x1 - lv_obj_get_scroll_x(parent);
|
||||
y += pad_top + parent->coords.y1 - lv_obj_get_scroll_y(parent);
|
||||
}
|
||||
@ -808,8 +812,7 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
||||
if(obj_scr != lv_disp_get_scr_act(disp) &&
|
||||
obj_scr != lv_disp_get_scr_prev(disp) &&
|
||||
obj_scr != lv_disp_get_layer_top(disp) &&
|
||||
obj_scr != lv_disp_get_layer_sys(disp))
|
||||
{
|
||||
obj_scr != lv_disp_get_layer_sys(disp)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -832,7 +835,8 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
||||
while(par != NULL) {
|
||||
is_common = _lv_area_intersect(area, area, &par->coords);
|
||||
if(is_common == false) return false; /*If no common parts with parent break;*/
|
||||
if(lv_obj_has_flag(par, LV_OBJ_FLAG_HIDDEN)) return false; /*If the parent is hidden then the child is hidden and won't be drawn*/
|
||||
if(lv_obj_has_flag(par, LV_OBJ_FLAG_HIDDEN)) return
|
||||
false; /*If the parent is hidden then the child is hidden and won't be drawn*/
|
||||
|
||||
par = lv_obj_get_parent(par);
|
||||
}
|
||||
@ -955,8 +959,8 @@ static void layout_update_core(lv_obj_t * obj)
|
||||
if(child_cnt > 0) {
|
||||
uint32_t layout_id = lv_obj_get_style_layout(obj, LV_PART_MAIN);
|
||||
if(layout_id > 0 && layout_id <= layout_cnt) {
|
||||
void * user_data = LV_GC_ROOT(_lv_layout_list)[layout_id -1].user_data;
|
||||
LV_GC_ROOT(_lv_layout_list)[layout_id -1].cb(obj, user_data);
|
||||
void * user_data = LV_GC_ROOT(_lv_layout_list)[layout_id - 1].user_data;
|
||||
LV_GC_ROOT(_lv_layout_list)[layout_id - 1].cb(obj, user_data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ typedef void (*lv_layout_update_cb_t)(struct _lv_obj_t *, void * user_data);
|
||||
typedef struct {
|
||||
lv_layout_update_cb_t cb;
|
||||
void * user_data;
|
||||
}lv_layout_dsc_t;
|
||||
} lv_layout_dsc_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@ -176,7 +176,8 @@ void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv
|
||||
* @param y_ofs y coordinate offset after alignment
|
||||
* @note if the position or size of `base` changes `obj` needs to be aligned manually again
|
||||
*/
|
||||
void lv_obj_align_to(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
|
||||
void lv_obj_align_to(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs,
|
||||
lv_coord_t y_ofs);
|
||||
|
||||
/**
|
||||
* Align an object to the center on its parent.
|
||||
|
@ -35,7 +35,8 @@ static void scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
||||
static void scroll_x_anim(void * obj, int32_t v);
|
||||
static void scroll_y_anim(void * obj, int32_t v);
|
||||
static void scroll_anim_ready_cb(lv_anim_t * a);
|
||||
static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_point_t * scroll_value, lv_anim_enable_t anim_en);
|
||||
static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_point_t * scroll_value,
|
||||
lv_anim_enable_t anim_en);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -189,7 +190,8 @@ lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj)
|
||||
if(x1 != LV_COORD_MAX) {
|
||||
child_res = x1;
|
||||
child_res = (obj->coords.x1 + pad_left + border_width) - child_res;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
child_res = LV_COORD_MIN;
|
||||
}
|
||||
|
||||
@ -285,13 +287,14 @@ void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable
|
||||
lv_anim_set_values(&a, -sy, -sy + y);
|
||||
lv_anim_set_exec_cb(&a, scroll_y_anim);
|
||||
lv_anim_set_path_cb(&a, lv_anim_path_ease_out);
|
||||
|
||||
|
||||
lv_res_t res;
|
||||
res = lv_event_send(obj, LV_EVENT_SCROLL_BEGIN, &a);
|
||||
if(res != LV_RES_OK) return;
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/*Remove pending animations*/
|
||||
bool y_del = lv_anim_del(obj, scroll_y_anim);
|
||||
bool x_del = lv_anim_del(obj, scroll_x_anim);
|
||||
@ -323,7 +326,8 @@ void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en)
|
||||
|
||||
if(x > scroll_max) x = scroll_max;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if(x > 0) x = 0;
|
||||
if(x < 0) {
|
||||
lv_coord_t scroll_max = lv_obj_get_scroll_left(obj) + lv_obj_get_scroll_right(obj);
|
||||
@ -429,18 +433,18 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
|
||||
|
||||
bool ver_draw = false;
|
||||
if((dir & LV_DIR_VER) &&
|
||||
((sm == LV_SCROLLBAR_MODE_ON) ||
|
||||
(sm == LV_SCROLLBAR_MODE_AUTO && (st > 0 || sb > 0)) ||
|
||||
(sm == LV_SCROLLBAR_MODE_ACTIVE && lv_indev_get_scroll_dir(indev) == LV_DIR_VER))) {
|
||||
((sm == LV_SCROLLBAR_MODE_ON) ||
|
||||
(sm == LV_SCROLLBAR_MODE_AUTO && (st > 0 || sb > 0)) ||
|
||||
(sm == LV_SCROLLBAR_MODE_ACTIVE && lv_indev_get_scroll_dir(indev) == LV_DIR_VER))) {
|
||||
ver_draw = true;
|
||||
}
|
||||
|
||||
|
||||
bool hor_draw = false;
|
||||
if((dir & LV_DIR_HOR) &&
|
||||
((sm == LV_SCROLLBAR_MODE_ON) ||
|
||||
(sm == LV_SCROLLBAR_MODE_AUTO && (sl > 0 || sr > 0)) ||
|
||||
(sm == LV_SCROLLBAR_MODE_ACTIVE && lv_indev_get_scroll_dir(indev) == LV_DIR_HOR))) {
|
||||
((sm == LV_SCROLLBAR_MODE_ON) ||
|
||||
(sm == LV_SCROLLBAR_MODE_AUTO && (sl > 0 || sr > 0)) ||
|
||||
(sm == LV_SCROLLBAR_MODE_ACTIVE && lv_indev_get_scroll_dir(indev) == LV_DIR_HOR))) {
|
||||
hor_draw = true;
|
||||
}
|
||||
|
||||
@ -472,31 +476,34 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
|
||||
if(rtl) {
|
||||
ver_area->x1 = obj->coords.x1 + side_space;
|
||||
ver_area->x2 = ver_area->x1 + tickness - 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ver_area->x2 = obj->coords.x2 - side_space;
|
||||
ver_area->x1 = ver_area->x2 - tickness + 1;
|
||||
}
|
||||
|
||||
lv_coord_t sb_h = ((obj_h - end_space * 2 - hor_req_space) * obj_h) / content_h;
|
||||
sb_h = LV_MAX(sb_h, SCROLLBAR_MIN_SIZE);
|
||||
rem = (obj_h - end_space * 2 - hor_req_space) - sb_h; /*Remaining size from the scrollbar track that is not the scrollbar itself*/
|
||||
rem = (obj_h - end_space * 2 - hor_req_space) -
|
||||
sb_h; /*Remaining size from the scrollbar track that is not the scrollbar itself*/
|
||||
lv_coord_t scroll_h = content_h - obj_h; /*The size of the content which can be really scrolled*/
|
||||
if(scroll_h <= 0) {
|
||||
ver_area->y1 = obj->coords.y1 + end_space;
|
||||
ver_area->y2 = obj->coords.y2 - end_space - hor_req_space - 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_coord_t sb_y = (rem * sb) / scroll_h;
|
||||
sb_y = rem - sb_y;
|
||||
|
||||
ver_area->y1 = obj->coords.y1 + sb_y + end_space;
|
||||
ver_area->y2 =ver_area->y1 + sb_h - 1;
|
||||
ver_area->y2 = ver_area->y1 + sb_h - 1;
|
||||
if(ver_area->y1 < obj->coords.y1 + end_space) {
|
||||
ver_area->y1 = obj->coords.y1 + end_space;
|
||||
if(ver_area->y1 + SCROLLBAR_MIN_SIZE >ver_area->y2)ver_area->y2 =ver_area->y1 + SCROLLBAR_MIN_SIZE;
|
||||
if(ver_area->y1 + SCROLLBAR_MIN_SIZE > ver_area->y2)ver_area->y2 = ver_area->y1 + SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
if(ver_area->y2 > obj->coords.y2 - hor_req_space - end_space) {
|
||||
ver_area->y2 = obj->coords.y2 - hor_req_space - end_space;
|
||||
if(ver_area->y2 - SCROLLBAR_MIN_SIZE <ver_area->y1)ver_area->y1 =ver_area->y2 - SCROLLBAR_MIN_SIZE;
|
||||
if(ver_area->y2 - SCROLLBAR_MIN_SIZE < ver_area->y1)ver_area->y1 = ver_area->y2 - SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -511,17 +518,20 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
|
||||
|
||||
lv_coord_t sb_w = ((obj_w - end_space * 2 - ver_reg_space) * obj_w) / content_w;
|
||||
sb_w = LV_MAX(sb_w, SCROLLBAR_MIN_SIZE);
|
||||
rem = (obj_w - end_space * 2 - ver_reg_space) - sb_w; /*Remaining size from the scrollbar track that is not the scrollbar itself*/
|
||||
rem = (obj_w - end_space * 2 - ver_reg_space) -
|
||||
sb_w; /*Remaining size from the scrollbar track that is not the scrollbar itself*/
|
||||
lv_coord_t scroll_w = content_w - obj_w; /*The size of the content which can be really scrolled*/
|
||||
if(scroll_w <= 0) {
|
||||
if(rtl) {
|
||||
hor_area->x1 = obj->coords.x1 + end_space + ver_reg_space - 1;
|
||||
hor_area->x2 = obj->coords.x2 - end_space;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
hor_area->x1 = obj->coords.x1 + end_space;
|
||||
hor_area->x2 = obj->coords.x2 - end_space - ver_reg_space - 1;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_coord_t sb_x = (rem * sr) / scroll_w;
|
||||
sb_x = rem - sb_x;
|
||||
|
||||
@ -536,7 +546,8 @@ void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor_area, lv_area_t *
|
||||
hor_area->x2 = obj->coords.x2 - end_space;
|
||||
if(hor_area->x2 - SCROLLBAR_MIN_SIZE < hor_area->x1) hor_area->x1 = hor_area->x2 - SCROLLBAR_MIN_SIZE;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
hor_area->x1 = obj->coords.x1 + sb_x + end_space;
|
||||
hor_area->x2 = hor_area->x1 + sb_w - 1;
|
||||
if(hor_area->x1 < obj->coords.x1 + end_space) {
|
||||
@ -586,7 +597,8 @@ void lv_obj_readjust_scroll(lv_obj_t * obj, lv_anim_enable_t anim_en)
|
||||
sr = LV_MIN(sl, -sr);
|
||||
lv_obj_scroll_by(obj, sr, 0, anim_en);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/*Be sure the right side is not remains scrolled in*/
|
||||
if(sl < 0 && sr > 0) {
|
||||
sr = LV_MIN(sr, -sl);
|
||||
@ -630,7 +642,8 @@ static void scroll_anim_ready_cb(lv_anim_t * a)
|
||||
lv_event_send(a->var, LV_EVENT_SCROLL_END, NULL);
|
||||
}
|
||||
|
||||
static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_point_t * scroll_value, lv_anim_enable_t anim_en)
|
||||
static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_point_t * scroll_value,
|
||||
lv_anim_enable_t anim_en)
|
||||
{
|
||||
lv_obj_t * parent = lv_obj_get_parent(child);
|
||||
lv_dir_t scroll_dir = lv_obj_get_scroll_dir(parent);
|
||||
@ -663,21 +676,21 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
|
||||
}
|
||||
|
||||
switch(snap_y) {
|
||||
case LV_SCROLL_SNAP_START:
|
||||
snap_goal = parent->coords.y1 + ptop;
|
||||
act = area_tmp->y1 + y_scroll;
|
||||
y_scroll += snap_goal - act;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
snap_goal = parent->coords.y2 - pbottom;
|
||||
act = area_tmp->y2 + y_scroll;
|
||||
y_scroll += snap_goal - act;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
snap_goal = parent->coords.y1 + ptop + parent_h / 2;
|
||||
act = lv_area_get_height(area_tmp) / 2 + area_tmp->y1 + y_scroll;
|
||||
y_scroll += snap_goal - act;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_START:
|
||||
snap_goal = parent->coords.y1 + ptop;
|
||||
act = area_tmp->y1 + y_scroll;
|
||||
y_scroll += snap_goal - act;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
snap_goal = parent->coords.y2 - pbottom;
|
||||
act = area_tmp->y2 + y_scroll;
|
||||
y_scroll += snap_goal - act;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
snap_goal = parent->coords.y1 + ptop + parent_h / 2;
|
||||
act = lv_area_get_height(area_tmp) / 2 + area_tmp->y1 + y_scroll;
|
||||
y_scroll += snap_goal - act;
|
||||
break;
|
||||
}
|
||||
|
||||
lv_coord_t x_scroll = 0;
|
||||
@ -688,7 +701,7 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
|
||||
lv_coord_t pleft = lv_obj_get_style_pad_left(parent, LV_PART_MAIN);
|
||||
lv_coord_t pright = lv_obj_get_style_pad_right(parent, LV_PART_MAIN);
|
||||
lv_coord_t left_diff = parent->coords.x1 + pleft - area_tmp->x1 - scroll_value->x;
|
||||
lv_coord_t right_diff = -(parent->coords.x2 - pright - area_tmp->x2- scroll_value->x);
|
||||
lv_coord_t right_diff = -(parent->coords.x2 - pright - area_tmp->x2 - scroll_value->x);
|
||||
if((left_diff > 0 && right_diff > 0)) x_scroll = 0;
|
||||
else if(left_diff > 0) {
|
||||
x_scroll = left_diff;
|
||||
@ -705,21 +718,21 @@ static void scroll_area_into_view(const lv_area_t * area, lv_obj_t * child, lv_p
|
||||
|
||||
lv_coord_t parent_w = lv_obj_get_width(parent) - pleft - pright;
|
||||
switch(snap_x) {
|
||||
case LV_SCROLL_SNAP_START:
|
||||
snap_goal = parent->coords.x1 + pleft;
|
||||
act = area_tmp->x1 + x_scroll;
|
||||
x_scroll += snap_goal - act;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
snap_goal = parent->coords.x2 - pright;
|
||||
act = area_tmp->x2 + x_scroll;
|
||||
x_scroll += snap_goal - act;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
snap_goal = parent->coords.x1 + pleft + parent_w / 2;
|
||||
act = lv_area_get_width(area_tmp) / 2 + area_tmp->x1 + x_scroll;
|
||||
x_scroll += snap_goal - act;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_START:
|
||||
snap_goal = parent->coords.x1 + pleft;
|
||||
act = area_tmp->x1 + x_scroll;
|
||||
x_scroll += snap_goal - act;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_END:
|
||||
snap_goal = parent->coords.x2 - pright;
|
||||
act = area_tmp->x2 + x_scroll;
|
||||
x_scroll += snap_goal - act;
|
||||
break;
|
||||
case LV_SCROLL_SNAP_CENTER:
|
||||
snap_goal = parent->coords.x1 + pleft + parent_w / 2;
|
||||
act = lv_area_get_width(area_tmp) / 2 + area_tmp->x1 + x_scroll;
|
||||
x_scroll += snap_goal - act;
|
||||
break;
|
||||
}
|
||||
|
||||
/*Remove any pending scroll animations.*/
|
||||
|
@ -33,7 +33,7 @@ typedef enum {
|
||||
CACHE_UNSET = 2,
|
||||
CACHE_255 = 3,
|
||||
CACHE_NEED_CHECK = 4,
|
||||
}cache_t;
|
||||
} cache_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@ -117,8 +117,7 @@ void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t
|
||||
lv_part_t part_act = lv_obj_style_get_selector_part(obj->styles[i].selector);
|
||||
if((state != LV_STATE_ANY && state_act != state) ||
|
||||
(part != LV_PART_ANY && part_act != part) ||
|
||||
(style != NULL && style != obj->styles[i].style))
|
||||
{
|
||||
(style != NULL && style != obj->styles[i].style)) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
@ -179,13 +178,13 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style
|
||||
if(part == LV_PART_ANY ||
|
||||
part == LV_PART_MAIN ||
|
||||
lv_obj_get_style_height(obj, 0) == LV_SIZE_CONTENT ||
|
||||
lv_obj_get_style_width(obj, 0) == LV_SIZE_CONTENT)
|
||||
{
|
||||
lv_obj_get_style_width(obj, 0) == LV_SIZE_CONTENT) {
|
||||
lv_event_send(obj, LV_EVENT_STYLE_CHANGED, NULL);
|
||||
lv_obj_mark_layout_as_dirty(obj);
|
||||
}
|
||||
}
|
||||
if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY || (prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) {
|
||||
if((part == LV_PART_ANY || part == LV_PART_MAIN) && (prop == LV_STYLE_PROP_ANY ||
|
||||
(prop & LV_STYLE_PROP_PARENT_LAYOUT_REFR))) {
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
if(parent) lv_obj_mark_layout_as_dirty(parent);
|
||||
}
|
||||
@ -196,8 +195,7 @@ void lv_obj_refresh_style(lv_obj_t * obj, lv_style_selector_t selector, lv_style
|
||||
lv_obj_invalidate(obj);
|
||||
|
||||
if(prop == LV_STYLE_PROP_ANY ||
|
||||
((prop & LV_STYLE_PROP_INHERIT) && ((prop & LV_STYLE_PROP_EXT_DRAW) || (prop & LV_STYLE_PROP_LAYOUT_REFR))))
|
||||
{
|
||||
((prop & LV_STYLE_PROP_INHERIT) && ((prop & LV_STYLE_PROP_EXT_DRAW) || (prop & LV_STYLE_PROP_LAYOUT_REFR)))) {
|
||||
if(part != LV_PART_SCROLLBAR) {
|
||||
refresh_children_style(obj);
|
||||
}
|
||||
@ -239,14 +237,16 @@ lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_
|
||||
while(cls) {
|
||||
if(prop == LV_STYLE_WIDTH) {
|
||||
if(cls->width_def != 0) break;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if(cls->height_def != 0) break;
|
||||
}
|
||||
cls = cls->base_class;
|
||||
}
|
||||
|
||||
value_act.num = prop == LV_STYLE_WIDTH ? cls->width_def : cls->height_def;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
value_act = lv_style_prop_get_default(prop);
|
||||
}
|
||||
}
|
||||
@ -254,7 +254,8 @@ lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_
|
||||
return value_act;
|
||||
}
|
||||
|
||||
void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value, lv_style_selector_t selector)
|
||||
void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value,
|
||||
lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_t * style = get_local_style(obj, selector);
|
||||
lv_style_set_prop(style, prop, value);
|
||||
@ -262,13 +263,13 @@ void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_
|
||||
}
|
||||
|
||||
|
||||
lv_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value, lv_style_selector_t selector)
|
||||
lv_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value,
|
||||
lv_style_selector_t selector)
|
||||
{
|
||||
uint32_t i;
|
||||
for(i = 0; i < obj->style_cnt; i++) {
|
||||
if(obj->styles[i].is_local &&
|
||||
obj->styles[i].selector == selector)
|
||||
{
|
||||
obj->styles[i].selector == selector) {
|
||||
return lv_style_get_prop(obj->styles[i].style, prop, value);
|
||||
}
|
||||
}
|
||||
@ -295,7 +296,8 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty
|
||||
return lv_style_remove_prop(obj->styles[i].style, prop);
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -483,8 +485,7 @@ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selecto
|
||||
uint32_t i;
|
||||
for(i = 0; i < obj->style_cnt; i++) {
|
||||
if(obj->styles[i].is_local &&
|
||||
obj->styles[i].selector == selector)
|
||||
{
|
||||
obj->styles[i].selector == selector) {
|
||||
return obj->styles[i].style;
|
||||
}
|
||||
}
|
||||
@ -706,7 +707,7 @@ static void trans_anim_cb(void * _tr, int32_t v)
|
||||
if(obj->styles[i].is_trans == 0 || obj->styles[i].selector != tr->selector) continue;
|
||||
|
||||
lv_style_value_t value_final;
|
||||
switch (tr->prop) {
|
||||
switch(tr->prop) {
|
||||
|
||||
case LV_STYLE_BORDER_SIDE:
|
||||
case LV_STYLE_BORDER_POST:
|
||||
@ -746,12 +747,13 @@ static void trans_anim_cb(void * _tr, int32_t v)
|
||||
lv_style_value_t old_value;
|
||||
bool refr = true;
|
||||
if(lv_style_get_prop(obj->styles[i].style, tr->prop, &old_value)) {
|
||||
if(value_final.ptr == old_value.ptr && value_final.color.full == old_value.color.full && value_final.num == old_value.num) {
|
||||
if(value_final.ptr == old_value.ptr && value_final.color.full == old_value.color.full &&
|
||||
value_final.num == old_value.num) {
|
||||
refr = false;
|
||||
}
|
||||
}
|
||||
lv_style_set_prop(obj->styles[i].style, tr->prop, value_final);
|
||||
if (refr) lv_obj_refresh_style(tr->obj, tr->selector, tr->prop);
|
||||
if(refr) lv_obj_refresh_style(tr->obj, tr->selector, tr->prop);
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -38,10 +38,10 @@ typedef uint32_t lv_style_selector_t;
|
||||
|
||||
typedef struct {
|
||||
lv_style_t * style;
|
||||
uint32_t selector :24;
|
||||
uint32_t is_local :1;
|
||||
uint32_t is_trans :1;
|
||||
}_lv_obj_style_t;
|
||||
uint32_t selector : 24;
|
||||
uint32_t is_local : 1;
|
||||
uint32_t is_trans : 1;
|
||||
} _lv_obj_style_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t time;
|
||||
@ -52,7 +52,7 @@ typedef struct {
|
||||
#if LV_USE_USER_DATA
|
||||
void * user_data;
|
||||
#endif
|
||||
}_lv_obj_style_transition_dsc_t;
|
||||
} _lv_obj_style_transition_dsc_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@ -138,9 +138,11 @@ lv_style_value_t lv_obj_get_style_prop(const struct _lv_obj_t * obj, lv_part_t p
|
||||
* @param prop the property
|
||||
* @param value value of the property. The correct element should be set according to the type of the property
|
||||
*/
|
||||
void lv_obj_set_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value,
|
||||
lv_style_selector_t selector);
|
||||
|
||||
lv_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value, lv_style_selector_t selector);
|
||||
lv_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value,
|
||||
lv_style_selector_t selector);
|
||||
|
||||
/**
|
||||
* Remove a local style property from a part of an object with a given state.
|
||||
@ -160,7 +162,8 @@ bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop
|
||||
* @param new_state
|
||||
* @param tr
|
||||
*/
|
||||
void _lv_obj_style_create_transition(struct _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);
|
||||
void _lv_obj_style_create_transition(struct _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
|
||||
@ -193,29 +196,34 @@ lv_part_t lv_obj_style_get_selector_part(lv_style_selector_t selector);
|
||||
|
||||
#include "lv_obj_style_gen.h"
|
||||
|
||||
static inline void lv_obj_set_style_pad_all(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
|
||||
static inline void lv_obj_set_style_pad_all(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_obj_set_style_pad_left(obj, value, selector);
|
||||
lv_obj_set_style_pad_right(obj, value, selector);
|
||||
lv_obj_set_style_pad_top(obj, value, selector);
|
||||
lv_obj_set_style_pad_bottom(obj, value, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_pad_hor(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
|
||||
static inline void lv_obj_set_style_pad_hor(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_obj_set_style_pad_left(obj, value, selector);
|
||||
lv_obj_set_style_pad_right(obj, value, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_pad_ver(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
|
||||
static inline void lv_obj_set_style_pad_ver(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_obj_set_style_pad_top(obj, value, selector);
|
||||
lv_obj_set_style_pad_bottom(obj, value, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
|
||||
static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_obj_set_style_pad_row(obj, value, selector);
|
||||
lv_obj_set_style_pad_column(obj, value, selector);
|
||||
}
|
||||
|
||||
static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
|
||||
static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
{
|
||||
lv_obj_set_style_width(obj, value, selector);
|
||||
lv_obj_set_style_height(obj, value, selector);
|
||||
}
|
||||
|
@ -191,7 +191,8 @@ void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selec
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_OPA, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value,
|
||||
lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
@ -223,7 +224,8 @@ void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_styl
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_ANIM_SPEED, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector)
|
||||
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value,
|
||||
lv_style_selector_t selector)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.ptr = value
|
||||
|
@ -142,7 +142,8 @@ static inline lv_opa_t lv_obj_get_style_opa(const struct _lv_obj_t * obj, uint32
|
||||
return (lv_opa_t)v.num;
|
||||
}
|
||||
|
||||
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj, uint32_t part)
|
||||
static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const struct _lv_obj_t * obj,
|
||||
uint32_t part)
|
||||
{
|
||||
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC);
|
||||
return (const lv_color_filter_dsc_t *)v.ptr;
|
||||
@ -556,11 +557,13 @@ void lv_obj_set_style_pad_column(struct _lv_obj_t * obj, lv_coord_t value, lv_st
|
||||
void lv_obj_set_style_radius(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_clip_corner(struct _lv_obj_t * obj, bool value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_color_filter_dsc(struct _lv_obj_t * obj, const lv_color_filter_dsc_t * value,
|
||||
lv_style_selector_t selector);
|
||||
void lv_obj_set_style_color_filter_opa(struct _lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_anim_time(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_anim_speed(struct _lv_obj_t * obj, uint32_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_transition(struct _lv_obj_t * obj, const lv_style_transition_dsc_t * value,
|
||||
lv_style_selector_t selector);
|
||||
void lv_obj_set_style_blend_mode(struct _lv_obj_t * obj, lv_blend_mode_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_layout(struct _lv_obj_t * obj, uint16_t value, lv_style_selector_t selector);
|
||||
void lv_obj_set_style_base_dir(struct _lv_obj_t * obj, lv_base_dir_t value, lv_style_selector_t selector);
|
||||
|
@ -30,9 +30,9 @@
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void lv_obj_del_async_cb(void* obj);
|
||||
static void lv_obj_del_async_cb(void * obj);
|
||||
static void obj_del_core(lv_obj_t * obj);
|
||||
static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb, void* user_data);
|
||||
static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb, void * user_data);
|
||||
|
||||
/**********************
|
||||
* STATIC VARIABLES
|
||||
@ -166,15 +166,18 @@ void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent)
|
||||
}
|
||||
old_parent->spec_attr->child_cnt--;
|
||||
if(old_parent->spec_attr->child_cnt) {
|
||||
old_parent->spec_attr->children = lv_mem_realloc(old_parent->spec_attr->children, old_parent->spec_attr->child_cnt * (sizeof(lv_obj_t *)));
|
||||
} else {
|
||||
old_parent->spec_attr->children = lv_mem_realloc(old_parent->spec_attr->children,
|
||||
old_parent->spec_attr->child_cnt * (sizeof(lv_obj_t *)));
|
||||
}
|
||||
else {
|
||||
lv_mem_free(old_parent->spec_attr->children);
|
||||
old_parent->spec_attr->children = NULL;
|
||||
}
|
||||
|
||||
/*Add the child to the new parent as the last (newest child)*/
|
||||
parent->spec_attr->child_cnt++;
|
||||
parent->spec_attr->children = lv_mem_realloc(parent->spec_attr->children, parent->spec_attr->child_cnt * (sizeof(lv_obj_t *)));
|
||||
parent->spec_attr->children = lv_mem_realloc(parent->spec_attr->children,
|
||||
parent->spec_attr->child_cnt * (sizeof(lv_obj_t *)));
|
||||
parent->spec_attr->children[lv_obj_get_child_cnt(parent) - 1] = obj;
|
||||
|
||||
obj->parent = parent;
|
||||
@ -211,13 +214,13 @@ void lv_obj_move_to_index(lv_obj_t * obj, int32_t index)
|
||||
|
||||
int32_t i = old_index;
|
||||
if(index < old_index) {
|
||||
while (i > index) {
|
||||
while(i > index) {
|
||||
parent->spec_attr->children[i] = parent->spec_attr->children[i - 1];
|
||||
i--;
|
||||
}
|
||||
}
|
||||
else {
|
||||
while (i < index) {
|
||||
while(i < index) {
|
||||
parent->spec_attr->children[i] = parent->spec_attr->children[i + 1];
|
||||
i++;
|
||||
}
|
||||
@ -247,8 +250,7 @@ void lv_obj_swap(lv_obj_t * obj1, lv_obj_t * obj2)
|
||||
|
||||
lv_obj_invalidate(parent);
|
||||
|
||||
if(parent != parent2)
|
||||
{
|
||||
if(parent != parent2) {
|
||||
lv_obj_invalidate(parent2);
|
||||
}
|
||||
lv_group_swap_obj(obj1, obj2);
|
||||
@ -309,7 +311,8 @@ lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, int32_t id)
|
||||
id = obj->spec_attr->child_cnt + id;
|
||||
if(id < 0) return NULL;
|
||||
idu = (uint32_t) id;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
idu = id;
|
||||
}
|
||||
|
||||
@ -339,7 +342,7 @@ uint32_t lv_obj_get_index(const lv_obj_t * obj)
|
||||
return 0xFFFFFFFF; /*Shouldn't happen*/
|
||||
}
|
||||
|
||||
void lv_obj_tree_walk(lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void* user_data)
|
||||
void lv_obj_tree_walk(lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void * user_data)
|
||||
{
|
||||
walk_core(start_obj, cb, user_data);
|
||||
}
|
||||
@ -348,7 +351,7 @@ void lv_obj_tree_walk(lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void* user
|
||||
* STATIC FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static void lv_obj_del_async_cb(void* obj)
|
||||
static void lv_obj_del_async_cb(void * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
@ -368,10 +371,10 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
child = lv_obj_get_child(obj, 0);
|
||||
}
|
||||
|
||||
lv_group_t* group = lv_obj_get_group(obj);
|
||||
lv_group_t * group = lv_obj_get_group(obj);
|
||||
|
||||
/*Reset all input devices if the object to delete is used*/
|
||||
lv_indev_t* indev = lv_indev_get_next(NULL);
|
||||
lv_indev_t * indev = lv_indev_get_next(NULL);
|
||||
while(indev) {
|
||||
if(indev->proc.types.pointer.act_obj == obj || indev->proc.types.pointer.last_obj == obj) {
|
||||
lv_indev_reset(indev, obj);
|
||||
@ -413,7 +416,8 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
obj->parent->spec_attr->children[i] = obj->parent->spec_attr->children[i + 1];
|
||||
}
|
||||
obj->parent->spec_attr->child_cnt--;
|
||||
obj->parent->spec_attr->children = lv_mem_realloc(obj->parent->spec_attr->children, obj->parent->spec_attr->child_cnt * sizeof(lv_obj_t *));
|
||||
obj->parent->spec_attr->children = lv_mem_realloc(obj->parent->spec_attr->children,
|
||||
obj->parent->spec_attr->child_cnt * sizeof(lv_obj_t *));
|
||||
}
|
||||
|
||||
/*Free the object itself*/
|
||||
@ -421,7 +425,7 @@ static void obj_del_core(lv_obj_t * obj)
|
||||
}
|
||||
|
||||
|
||||
static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb, void* user_data)
|
||||
static lv_obj_tree_walk_res_t walk_core(lv_obj_t * obj, lv_obj_tree_walk_cb_t cb, void * user_data)
|
||||
{
|
||||
lv_obj_tree_walk_res_t res = LV_OBJ_TREE_WALK_NEXT;
|
||||
|
||||
|
@ -91,7 +91,7 @@ void lv_obj_set_parent(struct _lv_obj_t * obj, struct _lv_obj_t * parent);
|
||||
* @param obj1 pointer to the first object
|
||||
* @param obj2 pointer to the second object
|
||||
*/
|
||||
void lv_obj_swap(struct _lv_obj_t* obj1, struct _lv_obj_t* obj2);
|
||||
void lv_obj_swap(struct _lv_obj_t * obj1, struct _lv_obj_t * obj2);
|
||||
|
||||
/**
|
||||
* moves the object to the given index in its parent.
|
||||
@ -99,9 +99,9 @@ void lv_obj_swap(struct _lv_obj_t* obj1, struct _lv_obj_t* obj2);
|
||||
* @param obj pointer to the object to be moved.
|
||||
* @param index new index in parent.
|
||||
* @note to move to the foreground: lv_obj_move_to_index(obj, 0)
|
||||
* @note to move forward (up): lv_obj_move_to_index(obj, lv_obj_get_index(obj) - 1)
|
||||
* @note to move forward (up): lv_obj_move_to_index(obj, lv_obj_get_index(obj) - 1)
|
||||
*/
|
||||
void lv_obj_move_to_index(struct _lv_obj_t* obj, int32_t index);
|
||||
void lv_obj_move_to_index(struct _lv_obj_t * obj, int32_t index);
|
||||
|
||||
/**
|
||||
* Get the screen of an object
|
||||
@ -150,7 +150,7 @@ uint32_t lv_obj_get_child_cnt(const struct _lv_obj_t * obj);
|
||||
* @return the child index of the object.
|
||||
* E.g. 0: the oldest (firstly created child)
|
||||
*/
|
||||
uint32_t lv_obj_get_index(const struct _lv_obj_t* obj);
|
||||
uint32_t lv_obj_get_index(const struct _lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Iterate through all children of any object.
|
||||
|
@ -57,9 +57,9 @@ static lv_disp_t * disp_refr; /*Display being refreshed*/
|
||||
* MACROS
|
||||
**********************/
|
||||
#if LV_LOG_TRACE_DISP_REFR
|
||||
# define TRACE_REFR(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#define TRACE_REFR(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#else
|
||||
# define TRACE_REFR(...)
|
||||
#define TRACE_REFR(...)
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@ -307,7 +307,8 @@ void _lv_disp_refr_timer(lv_timer_t * tmr)
|
||||
uint32_t used_size = mon.total_size - mon.free_size;;
|
||||
uint32_t used_kb = used_size / 1024;
|
||||
uint32_t used_kb_tenth = (used_size - (used_kb * 1024)) / 102;
|
||||
lv_label_set_text_fmt(mem_label, "%d.%d kB used (%d %%)\n%d%% frag.", used_kb, used_kb_tenth, mon.used_pct, mon.frag_pct);
|
||||
lv_label_set_text_fmt(mem_label, "%d.%d kB used (%d %%)\n%d%% frag.", used_kb, used_kb_tenth, mon.used_pct,
|
||||
mon.frag_pct);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -421,7 +422,7 @@ static void lv_refr_area(const lv_area_t * area_p)
|
||||
lv_coord_t w = lv_area_get_width(area_p);
|
||||
lv_coord_t h = lv_area_get_height(area_p);
|
||||
lv_coord_t y2 = area_p->y2 >= lv_disp_get_ver_res(disp_refr) ?
|
||||
lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
|
||||
lv_disp_get_ver_res(disp_refr) - 1 : area_p->y2;
|
||||
|
||||
int32_t max_row = (uint32_t)draw_buf->size / w;
|
||||
|
||||
@ -495,9 +496,9 @@ static void lv_refr_area_part(const lv_area_t * area_p)
|
||||
/* Below the `area_p` area will be redrawn into the draw buffer.
|
||||
* In single buffered mode wait here until the buffer is freed.*/
|
||||
if(draw_buf->buf1 && !draw_buf->buf2) {
|
||||
while(draw_buf->flushing) {
|
||||
if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver);
|
||||
}
|
||||
while(draw_buf->flushing) {
|
||||
if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver);
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_t * top_act_scr = NULL;
|
||||
@ -641,16 +642,17 @@ static void lv_refr_obj_and_children(lv_obj_t * top_p, const lv_area_t * mask_p)
|
||||
lv_obj_t * child = par->spec_attr->children[i];
|
||||
if(!go) {
|
||||
if(child == border_p) go = true;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/*Refresh the objects*/
|
||||
lv_refr_obj(child, mask_p);
|
||||
}
|
||||
}
|
||||
|
||||
/*Call the post draw draw function of the parents of the to object*/
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST_BEGIN, (void*)mask_p);
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST, (void*)mask_p);
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST_END, (void*)mask_p);
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST_BEGIN, (void *)mask_p);
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST, (void *)mask_p);
|
||||
lv_event_send(par, LV_EVENT_DRAW_POST_END, (void *)mask_p);
|
||||
|
||||
/*The new border will be the last parents,
|
||||
*so the 'younger' brothers of parent will be refreshed*/
|
||||
@ -737,7 +739,8 @@ static void lv_refr_obj(lv_obj_t * obj, const lv_area_t * mask_ori_p)
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_buf_rotate_180(lv_disp_drv_t *drv, lv_area_t *area, lv_color_t *color_p) {
|
||||
static void draw_buf_rotate_180(lv_disp_drv_t * drv, lv_area_t * area, lv_color_t * color_p)
|
||||
{
|
||||
lv_coord_t area_w = lv_area_get_width(area);
|
||||
lv_coord_t area_h = lv_area_get_height(area);
|
||||
uint32_t total = area_w * area_h;
|
||||
@ -760,7 +763,9 @@ static void draw_buf_rotate_180(lv_disp_drv_t *drv, lv_area_t *area, lv_color_t
|
||||
area->x1 = drv->hor_res - tmp_coord - 1;
|
||||
}
|
||||
|
||||
static LV_ATTRIBUTE_FAST_MEM void draw_buf_rotate_90(bool invert_i, lv_coord_t area_w, lv_coord_t area_h, lv_color_t *orig_color_p, lv_color_t *rot_buf) {
|
||||
static LV_ATTRIBUTE_FAST_MEM void draw_buf_rotate_90(bool invert_i, lv_coord_t area_w, lv_coord_t area_h,
|
||||
lv_color_t * orig_color_p, lv_color_t * rot_buf)
|
||||
{
|
||||
|
||||
uint32_t invert = (area_w * area_h) - 1;
|
||||
uint32_t initial_i = ((area_w - 1) * area_h);
|
||||
@ -781,7 +786,8 @@ static LV_ATTRIBUTE_FAST_MEM void draw_buf_rotate_90(bool invert_i, lv_coord_t a
|
||||
/**
|
||||
* Helper function for draw_buf_rotate_90_sqr. Given a list of four numbers, rotate the entire list to the left.
|
||||
*/
|
||||
static inline void draw_buf_rotate4(lv_color_t *a, lv_color_t *b, lv_color_t * c, lv_color_t * d) {
|
||||
static inline void draw_buf_rotate4(lv_color_t * a, lv_color_t * b, lv_color_t * c, lv_color_t * d)
|
||||
{
|
||||
lv_color_t tmp;
|
||||
tmp = *a;
|
||||
*a = *b;
|
||||
@ -794,9 +800,10 @@ static inline void draw_buf_rotate4(lv_color_t *a, lv_color_t *b, lv_color_t * c
|
||||
* Rotate a square image 90/270 degrees in place.
|
||||
* @note inspired by https://stackoverflow.com/a/43694906
|
||||
*/
|
||||
static void draw_buf_rotate_90_sqr(bool is_270, lv_coord_t w, lv_color_t * color_p) {
|
||||
for(lv_coord_t i = 0; i < w/2; i++) {
|
||||
for(lv_coord_t j = 0; j < (w + 1)/2; j++) {
|
||||
static void draw_buf_rotate_90_sqr(bool is_270, lv_coord_t w, lv_color_t * color_p)
|
||||
{
|
||||
for(lv_coord_t i = 0; i < w / 2; i++) {
|
||||
for(lv_coord_t j = 0; j < (w + 1) / 2; j++) {
|
||||
lv_coord_t inv_i = (w - 1) - i;
|
||||
lv_coord_t inv_j = (w - 1) - j;
|
||||
if(is_270) {
|
||||
@ -806,7 +813,8 @@ static void draw_buf_rotate_90_sqr(bool is_270, lv_coord_t w, lv_color_t * color
|
||||
&color_p[inv_i * w + inv_j],
|
||||
&color_p[j * w + inv_i]
|
||||
);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
draw_buf_rotate4(
|
||||
&color_p[i * w + j],
|
||||
&color_p[j * w + inv_i],
|
||||
@ -822,7 +830,8 @@ static void draw_buf_rotate_90_sqr(bool is_270, lv_coord_t w, lv_color_t * color
|
||||
/**
|
||||
* Rotate the draw_buf to the display's native orientation.
|
||||
*/
|
||||
static void draw_buf_rotate(lv_area_t *area, lv_color_t *color_p) {
|
||||
static void draw_buf_rotate(lv_area_t * area, lv_color_t * color_p)
|
||||
{
|
||||
lv_disp_drv_t * drv = disp_refr->driver;
|
||||
if(disp_refr->driver->full_refresh && drv->sw_rotate) {
|
||||
LV_LOG_ERROR("cannot rotate a full refreshed display!");
|
||||
@ -831,14 +840,15 @@ static void draw_buf_rotate(lv_area_t *area, lv_color_t *color_p) {
|
||||
if(drv->rotated == LV_DISP_ROT_180) {
|
||||
draw_buf_rotate_180(drv, area, color_p);
|
||||
call_flush_cb(drv, area, color_p);
|
||||
} else if(drv->rotated == LV_DISP_ROT_90 || drv->rotated == LV_DISP_ROT_270) {
|
||||
}
|
||||
else if(drv->rotated == LV_DISP_ROT_90 || drv->rotated == LV_DISP_ROT_270) {
|
||||
/*Allocate a temporary buffer to store rotated image*/
|
||||
lv_color_t * rot_buf = NULL;
|
||||
lv_disp_draw_buf_t * draw_buf = lv_disp_get_draw_buf(disp_refr);
|
||||
lv_coord_t area_w = lv_area_get_width(area);
|
||||
lv_coord_t area_h = lv_area_get_height(area);
|
||||
/*Determine the maximum number of rows that can be rotated at a time*/
|
||||
lv_coord_t max_row = LV_MIN((lv_coord_t)((LV_DISP_ROT_MAX_BUF/sizeof(lv_color_t)) / area_w), area_h);
|
||||
lv_coord_t max_row = LV_MIN((lv_coord_t)((LV_DISP_ROT_MAX_BUF / sizeof(lv_color_t)) / area_w), area_h);
|
||||
lv_coord_t init_y_off;
|
||||
init_y_off = area->y1;
|
||||
if(drv->rotated == LV_DISP_ROT_90) {
|
||||
@ -853,7 +863,7 @@ static void draw_buf_rotate(lv_area_t *area, lv_color_t *color_p) {
|
||||
/*Rotate the screen in chunks, flushing after each one*/
|
||||
lv_coord_t row = 0;
|
||||
while(row < area_h) {
|
||||
lv_coord_t height = LV_MIN(max_row, area_h-row);
|
||||
lv_coord_t height = LV_MIN(max_row, area_h - row);
|
||||
draw_buf->flushing = 1;
|
||||
if((row == 0) && (area_h >= area_w)) {
|
||||
/*Rotate the initial area as a square*/
|
||||
@ -887,7 +897,8 @@ static void draw_buf_rotate(lv_area_t *area, lv_color_t *color_p) {
|
||||
* Set the original last_part flag on the last part of rotation. */
|
||||
if(row + height >= area_h && draw_buf->last_area && draw_buf->last_part) {
|
||||
draw_buf->flushing_last = 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
draw_buf->flushing_last = 0;
|
||||
}
|
||||
|
||||
@ -917,24 +928,25 @@ static void draw_buf_flush(void)
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
if(disp->driver->gpu_wait_cb) disp->driver->gpu_wait_cb(disp->driver);
|
||||
|
||||
/* In double buffered mode wait until the other buffer is freed
|
||||
* and driver is ready to receive the new buffer */
|
||||
if(draw_buf->buf1 && draw_buf->buf2) {
|
||||
while(draw_buf->flushing) {
|
||||
if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver);
|
||||
}
|
||||
}
|
||||
/* In double buffered mode wait until the other buffer is freed
|
||||
* and driver is ready to receive the new buffer */
|
||||
if(draw_buf->buf1 && draw_buf->buf2) {
|
||||
while(draw_buf->flushing) {
|
||||
if(disp_refr->driver->wait_cb) disp_refr->driver->wait_cb(disp_refr->driver);
|
||||
}
|
||||
}
|
||||
|
||||
draw_buf->flushing = 1;
|
||||
draw_buf->flushing = 1;
|
||||
|
||||
if(disp_refr->driver->draw_buf->last_area && disp_refr->driver->draw_buf->last_part) draw_buf->flushing_last = 1;
|
||||
else draw_buf->flushing_last = 0;
|
||||
if(disp_refr->driver->draw_buf->last_area && disp_refr->driver->draw_buf->last_part) draw_buf->flushing_last = 1;
|
||||
else draw_buf->flushing_last = 0;
|
||||
|
||||
if(disp->driver->flush_cb) {
|
||||
/*Rotate the buffer to the display's native orientation if necessary*/
|
||||
if(disp->driver->rotated != LV_DISP_ROT_NONE && disp->driver->sw_rotate) {
|
||||
draw_buf_rotate(&draw_buf->area, draw_buf->buf_act);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
call_flush_cb(disp->driver, &draw_buf->area, color_p);
|
||||
}
|
||||
}
|
||||
@ -948,6 +960,7 @@ static void draw_buf_flush(void)
|
||||
|
||||
static void call_flush_cb(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * color_p)
|
||||
{
|
||||
TRACE_REFR("Calling flush_cb on (%d;%d)(%d;%d) area with %p image pointer", area->x1, area->y1, area->x2, area->y2, color_p);
|
||||
TRACE_REFR("Calling flush_cb on (%d;%d)(%d;%d) area with %p image pointer", area->x1, area->y1, area->x2, area->y2,
|
||||
color_p);
|
||||
drv->flush_cb(drv, area, color_p);
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ static void apply_theme(lv_theme_t * th, lv_obj_t * obj);
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj)
|
||||
lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj)
|
||||
{
|
||||
lv_disp_t * disp = obj ? lv_obj_get_disp(obj) : lv_disp_get_default();
|
||||
return lv_disp_get_theme(disp);
|
||||
|
@ -50,7 +50,7 @@ typedef struct _lv_theme_t {
|
||||
* @param obj pointer to object
|
||||
* @return the theme of the object's display (can be NULL)
|
||||
*/
|
||||
lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj);
|
||||
lv_theme_t * lv_theme_get_from_obj(lv_obj_t * obj);
|
||||
|
||||
/**
|
||||
* Apply the active theme on an object
|
||||
|
@ -40,11 +40,11 @@ typedef struct {
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
#if LV_DRAW_COMPLEX
|
||||
static void draw_quarter_0(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_1(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_2(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_3(quarter_draw_dsc_t * q);
|
||||
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area);
|
||||
static void draw_quarter_0(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_1(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_2(quarter_draw_dsc_t * q);
|
||||
static void draw_quarter_3(quarter_draw_dsc_t * q);
|
||||
static void get_rounded_area(int16_t angle, lv_coord_t radius, uint8_t thickness, lv_area_t * res_area);
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
|
||||
/**********************
|
||||
@ -85,7 +85,8 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uin
|
||||
cir_dsc.bg_opa = LV_OPA_TRANSP;
|
||||
cir_dsc.bg_img_src = dsc->img_src;
|
||||
cir_dsc.bg_img_opa = dsc->opa;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
cir_dsc.bg_opa = dsc->opa;
|
||||
cir_dsc.bg_color = dsc->color;
|
||||
}
|
||||
@ -217,7 +218,8 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uin
|
||||
#endif /*LV_DRAW_COMPLEX*/
|
||||
}
|
||||
|
||||
void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t start_angle, uint16_t end_angle, lv_coord_t w, bool rounded, lv_area_t * area)
|
||||
void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t start_angle, uint16_t end_angle,
|
||||
lv_coord_t w, bool rounded, lv_area_t * area)
|
||||
{
|
||||
lv_coord_t rout = radius;
|
||||
|
||||
@ -275,7 +277,7 @@ void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t
|
||||
else if(start_quarter == 0 && end_quarter == 1) {
|
||||
area->x1 = x + ((lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
area->y1 = y + ((LV_MIN(lv_trigo_sin(end_angle),
|
||||
lv_trigo_sin(start_angle)) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
lv_trigo_sin(start_angle)) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
area->x2 = x + ((lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
area->y2 = y + rout + extra_area;
|
||||
}
|
||||
@ -283,7 +285,7 @@ void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t
|
||||
area->x1 = x - rout - extra_area;
|
||||
area->y1 = y + ((lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
area->x2 = x + ((LV_MAX(lv_trigo_sin(start_angle + 90),
|
||||
lv_trigo_sin(end_angle + 90)) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
lv_trigo_sin(end_angle + 90)) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
area->y2 = y + ((lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
}
|
||||
else if(start_quarter == 2 && end_quarter == 3) {
|
||||
@ -291,11 +293,11 @@ void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t
|
||||
area->y1 = y - rout - extra_area;
|
||||
area->x2 = x + ((lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
area->y2 = y + (LV_MAX(lv_trigo_sin(end_angle) * rin,
|
||||
lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
}
|
||||
else if(start_quarter == 3 && end_quarter == 0) {
|
||||
area->x1 = x + ((LV_MIN(lv_trigo_sin(end_angle + 90),
|
||||
lv_trigo_sin(start_angle + 90)) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
lv_trigo_sin(start_angle + 90)) * rin) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
area->y1 = y + ((lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
|
||||
area->x2 = x + rout + extra_area;
|
||||
area->y2 = y + ((lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
|
||||
|
@ -62,7 +62,8 @@ void lv_draw_arc(lv_coord_t center_x, lv_coord_t center_y, uint16_t radius, uin
|
||||
* @param rounded true: the arc is rounded
|
||||
* @param area store the area to invalidate here
|
||||
*/
|
||||
void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t start_angle, uint16_t end_angle, lv_coord_t w, bool rounded, lv_area_t * area);
|
||||
void lv_draw_arc_get_area(lv_coord_t x, lv_coord_t y, uint16_t radius, uint16_t start_angle, uint16_t end_angle,
|
||||
lv_coord_t w, bool rounded, lv_area_t * area);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
@ -100,7 +100,7 @@ static inline lv_color_t color_blend_true_color_subtractive(lv_color_t fg, lv_co
|
||||
if(*mask_tmp_x) { \
|
||||
if(*mask_tmp_x == LV_OPA_COVER) disp_buf_first[x] = map_buf_first[x]; \
|
||||
else if(disp->driver->screen_transp) lv_color_mix_with_alpha(disp_buf_first[x], disp_buf_first[x].ch.alpha, \
|
||||
map_buf_first[x], *mask_tmp_x, &disp_buf_first[x], &disp_buf_first[x].ch.alpha); \
|
||||
map_buf_first[x], *mask_tmp_x, &disp_buf_first[x], &disp_buf_first[x].ch.alpha); \
|
||||
else disp_buf_first[x] = lv_color_mix(map_buf_first[x], disp_buf_first[x], *mask_tmp_x); \
|
||||
} \
|
||||
mask_tmp_x++;
|
||||
@ -210,8 +210,7 @@ LV_ATTRIBUTE_FAST_MEM void _lv_blend_map(const lv_area_t * clip_area, const lv_a
|
||||
draw_area.y2 -= disp_area->y1;
|
||||
|
||||
/*Round the values in the mask if anti-aliasing is disabled*/
|
||||
if(mask && disp->driver->antialiasing == 0)
|
||||
{
|
||||
if(mask && disp->driver->antialiasing == 0) {
|
||||
int32_t mask_w = lv_area_get_width(&draw_area);
|
||||
int32_t i;
|
||||
for(i = 0; i < mask_w; i++) mask[i] = mask[i] > 128 ? LV_OPA_COVER : LV_OPA_TRANSP;
|
||||
@ -266,7 +265,7 @@ static void fill_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, con
|
||||
for(x = draw_area->x1; x <= draw_area->x2; x++) {
|
||||
if(mask_tmp[x]) {
|
||||
disp->driver->set_px_cb(disp->driver, (void *)disp_buf, disp_w, x, y, color,
|
||||
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
|
||||
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
|
||||
}
|
||||
}
|
||||
mask_tmp += draw_area_w;
|
||||
@ -404,11 +403,12 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
#if LV_COLOR_DEPTH == 16
|
||||
if((lv_uintptr_t)disp_buf_first & 0x3) {
|
||||
*(disp_buf_first + 0) = color;
|
||||
uint32_t * d = (uint32_t * )(disp_buf_first + 1);
|
||||
uint32_t * d = (uint32_t *)(disp_buf_first + 1);
|
||||
*d = c32;
|
||||
*(disp_buf_first + 3) = color;
|
||||
} else {
|
||||
uint32_t * d = (uint32_t * )disp_buf_first;
|
||||
}
|
||||
else {
|
||||
uint32_t * d = (uint32_t *)disp_buf_first;
|
||||
*d = c32;
|
||||
*(d + 1) = c32;
|
||||
}
|
||||
@ -418,7 +418,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
disp_buf_first[2] = color;
|
||||
disp_buf_first[3] = color;
|
||||
#endif
|
||||
disp_buf_first+= 4;
|
||||
disp_buf_first += 4;
|
||||
mask += 4;
|
||||
}
|
||||
else if(mask32) {
|
||||
@ -426,7 +426,8 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
FILL_NORMAL_MASK_PX(color)
|
||||
FILL_NORMAL_MASK_PX(color)
|
||||
FILL_NORMAL_MASK_PX(color)
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
mask += 4;
|
||||
disp_buf_first += 4;
|
||||
}
|
||||
@ -435,7 +436,7 @@ LV_ATTRIBUTE_FAST_MEM static void fill_normal(const lv_area_t * disp_area, lv_co
|
||||
for(; x < draw_area_w ; x++) {
|
||||
FILL_NORMAL_MASK_PX(color)
|
||||
}
|
||||
disp_buf_first += (disp_w-draw_area_w);
|
||||
disp_buf_first += (disp_w - draw_area_w);
|
||||
}
|
||||
}
|
||||
/*Handle opa and mask values too*/
|
||||
@ -614,7 +615,7 @@ static void map_set_px(const lv_area_t * disp_area, lv_color_t * disp_buf, cons
|
||||
for(x = draw_area->x1; x <= draw_area->x2; x++) {
|
||||
if(mask_tmp[x]) {
|
||||
disp->driver->set_px_cb(disp->driver, (void *)disp_buf, disp_w, x, y, map_buf_tmp[x],
|
||||
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
|
||||
(uint32_t)((uint32_t)opa * mask_tmp[x]) >> 8);
|
||||
}
|
||||
}
|
||||
mask_tmp += draw_area_w;
|
||||
|
@ -289,7 +289,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t lv_img_draw_core(const lv_area_t * coords,
|
||||
int32_t width = lv_area_get_width(&mask_com);
|
||||
|
||||
uint8_t * buf = lv_mem_buf_get(lv_area_get_width(&mask_com) *
|
||||
LV_IMG_PX_SIZE_ALPHA_BYTE); /*+1 because of the possible alpha byte*/
|
||||
LV_IMG_PX_SIZE_ALPHA_BYTE); /*+1 because of the possible alpha byte*/
|
||||
|
||||
lv_area_t line;
|
||||
lv_area_copy(&line, &mask_com);
|
||||
@ -381,7 +381,7 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
#endif
|
||||
/*In the other cases every pixel need to be checked one-by-one*/
|
||||
else {
|
||||
//#if LV_DRAW_COMPLEX
|
||||
//#if LV_DRAW_COMPLEX
|
||||
/*The pixel size in byte is different if an alpha byte is added too*/
|
||||
uint8_t px_size_byte = alpha_byte ? LV_IMG_PX_SIZE_ALPHA_BYTE : sizeof(lv_color_t);
|
||||
|
||||
@ -591,7 +591,8 @@ LV_ATTRIBUTE_FAST_MEM static void lv_draw_map(const lv_area_t * map_area, const
|
||||
/*Apply the masks if any*/
|
||||
if(mask_any) {
|
||||
lv_draw_mask_res_t mask_res_sub;
|
||||
mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + draw_buf->area.x1, y + draw_area.y1 + draw_buf->area.y1,
|
||||
mask_res_sub = lv_draw_mask_apply(mask_buf + px_i_start, draw_area.x1 + draw_buf->area.x1,
|
||||
y + draw_area.y1 + draw_buf->area.y1,
|
||||
lv_area_get_width(&draw_area));
|
||||
if(mask_res_sub == LV_DRAW_MASK_RES_TRANSP) {
|
||||
lv_memset_00(mask_buf + px_i_start, lv_area_get_width(&draw_area));
|
||||
|
@ -121,7 +121,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
int32_t w;
|
||||
|
||||
/*No need to waste processor time if string is empty*/
|
||||
if (txt == NULL || txt[0] == '\0')
|
||||
if(txt == NULL || txt[0] == '\0')
|
||||
return;
|
||||
|
||||
lv_area_t clipped_area;
|
||||
@ -141,7 +141,7 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_label(const lv_area_t * coords, const lv_area
|
||||
/*If EXAPND is enabled then not limit the text's width to the object's width*/
|
||||
lv_point_t p;
|
||||
lv_txt_get_size(&p, txt, dsc->font, dsc->letter_space, dsc->line_space, LV_COORD_MAX,
|
||||
dsc->flag);
|
||||
dsc->flag);
|
||||
w = p.x;
|
||||
}
|
||||
|
||||
@ -419,8 +419,8 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(const lv_point_t * pos_p, const lv_are
|
||||
/*Add warning if the dsc is not found
|
||||
*but do not print warning for non printable ASCII chars (e.g. '\n')*/
|
||||
if(letter >= 0x20 &&
|
||||
letter != 0xf8ff && /*LV_SYMBOL_DUMMY*/
|
||||
letter != 0x200c) { /*ZERO WIDTH NON-JOINER*/
|
||||
letter != 0xf8ff && /*LV_SYMBOL_DUMMY*/
|
||||
letter != 0x200c) { /*ZERO WIDTH NON-JOINER*/
|
||||
LV_LOG_WARN("lv_draw_letter: glyph dsc. not found for U+%X", letter);
|
||||
}
|
||||
return;
|
||||
@ -448,11 +448,12 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_letter(const lv_point_t * pos_p, const lv_are
|
||||
|
||||
if(font_p->subpx) {
|
||||
#if LV_DRAW_COMPLEX && LV_USE_FONT_SUBPX
|
||||
draw_letter_subpx(pos_x, pos_y, &g, clip_area, map_p, color, opa, blend_mode);
|
||||
draw_letter_subpx(pos_x, pos_y, &g, clip_area, map_p, color, opa, blend_mode);
|
||||
#else
|
||||
LV_LOG_WARN("Can't draw sub-pixel rendered letter because LV_USE_FONT_SUBPX == 0 in lv_conf.h");
|
||||
LV_LOG_WARN("Can't draw sub-pixel rendered letter because LV_USE_FONT_SUBPX == 0 in lv_conf.h");
|
||||
#endif
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
draw_letter_normal(pos_x, pos_y, &g, clip_area, map_p, color, opa, blend_mode);
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +182,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_hor(const lv_point_t * point1, const
|
||||
int32_t h;
|
||||
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h, draw_area_w);
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h,
|
||||
draw_area_w);
|
||||
|
||||
if(dashed) {
|
||||
if(mask_res != LV_DRAW_MASK_RES_TRANSP) {
|
||||
@ -285,7 +286,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_line_ver(const lv_point_t * point1, const
|
||||
int32_t h;
|
||||
for(h = draw_area.y1; h <= draw_area.y2; h++) {
|
||||
lv_memset_ff(mask_buf, draw_area_w);
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h, draw_area_w);
|
||||
lv_draw_mask_res_t mask_res = lv_draw_mask_apply(mask_buf, draw_buf->area.x1 + draw_area.x1, draw_buf->area.y1 + h,
|
||||
draw_area_w);
|
||||
|
||||
if(dashed) {
|
||||
if(mask_res != LV_DRAW_MASK_RES_TRANSP) {
|
||||
|
@ -53,7 +53,8 @@ static void circ_init(lv_point_t * c, lv_coord_t * tmp, lv_coord_t radius);
|
||||
static bool circ_cont(lv_point_t * c);
|
||||
static void circ_next(lv_point_t * c, lv_coord_t * tmp);
|
||||
static void circ_calc_aa4(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t radius);
|
||||
static lv_opa_t * get_next_line(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t y, lv_coord_t * len, lv_coord_t * x_start);
|
||||
static lv_opa_t * get_next_line(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t y, lv_coord_t * len,
|
||||
lv_coord_t * x_start);
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_opa_t mask_mix(lv_opa_t mask_act, lv_opa_t mask_new);
|
||||
|
||||
/**********************
|
||||
@ -179,7 +180,8 @@ void lv_draw_mask_free_param(void * p)
|
||||
if(radius_p->circle->life < 0) {
|
||||
lv_mem_free(radius_p->circle->cir_opa);
|
||||
lv_mem_free(radius_p->circle);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
radius_p->circle->used_cnt--;
|
||||
}
|
||||
}
|
||||
@ -227,7 +229,8 @@ bool lv_draw_mask_is_any(const lv_area_t * a)
|
||||
else {
|
||||
if(!_lv_area_is_in(a, &radius_param->cfg.rect, radius_param->cfg.radius)) return true;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -476,7 +479,8 @@ void lv_draw_mask_radius_init(lv_draw_mask_radius_param_t * param, const lv_area
|
||||
LV_ASSERT_MALLOC(entry);
|
||||
lv_memset_00(entry, sizeof(_lv_draw_mask_radius_circle_dsc_t));
|
||||
entry->life = -1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
entry->used_cnt++;
|
||||
entry->life = 0;
|
||||
CIRCLE_CACHE_AGING(entry->life, radius);
|
||||
@ -1035,13 +1039,13 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
}
|
||||
return LV_DRAW_MASK_RES_CHANGED;
|
||||
}
|
||||
// printf("exec: x:%d.. %d, y:%d: r:%d, %s\n", abs_x, abs_x + len - 1, abs_y, p->cfg.radius, p->cfg.outer ? "inv" : "norm");
|
||||
// printf("exec: x:%d.. %d, y:%d: r:%d, %s\n", abs_x, abs_x + len - 1, abs_y, p->cfg.radius, p->cfg.outer ? "inv" : "norm");
|
||||
|
||||
|
||||
// if( abs_x == 276 && abs_x + len - 1 == 479 && abs_y == 63 && p->cfg.radius == 5 && p->cfg.outer == 1) {
|
||||
// char x = 0;
|
||||
// }
|
||||
//exec: x:276.. 479, y:63: r:5, inv)
|
||||
// if( abs_x == 276 && abs_x + len - 1 == 479 && abs_y == 63 && p->cfg.radius == 5 && p->cfg.outer == 1) {
|
||||
// char x = 0;
|
||||
// }
|
||||
//exec: x:276.. 479, y:63: r:5, inv)
|
||||
|
||||
int32_t k = rect.x1 - abs_x; /*First relevant coordinate on the of the mask*/
|
||||
int32_t w = lv_area_get_width(&rect);
|
||||
@ -1054,7 +1058,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
lv_coord_t cir_y;
|
||||
if(abs_y < radius) {
|
||||
cir_y = radius - abs_y - 1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
cir_y = abs_y - (h - radius);
|
||||
}
|
||||
lv_opa_t * aa_opa = get_next_line(p->circle, cir_y, &aa_len, &x_start);
|
||||
@ -1080,7 +1085,8 @@ LV_ATTRIBUTE_FAST_MEM static lv_draw_mask_res_t lv_draw_mask_radius(lv_opa_t * m
|
||||
/*Clean the left side*/
|
||||
cir_x_left = LV_CLAMP(0, cir_x_left - aa_len + 1, len);
|
||||
lv_memset_00(&mask_buf[0], cir_x_left);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
for(i = 0; i < aa_len; i++) {
|
||||
lv_opa_t opa = 255 - (aa_opa[aa_len - 1 - i]);
|
||||
if(cir_x_right + i >= 0 && cir_x_right + i < len) {
|
||||
@ -1212,7 +1218,8 @@ static void circ_next(lv_point_t * c, lv_coord_t * tmp)
|
||||
|
||||
if(*tmp <= 0) {
|
||||
(*tmp) += 2 * c->y + 3; /*Change in decision criterion for y -> y+1*/
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
(*tmp) += 2 * (c->y - c->x) + 5; /*Change for y -> y+1, x -> x-1*/
|
||||
c->x--;
|
||||
}
|
||||
@ -1230,8 +1237,8 @@ static void circ_calc_aa4(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t radi
|
||||
c->buf = lv_mem_alloc(radius * 6 + 6); /*Use uint16_t for opa_start_on_y and x_start_on_y*/
|
||||
LV_ASSERT_MALLOC(c->buf);
|
||||
c->cir_opa = c->buf;
|
||||
c->opa_start_on_y = (uint16_t *) (c->buf + 2 * radius + 2);
|
||||
c->x_start_on_y = (uint16_t *) (c->buf + 4 * radius + 4);
|
||||
c->opa_start_on_y = (uint16_t *)(c->buf + 2 * radius + 2);
|
||||
c->x_start_on_y = (uint16_t *)(c->buf + 4 * radius + 4);
|
||||
|
||||
/*Special case, handle manually*/
|
||||
if(radius == 1) {
|
||||
@ -1325,12 +1332,13 @@ static void circ_calc_aa4(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t radi
|
||||
/*The point on the 1/8 circle is special, calculate it manually*/
|
||||
int32_t mid = radius * 723;
|
||||
int32_t mid_int = mid >> 10;
|
||||
if(cir_x[cir_size-1] != mid_int || cir_y[cir_size-1] != mid_int) {
|
||||
if(cir_x[cir_size - 1] != mid_int || cir_y[cir_size - 1] != mid_int) {
|
||||
int32_t tmp_val = mid - (mid_int << 10);
|
||||
if(tmp_val <= 512) {
|
||||
tmp_val = tmp_val * tmp_val * 2;
|
||||
tmp_val = tmp_val >> (10 + 6);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
tmp_val = 1024 - tmp_val;
|
||||
tmp_val = tmp_val * tmp_val * 2;
|
||||
tmp_val = tmp_val >> (10 + 6);
|
||||
@ -1366,7 +1374,8 @@ static void circ_calc_aa4(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t radi
|
||||
lv_mem_buf_release(cir_x);
|
||||
}
|
||||
|
||||
static lv_opa_t * get_next_line(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t y, lv_coord_t * len, lv_coord_t * x_start)
|
||||
static lv_opa_t * get_next_line(_lv_draw_mask_radius_circle_dsc_t * c, lv_coord_t y, lv_coord_t * len,
|
||||
lv_coord_t * x_start)
|
||||
{
|
||||
*len = c->opa_start_on_y[y + 1] - c->opa_start_on_y[y];
|
||||
*x_start = c->x_start_on_y[y];
|
||||
|
@ -31,7 +31,7 @@
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_area_t * clip_area,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_bg_img(const lv_area_t * coords, const lv_area_t * clip,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_border(const lv_area_t * coords, const lv_area_t * clip,
|
||||
const lv_draw_rect_dsc_t * dsc);
|
||||
|
||||
@ -49,10 +49,10 @@ void draw_border_generic(const lv_area_t * clip_area, const lv_area_t * outer_ar
|
||||
lv_coord_t rout, lv_coord_t rin, lv_color_t color, lv_opa_t opa, lv_blend_mode_t blend_mode);
|
||||
|
||||
static void draw_border_simple(const lv_area_t * clip, const lv_area_t * outer_area, const lv_area_t * inner_area,
|
||||
lv_color_t color, lv_opa_t opa);
|
||||
lv_color_t color, lv_opa_t opa);
|
||||
|
||||
#if LV_DRAW_COMPLEX
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(const lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
|
||||
LV_ATTRIBUTE_FAST_MEM static inline lv_color_t grad_get(const lv_draw_rect_dsc_t * dsc, lv_coord_t s, lv_coord_t i);
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
@ -283,7 +283,7 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg(const lv_area_t * coords, const lv_are
|
||||
blend_area.y1 = h;
|
||||
blend_area.y2 = h;
|
||||
if(grad_dir == LV_GRAD_DIR_NONE) {
|
||||
_lv_blend_fill(clip_area, &blend_area, dsc->bg_color, mask_buf, mask_res, opa, dsc->blend_mode);
|
||||
_lv_blend_fill(clip_area, &blend_area, dsc->bg_color, mask_buf, mask_res, opa, dsc->blend_mode);
|
||||
}
|
||||
else if(grad_dir == LV_GRAD_DIR_HOR) {
|
||||
_lv_blend_map(clip_area, &blend_area, grad_map, mask_buf, mask_res, opa, dsc->blend_mode);
|
||||
@ -308,7 +308,7 @@ bg_clean_up:
|
||||
}
|
||||
|
||||
LV_ATTRIBUTE_FAST_MEM static void draw_bg_img(const lv_area_t * coords, const lv_area_t * clip,
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
const lv_draw_rect_dsc_t * dsc)
|
||||
{
|
||||
if(dsc->bg_img_src == NULL) return;
|
||||
if(dsc->bg_img_opa <= LV_OPA_MIN) return;
|
||||
@ -354,7 +354,8 @@ LV_ATTRIBUTE_FAST_MEM static void draw_bg_img(const lv_area_t * coords, const lv
|
||||
area.y2 = area.y1 + header.h - 1;
|
||||
|
||||
lv_draw_img(&area, clip, dsc->bg_img_src, &img_dsc);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_area_t area;
|
||||
area.y1 = coords->y1;
|
||||
area.y2 = area.y1 + header.h - 1;
|
||||
@ -621,9 +622,11 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
mask_res = lv_draw_mask_apply(mask_buf, clip_area_sub.x1, y, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
_lv_blend_fill(&clip_area_sub, &blend_area, dsc->shadow_color, mask_buf, mask_res, dsc->shadow_opa, dsc->blend_mode);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_opa_t line_opa = opa == LV_OPA_COVER ? sh_buf_tmp[0] : (sh_buf_tmp[0] * dsc->shadow_opa) >> 8;
|
||||
_lv_blend_fill(&clip_area_sub, &blend_area, dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, line_opa, dsc->blend_mode);
|
||||
_lv_blend_fill(&clip_area_sub, &blend_area, dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, line_opa,
|
||||
dsc->blend_mode);
|
||||
}
|
||||
sh_buf_tmp += corner_size;
|
||||
}
|
||||
@ -655,9 +658,11 @@ LV_ATTRIBUTE_FAST_MEM static void draw_shadow(const lv_area_t * coords, const lv
|
||||
mask_res = lv_draw_mask_apply(mask_buf, clip_area_sub.x1, y, w);
|
||||
if(mask_res == LV_DRAW_MASK_RES_FULL_COVER) mask_res = LV_DRAW_MASK_RES_CHANGED;
|
||||
_lv_blend_fill(&clip_area_sub, &blend_area, dsc->shadow_color, mask_buf, mask_res, dsc->shadow_opa, dsc->blend_mode);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_opa_t line_opa = opa == LV_OPA_COVER ? sh_buf_tmp[0] : (sh_buf_tmp[0] * dsc->shadow_opa) >> 8;
|
||||
_lv_blend_fill(&clip_area_sub, &blend_area, dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, line_opa, dsc->blend_mode);
|
||||
_lv_blend_fill(&clip_area_sub, &blend_area, dsc->shadow_color, NULL, LV_DRAW_MASK_RES_FULL_COVER, line_opa,
|
||||
dsc->blend_mode);
|
||||
|
||||
}
|
||||
sh_buf_tmp += corner_size;
|
||||
@ -1145,8 +1150,7 @@ void draw_border_generic(const lv_area_t * clip_area, const lv_area_t * outer_ar
|
||||
|
||||
bool split_hor = true;
|
||||
if(left_side && right_side && top_side && bottom_side &&
|
||||
core_w < SPLIT_LIMIT)
|
||||
{
|
||||
core_w < SPLIT_LIMIT) {
|
||||
split_hor = false;
|
||||
}
|
||||
|
||||
@ -1212,7 +1216,8 @@ void draw_border_generic(const lv_area_t * clip_area, const lv_area_t * outer_ar
|
||||
_lv_blend_fill(clip_area, &blend_area, color, mask_buf, mask_res, opa, blend_mode);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/*Left corners*/
|
||||
blend_area.x1 = draw_area.x1;
|
||||
blend_area.x2 = LV_MIN(draw_area.x2, core_area.x1 - 1);
|
||||
@ -1283,7 +1288,7 @@ void draw_border_generic(const lv_area_t * clip_area, const lv_area_t * outer_ar
|
||||
}
|
||||
|
||||
static void draw_border_simple(const lv_area_t * clip, const lv_area_t * outer_area, const lv_area_t * inner_area,
|
||||
lv_color_t color, lv_opa_t opa)
|
||||
lv_color_t color, lv_opa_t opa)
|
||||
{
|
||||
bool top_side = outer_area->y1 <= inner_area->y1 ? true : false;
|
||||
bool bottom_side = outer_area->y2 >= inner_area->y2 ? true : false;
|
||||
|
@ -37,7 +37,7 @@ typedef struct {
|
||||
uint8_t bg_main_color_stop;
|
||||
uint8_t bg_grad_color_stop;
|
||||
lv_opa_t bg_opa;
|
||||
lv_grad_dir_t bg_grad_dir :3;
|
||||
lv_grad_dir_t bg_grad_dir : 3;
|
||||
|
||||
/*Background img*/
|
||||
const void * bg_img_src;
|
||||
@ -52,7 +52,7 @@ typedef struct {
|
||||
lv_coord_t border_width;
|
||||
lv_opa_t border_opa;
|
||||
uint8_t border_post : 1; /*There is a border it will be drawn later.*/
|
||||
lv_border_side_t border_side :5;
|
||||
lv_border_side_t border_side : 5;
|
||||
|
||||
/*Outline*/
|
||||
lv_color_t outline_color;
|
||||
|
@ -367,7 +367,7 @@ void lv_img_buf_free(lv_img_dsc_t * dsc)
|
||||
{
|
||||
if(dsc != NULL) {
|
||||
if(dsc->data != NULL)
|
||||
lv_mem_free((void*)dsc->data);
|
||||
lv_mem_free((void *)dsc->data);
|
||||
|
||||
lv_mem_free(dsc);
|
||||
}
|
||||
@ -710,7 +710,7 @@ bool _lv_img_buf_transform_anti_alias(lv_img_transform_dsc_t * dsc)
|
||||
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));
|
||||
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];
|
||||
a01 = src_u8[dsc->tmp.pxi + dsc->cfg.src_w * dsc->tmp.px_size * yn + dsc->tmp.px_size - 1];
|
||||
|
@ -159,7 +159,7 @@ lv_res_t lv_img_decoder_open(lv_img_decoder_dsc_t * dsc, const void * src, lv_co
|
||||
}
|
||||
|
||||
if(dsc->src_type == LV_IMG_SRC_FILE)
|
||||
lv_mem_free((void*)dsc->src);
|
||||
lv_mem_free((void *)dsc->src);
|
||||
|
||||
return res;
|
||||
}
|
||||
@ -191,7 +191,7 @@ void lv_img_decoder_close(lv_img_decoder_dsc_t * dsc)
|
||||
if(dsc->decoder->close_cb) dsc->decoder->close_cb(dsc->decoder, dsc);
|
||||
|
||||
if(dsc->src_type == LV_IMG_SRC_FILE) {
|
||||
lv_mem_free((void*)dsc->src);
|
||||
lv_mem_free((void *)dsc->src);
|
||||
dsc->src = NULL;
|
||||
}
|
||||
}
|
||||
@ -594,7 +594,7 @@ static lv_res_t lv_img_decoder_built_in_line_alpha(lv_img_decoder_dsc_t * dsc, l
|
||||
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
uint8_t * fs_buf = lv_mem_buf_get(w);
|
||||
if (fs_buf == NULL) return LV_RES_INV;
|
||||
if(fs_buf == NULL) return LV_RES_INV;
|
||||
|
||||
const uint8_t * data_tmp = NULL;
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
@ -663,7 +663,7 @@ static lv_res_t lv_img_decoder_built_in_line_indexed(lv_img_decoder_dsc_t * dsc,
|
||||
lv_img_decoder_built_in_data_t * user_data = dsc->user_data;
|
||||
|
||||
uint8_t * fs_buf = lv_mem_buf_get(w);
|
||||
if (fs_buf == NULL) return LV_RES_INV;
|
||||
if(fs_buf == NULL) return LV_RES_INV;
|
||||
const uint8_t * data_tmp = NULL;
|
||||
if(dsc->src_type == LV_IMG_SRC_VARIABLE) {
|
||||
const lv_img_dsc_t * img_dsc = dsc->src;
|
||||
|
@ -21,10 +21,10 @@ typedef struct {
|
||||
lv_flex_align_t main_place;
|
||||
lv_flex_align_t cross_place;
|
||||
lv_flex_align_t track_place;
|
||||
uint8_t row :1;
|
||||
uint8_t wrap :1;
|
||||
uint8_t rev :1;
|
||||
}flex_t;
|
||||
uint8_t row : 1;
|
||||
uint8_t wrap : 1;
|
||||
uint8_t rev : 1;
|
||||
} flex_t;
|
||||
|
||||
typedef struct {
|
||||
lv_obj_t * item;
|
||||
@ -32,8 +32,8 @@ typedef struct {
|
||||
lv_coord_t max_size;
|
||||
lv_coord_t final_size;
|
||||
uint32_t grow_value;
|
||||
uint32_t clamped :1;
|
||||
}grow_dsc_t;
|
||||
uint32_t clamped : 1;
|
||||
} grow_dsc_t;
|
||||
|
||||
typedef struct {
|
||||
lv_coord_t track_cross_size;
|
||||
@ -42,8 +42,8 @@ typedef struct {
|
||||
uint32_t item_cnt;
|
||||
grow_dsc_t * grow_dsc;
|
||||
uint32_t grow_item_cnt;
|
||||
uint32_t grow_dsc_calc :1;
|
||||
}track_t;
|
||||
uint32_t grow_dsc_calc : 1;
|
||||
} track_t;
|
||||
|
||||
|
||||
/**********************
|
||||
@ -54,9 +54,12 @@ typedef struct {
|
||||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
static void flex_update(lv_obj_t * cont, void * user_data);
|
||||
static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id, lv_coord_t item_gap, lv_coord_t max_main_size, track_t * t);
|
||||
static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, int32_t item_last_id, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t max_main_size, lv_coord_t item_gap, track_t * t);
|
||||
static void place_content(lv_flex_align_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt, lv_coord_t * start_pos, lv_coord_t * gap);
|
||||
static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id, lv_coord_t item_gap,
|
||||
lv_coord_t max_main_size, track_t * t);
|
||||
static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, int32_t item_last_id, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t max_main_size, lv_coord_t item_gap, track_t * t);
|
||||
static void place_content(lv_flex_align_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt,
|
||||
lv_coord_t * start_pos, lv_coord_t * gap);
|
||||
static lv_obj_t * get_next_item(lv_obj_t * cont, bool rev, int32_t * item_id);
|
||||
|
||||
/**********************
|
||||
@ -102,7 +105,8 @@ void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow)
|
||||
lv_obj_set_style_layout(obj, LV_LAYOUT_FLEX, 0);
|
||||
}
|
||||
|
||||
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place, lv_flex_align_t track_place)
|
||||
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place,
|
||||
lv_flex_align_t track_place)
|
||||
{
|
||||
lv_obj_set_style_flex_main_place(obj, main_place, 0);
|
||||
lv_obj_set_style_flex_cross_place(obj, cross_place, 0);
|
||||
@ -152,7 +156,7 @@ void lv_style_set_flex_track_place(lv_style_t * style, lv_flex_align_t value)
|
||||
void lv_style_set_flex_grow(lv_style_t * style, uint8_t value)
|
||||
{
|
||||
lv_style_value_t v = {
|
||||
.num = (int32_t)value
|
||||
.num = (int32_t)value
|
||||
};
|
||||
lv_style_set_prop(style, LV_STYLE_FLEX_GROW, v);
|
||||
}
|
||||
@ -217,12 +221,16 @@ static void flex_update(lv_obj_t * cont, void * user_data)
|
||||
f.track_place = lv_obj_get_style_flex_track_place(cont, LV_PART_MAIN);
|
||||
|
||||
bool rtl = lv_obj_get_style_base_dir(cont, LV_PART_MAIN) == LV_BASE_DIR_RTL ? true : false;
|
||||
lv_coord_t track_gap = !f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont, LV_PART_MAIN);
|
||||
lv_coord_t item_gap = f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont, LV_PART_MAIN);
|
||||
lv_coord_t track_gap = !f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont,
|
||||
LV_PART_MAIN);
|
||||
lv_coord_t item_gap = f.row ? lv_obj_get_style_pad_column(cont, LV_PART_MAIN) : lv_obj_get_style_pad_row(cont,
|
||||
LV_PART_MAIN);
|
||||
lv_coord_t max_main_size = (f.row ? lv_obj_get_content_width(cont) : lv_obj_get_content_height(cont));
|
||||
lv_coord_t border_widt = lv_obj_get_style_border_width(cont, LV_PART_MAIN);
|
||||
lv_coord_t abs_y = cont->coords.y1 + lv_obj_get_style_pad_top(cont, LV_PART_MAIN) + border_widt - lv_obj_get_scroll_y(cont);
|
||||
lv_coord_t abs_x = cont->coords.x1 + lv_obj_get_style_pad_left(cont, LV_PART_MAIN) + border_widt - lv_obj_get_scroll_x(cont);
|
||||
lv_coord_t abs_y = cont->coords.y1 + lv_obj_get_style_pad_top(cont,
|
||||
LV_PART_MAIN) + border_widt - lv_obj_get_scroll_y(cont);
|
||||
lv_coord_t abs_x = cont->coords.x1 + lv_obj_get_style_pad_left(cont,
|
||||
LV_PART_MAIN) + border_widt - lv_obj_get_scroll_x(cont);
|
||||
|
||||
lv_flex_align_t track_cross_place = f.track_place;
|
||||
lv_coord_t * cross_pos = (f.row ? &abs_y : &abs_x);
|
||||
@ -232,8 +240,7 @@ static void flex_update(lv_obj_t * cont, void * user_data)
|
||||
|
||||
/*Content sized objects should squeezed the gap between the children, therefore any alignment will look like `START`*/
|
||||
if((f.row && h_set == LV_SIZE_CONTENT && cont->h_layout == 0) ||
|
||||
(!f.row && w_set == LV_SIZE_CONTENT && cont->w_layout == 0))
|
||||
{
|
||||
(!f.row && w_set == LV_SIZE_CONTENT && cont->w_layout == 0)) {
|
||||
track_cross_place = LV_FLEX_ALIGN_START;
|
||||
}
|
||||
|
||||
@ -270,7 +277,7 @@ static void flex_update(lv_obj_t * cont, void * user_data)
|
||||
track_first_item = f.rev ? cont->spec_attr->child_cnt - 1 : 0;
|
||||
|
||||
if(rtl && !f.row) {
|
||||
*cross_pos += total_track_cross_size;
|
||||
*cross_pos += total_track_cross_size;
|
||||
}
|
||||
|
||||
while(track_first_item < (int32_t)cont->spec_attr->child_cnt && track_first_item >= 0) {
|
||||
@ -288,7 +295,8 @@ static void flex_update(lv_obj_t * cont, void * user_data)
|
||||
t.grow_dsc = NULL;
|
||||
if(rtl && !f.row) {
|
||||
*cross_pos -= gap + track_gap;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
*cross_pos += t.track_cross_size + gap + track_gap;
|
||||
}
|
||||
}
|
||||
@ -306,7 +314,8 @@ static void flex_update(lv_obj_t * cont, void * user_data)
|
||||
/**
|
||||
* Find the last item of a track
|
||||
*/
|
||||
static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id, lv_coord_t max_main_size, lv_coord_t item_gap, track_t * t)
|
||||
static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id, lv_coord_t max_main_size,
|
||||
lv_coord_t item_gap, track_t * t)
|
||||
{
|
||||
lv_coord_t w_set = lv_obj_get_style_width(cont, LV_PART_MAIN);
|
||||
lv_coord_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN);
|
||||
@ -348,13 +357,16 @@ static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id
|
||||
lv_mem_buf_release(t->grow_dsc);
|
||||
}
|
||||
new_dsc[t->grow_item_cnt - 1].item = item;
|
||||
new_dsc[t->grow_item_cnt - 1].min_size = f->row ? lv_obj_get_style_min_width(item, LV_PART_MAIN) : lv_obj_get_style_min_height(item, LV_PART_MAIN);
|
||||
new_dsc[t->grow_item_cnt - 1].max_size = f->row ? lv_obj_get_style_max_width(item, LV_PART_MAIN) : lv_obj_get_style_max_height(item, LV_PART_MAIN);
|
||||
new_dsc[t->grow_item_cnt - 1].min_size = f->row ? lv_obj_get_style_min_width(item,
|
||||
LV_PART_MAIN) : lv_obj_get_style_min_height(item, LV_PART_MAIN);
|
||||
new_dsc[t->grow_item_cnt - 1].max_size = f->row ? lv_obj_get_style_max_width(item,
|
||||
LV_PART_MAIN) : lv_obj_get_style_max_height(item, LV_PART_MAIN);
|
||||
new_dsc[t->grow_item_cnt - 1].grow_value = grow_value;
|
||||
new_dsc[t->grow_item_cnt - 1].clamped = 0;
|
||||
t->grow_dsc = new_dsc;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_coord_t item_size = get_main_size(item);
|
||||
if(f->wrap && t->track_fix_main_size + item_size > max_main_size) break;
|
||||
t->track_fix_main_size += item_size + item_gap;
|
||||
@ -392,7 +404,8 @@ static int32_t find_track_end(lv_obj_t * cont, flex_t * f, int32_t item_start_id
|
||||
/**
|
||||
* Position the children in the same track
|
||||
*/
|
||||
static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, int32_t item_last_id, lv_coord_t abs_x, lv_coord_t abs_y, lv_coord_t max_main_size, lv_coord_t item_gap, track_t * t)
|
||||
static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, int32_t item_last_id, lv_coord_t abs_x,
|
||||
lv_coord_t abs_y, lv_coord_t max_main_size, lv_coord_t item_gap, track_t * t)
|
||||
{
|
||||
void (*area_set_main_size)(lv_area_t *, lv_coord_t) = (f->row ? lv_area_set_width : lv_area_set_height);
|
||||
lv_coord_t (*area_get_main_size)(const lv_area_t *) = (f->row ? lv_area_get_width : lv_area_get_height);
|
||||
@ -408,7 +421,8 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i
|
||||
for(i = 0; i < t->grow_item_cnt; i++) {
|
||||
if(t->grow_dsc[i].clamped == 0) {
|
||||
grow_value_sum += t->grow_dsc[i].grow_value;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
grow_max_size -= t->grow_dsc[i].final_size;
|
||||
}
|
||||
}
|
||||
@ -470,23 +484,24 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i
|
||||
lv_event_send(lv_obj_get_parent(item), LV_EVENT_CHILD_CHANGED, item);
|
||||
lv_obj_invalidate(item);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
item->w_layout = 0;
|
||||
item->h_layout = 0;
|
||||
}
|
||||
|
||||
lv_coord_t cross_pos = 0;
|
||||
switch(f->cross_place) {
|
||||
case LV_FLEX_ALIGN_CENTER:
|
||||
/*Round up the cross size to avoid rounding error when dividing by 2
|
||||
*The issue comes up e,g, with column direction with center cross direction if an element's width changes*/
|
||||
cross_pos = (((t->track_cross_size + 1) & (~1)) - area_get_cross_size(&item->coords)) / 2;
|
||||
break;
|
||||
case LV_FLEX_ALIGN_END:
|
||||
cross_pos = t->track_cross_size - area_get_cross_size(&item->coords);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case LV_FLEX_ALIGN_CENTER:
|
||||
/*Round up the cross size to avoid rounding error when dividing by 2
|
||||
*The issue comes up e,g, with column direction with center cross direction if an element's width changes*/
|
||||
cross_pos = (((t->track_cross_size + 1) & (~1)) - area_get_cross_size(&item->coords)) / 2;
|
||||
break;
|
||||
case LV_FLEX_ALIGN_END:
|
||||
cross_pos = t->track_cross_size - area_get_cross_size(&item->coords);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if(f->row && rtl) main_pos -= area_get_main_size(&item->coords);
|
||||
@ -525,7 +540,8 @@ static void children_repos(lv_obj_t * cont, flex_t * f, int32_t item_first_id, i
|
||||
/**
|
||||
* Tell a start coordinate and gap for a placement type.
|
||||
*/
|
||||
static void place_content(lv_flex_align_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt, lv_coord_t * start_pos, lv_coord_t * gap)
|
||||
static void place_content(lv_flex_align_t place, lv_coord_t max_size, lv_coord_t content_size, lv_coord_t item_cnt,
|
||||
lv_coord_t * start_pos, lv_coord_t * gap)
|
||||
{
|
||||
if(item_cnt <= 1) {
|
||||
switch(place) {
|
||||
@ -540,27 +556,27 @@ static void place_content(lv_flex_align_t place, lv_coord_t max_size, lv_coord_t
|
||||
}
|
||||
|
||||
switch(place) {
|
||||
case LV_FLEX_ALIGN_CENTER:
|
||||
*gap = 0;
|
||||
*start_pos += (max_size - content_size) / 2;
|
||||
break;
|
||||
case LV_FLEX_ALIGN_END:
|
||||
*gap = 0;
|
||||
*start_pos += max_size - content_size;
|
||||
break;
|
||||
case LV_FLEX_ALIGN_SPACE_BETWEEN:
|
||||
*gap = (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt - 1);
|
||||
break;
|
||||
case LV_FLEX_ALIGN_SPACE_AROUND:
|
||||
*gap += (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt);
|
||||
*start_pos += *gap / 2;
|
||||
break;
|
||||
case LV_FLEX_ALIGN_SPACE_EVENLY:
|
||||
*gap = (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt + 1);
|
||||
*start_pos += *gap;
|
||||
break;
|
||||
default:
|
||||
*gap = 0;
|
||||
case LV_FLEX_ALIGN_CENTER:
|
||||
*gap = 0;
|
||||
*start_pos += (max_size - content_size) / 2;
|
||||
break;
|
||||
case LV_FLEX_ALIGN_END:
|
||||
*gap = 0;
|
||||
*start_pos += max_size - content_size;
|
||||
break;
|
||||
case LV_FLEX_ALIGN_SPACE_BETWEEN:
|
||||
*gap = (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt - 1);
|
||||
break;
|
||||
case LV_FLEX_ALIGN_SPACE_AROUND:
|
||||
*gap += (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt);
|
||||
*start_pos += *gap / 2;
|
||||
break;
|
||||
case LV_FLEX_ALIGN_SPACE_EVENLY:
|
||||
*gap = (lv_coord_t)(max_size - content_size) / (lv_coord_t)(item_cnt + 1);
|
||||
*start_pos += *gap;
|
||||
break;
|
||||
default:
|
||||
*gap = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -570,7 +586,8 @@ static lv_obj_t * get_next_item(lv_obj_t * cont, bool rev, int32_t * item_id)
|
||||
(*item_id)--;
|
||||
if(*item_id >= 0) return cont->spec_attr->children[*item_id];
|
||||
else return NULL;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
(*item_id)++;
|
||||
if((*item_id) < (int32_t)cont->spec_attr->child_cnt) return cont->spec_attr->children[*item_id];
|
||||
else return NULL;
|
||||
|
@ -41,7 +41,7 @@ typedef enum {
|
||||
LV_FLEX_ALIGN_SPACE_EVENLY,
|
||||
LV_FLEX_ALIGN_SPACE_AROUND,
|
||||
LV_FLEX_ALIGN_SPACE_BETWEEN,
|
||||
}lv_flex_align_t;
|
||||
} lv_flex_align_t;
|
||||
|
||||
typedef enum {
|
||||
LV_FLEX_FLOW_ROW = 0x00,
|
||||
@ -52,7 +52,7 @@ typedef enum {
|
||||
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;
|
||||
} lv_flex_flow_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
@ -88,7 +88,8 @@ void lv_obj_set_flex_flow(lv_obj_t * obj, lv_flex_flow_t flow);
|
||||
* @param cross_place where to place the item in their track on the cross axis. `LV_FLEX_ALIGN_START/END/CENTER`
|
||||
* @param track_place where to place the tracks in the cross direction. Any value of `lv_flex_align_t`.
|
||||
*/
|
||||
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place, lv_flex_align_t track_cross_place);
|
||||
void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_align_t cross_place,
|
||||
lv_flex_align_t track_cross_place);
|
||||
|
||||
/**
|
||||
* Sets the width or height (on main axis) to grow the object in order fill the free space
|
||||
|
@ -27,7 +27,7 @@ typedef struct {
|
||||
uint32_t col;
|
||||
uint32_t row;
|
||||
lv_point_t grid_abs;
|
||||
}item_repos_hint_t;
|
||||
} item_repos_hint_t;
|
||||
|
||||
typedef struct {
|
||||
lv_coord_t * x;
|
||||
@ -38,7 +38,7 @@ typedef struct {
|
||||
uint32_t row_num;
|
||||
lv_coord_t grid_w;
|
||||
lv_coord_t grid_h;
|
||||
}_lv_grid_calc_t;
|
||||
} _lv_grid_calc_t;
|
||||
|
||||
|
||||
/**********************
|
||||
@ -54,19 +54,50 @@ static void calc_free(_lv_grid_calc_t * calc);
|
||||
static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c);
|
||||
static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c);
|
||||
static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t * hint);
|
||||
static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, uint8_t align, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse);
|
||||
static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, uint8_t align, lv_coord_t gap, uint32_t track_num,
|
||||
lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse);
|
||||
static uint32_t count_tracks(const lv_coord_t * templ);
|
||||
|
||||
static inline const lv_coord_t * get_col_dsc(lv_obj_t * obj) {return lv_obj_get_style_grid_column_dsc_array(obj, 0); }
|
||||
static inline const lv_coord_t * get_row_dsc(lv_obj_t * obj) {return lv_obj_get_style_grid_row_dsc_array(obj, 0); }
|
||||
static inline uint8_t get_col_pos(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_column_pos(obj, 0); }
|
||||
static inline uint8_t get_row_pos(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_row_pos(obj, 0); }
|
||||
static inline uint8_t get_col_span(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_column_span(obj, 0); }
|
||||
static inline uint8_t get_row_span(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_row_span(obj, 0); }
|
||||
static inline uint8_t get_cell_col_align(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_x_align(obj, 0); }
|
||||
static inline uint8_t get_cell_row_align(lv_obj_t * obj) {return lv_obj_get_style_grid_cell_y_align(obj, 0); }
|
||||
static inline uint8_t get_grid_col_align(lv_obj_t * obj) {return lv_obj_get_style_grid_column_align(obj, 0); }
|
||||
static inline uint8_t get_grid_row_align(lv_obj_t * obj) {return lv_obj_get_style_grid_row_align(obj, 0); }
|
||||
static inline const lv_coord_t * get_col_dsc(lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_grid_column_dsc_array(obj, 0);
|
||||
}
|
||||
static inline const lv_coord_t * get_row_dsc(lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_grid_row_dsc_array(obj, 0);
|
||||
}
|
||||
static inline uint8_t get_col_pos(lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_grid_cell_column_pos(obj, 0);
|
||||
}
|
||||
static inline uint8_t get_row_pos(lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_grid_cell_row_pos(obj, 0);
|
||||
}
|
||||
static inline uint8_t get_col_span(lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_grid_cell_column_span(obj, 0);
|
||||
}
|
||||
static inline uint8_t get_row_span(lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_grid_cell_row_span(obj, 0);
|
||||
}
|
||||
static inline uint8_t get_cell_col_align(lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_grid_cell_x_align(obj, 0);
|
||||
}
|
||||
static inline uint8_t get_cell_row_align(lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_grid_cell_y_align(obj, 0);
|
||||
}
|
||||
static inline uint8_t get_grid_col_align(lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_grid_column_align(obj, 0);
|
||||
}
|
||||
static inline uint8_t get_grid_row_align(lv_obj_t * obj)
|
||||
{
|
||||
return lv_obj_get_style_grid_row_align(obj, 0);
|
||||
}
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
@ -128,7 +159,7 @@ void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid
|
||||
}
|
||||
|
||||
void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t x_align, uint8_t col_pos, uint8_t col_span,
|
||||
lv_grid_align_t y_align, uint8_t row_pos, uint8_t row_span)
|
||||
lv_grid_align_t y_align, uint8_t row_pos, uint8_t row_span)
|
||||
|
||||
{
|
||||
lv_obj_set_style_grid_cell_column_pos(obj, col_pos, 0);
|
||||
@ -228,7 +259,7 @@ void lv_obj_set_style_grid_row_dsc_array(lv_obj_t * obj, const lv_coord_t value[
|
||||
lv_style_value_t v = {
|
||||
.ptr = (const void *)value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj,LV_STYLE_GRID_ROW_DSC_ARRAY, v, selector);
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_ROW_DSC_ARRAY, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_grid_column_dsc_array(lv_obj_t * obj, const lv_coord_t value[], lv_style_selector_t selector)
|
||||
@ -262,7 +293,7 @@ void lv_obj_set_style_grid_cell_column_pos(lv_obj_t * obj, lv_coord_t value, lv_
|
||||
lv_style_value_t v = {
|
||||
.num = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj,LV_STYLE_GRID_CELL_COLUMN_POS, v, selector);
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_COLUMN_POS, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_grid_cell_column_span(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
@ -270,7 +301,7 @@ void lv_obj_set_style_grid_cell_column_span(lv_obj_t * obj, lv_coord_t value, lv
|
||||
lv_style_value_t v = {
|
||||
.num = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj,LV_STYLE_GRID_CELL_COLUMN_SPAN, v, selector);
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_COLUMN_SPAN, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_grid_cell_row_pos(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
@ -278,7 +309,7 @@ void lv_obj_set_style_grid_cell_row_pos(lv_obj_t * obj, lv_coord_t value, lv_sty
|
||||
lv_style_value_t v = {
|
||||
.num = value
|
||||
};
|
||||
lv_obj_set_local_style_prop(obj,LV_STYLE_GRID_CELL_ROW_POS, v, selector);
|
||||
lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_ROW_POS, v, selector);
|
||||
}
|
||||
|
||||
void lv_obj_set_style_grid_cell_row_span(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector)
|
||||
@ -376,11 +407,13 @@ static void calc(lv_obj_t * cont, _lv_grid_calc_t * calc_out)
|
||||
lv_coord_t h_set = lv_obj_get_style_height(cont, LV_PART_MAIN);
|
||||
bool auto_w = (w_set == LV_SIZE_CONTENT && !cont->w_layout) ? true : false;
|
||||
lv_coord_t cont_w = lv_obj_get_content_width(cont);
|
||||
calc_out->grid_w = grid_align(cont_w, auto_w, get_grid_col_align(cont), col_gap, calc_out->col_num, calc_out->w, calc_out->x, rev);
|
||||
calc_out->grid_w = grid_align(cont_w, auto_w, get_grid_col_align(cont), col_gap, calc_out->col_num, calc_out->w,
|
||||
calc_out->x, rev);
|
||||
|
||||
bool auto_h = (h_set == LV_SIZE_CONTENT && !cont->h_layout) ? true : false;
|
||||
lv_coord_t cont_h = lv_obj_get_content_height(cont);
|
||||
calc_out->grid_h = grid_align(cont_h, auto_h, get_grid_row_align(cont), row_gap, calc_out->row_num, calc_out->h, calc_out->y, false);
|
||||
calc_out->grid_h = grid_align(cont_h, auto_h, get_grid_row_align(cont), row_gap, calc_out->row_num, calc_out->h,
|
||||
calc_out->y, false);
|
||||
|
||||
LV_ASSERT_MEM_INTEGRITY();
|
||||
}
|
||||
@ -437,7 +470,7 @@ static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c)
|
||||
if(IS_FR(x)) {
|
||||
col_fr_cnt += GET_FR(x);
|
||||
}
|
||||
else if (IS_CONTENT(x)) {
|
||||
else if(IS_CONTENT(x)) {
|
||||
grid_w += c->w[i];
|
||||
}
|
||||
else {
|
||||
@ -465,7 +498,7 @@ static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c)
|
||||
|
||||
/*To avoid rounding errors set the last FR track to the remaining size */
|
||||
if(last_fr_i >= 0) {
|
||||
c->w[last_fr_i] = free_w - ((free_w * (col_fr_cnt - last_fr_x)) / col_fr_cnt);
|
||||
c->w[last_fr_i] = free_w - ((free_w * (col_fr_cnt - last_fr_x)) / col_fr_cnt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -505,9 +538,11 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c)
|
||||
lv_coord_t x = row_templ[i];
|
||||
if(IS_FR(x)) {
|
||||
row_fr_cnt += GET_FR(x);
|
||||
} else if (IS_CONTENT(x)) {
|
||||
}
|
||||
else if(IS_CONTENT(x)) {
|
||||
grid_h += c->h[i];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
c->h[i] = x;
|
||||
grid_h += x;
|
||||
}
|
||||
@ -531,7 +566,7 @@ static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c)
|
||||
|
||||
/*To avoid rounding errors set the last FR track to the remaining size */
|
||||
if(last_fr_i >= 0) {
|
||||
c->h[last_fr_i] = free_h - ((free_h * (row_fr_cnt - last_fr_x)) / row_fr_cnt);
|
||||
c->h[last_fr_i] = free_h - ((free_h * (row_fr_cnt - last_fr_x)) / row_fr_cnt);
|
||||
}
|
||||
}
|
||||
|
||||
@ -666,14 +701,16 @@ static void item_repos(lv_obj_t * item, _lv_grid_calc_t * c, item_repos_hint_t *
|
||||
* @param pos_array write the positions of the tracks here
|
||||
* @return the total size of the grid
|
||||
*/
|
||||
static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, uint8_t align, lv_coord_t gap, uint32_t track_num, lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse)
|
||||
static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, uint8_t align, lv_coord_t gap, uint32_t track_num,
|
||||
lv_coord_t * size_array, lv_coord_t * pos_array, bool reverse)
|
||||
{
|
||||
lv_coord_t grid_size = 0;
|
||||
uint32_t i;
|
||||
|
||||
if(auto_size) {
|
||||
pos_array[0] = 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/*With spaced alignment gap will be calculated from the remaining space*/
|
||||
if(align == LV_GRID_ALIGN_SPACE_AROUND || align == LV_GRID_ALIGN_SPACE_BETWEEN || align == LV_GRID_ALIGN_SPACE_EVENLY) {
|
||||
gap = 0;
|
||||
@ -688,27 +725,27 @@ static lv_coord_t grid_align(lv_coord_t cont_size, bool auto_size, uint8_t alig
|
||||
|
||||
/*Calculate the position of the first item and set gap is necessary*/
|
||||
switch(align) {
|
||||
case LV_GRID_ALIGN_START:
|
||||
pos_array[0] = 0;
|
||||
break;
|
||||
case LV_GRID_ALIGN_CENTER:
|
||||
pos_array[0] = (cont_size - grid_size) / 2;
|
||||
break;
|
||||
case LV_GRID_ALIGN_END:
|
||||
pos_array[0] = cont_size - grid_size;
|
||||
break;
|
||||
case LV_GRID_ALIGN_SPACE_BETWEEN:
|
||||
pos_array[0] = 0;
|
||||
gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num - 1);
|
||||
break;
|
||||
case LV_GRID_ALIGN_SPACE_AROUND:
|
||||
gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num);
|
||||
pos_array[0] = gap / 2;
|
||||
break;
|
||||
case LV_GRID_ALIGN_SPACE_EVENLY:
|
||||
gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num + 1);
|
||||
pos_array[0] = gap;
|
||||
break;
|
||||
case LV_GRID_ALIGN_START:
|
||||
pos_array[0] = 0;
|
||||
break;
|
||||
case LV_GRID_ALIGN_CENTER:
|
||||
pos_array[0] = (cont_size - grid_size) / 2;
|
||||
break;
|
||||
case LV_GRID_ALIGN_END:
|
||||
pos_array[0] = cont_size - grid_size;
|
||||
break;
|
||||
case LV_GRID_ALIGN_SPACE_BETWEEN:
|
||||
pos_array[0] = 0;
|
||||
gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num - 1);
|
||||
break;
|
||||
case LV_GRID_ALIGN_SPACE_AROUND:
|
||||
gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num);
|
||||
pos_array[0] = gap / 2;
|
||||
break;
|
||||
case LV_GRID_ALIGN_SPACE_EVENLY:
|
||||
gap = (lv_coord_t)(cont_size - grid_size) / (lv_coord_t)(track_num + 1);
|
||||
pos_array[0] = gap;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ typedef enum {
|
||||
LV_GRID_ALIGN_SPACE_EVENLY,
|
||||
LV_GRID_ALIGN_SPACE_AROUND,
|
||||
LV_GRID_ALIGN_SPACE_BETWEEN,
|
||||
}lv_grid_align_t;
|
||||
} lv_grid_align_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL VARIABLES
|
||||
@ -86,7 +86,7 @@ void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid
|
||||
* @param row_span number of rows to take (>= 1)
|
||||
*/
|
||||
void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t column_align, uint8_t col_pos, uint8_t col_span,
|
||||
lv_grid_align_t row_align, uint8_t row_pos, uint8_t row_span);
|
||||
lv_grid_align_t row_align, uint8_t row_pos, uint8_t row_span);
|
||||
|
||||
/**
|
||||
* Just a wrapper to `LV_GRID_FR` for bindings.
|
||||
|
@ -406,8 +406,8 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
||||
|
||||
#if LV_USE_LED
|
||||
else if(lv_obj_check_type(obj, &lv_led_class)) {
|
||||
lv_obj_add_style(obj, &styles->light, 0);
|
||||
}
|
||||
lv_obj_add_style(obj, &styles->light, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -147,14 +147,14 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
lv_theme_t base;
|
||||
uint8_t light :1;
|
||||
}my_theme_t;
|
||||
uint8_t light : 1;
|
||||
} my_theme_t;
|
||||
|
||||
typedef enum {
|
||||
DISP_SMALL = 3,
|
||||
DISP_MEDIUM = 2,
|
||||
DISP_LARGE = 1,
|
||||
}disp_size_t;
|
||||
} disp_size_t;
|
||||
|
||||
/**********************
|
||||
* STATIC PROTOTYPES
|
||||
@ -200,12 +200,12 @@ static lv_color_t grey_filter_cb(const lv_color_filter_dsc_t * f, lv_color_t col
|
||||
static void style_init(void)
|
||||
{
|
||||
static const lv_style_prop_t trans_props[] = {
|
||||
LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR,
|
||||
LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT,
|
||||
LV_STYLE_TRANSLATE_Y, LV_STYLE_TRANSLATE_X,
|
||||
LV_STYLE_TRANSFORM_ZOOM, LV_STYLE_TRANSFORM_ANGLE,
|
||||
LV_STYLE_COLOR_FILTER_OPA, LV_STYLE_COLOR_FILTER_DSC,
|
||||
0
|
||||
LV_STYLE_BG_OPA, LV_STYLE_BG_COLOR,
|
||||
LV_STYLE_TRANSFORM_WIDTH, LV_STYLE_TRANSFORM_HEIGHT,
|
||||
LV_STYLE_TRANSLATE_Y, LV_STYLE_TRANSLATE_X,
|
||||
LV_STYLE_TRANSFORM_ZOOM, LV_STYLE_TRANSFORM_ANGLE,
|
||||
LV_STYLE_COLOR_FILTER_OPA, LV_STYLE_COLOR_FILTER_DSC,
|
||||
0
|
||||
};
|
||||
|
||||
color_scr = theme.flags & MODE_DARK ? DARK_COLOR_SCR : LIGHT_COLOR_SCR;
|
||||
@ -226,7 +226,8 @@ static void style_init(void)
|
||||
lv_style_set_transition(&styles->transition_normal, &trans_normal); /*Go back to default state with delay*/
|
||||
|
||||
style_init_reset(&styles->scrollbar);
|
||||
lv_style_set_bg_color(&styles->scrollbar, (theme.flags & MODE_DARK) ? lv_palette_darken(LV_PALETTE_GREY, 2) : lv_palette_main(LV_PALETTE_GREY));
|
||||
lv_style_set_bg_color(&styles->scrollbar, (theme.flags & MODE_DARK) ? lv_palette_darken(LV_PALETTE_GREY,
|
||||
2) : lv_palette_main(LV_PALETTE_GREY));
|
||||
lv_style_set_radius(&styles->scrollbar, LV_RADIUS_CIRCLE);
|
||||
lv_style_set_pad_right(&styles->scrollbar, lv_disp_dpx(theme.disp, 7));
|
||||
lv_style_set_pad_top(&styles->scrollbar, lv_disp_dpx(theme.disp, 7));
|
||||
@ -270,7 +271,8 @@ static void style_init(void)
|
||||
lv_style_set_outline_opa(&styles->outline_secondary, LV_OPA_50);
|
||||
|
||||
style_init_reset(&styles->btn);
|
||||
lv_style_set_radius(&styles->btn, (disp_size == DISP_LARGE ? lv_disp_dpx(theme.disp, 16) : disp_size == DISP_MEDIUM ? lv_disp_dpx(theme.disp, 12) : lv_disp_dpx(theme.disp, 8)));
|
||||
lv_style_set_radius(&styles->btn, (disp_size == DISP_LARGE ? lv_disp_dpx(theme.disp,
|
||||
16) : disp_size == DISP_MEDIUM ? lv_disp_dpx(theme.disp, 12) : lv_disp_dpx(theme.disp, 8)));
|
||||
lv_style_set_bg_opa(&styles->btn, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&styles->btn, color_grey);
|
||||
if(!(theme.flags & MODE_DARK)) {
|
||||
@ -440,7 +442,7 @@ static void style_init(void)
|
||||
lv_style_set_pad_column(&styles->chart_series, lv_disp_dpx(theme.disp, 2));
|
||||
|
||||
style_init_reset(&styles->chart_indic);
|
||||
lv_style_set_radius(&styles->chart_indic,LV_RADIUS_CIRCLE);
|
||||
lv_style_set_radius(&styles->chart_indic, LV_RADIUS_CIRCLE);
|
||||
lv_style_set_size(&styles->chart_indic, lv_disp_dpx(theme.disp, 8));
|
||||
lv_style_set_bg_color(&styles->chart_indic, theme.color_primary);
|
||||
lv_style_set_bg_opa(&styles->chart_indic, LV_OPA_COVER);
|
||||
@ -470,7 +472,7 @@ static void style_init(void)
|
||||
style_init_reset(&styles->table_cell);
|
||||
lv_style_set_border_width(&styles->table_cell, lv_disp_dpx(theme.disp, 1));
|
||||
lv_style_set_border_color(&styles->table_cell, color_grey);
|
||||
lv_style_set_border_side(&styles->table_cell, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM );
|
||||
lv_style_set_border_side(&styles->table_cell, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM);
|
||||
#endif
|
||||
|
||||
#if LV_USE_TEXTAREA
|
||||
@ -482,7 +484,8 @@ static void style_init(void)
|
||||
lv_style_set_anim_time(&styles->ta_cursor, 400);
|
||||
|
||||
style_init_reset(&styles->ta_placeholder);
|
||||
lv_style_set_text_color(&styles->ta_placeholder, (theme.flags & MODE_DARK) ? lv_palette_darken(LV_PALETTE_GREY, 2) : lv_palette_lighten(LV_PALETTE_GREY, 1));
|
||||
lv_style_set_text_color(&styles->ta_placeholder, (theme.flags & MODE_DARK) ? lv_palette_darken(LV_PALETTE_GREY,
|
||||
2) : lv_palette_lighten(LV_PALETTE_GREY, 1));
|
||||
#endif
|
||||
|
||||
#if LV_USE_CALENDAR
|
||||
@ -562,7 +565,8 @@ static void style_init(void)
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark, const lv_font_t * font)
|
||||
lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark,
|
||||
const lv_font_t * font)
|
||||
{
|
||||
|
||||
/*This trick is required only to avoid the garbage collection of
|
||||
@ -648,7 +652,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
||||
lv_obj_add_style(obj, &styles->scrollbar, LV_PART_SCROLLBAR);
|
||||
lv_obj_add_style(obj, &styles->scrollbar_scrolled, LV_PART_SCROLLBAR | LV_STATE_SCROLLED);
|
||||
}
|
||||
#if LV_USE_BTN
|
||||
#if LV_USE_BTN
|
||||
else if(lv_obj_check_type(obj, &lv_btn_class)) {
|
||||
lv_obj_add_style(obj, &styles->btn, 0);
|
||||
lv_obj_add_style(obj, &styles->bg_color_primary, 0);
|
||||
@ -999,8 +1003,8 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
||||
|
||||
#if LV_USE_LED
|
||||
else if(lv_obj_check_type(obj, &lv_led_class)) {
|
||||
lv_obj_add_style(obj, &styles->led, 0);
|
||||
}
|
||||
lv_obj_add_style(obj, &styles->led, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,8 @@ extern "C" {
|
||||
* @param font pointer to a font to use.
|
||||
* @return a pointer to reference this theme later
|
||||
*/
|
||||
lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark, const lv_font_t * font);
|
||||
lv_theme_t * lv_theme_default_init(lv_disp_t * disp, lv_color_t color_primary, lv_color_t color_secondary, bool dark,
|
||||
const lv_font_t * font);
|
||||
|
||||
|
||||
bool lv_theme_default_is_inited(void);
|
||||
|
@ -78,7 +78,7 @@ static void style_init(bool dark_bg, const lv_font_t * font)
|
||||
{
|
||||
style_init_reset(&styles->scrollbar);
|
||||
lv_style_set_bg_opa(&styles->scrollbar, LV_OPA_COVER);
|
||||
lv_style_set_bg_color(&styles->scrollbar,COLOR_FG);
|
||||
lv_style_set_bg_color(&styles->scrollbar, COLOR_FG);
|
||||
lv_style_set_width(&styles->scrollbar, PAD_DEF);
|
||||
|
||||
style_init_reset(&styles->scr);
|
||||
@ -279,7 +279,7 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
||||
lv_obj_add_style(obj, &styles->inv, LV_PART_ITEMS | LV_STATE_CHECKED);
|
||||
lv_obj_add_style(obj, &styles->disabled, LV_PART_ITEMS | LV_STATE_DISABLED);
|
||||
lv_obj_add_style(obj, &styles->underline, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
|
||||
lv_obj_add_style(obj, &styles->large_border, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
|
||||
lv_obj_add_style(obj, &styles->large_border, LV_PART_ITEMS | LV_STATE_FOCUS_KEY);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -476,8 +476,8 @@ static void theme_apply(lv_theme_t * th, lv_obj_t * obj)
|
||||
|
||||
#if LV_USE_LED
|
||||
else if(lv_obj_check_type(obj, &lv_led_class)) {
|
||||
lv_obj_add_style(obj, &styles->card, 0);
|
||||
}
|
||||
lv_obj_add_style(obj, &styles->card, 0);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ void lv_animimg_set_src(lv_obj_t * obj, lv_img_dsc_t * dsc[], uint8_t num)
|
||||
lv_animimg_t * animimg = (lv_animimg_t *)obj;
|
||||
animimg->dsc = dsc;
|
||||
animimg->pic_count = num;
|
||||
lv_anim_set_values(&animimg->anim, 0 , num);
|
||||
lv_anim_set_values(&animimg->anim, 0, num);
|
||||
}
|
||||
|
||||
void lv_animimg_start(lv_obj_t * obj)
|
||||
@ -115,7 +115,7 @@ static void lv_animimg_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob
|
||||
lv_anim_set_var(&animimg->anim, obj);
|
||||
lv_anim_set_time(&animimg->anim, 30);
|
||||
lv_anim_set_exec_cb(&animimg->anim, (lv_anim_exec_xcb_t)index_change);
|
||||
lv_anim_set_values(&animimg->anim, 0 , 1);
|
||||
lv_anim_set_values(&animimg->anim, 0, 1);
|
||||
lv_anim_set_repeat_count(&animimg->anim, LV_ANIM_REPEAT_INFINITE);
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,8 @@ typedef struct {
|
||||
lv_img_t img;
|
||||
lv_anim_t anim;
|
||||
/*picture sequence */
|
||||
lv_img_dsc_t **dsc;
|
||||
int8_t pic_count;
|
||||
lv_img_dsc_t ** dsc;
|
||||
int8_t pic_count;
|
||||
} lv_animimg_t;
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ static void highlight_update(lv_obj_t * calendar);
|
||||
const lv_obj_class_t lv_calendar_class = {
|
||||
.constructor_cb = lv_calendar_constructor,
|
||||
.width_def = (LV_DPI_DEF * 3) / 2,
|
||||
.height_def =(LV_DPI_DEF * 3) / 2,
|
||||
.height_def = (LV_DPI_DEF * 3) / 2,
|
||||
.group_def = LV_OBJ_CLASS_GROUP_DEF_TRUE,
|
||||
.instance_size = sizeof(lv_calendar_t),
|
||||
.base_class = &lv_btnmatrix_class
|
||||
@ -238,9 +238,11 @@ static void lv_calendar_constructor(const lv_obj_class_t * class_p, lv_obj_t * o
|
||||
/*Every 8th string is "\n"*/
|
||||
if(i != 0 && (i + 1) % 8 == 0) {
|
||||
calendar->map[i] = "\n";
|
||||
} else if(i < 8){
|
||||
}
|
||||
else if(i < 8) {
|
||||
calendar->map[i] = day_names_def[i];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
calendar->nums[j][0] = 'x';
|
||||
calendar->map[i] = calendar->nums[j];
|
||||
j++;
|
||||
@ -359,7 +361,8 @@ static void highlight_update(lv_obj_t * obj)
|
||||
uint8_t day_first = get_day_of_week(calendar->showed_date.year, calendar->showed_date.month, 1);
|
||||
if(calendar->highlighted_dates) {
|
||||
for(i = 0; i < calendar->highlighted_dates_num; i++) {
|
||||
if(calendar->highlighted_dates[i].year == calendar->showed_date.year && calendar->highlighted_dates[i].month == calendar->showed_date.month) {
|
||||
if(calendar->highlighted_dates[i].year == calendar->showed_date.year &&
|
||||
calendar->highlighted_dates[i].month == calendar->showed_date.month) {
|
||||
lv_btnmatrix_set_btn_ctrl(obj, calendar->highlighted_dates[i].day - 1 + day_first + 7, LV_CALENDAR_CTRL_HIGHLIGHT);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ typedef struct {
|
||||
/*New data for this type*/
|
||||
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 an array defined by the user)*/
|
||||
lv_calendar_date_t *
|
||||
highlighted_dates; /*Apply different style on these days (pointer to an array defined by the user)*/
|
||||
uint16_t highlighted_dates_num; /*Number of elements in `highlighted_days`*/
|
||||
const char * map[8 * 7];
|
||||
char nums [7 * 6][4];
|
||||
|
@ -32,8 +32,8 @@ static void month_event_cb(lv_event_t * e);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
const lv_obj_class_t lv_calendar_header_arrow_class = {
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = my_constructor
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = my_constructor
|
||||
};
|
||||
|
||||
static const char * month_names_def[12] = LV_CALENDAR_DEFAULT_MONTH_NAMES;
|
||||
@ -120,14 +120,17 @@ static void month_event_cb(lv_event_t * e)
|
||||
if(newd.month == 1) {
|
||||
newd.month = 12;
|
||||
newd.year --;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
newd.month --;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if(newd.month == 12) {
|
||||
newd.month = 1;
|
||||
newd.year ++;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
newd.month ++;
|
||||
}
|
||||
}
|
||||
|
@ -32,19 +32,19 @@ static void month_event_cb(lv_event_t * e);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
const lv_obj_class_t lv_calendar_header_dropdown_class = {
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = my_constructor
|
||||
};
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = my_constructor
|
||||
};
|
||||
|
||||
static const char * month_list = "01\n02\n03\n04\n05\n06\n07\n08\n09\n10\n11\n12";
|
||||
static const char * year_list = {
|
||||
"2023\n2022\n2021\n"
|
||||
"2020\n2019\n2018\n2017\n2016\n2015\n2014\n2013\n2012\n2011\n2010\n2009\n2008\n2007\n2006\n2005\n2004\n2003\n2002\n2001\n"
|
||||
"2000\n1999\n1998\n1997\n1996\n1995\n1994\n1993\n1992\n1991\n1990\n1989\n1988\n1987\n1986\n1985\n1984\n1983\n1982\n1981\n"
|
||||
"1980\n1979\n1978\n1977\n1976\n1975\n1974\n1973\n1972\n1971\n1970\n1969\n1968\n1967\n1966\n1965\n1964\n1963\n1962\n1961\n"
|
||||
"1960\n1959\n1958\n1957\n1956\n1955\n1954\n1953\n1952\n1951\n1950\n1949\n1948\n1947\n1946\n1945\n1944\n1943\n1942\n1941\n"
|
||||
"1940\n1939\n1938\n1937\n1936\n1935\n1934\n1933\n1932\n1931\n1930\n1929\n1928\n1927\n1926\n1925\n1924\n1923\n1922\n1921\n"
|
||||
"1920\n1919\n1918\n1917\n1916\n1915\n1914\n1913\n1912\n1911\n1910\n1909\n1908\n1907\n1906\n1905\n1904\n1903\n1902\n1901"
|
||||
"2023\n2022\n2021\n"
|
||||
"2020\n2019\n2018\n2017\n2016\n2015\n2014\n2013\n2012\n2011\n2010\n2009\n2008\n2007\n2006\n2005\n2004\n2003\n2002\n2001\n"
|
||||
"2000\n1999\n1998\n1997\n1996\n1995\n1994\n1993\n1992\n1991\n1990\n1989\n1988\n1987\n1986\n1985\n1984\n1983\n1982\n1981\n"
|
||||
"1980\n1979\n1978\n1977\n1976\n1975\n1974\n1973\n1972\n1971\n1970\n1969\n1968\n1967\n1966\n1965\n1964\n1963\n1962\n1961\n"
|
||||
"1960\n1959\n1958\n1957\n1956\n1955\n1954\n1953\n1952\n1951\n1950\n1949\n1948\n1947\n1946\n1945\n1944\n1943\n1942\n1941\n"
|
||||
"1940\n1939\n1938\n1937\n1936\n1935\n1934\n1933\n1932\n1931\n1930\n1929\n1928\n1927\n1926\n1925\n1924\n1923\n1922\n1921\n"
|
||||
"1920\n1919\n1918\n1917\n1916\n1915\n1914\n1913\n1912\n1911\n1910\n1909\n1908\n1907\n1906\n1905\n1904\n1903\n1902\n1901"
|
||||
};
|
||||
|
||||
static lv_obj_t * calendar_param;
|
||||
@ -77,12 +77,12 @@ static void my_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
|
||||
LV_UNUSED(class_p);
|
||||
|
||||
/*Use the same paddings as the calendar_param*/
|
||||
lv_obj_set_style_pad_left(obj,lv_obj_get_style_pad_left(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_pad_right(obj,lv_obj_get_style_pad_right(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_pad_top(obj,lv_obj_get_style_pad_top(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_pad_bottom(obj,lv_obj_get_style_pad_bottom(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_pad_column(obj,lv_obj_get_style_pad_column(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_radius(obj,lv_obj_get_style_radius(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_pad_left(obj, lv_obj_get_style_pad_left(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_pad_right(obj, lv_obj_get_style_pad_right(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_pad_top(obj, lv_obj_get_style_pad_top(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_pad_bottom(obj, lv_obj_get_style_pad_bottom(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_pad_column(obj, lv_obj_get_style_pad_column(calendar_param, LV_PART_MAIN), 0);
|
||||
lv_obj_set_style_radius(obj, lv_obj_get_style_radius(calendar_param, LV_PART_MAIN), 0);
|
||||
|
||||
const lv_calendar_date_t * cur_date = lv_calendar_get_showed_date(calendar_param);
|
||||
|
||||
|
@ -29,7 +29,7 @@ static void lv_chart_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
|
||||
static void lv_chart_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj);
|
||||
static void lv_chart_event(const lv_obj_class_t * class_p, lv_event_t * e);
|
||||
|
||||
static void draw_div_lines(lv_obj_t * obj , const lv_area_t * mask);
|
||||
static void draw_div_lines(lv_obj_t * obj, const lv_area_t * mask);
|
||||
static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area);
|
||||
static void draw_series_bar(lv_obj_t * obj, const lv_area_t * clip_area);
|
||||
static void draw_series_scatter(lv_obj_t * obj, const lv_area_t * clip_area);
|
||||
@ -130,25 +130,25 @@ void lv_chart_set_range(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t min, lv
|
||||
|
||||
lv_chart_t * chart = (lv_chart_t *)obj;
|
||||
switch(axis) {
|
||||
case LV_CHART_AXIS_PRIMARY_Y:
|
||||
chart->ymin[0] = min;
|
||||
chart->ymax[0] = max;
|
||||
break;
|
||||
case LV_CHART_AXIS_SECONDARY_Y:
|
||||
chart->ymin[1] = min;
|
||||
chart->ymax[1] = max;
|
||||
break;
|
||||
case LV_CHART_AXIS_PRIMARY_X:
|
||||
chart->xmin[0] = min;
|
||||
chart->xmax[0] = max;
|
||||
break;
|
||||
case LV_CHART_AXIS_SECONDARY_X:
|
||||
chart->xmin[1] = min;
|
||||
chart->xmax[1] = max;
|
||||
break;
|
||||
default:
|
||||
LV_LOG_WARN("Invalid axis: %d", axis);
|
||||
return;
|
||||
case LV_CHART_AXIS_PRIMARY_Y:
|
||||
chart->ymin[0] = min;
|
||||
chart->ymax[0] = max;
|
||||
break;
|
||||
case LV_CHART_AXIS_SECONDARY_Y:
|
||||
chart->ymin[1] = min;
|
||||
chart->ymax[1] = max;
|
||||
break;
|
||||
case LV_CHART_AXIS_PRIMARY_X:
|
||||
chart->xmin[0] = min;
|
||||
chart->xmax[0] = max;
|
||||
break;
|
||||
case LV_CHART_AXIS_SECONDARY_X:
|
||||
chart->xmin[1] = min;
|
||||
chart->xmax[1] = max;
|
||||
break;
|
||||
default:
|
||||
LV_LOG_WARN("Invalid axis: %d", axis);
|
||||
return;
|
||||
}
|
||||
|
||||
lv_chart_refresh(obj);
|
||||
@ -223,7 +223,8 @@ uint16_t lv_chart_get_zoom_y(const lv_obj_t * obj)
|
||||
return chart->zoom_y;
|
||||
}
|
||||
|
||||
void lv_chart_set_axis_tick(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t major_len, lv_coord_t minor_len, lv_coord_t major_cnt, lv_coord_t minor_cnt, bool label_en, lv_coord_t draw_size)
|
||||
void lv_chart_set_axis_tick(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t major_len, lv_coord_t minor_len,
|
||||
lv_coord_t major_cnt, lv_coord_t minor_cnt, bool label_en, lv_coord_t draw_size)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
@ -287,8 +288,10 @@ void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint1
|
||||
}
|
||||
else if(chart->type == LV_CHART_TYPE_BAR) {
|
||||
uint32_t ser_cnt = _lv_ll_get_len(&chart->series_ll);
|
||||
int32_t ser_gap = ((int32_t)lv_obj_get_style_pad_column(obj, LV_PART_ITEMS) * chart->zoom_x) >> 8; /*Gap between the column on the ~same X*/
|
||||
int32_t block_gap = ((int32_t)lv_obj_get_style_pad_column(obj, LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the column on ~adjacent X*/
|
||||
int32_t ser_gap = ((int32_t)lv_obj_get_style_pad_column(obj,
|
||||
LV_PART_ITEMS) * chart->zoom_x) >> 8; /*Gap between the column on the ~same X*/
|
||||
int32_t block_gap = ((int32_t)lv_obj_get_style_pad_column(obj,
|
||||
LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the column on ~adjacent X*/
|
||||
lv_coord_t block_w = (w - ((chart->point_cnt - 1) * block_gap)) / chart->point_cnt;
|
||||
lv_coord_t col_w = block_w / ser_cnt;
|
||||
|
||||
@ -565,7 +568,8 @@ void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t
|
||||
ser->y_points[id] = value;
|
||||
}
|
||||
|
||||
void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id, lv_coord_t x_value, lv_coord_t y_value)
|
||||
void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id, lv_coord_t x_value,
|
||||
lv_coord_t y_value)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
LV_ASSERT_NULL(ser);
|
||||
@ -707,18 +711,24 @@ static void lv_chart_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
chart->pressed_point_id = id;
|
||||
lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
}
|
||||
} else if(code == LV_EVENT_RELEASED) {
|
||||
}
|
||||
else if(code == LV_EVENT_RELEASED) {
|
||||
invalidate_point(obj, chart->pressed_point_id);
|
||||
chart->pressed_point_id = LV_CHART_POINT_NONE;
|
||||
} else if(code == LV_EVENT_SIZE_CHANGED) {
|
||||
}
|
||||
else if(code == LV_EVENT_SIZE_CHANGED) {
|
||||
lv_obj_refresh_self_size(obj);
|
||||
} else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
||||
lv_event_set_ext_draw_size(e, LV_MAX4(chart->tick[0].draw_size, chart->tick[1].draw_size, chart->tick[2].draw_size, chart->tick[3].draw_size));
|
||||
} else if(code == LV_EVENT_GET_SELF_SIZE) {
|
||||
}
|
||||
else if(code == LV_EVENT_REFR_EXT_DRAW_SIZE) {
|
||||
lv_event_set_ext_draw_size(e, LV_MAX4(chart->tick[0].draw_size, chart->tick[1].draw_size, chart->tick[2].draw_size,
|
||||
chart->tick[3].draw_size));
|
||||
}
|
||||
else if(code == LV_EVENT_GET_SELF_SIZE) {
|
||||
lv_point_t * p = lv_event_get_param(e);
|
||||
p->x = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8;
|
||||
p->y = ((int32_t)lv_obj_get_content_height(obj) * chart->zoom_y) >> 8;
|
||||
} else if(code == LV_EVENT_DRAW_MAIN) {
|
||||
}
|
||||
else if(code == LV_EVENT_DRAW_MAIN) {
|
||||
const lv_area_t * clip_area = lv_event_get_param(e);
|
||||
draw_div_lines(obj, clip_area);
|
||||
draw_axes(obj, clip_area);
|
||||
@ -881,7 +891,7 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
|
||||
/*Go through all data lines*/
|
||||
_LV_LL_READ_BACK(&chart->series_ll, ser) {
|
||||
if (ser->hidden) continue;
|
||||
if(ser->hidden) continue;
|
||||
line_dsc_default.color = ser->color;
|
||||
point_dsc_default.bg_color = ser->color;
|
||||
|
||||
@ -946,7 +956,8 @@ static void draw_series_line(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
y_max = y_cur;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_area_t point_area;
|
||||
point_area.x1 = p1.x - point_w;
|
||||
point_area.x2 = p1.x + point_w;
|
||||
@ -1040,7 +1051,7 @@ static void draw_series_scatter(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
|
||||
/*Go through all data lines*/
|
||||
_LV_LL_READ_BACK(&chart->series_ll, ser) {
|
||||
if (ser->hidden) continue;
|
||||
if(ser->hidden) continue;
|
||||
line_dsc_default.color = ser->color;
|
||||
point_dsc_default.bg_color = ser->color;
|
||||
|
||||
@ -1058,7 +1069,8 @@ static void draw_series_scatter(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
p2.y = lv_map(ser->y_points[p_act], chart->ymin[ser->y_axis_sec], chart->ymax[ser->y_axis_sec], 0, h);
|
||||
p2.y = h - p2.y;
|
||||
p2.y += y_ofs;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
p2.x = LV_COORD_MIN;
|
||||
p2.y = LV_COORD_MIN;
|
||||
}
|
||||
@ -1084,7 +1096,8 @@ static void draw_series_scatter(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
|
||||
p2.x = lv_map(ser->x_points[p_act], chart->xmin[ser->x_axis_sec], chart->xmax[ser->x_axis_sec], 0, w);
|
||||
p2.x += x_ofs;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
p_prev = p_act;
|
||||
continue;
|
||||
}
|
||||
@ -1156,10 +1169,12 @@ static void draw_series_bar(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
int32_t y_tmp;
|
||||
lv_chart_series_t * ser;
|
||||
uint32_t ser_cnt = _lv_ll_get_len(&chart->series_ll);
|
||||
int32_t block_gap = ((int32_t)lv_obj_get_style_pad_column(obj, LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the column on ~adjacent X*/
|
||||
int32_t block_gap = ((int32_t)lv_obj_get_style_pad_column(obj,
|
||||
LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the column on ~adjacent X*/
|
||||
lv_coord_t block_w = (w - ((chart->point_cnt - 1) * block_gap)) / chart->point_cnt;
|
||||
lv_coord_t col_w = block_w / ser_cnt;
|
||||
int32_t ser_gap = ((int32_t)lv_obj_get_style_pad_column(obj, LV_PART_ITEMS) * chart->zoom_x) >> 8; /*Gap between the column on the ~same X*/
|
||||
int32_t ser_gap = ((int32_t)lv_obj_get_style_pad_column(obj,
|
||||
LV_PART_ITEMS) * chart->zoom_x) >> 8; /*Gap between the column on the ~same X*/
|
||||
lv_coord_t x_ofs = pad_left - lv_obj_get_scroll_left(obj);
|
||||
lv_coord_t y_ofs = pad_top - lv_obj_get_scroll_top(obj);
|
||||
|
||||
@ -1190,7 +1205,7 @@ static void draw_series_bar(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
|
||||
/*Draw the current point of all data line*/
|
||||
_LV_LL_READ_BACK(&chart->series_ll, ser) {
|
||||
if (ser->hidden) continue;
|
||||
if(ser->hidden) continue;
|
||||
lv_coord_t start_point = chart->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0;
|
||||
|
||||
col_a.x1 = x_act;
|
||||
@ -1272,7 +1287,8 @@ static void draw_cursors(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
if(cursor->pos_set) {
|
||||
cx = cursor->pos.x;
|
||||
cy = cursor->pos.y;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
if(cursor->point_id == LV_CHART_POINT_NONE) continue;
|
||||
lv_point_t p;
|
||||
lv_chart_get_point_pos_by_id(obj, cursor->ser, cursor->point_id, &p);
|
||||
@ -1291,7 +1307,8 @@ static void draw_cursors(lv_obj_t * obj, const lv_area_t * clip_area)
|
||||
point_area.y2 = cy + point_h;
|
||||
|
||||
part_draw_dsc.draw_area = &point_area;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
part_draw_dsc.draw_area = NULL;
|
||||
}
|
||||
|
||||
@ -1348,7 +1365,8 @@ static void draw_y_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
if(axis == LV_CHART_AXIS_PRIMARY_Y) {
|
||||
label_gap = lv_obj_get_style_pad_left(obj, LV_PART_TICKS);
|
||||
x_ofs = obj->coords.x1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
label_gap = lv_obj_get_style_pad_right(obj, LV_PART_TICKS);
|
||||
x_ofs = obj->coords.x2;
|
||||
}
|
||||
@ -1413,7 +1431,8 @@ static void draw_y_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
|
||||
/*reserve appropriate area*/
|
||||
lv_point_t size;
|
||||
lv_txt_get_size(&size, part_draw_dsc.text, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
|
||||
lv_txt_get_size(&size, part_draw_dsc.text, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
|
||||
LV_TEXT_FLAG_NONE);
|
||||
|
||||
/*set the area at some distance of the major tick len left of the tick*/
|
||||
lv_area_t a;
|
||||
@ -1430,19 +1449,18 @@ static void draw_y_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
}
|
||||
|
||||
if(a.y2 >= obj->coords.y1 &&
|
||||
a.y1 <= obj->coords.y2)
|
||||
{
|
||||
a.y1 <= obj->coords.y2) {
|
||||
lv_draw_label(&a, clip_area, &label_dsc, part_draw_dsc.text, NULL);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
part_draw_dsc.label_dsc = NULL;
|
||||
part_draw_dsc.text = NULL;
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc);
|
||||
}
|
||||
|
||||
if(p1.y + line_dsc.width / 2 >= obj->coords.y1 &&
|
||||
p2.y - line_dsc.width / 2 <= obj->coords.y2)
|
||||
{
|
||||
p2.y - line_dsc.width / 2 <= obj->coords.y2) {
|
||||
lv_draw_line(&p1, &p2, clip_area, &line_dsc);
|
||||
}
|
||||
|
||||
@ -1476,7 +1494,8 @@ static void draw_x_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
if(axis == LV_CHART_AXIS_PRIMARY_X) {
|
||||
label_gap = t->label_en ? lv_obj_get_style_pad_bottom(obj, LV_PART_TICKS) : 0;
|
||||
y_ofs = obj->coords.y2;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
label_gap = t->label_en ? lv_obj_get_style_pad_top(obj, LV_PART_TICKS) : 0;
|
||||
y_ofs = obj->coords.y1;
|
||||
}
|
||||
@ -1505,7 +1524,8 @@ static void draw_x_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
|
||||
/*The columns ticks should be aligned to the center of blocks*/
|
||||
if(chart->type == LV_CHART_TYPE_BAR) {
|
||||
int32_t block_gap = ((int32_t)lv_obj_get_style_pad_column(obj, LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the columns on ~adjacent X*/
|
||||
int32_t block_gap = ((int32_t)lv_obj_get_style_pad_column(obj,
|
||||
LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the columns on ~adjacent X*/
|
||||
lv_coord_t block_w = (w + block_gap) / (chart->point_cnt);
|
||||
x_ofs += (block_w - block_gap) / 2;
|
||||
w -= block_w - block_gap;
|
||||
@ -1530,7 +1550,8 @@ static void draw_x_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
int32_t tick_value;
|
||||
if(chart->type == LV_CHART_TYPE_SCATTER) {
|
||||
tick_value = lv_map(i, 0, total_tick_num, chart->xmin[sec_axis], chart->xmax[sec_axis]);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
tick_value = i / t->minor_cnt;
|
||||
}
|
||||
part_draw_dsc.value = tick_value;
|
||||
@ -1545,7 +1566,8 @@ static void draw_x_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
|
||||
/*reserve appropriate area*/
|
||||
lv_point_t size;
|
||||
lv_txt_get_size(&size, part_draw_dsc.text, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX, LV_TEXT_FLAG_NONE);
|
||||
lv_txt_get_size(&size, part_draw_dsc.text, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
|
||||
LV_TEXT_FLAG_NONE);
|
||||
|
||||
/*set the area at some distance of the major tick len under of the tick*/
|
||||
lv_area_t a;
|
||||
@ -1561,11 +1583,11 @@ static void draw_x_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
}
|
||||
|
||||
if(a.x2 >= obj->coords.x1 &&
|
||||
a.x1 <= obj->coords.x2)
|
||||
{
|
||||
a.x1 <= obj->coords.x2) {
|
||||
lv_draw_label(&a, clip_area, &label_dsc, part_draw_dsc.text, NULL);
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
part_draw_dsc.label_dsc = NULL;
|
||||
part_draw_dsc.text = NULL;
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc);
|
||||
@ -1573,8 +1595,7 @@ static void draw_x_ticks(lv_obj_t * obj, const lv_area_t * clip_area, lv_chart_a
|
||||
|
||||
|
||||
if(p1.x + line_dsc.width / 2 >= obj->coords.x1 &&
|
||||
p2.x - line_dsc.width / 2 <= obj->coords.x2)
|
||||
{
|
||||
p2.x - line_dsc.width / 2 <= obj->coords.x2) {
|
||||
lv_draw_line(&p1, &p2, clip_area, &line_dsc);
|
||||
}
|
||||
|
||||
@ -1601,7 +1622,7 @@ static uint32_t get_index_from_x(lv_obj_t * obj, lv_coord_t x)
|
||||
lv_chart_t * chart = (lv_chart_t *)obj;
|
||||
lv_coord_t w = ((int32_t)lv_obj_get_content_width(obj) * chart->zoom_x) >> 8;
|
||||
lv_coord_t pad_left = lv_obj_get_style_pad_left(obj, LV_PART_MAIN);
|
||||
x-= pad_left;
|
||||
x -= pad_left;
|
||||
|
||||
if(x < 0) return 0;
|
||||
if(x > w) return chart->point_cnt - 1;
|
||||
@ -1651,7 +1672,8 @@ static void invalidate_point(lv_obj_t * obj, uint16_t i)
|
||||
}
|
||||
else if(chart->type == LV_CHART_TYPE_BAR) {
|
||||
lv_area_t col_a;
|
||||
int32_t block_gap = ((int32_t)lv_obj_get_style_pad_column(obj, LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the column on ~adjacent X*/
|
||||
int32_t block_gap = ((int32_t)lv_obj_get_style_pad_column(obj,
|
||||
LV_PART_MAIN) * chart->zoom_x) >> 8; /*Gap between the column on ~adjacent X*/
|
||||
lv_coord_t block_w = (w + block_gap) / chart->point_cnt;
|
||||
|
||||
lv_coord_t x_act;
|
||||
@ -1677,7 +1699,7 @@ static void new_points_alloc(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t c
|
||||
{
|
||||
if((*a) == NULL) return;
|
||||
|
||||
lv_chart_t * chart = (lv_chart_t*) obj;
|
||||
lv_chart_t * chart = (lv_chart_t *) obj;
|
||||
uint32_t point_cnt_old = chart->point_cnt;
|
||||
uint32_t i;
|
||||
|
||||
@ -1689,7 +1711,7 @@ static void new_points_alloc(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t c
|
||||
if(cnt >= point_cnt_old) {
|
||||
for(i = 0; i < point_cnt_old; i++) {
|
||||
new_points[i] =
|
||||
(*a)[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
(*a)[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
}
|
||||
for(i = point_cnt_old; i < cnt; i++) {
|
||||
new_points[i] = LV_CHART_POINT_NONE; /*Fill up the rest with default value*/
|
||||
@ -1698,7 +1720,7 @@ static void new_points_alloc(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t c
|
||||
else {
|
||||
for(i = 0; i < cnt; i++) {
|
||||
new_points[i] =
|
||||
(*a)[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
(*a)[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
|
||||
}
|
||||
}
|
||||
|
||||
@ -1721,13 +1743,18 @@ static void new_points_alloc(lv_obj_t * obj, lv_chart_series_t * ser, uint32_t c
|
||||
|
||||
lv_chart_tick_dsc_t * get_tick_gsc(lv_obj_t * obj, lv_chart_axis_t axis)
|
||||
{
|
||||
lv_chart_t * chart = (lv_chart_t*) obj;
|
||||
lv_chart_t * chart = (lv_chart_t *) obj;
|
||||
switch(axis) {
|
||||
case LV_CHART_AXIS_PRIMARY_Y: return &chart->tick[0];
|
||||
case LV_CHART_AXIS_PRIMARY_X: return &chart->tick[1];
|
||||
case LV_CHART_AXIS_SECONDARY_Y: return &chart->tick[2];
|
||||
case LV_CHART_AXIS_SECONDARY_X: return &chart->tick[3];
|
||||
default: return NULL;
|
||||
case LV_CHART_AXIS_PRIMARY_Y:
|
||||
return &chart->tick[0];
|
||||
case LV_CHART_AXIS_PRIMARY_X:
|
||||
return &chart->tick[1];
|
||||
case LV_CHART_AXIS_SECONDARY_Y:
|
||||
return &chart->tick[2];
|
||||
case LV_CHART_AXIS_SECONDARY_X:
|
||||
return &chart->tick[3];
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,17 +82,17 @@ typedef struct {
|
||||
lv_color_t color;
|
||||
lv_chart_series_t * ser;
|
||||
lv_dir_t dir;
|
||||
uint8_t pos_set:1; /*1: pos is set; 0: point_id is set*/
|
||||
uint8_t pos_set: 1; /*1: pos is set; 0: point_id is set*/
|
||||
} lv_chart_cursor_t;
|
||||
|
||||
typedef struct {
|
||||
lv_coord_t major_len;
|
||||
lv_coord_t minor_len;
|
||||
lv_coord_t draw_size;
|
||||
uint32_t minor_cnt :15;
|
||||
uint32_t major_cnt :15;
|
||||
uint32_t label_en :1;
|
||||
}lv_chart_tick_dsc_t;
|
||||
uint32_t minor_cnt : 15;
|
||||
uint32_t major_cnt : 15;
|
||||
uint32_t label_en : 1;
|
||||
} lv_chart_tick_dsc_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
@ -110,9 +110,9 @@ typedef struct {
|
||||
uint16_t point_cnt; /**< Point number in a data line*/
|
||||
uint16_t zoom_x;
|
||||
uint16_t zoom_y;
|
||||
lv_chart_type_t type :3; /**< Line or column chart*/
|
||||
lv_chart_type_t type : 3; /**< Line or column chart*/
|
||||
lv_chart_update_mode_t update_mode : 1;
|
||||
}lv_chart_t;
|
||||
} lv_chart_t;
|
||||
|
||||
extern const lv_obj_class_t lv_chart_class;
|
||||
|
||||
@ -128,7 +128,7 @@ typedef enum {
|
||||
LV_CHART_DRAW_PART_BAR, /**< Used on bar charts for the rectangles*/
|
||||
LV_CHART_DRAW_PART_CURSOR, /**< Used on cursor lines and points*/
|
||||
LV_CHART_DRAW_PART_TICK_LABEL, /**< Used on tick lines and labels*/
|
||||
}lv_chart_draw_part_type_t;
|
||||
} lv_chart_draw_part_type_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@ -218,7 +218,8 @@ uint16_t lv_chart_get_zoom_y(const lv_obj_t * obj);
|
||||
* @param draw_size extra size required to draw the tick and labels
|
||||
* (start with 20 px and increase if the ticks/labels are clipped)
|
||||
*/
|
||||
void lv_chart_set_axis_tick(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t major_len, lv_coord_t minor_len, lv_coord_t major_cnt, lv_coord_t minor_cnt, bool label_en, lv_coord_t draw_size);
|
||||
void lv_chart_set_axis_tick(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t major_len, lv_coord_t minor_len,
|
||||
lv_coord_t major_cnt, lv_coord_t minor_cnt, bool label_en, lv_coord_t draw_size);
|
||||
|
||||
/**
|
||||
* Get the type of a chart
|
||||
@ -340,7 +341,8 @@ void lv_chart_set_cursor_pos(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_po
|
||||
* @param ser pointer to a series
|
||||
* @param point_id the point's index or `LV_CHART_POINT_NONE` to not assign to any points.
|
||||
*/
|
||||
void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_chart_series_t * ser, uint16_t point_id);
|
||||
void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_chart_series_t * ser,
|
||||
uint16_t point_id);
|
||||
|
||||
/**
|
||||
* Get the coordinate of the cursor with respect to the paddings
|
||||
@ -397,7 +399,8 @@ void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t
|
||||
* @param x_value the new X value of the next data
|
||||
* @param y_value the new Y value of the next data
|
||||
*/
|
||||
void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id, lv_coord_t x_value, lv_coord_t y_value);
|
||||
void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id, lv_coord_t x_value,
|
||||
lv_coord_t y_value);
|
||||
|
||||
/**
|
||||
* Set an external array for the y data points to use for the chart
|
||||
|
@ -50,12 +50,12 @@ static uint16_t get_angle(lv_obj_t * obj);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
const lv_obj_class_t lv_colorwheel_class = {.instance_size = sizeof(lv_colorwheel_t), .base_class = &lv_obj_class,
|
||||
.constructor_cb = lv_colorwheel_constructor,
|
||||
.event_cb = lv_colorwheel_event,
|
||||
.width_def = LV_DPI_DEF * 2,
|
||||
.height_def = LV_DPI_DEF * 2,
|
||||
.editable = LV_OBJ_CLASS_EDITABLE_TRUE,
|
||||
};
|
||||
.constructor_cb = lv_colorwheel_constructor,
|
||||
.event_cb = lv_colorwheel_event,
|
||||
.width_def = LV_DPI_DEF * 2,
|
||||
.height_def = LV_DPI_DEF * 2,
|
||||
.editable = LV_OBJ_CLASS_EDITABLE_TRUE,
|
||||
};
|
||||
|
||||
static bool create_knob_recolor;
|
||||
|
||||
@ -590,7 +590,7 @@ static lv_res_t double_click_reset(lv_obj_t * obj)
|
||||
|
||||
#define SWAPPTR(A, B) do { uint8_t * t = A; A = B; B = t; } while(0)
|
||||
#define HSV_PTR_SWAP(sextant,r,g,b) if((sextant) & 2) { SWAPPTR((r), (b)); } if((sextant) & 4) { SWAPPTR((g), (b)); } if(!((sextant) & 6)) { \
|
||||
if(!((sextant) & 1)) { SWAPPTR((r), (g)); } } else { if((sextant) & 1) { SWAPPTR((r), (g)); } }
|
||||
if(!((sextant) & 1)) { SWAPPTR((r), (g)); } } else { if((sextant) & 1) { SWAPPTR((r), (g)); } }
|
||||
|
||||
/**
|
||||
* Based on the idea from https://www.vagrearg.org/content/hsvrgb
|
||||
@ -604,10 +604,13 @@ static lv_res_t double_click_reset(lv_obj_t * obj)
|
||||
* We replace division by 255 by a division by 256, a.k.a a shift right by 8 bits.
|
||||
* This is wrong, but since this is only used to compute the pixels on the screen and not the final color, it's ok.
|
||||
*/
|
||||
static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t *r, uint8_t *g , uint8_t *b);
|
||||
static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t *r, uint8_t *g , uint8_t *b)
|
||||
static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t * r, uint8_t * g, uint8_t * b);
|
||||
static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t * r, uint8_t * g, uint8_t * b)
|
||||
{
|
||||
if (!s) { *r = *g = *b = v; return; }
|
||||
if(!s) {
|
||||
*r = *g = *b = v;
|
||||
return;
|
||||
}
|
||||
|
||||
uint8_t sextant = h >> 8;
|
||||
HSV_PTR_SWAP(sextant, r, g, b); /*Swap pointers so the conversion code is the same*/
|
||||
@ -623,7 +626,8 @@ static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t *r, uint8_t *
|
||||
if(!(sextant & 1)) {
|
||||
/*Up slope*/
|
||||
ww = !h_frac ? ((uint16_t)s << 8) : (s * (uint8_t)(-h_frac)); /*Skip multiply if not required*/
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
/*Down slope*/
|
||||
ww = s * h_frac;
|
||||
}
|
||||
@ -635,7 +639,7 @@ static void fast_hsv2rgb(uint16_t h, uint8_t s, uint8_t v, uint8_t *r, uint8_t *
|
||||
|
||||
static lv_color_t angle_to_mode_color_fast(lv_obj_t * obj, uint16_t angle)
|
||||
{
|
||||
lv_colorwheel_t * ext = (lv_colorwheel_t*)obj;
|
||||
lv_colorwheel_t * ext = (lv_colorwheel_t *)obj;
|
||||
uint8_t r = 0, g = 0, b = 0;
|
||||
static uint16_t h = 0;
|
||||
static uint8_t s = 0, v = 0, m = 255;
|
||||
@ -644,25 +648,29 @@ static lv_color_t angle_to_mode_color_fast(lv_obj_t * obj, uint16_t angle)
|
||||
default:
|
||||
case LV_COLORWHEEL_MODE_HUE:
|
||||
/*Don't recompute costly scaling if it does not change*/
|
||||
if (m != ext->mode) {
|
||||
s = (uint8_t)(((uint16_t)ext->hsv.s * 51) / 20); v = (uint8_t)(((uint16_t)ext->hsv.v * 51) / 20);
|
||||
m = ext->mode;
|
||||
if(m != ext->mode) {
|
||||
s = (uint8_t)(((uint16_t)ext->hsv.s * 51) / 20);
|
||||
v = (uint8_t)(((uint16_t)ext->hsv.v * 51) / 20);
|
||||
m = ext->mode;
|
||||
}
|
||||
fast_hsv2rgb(angle * 6, s, v, &r, &g, &b); /*A smart compiler will replace x * 6 by (x << 2) + (x << 1) if it's more efficient*/
|
||||
fast_hsv2rgb(angle * 6, s, v, &r, &g,
|
||||
&b); /*A smart compiler will replace x * 6 by (x << 2) + (x << 1) if it's more efficient*/
|
||||
break;
|
||||
case LV_COLORWHEEL_MODE_SATURATION:
|
||||
/*Don't recompute costly scaling if it does not change*/
|
||||
if (m != ext->mode) {
|
||||
h = (uint16_t)(((uint32_t)ext->hsv.h * 6 * 256) / 360); v = (uint8_t)(((uint16_t)ext->hsv.v * 51) / 20);
|
||||
m = ext->mode;
|
||||
if(m != ext->mode) {
|
||||
h = (uint16_t)(((uint32_t)ext->hsv.h * 6 * 256) / 360);
|
||||
v = (uint8_t)(((uint16_t)ext->hsv.v * 51) / 20);
|
||||
m = ext->mode;
|
||||
}
|
||||
fast_hsv2rgb(h, angle, v, &r, &g, &b);
|
||||
break;
|
||||
case LV_COLORWHEEL_MODE_VALUE:
|
||||
/*Don't recompute costly scaling if it does not change*/
|
||||
if (m != ext->mode) {
|
||||
h = (uint16_t)(((uint32_t)ext->hsv.h * 6 * 256) / 360); s = (uint8_t)(((uint16_t)ext->hsv.s * 51) / 20);
|
||||
m = ext->mode;
|
||||
if(m != ext->mode) {
|
||||
h = (uint16_t)(((uint32_t)ext->hsv.h * 6 * 256) / 360);
|
||||
s = (uint8_t)(((uint16_t)ext->hsv.s * 51) / 20);
|
||||
m = ext->mode;
|
||||
}
|
||||
fast_hsv2rgb(h, s, angle, &r, &g, &b);
|
||||
break;
|
||||
|
@ -34,10 +34,10 @@ lv_imgbtn_state_t get_state(const lv_obj_t * imgbtn);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
const lv_obj_class_t lv_imgbtn_class = {
|
||||
.base_class = &lv_obj_class,
|
||||
.instance_size = sizeof(lv_imgbtn_t),
|
||||
.constructor_cb = lv_imgbtn_constructor,
|
||||
.event_cb = lv_imgbtn_event,
|
||||
.base_class = &lv_obj_class,
|
||||
.instance_size = sizeof(lv_imgbtn_t),
|
||||
.constructor_cb = lv_imgbtn_constructor,
|
||||
.event_cb = lv_imgbtn_event,
|
||||
};
|
||||
|
||||
/**********************
|
||||
@ -77,7 +77,7 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * parent)
|
||||
* to a file)
|
||||
*/
|
||||
void lv_imgbtn_set_src(lv_obj_t * obj, lv_imgbtn_state_t state, const void * src_left, const void * src_mid,
|
||||
const void * src_right)
|
||||
const void * src_right)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
|
||||
@ -146,13 +146,13 @@ const void * lv_imgbtn_get_src_right(lv_obj_t * obj, lv_imgbtn_state_t state)
|
||||
static void lv_imgbtn_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj)
|
||||
{
|
||||
LV_UNUSED(class_p);
|
||||
lv_imgbtn_t * imgbtn = (lv_imgbtn_t *)obj;
|
||||
/*Initialize the allocated 'ext'*/
|
||||
lv_memset_00((void *)imgbtn->img_src_mid, sizeof(imgbtn->img_src_mid));
|
||||
lv_memset_00(imgbtn->img_src_left, sizeof(imgbtn->img_src_left));
|
||||
lv_memset_00(imgbtn->img_src_right, sizeof(imgbtn->img_src_right));
|
||||
lv_imgbtn_t * imgbtn = (lv_imgbtn_t *)obj;
|
||||
/*Initialize the allocated 'ext'*/
|
||||
lv_memset_00((void *)imgbtn->img_src_mid, sizeof(imgbtn->img_src_mid));
|
||||
lv_memset_00(imgbtn->img_src_left, sizeof(imgbtn->img_src_left));
|
||||
lv_memset_00(imgbtn->img_src_right, sizeof(imgbtn->img_src_right));
|
||||
|
||||
imgbtn->act_cf = LV_IMG_CF_UNKNOWN;
|
||||
imgbtn->act_cf = LV_IMG_CF_UNKNOWN;
|
||||
}
|
||||
|
||||
|
||||
@ -181,8 +181,7 @@ static void lv_imgbtn_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
lv_imgbtn_state_t state = suggest_state(obj, get_state(obj));
|
||||
if(imgbtn->img_src_left[state] == NULL &&
|
||||
imgbtn->img_src_mid[state] != NULL &&
|
||||
imgbtn->img_src_right[state] == NULL)
|
||||
{
|
||||
imgbtn->img_src_right[state] == NULL) {
|
||||
lv_img_header_t header;
|
||||
lv_img_decoder_get_info(imgbtn->img_src_mid[state], &header);
|
||||
p->x = LV_MAX(p->x, header.w);
|
||||
|
@ -28,7 +28,7 @@ typedef enum {
|
||||
LV_IMGBTN_STATE_CHECKED_PRESSED,
|
||||
LV_IMGBTN_STATE_CHECKED_DISABLED,
|
||||
_LV_IMGBTN_STATE_NUM,
|
||||
}lv_imgbtn_state_t;
|
||||
} lv_imgbtn_state_t;
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@ -75,7 +75,7 @@ lv_obj_t * lv_imgbtn_create(lv_obj_t * parent);
|
||||
* to a file)
|
||||
*/
|
||||
void lv_imgbtn_set_src(lv_obj_t * imgbtn, lv_imgbtn_state_t state, const void * src_left, const void * src_mid,
|
||||
const void * src_right);
|
||||
const void * src_right);
|
||||
|
||||
|
||||
/*=====================
|
||||
|
@ -179,7 +179,8 @@ void lv_keyboard_set_mode(lv_obj_t * obj, lv_keyboard_mode_t mode)
|
||||
* @param map pointer to a string array to describe the map.
|
||||
* See 'lv_btnmatrix_set_map()' for more info.
|
||||
*/
|
||||
void lv_keyboard_set_map(lv_obj_t * obj, lv_keyboard_mode_t mode, const char * map[], const lv_btnmatrix_ctrl_t ctrl_map[])
|
||||
void lv_keyboard_set_map(lv_obj_t * obj, lv_keyboard_mode_t mode, const char * map[],
|
||||
const lv_btnmatrix_ctrl_t ctrl_map[])
|
||||
{
|
||||
kb_map[mode] = map;
|
||||
kb_ctrl[mode] = ctrl_map;
|
||||
@ -282,13 +283,17 @@ void lv_keyboard_def_event_cb(lv_event_t * e)
|
||||
lv_res_t res = lv_event_send(keyboard->ta, LV_EVENT_READY, NULL);
|
||||
if(res != LV_RES_OK) return;
|
||||
}
|
||||
} else if(strcmp(txt, LV_SYMBOL_LEFT) == 0) {
|
||||
}
|
||||
else if(strcmp(txt, LV_SYMBOL_LEFT) == 0) {
|
||||
lv_textarea_cursor_left(keyboard->ta);
|
||||
} else if(strcmp(txt, LV_SYMBOL_RIGHT) == 0) {
|
||||
}
|
||||
else if(strcmp(txt, LV_SYMBOL_RIGHT) == 0) {
|
||||
lv_textarea_cursor_right(keyboard->ta);
|
||||
} else if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) {
|
||||
}
|
||||
else if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0) {
|
||||
lv_textarea_del_char(keyboard->ta);
|
||||
} else if(strcmp(txt, "+/-") == 0) {
|
||||
}
|
||||
else if(strcmp(txt, "+/-") == 0) {
|
||||
uint16_t cur = lv_textarea_get_cursor_pos(keyboard->ta);
|
||||
const char * ta_txt = lv_textarea_get_text(keyboard->ta);
|
||||
if(ta_txt[0] == '-') {
|
||||
|
@ -89,7 +89,8 @@ void lv_keyboard_set_mode(lv_obj_t * kb, lv_keyboard_mode_t mode);
|
||||
* @param map pointer to a string array to describe the map.
|
||||
* See 'lv_btnmatrix_set_map()' for more info.
|
||||
*/
|
||||
void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * map[], const lv_btnmatrix_ctrl_t ctrl_map[]);
|
||||
void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * map[],
|
||||
const lv_btnmatrix_ctrl_t ctrl_map[]);
|
||||
|
||||
/*=====================
|
||||
* Getter functions
|
||||
|
@ -28,12 +28,12 @@ static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
const lv_obj_class_t lv_led_class = {
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = lv_led_constructor,
|
||||
.width_def = LV_DPI_DEF / 5,
|
||||
.height_def = LV_DPI_DEF / 5,
|
||||
.event_cb = lv_led_event,
|
||||
.instance_size = sizeof(lv_led_t),
|
||||
.base_class = &lv_obj_class,
|
||||
.constructor_cb = lv_led_constructor,
|
||||
.width_def = LV_DPI_DEF / 5,
|
||||
.height_def = LV_DPI_DEF / 5,
|
||||
.event_cb = lv_led_event,
|
||||
.instance_size = sizeof(lv_led_t),
|
||||
};
|
||||
|
||||
/**********************
|
||||
@ -186,9 +186,9 @@ static void lv_led_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
/*Set the current shadow width according to brightness proportionally between LV_LED_BRIGHT_OFF
|
||||
* and LV_LED_BRIGHT_ON*/
|
||||
rect_dsc.shadow_width = ((led->bright - LV_LED_BRIGHT_MIN) * rect_dsc.shadow_width) /
|
||||
(LV_LED_BRIGHT_MAX - LV_LED_BRIGHT_MIN);
|
||||
(LV_LED_BRIGHT_MAX - LV_LED_BRIGHT_MIN);
|
||||
rect_dsc.shadow_spread = ((led->bright - LV_LED_BRIGHT_MIN) * rect_dsc.shadow_spread) /
|
||||
(LV_LED_BRIGHT_MAX - LV_LED_BRIGHT_MIN);
|
||||
(LV_LED_BRIGHT_MAX - LV_LED_BRIGHT_MIN);
|
||||
|
||||
const lv_area_t * clip_area = lv_event_get_param(e);
|
||||
|
||||
|
@ -50,7 +50,7 @@ extern const lv_obj_class_t lv_led_class;
|
||||
*/
|
||||
typedef enum {
|
||||
LV_LED_DRAW_PART_RECTANGLE, /**< The main rectangle*/
|
||||
}lv_led_draw_part_type_t;
|
||||
} lv_led_draw_part_type_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
@ -81,7 +81,8 @@ lv_meter_scale_t * lv_meter_add_scale(lv_obj_t * obj)
|
||||
return scale;
|
||||
}
|
||||
|
||||
void lv_meter_set_scale_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t cnt, uint16_t width, uint16_t len, lv_color_t color)
|
||||
void lv_meter_set_scale_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t cnt, uint16_t width, uint16_t len,
|
||||
lv_color_t color)
|
||||
{
|
||||
scale->tick_cnt = cnt;
|
||||
scale->tick_width = width;
|
||||
@ -90,7 +91,8 @@ void lv_meter_set_scale_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_meter_set_scale_major_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t nth, uint16_t width, uint16_t len, lv_color_t color, int16_t label_gap)
|
||||
void lv_meter_set_scale_major_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t nth, uint16_t width,
|
||||
uint16_t len, lv_color_t color, int16_t label_gap)
|
||||
{
|
||||
scale->tick_major_nth = nth;
|
||||
scale->tick_major_width = width;
|
||||
@ -100,7 +102,8 @@ void lv_meter_set_scale_major_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, ui
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_meter_set_scale_range(lv_obj_t * obj, lv_meter_scale_t * scale, int32_t min, int32_t max, uint32_t angle_range, uint32_t rotation)
|
||||
void lv_meter_set_scale_range(lv_obj_t * obj, lv_meter_scale_t * scale, int32_t min, int32_t max, uint32_t angle_range,
|
||||
uint32_t rotation)
|
||||
{
|
||||
scale->min = min;
|
||||
scale->max = max;
|
||||
@ -113,7 +116,8 @@ void lv_meter_set_scale_range(lv_obj_t * obj, lv_meter_scale_t * scale, int32_t
|
||||
* Add indicator
|
||||
*====================*/
|
||||
|
||||
lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width, lv_color_t color, int16_t r_mod)
|
||||
lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width,
|
||||
lv_color_t color, int16_t r_mod)
|
||||
{
|
||||
lv_meter_t * meter = (lv_meter_t *)obj;
|
||||
lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll);
|
||||
@ -131,7 +135,8 @@ lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t
|
||||
return indic;
|
||||
}
|
||||
|
||||
lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t * scale, const void * src, lv_coord_t pivot_x, lv_coord_t pivot_y)
|
||||
lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t * scale, const void * src,
|
||||
lv_coord_t pivot_x, lv_coord_t pivot_y)
|
||||
{
|
||||
lv_meter_t * meter = (lv_meter_t *)obj;
|
||||
lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll);
|
||||
@ -149,7 +154,8 @@ lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t
|
||||
return indic;
|
||||
}
|
||||
|
||||
lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width, lv_color_t color, int16_t r_mod)
|
||||
lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width, lv_color_t color,
|
||||
int16_t r_mod)
|
||||
{
|
||||
lv_meter_t * meter = (lv_meter_t *)obj;
|
||||
lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll);
|
||||
@ -167,7 +173,8 @@ lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale
|
||||
return indic;
|
||||
}
|
||||
|
||||
lv_meter_indicator_t * lv_meter_add_scale_lines(lv_obj_t * obj, lv_meter_scale_t * scale, lv_color_t color_start, lv_color_t color_end, bool local, int16_t width_mod)
|
||||
lv_meter_indicator_t * lv_meter_add_scale_lines(lv_obj_t * obj, lv_meter_scale_t * scale, lv_color_t color_start,
|
||||
lv_color_t color_end, bool local, int16_t width_mod)
|
||||
{
|
||||
lv_meter_t * meter = (lv_meter_t *)obj;
|
||||
lv_meter_indicator_t * indic = _lv_ll_ins_head(&meter->indicator_ll);
|
||||
@ -205,7 +212,8 @@ void lv_meter_set_indicator_value(lv_obj_t * obj, lv_meter_indicator_t * indic,
|
||||
inv_line(obj, indic, old_start);
|
||||
inv_line(obj, indic, old_end);
|
||||
inv_line(obj, indic, value);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
}
|
||||
@ -339,8 +347,10 @@ static void draw_arcs(lv_obj_t * obj, const lv_area_t * clip_area, const lv_area
|
||||
|
||||
lv_meter_scale_t * scale = indic->scale;
|
||||
|
||||
int32_t start_angle = lv_map(indic->start_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range);
|
||||
int32_t end_angle = lv_map(indic->end_value, scale->min, scale->max, scale->rotation, scale->rotation + scale->angle_range);
|
||||
int32_t start_angle = lv_map(indic->start_value, scale->min, scale->max, scale->rotation,
|
||||
scale->rotation + scale->angle_range);
|
||||
int32_t end_angle = lv_map(indic->end_value, scale->min, scale->max, scale->rotation,
|
||||
scale->rotation + scale->angle_range);
|
||||
|
||||
part_draw_dsc.radius = r_out + indic->type_data.arc.r_mod;
|
||||
part_draw_dsc.sub_part_ptr = indic;
|
||||
@ -442,11 +452,13 @@ static void draw_ticks_and_labels(lv_obj_t * obj, const lv_area_t * clip_area, c
|
||||
|
||||
if(indic->type_data.scale_lines.color_start.full == indic->type_data.scale_lines.color_end.full) {
|
||||
line_color = indic->type_data.scale_lines.color_start;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
lv_opa_t ratio;
|
||||
if(indic->type_data.scale_lines.local_grad) {
|
||||
ratio = lv_map(value_of_line, indic->start_value, indic->end_value, LV_OPA_TRANSP, LV_OPA_COVER);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
ratio = lv_map(value_of_line, scale->min, scale->max, LV_OPA_TRANSP, LV_OPA_COVER);
|
||||
}
|
||||
line_color = lv_color_mix(indic->type_data.scale_lines.color_end, indic->type_data.scale_lines.color_start, ratio);
|
||||
@ -504,7 +516,7 @@ static void draw_ticks_and_labels(lv_obj_t * obj, const lv_area_t * clip_area, c
|
||||
|
||||
lv_point_t label_size;
|
||||
lv_txt_get_size(&label_size, part_draw_dsc.text, label_dsc.font, label_dsc.letter_space, label_dsc.line_space,
|
||||
LV_COORD_MAX, LV_TEXT_FLAG_NONE);
|
||||
LV_COORD_MAX, LV_TEXT_FLAG_NONE);
|
||||
|
||||
lv_area_t label_cord;
|
||||
label_cord.x1 = p.x - label_size.x / 2;
|
||||
@ -515,7 +527,8 @@ static void draw_ticks_and_labels(lv_obj_t * obj, const lv_area_t * clip_area, c
|
||||
lv_draw_label(&label_cord, clip_area, &label_dsc, part_draw_dsc.text, NULL);
|
||||
|
||||
outer_mask_id = lv_draw_mask_add(&outer_mask, NULL);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
part_draw_dsc.label_dsc = NULL;
|
||||
part_draw_dsc.text = NULL;
|
||||
lv_event_send(obj, LV_EVENT_DRAW_PART_BEGIN, &part_draw_dsc);
|
||||
@ -632,7 +645,8 @@ static void inv_arc(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t old_va
|
||||
int32_t end_angle = lv_map(new_value, scale->min, scale->max, scale->rotation, scale->angle_range + scale->rotation);
|
||||
|
||||
lv_area_t a;
|
||||
lv_draw_arc_get_area(scale_center.x, scale_center.y, r_out, LV_MIN(start_angle, end_angle), LV_MAX(start_angle, end_angle), indic->type_data.arc.width, rounded, &a);
|
||||
lv_draw_arc_get_area(scale_center.x, scale_center.y, r_out, LV_MIN(start_angle, end_angle), LV_MAX(start_angle,
|
||||
end_angle), indic->type_data.arc.width, rounded, &a);
|
||||
lv_obj_invalidate_area(obj, &a);
|
||||
}
|
||||
|
||||
@ -682,6 +696,6 @@ static void inv_line(lv_obj_t * obj, lv_meter_indicator_t * indic, int32_t value
|
||||
a.y2 += scale_center.y + 2;
|
||||
|
||||
lv_obj_invalidate_area(obj, &a);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -49,14 +49,14 @@ typedef struct {
|
||||
int16_t r_mod;
|
||||
uint16_t angle_range;
|
||||
int16_t rotation;
|
||||
}lv_meter_scale_t;
|
||||
} lv_meter_scale_t;
|
||||
|
||||
typedef enum {
|
||||
LV_METER_INDICATOR_TYPE_NEEDLE_IMG,
|
||||
LV_METER_INDICATOR_TYPE_NEEDLE_LINE,
|
||||
LV_METER_INDICATOR_TYPE_SCALE_LINES,
|
||||
LV_METER_INDICATOR_TYPE_ARC,
|
||||
}lv_meter_indicator_type_t;
|
||||
} lv_meter_indicator_type_t;
|
||||
|
||||
typedef struct {
|
||||
lv_meter_scale_t * scale;
|
||||
@ -68,26 +68,26 @@ typedef struct {
|
||||
struct {
|
||||
const void * src;
|
||||
lv_point_t pivot;
|
||||
}needle_img;
|
||||
} needle_img;
|
||||
struct {
|
||||
uint16_t width;
|
||||
int16_t r_mod;
|
||||
lv_color_t color;
|
||||
}needle_line;
|
||||
} needle_line;
|
||||
struct {
|
||||
uint16_t width;
|
||||
const void * src;
|
||||
lv_color_t color;
|
||||
int16_t r_mod;
|
||||
}arc;
|
||||
} arc;
|
||||
struct {
|
||||
int16_t width_mod;
|
||||
lv_color_t color_start;
|
||||
lv_color_t color_end;
|
||||
uint8_t local_grad :1;
|
||||
}scale_lines;
|
||||
uint8_t local_grad : 1;
|
||||
} scale_lines;
|
||||
} type_data;
|
||||
}lv_meter_indicator_t;
|
||||
} lv_meter_indicator_t;
|
||||
|
||||
/*Data of line meter*/
|
||||
typedef struct {
|
||||
@ -107,7 +107,7 @@ typedef enum {
|
||||
LV_METER_DRAW_PART_NEEDLE_LINE, /**< The needle lines*/
|
||||
LV_METER_DRAW_PART_NEEDLE_IMG, /**< The needle images*/
|
||||
LV_METER_DRAW_PART_TICK, /**< The tick lines and labels*/
|
||||
}lv_meter_draw_part_type_t;
|
||||
} lv_meter_draw_part_type_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@ -141,7 +141,8 @@ lv_meter_scale_t * lv_meter_add_scale(lv_obj_t * obj);
|
||||
* @param len length of tick lines
|
||||
* @param color color of tick lines
|
||||
*/
|
||||
void lv_meter_set_scale_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t cnt, uint16_t width, uint16_t len, lv_color_t color);
|
||||
void lv_meter_set_scale_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t cnt, uint16_t width, uint16_t len,
|
||||
lv_color_t color);
|
||||
|
||||
/**
|
||||
* Make some "normal" ticks major ticks and set their attributes.
|
||||
@ -154,7 +155,8 @@ void lv_meter_set_scale_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t
|
||||
* @param color color of the major ticks
|
||||
* @param label_gap gap between the major ticks and the labels
|
||||
*/
|
||||
void lv_meter_set_scale_major_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t nth, uint16_t width, uint16_t len, lv_color_t color, int16_t label_gap);
|
||||
void lv_meter_set_scale_major_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t nth, uint16_t width,
|
||||
uint16_t len, lv_color_t color, int16_t label_gap);
|
||||
|
||||
/**
|
||||
* Set the value and angular range of a scale.
|
||||
@ -165,7 +167,8 @@ void lv_meter_set_scale_major_ticks(lv_obj_t * obj, lv_meter_scale_t * scale, ui
|
||||
* @param angle_range the angular range of the scale
|
||||
* @param rotation the angular offset from the 3 o'clock position (clock-wise)
|
||||
*/
|
||||
void lv_meter_set_scale_range(lv_obj_t * obj, lv_meter_scale_t * scale, int32_t min, int32_t max, uint32_t angle_range, uint32_t rotation);
|
||||
void lv_meter_set_scale_range(lv_obj_t * obj, lv_meter_scale_t * scale, int32_t min, int32_t max, uint32_t angle_range,
|
||||
uint32_t rotation);
|
||||
|
||||
/*=====================
|
||||
* Add indicator
|
||||
@ -180,7 +183,8 @@ void lv_meter_set_scale_range(lv_obj_t * obj, lv_meter_scale_t * scale, int32_t
|
||||
* @param r_mod the radius modifier (added to the scale's radius) to get the lines length
|
||||
* @return the new indicator
|
||||
*/
|
||||
lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width, lv_color_t color, int16_t r_mod);
|
||||
lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width,
|
||||
lv_color_t color, int16_t r_mod);
|
||||
|
||||
/**
|
||||
* Add a needle image indicator the scale
|
||||
@ -192,7 +196,8 @@ lv_meter_indicator_t * lv_meter_add_needle_line(lv_obj_t * obj, lv_meter_scale_t
|
||||
* @return the new indicator
|
||||
* @note the needle image should point to the right, like -O----->
|
||||
*/
|
||||
lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t * scale, const void * src, lv_coord_t pivot_x, lv_coord_t pivot_y);
|
||||
lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t * scale, const void * src,
|
||||
lv_coord_t pivot_x, lv_coord_t pivot_y);
|
||||
|
||||
/**
|
||||
* Add an arc indicator the scale
|
||||
@ -203,7 +208,8 @@ lv_meter_indicator_t * lv_meter_add_needle_img(lv_obj_t * obj, lv_meter_scale_t
|
||||
* @param r_mod the radius modifier (added to the scale's radius) to get the outer radius of the arc
|
||||
* @return the new indicator
|
||||
*/
|
||||
lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width, lv_color_t color, int16_t r_mod);
|
||||
lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale, uint16_t width, lv_color_t color,
|
||||
int16_t r_mod);
|
||||
|
||||
|
||||
/**
|
||||
@ -216,7 +222,8 @@ lv_meter_indicator_t * lv_meter_add_arc(lv_obj_t * obj, lv_meter_scale_t * scale
|
||||
* @param width_mod add this the affected tick's width
|
||||
* @return the new indicator
|
||||
*/
|
||||
lv_meter_indicator_t * lv_meter_add_scale_lines(lv_obj_t * obj, lv_meter_scale_t * scale, lv_color_t color_start, lv_color_t color_end, bool local, int16_t width_mod);
|
||||
lv_meter_indicator_t * lv_meter_add_scale_lines(lv_obj_t * obj, lv_meter_scale_t * scale, lv_color_t color_start,
|
||||
lv_color_t color_end, bool local, int16_t width_mod);
|
||||
|
||||
/*=====================
|
||||
* Set indicator value
|
||||
|
@ -37,7 +37,8 @@ const lv_obj_class_t lv_msgbox_class = {.base_class = &lv_obj_class, .instance_s
|
||||
* GLOBAL FUNCTIONS
|
||||
**********************/
|
||||
|
||||
lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char * txt, const char * btn_txts[], bool add_close_btn)
|
||||
lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char * txt, const char * btn_txts[],
|
||||
bool add_close_btn)
|
||||
{
|
||||
LV_LOG_INFO("begin");
|
||||
bool auto_parent = false;
|
||||
|
@ -40,7 +40,7 @@ typedef struct {
|
||||
lv_obj_t * close_btn;
|
||||
lv_obj_t * text;
|
||||
lv_obj_t * btns;
|
||||
}lv_msgbox_t;
|
||||
} lv_msgbox_t;
|
||||
|
||||
extern const lv_obj_class_t lv_msgbox_class;
|
||||
|
||||
@ -57,7 +57,8 @@ extern const lv_obj_class_t lv_msgbox_class;
|
||||
* @param add_close_btn true: add a close button
|
||||
* @return pointer to the message box object
|
||||
*/
|
||||
lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char * txt, const char * btn_txts[], bool add_close_btn);
|
||||
lv_obj_t * lv_msgbox_create(lv_obj_t * parent, const char * title, const char * txt, const char * btn_txts[],
|
||||
bool add_close_btn);
|
||||
|
||||
lv_obj_t * lv_msgbox_get_title(lv_obj_t * obj);
|
||||
|
||||
|
@ -158,8 +158,8 @@ void lv_spinbox_set_pos(lv_obj_t * obj, uint8_t pos)
|
||||
step_limit = LV_MAX(spinbox->range_max, (spinbox->range_min < 0 ? (-spinbox->range_min) : spinbox->range_min));
|
||||
int32_t new_step = spinbox->step * lv_pow(10, pos);
|
||||
if(pos <= 0) spinbox->step = 1;
|
||||
else if(new_step <= step_limit) spinbox->step = new_step;
|
||||
|
||||
else if(new_step <= step_limit) spinbox->step = new_step;
|
||||
|
||||
lv_spinbox_updatevalue(obj);
|
||||
}
|
||||
/*=====================
|
||||
|
@ -28,8 +28,8 @@ static void arc_anim_end_angle(void * obj, int32_t v);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
const lv_obj_class_t lv_spinner_class = {
|
||||
.base_class = &lv_arc_class,
|
||||
.constructor_cb = lv_spinner_constructor
|
||||
.base_class = &lv_arc_class,
|
||||
.constructor_cb = lv_spinner_constructor
|
||||
};
|
||||
|
||||
static uint32_t time_param;
|
||||
|
@ -30,13 +30,14 @@ static void cont_scroll_end_event_cb(lv_event_t * e);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
const lv_obj_class_t lv_tabview_class = {
|
||||
.constructor_cb = lv_tabview_constructor,
|
||||
.destructor_cb = lv_tabview_destructor,
|
||||
.event_cb = lv_tabview_event,
|
||||
.width_def = LV_PCT(100),
|
||||
.height_def = LV_PCT(100),
|
||||
.base_class = &lv_obj_class,
|
||||
.instance_size = sizeof(lv_tabview_t)};
|
||||
.constructor_cb = lv_tabview_constructor,
|
||||
.destructor_cb = lv_tabview_destructor,
|
||||
.event_cb = lv_tabview_event,
|
||||
.width_def = LV_PCT(100),
|
||||
.height_def = LV_PCT(100),
|
||||
.base_class = &lv_obj_class,
|
||||
.instance_size = sizeof(lv_tabview_t)
|
||||
};
|
||||
|
||||
static lv_dir_t tabpos_create;
|
||||
static lv_coord_t tabsize_create;
|
||||
@ -91,7 +92,8 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name)
|
||||
new_map[0] = lv_mem_alloc(strlen(name) + 1);
|
||||
strcpy((char *)new_map[0], name);
|
||||
new_map[1] = "";
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
new_map[tab_id * 2 - 3] = "\n";
|
||||
new_map[tab_id * 2 - 2] = lv_mem_alloc(strlen(name) + 1);
|
||||
new_map[tab_id * 2 - 1] = "";
|
||||
@ -102,7 +104,8 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name)
|
||||
lv_btnmatrix_set_map(btns, (const char **)new_map);
|
||||
lv_mem_free(old_map);
|
||||
|
||||
lv_btnmatrix_set_btn_ctrl_all(btns, LV_BTNMATRIX_CTRL_CHECKABLE | LV_BTNMATRIX_CTRL_CLICK_TRIG | LV_BTNMATRIX_CTRL_NO_REPEAT);
|
||||
lv_btnmatrix_set_btn_ctrl_all(btns, LV_BTNMATRIX_CTRL_CHECKABLE | LV_BTNMATRIX_CTRL_CLICK_TRIG |
|
||||
LV_BTNMATRIX_CTRL_NO_REPEAT);
|
||||
|
||||
tabview->tab_cnt++;
|
||||
if(tabview->tab_cnt == 1) {
|
||||
@ -131,7 +134,8 @@ void lv_tabview_set_act(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en)
|
||||
lv_coord_t w = lv_obj_get_content_width(cont);
|
||||
if(lv_obj_get_style_base_dir(obj, LV_PART_MAIN) != LV_BASE_DIR_RTL) {
|
||||
lv_obj_scroll_to_x(cont, id * (gap + w), anim_en);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
int32_t id_rtl = -(int32_t)id;
|
||||
lv_obj_scroll_to_x(cont, (gap + w) * id_rtl, anim_en);
|
||||
}
|
||||
@ -169,18 +173,18 @@ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob
|
||||
tabview->tab_pos = tabpos_create;
|
||||
|
||||
switch(tabview->tab_pos) {
|
||||
case LV_DIR_TOP:
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN);
|
||||
break;
|
||||
case LV_DIR_BOTTOM:
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN_REVERSE);
|
||||
break;
|
||||
case LV_DIR_LEFT:
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW);
|
||||
break;
|
||||
case LV_DIR_RIGHT:
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW_REVERSE);
|
||||
break;
|
||||
case LV_DIR_TOP:
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN);
|
||||
break;
|
||||
case LV_DIR_BOTTOM:
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_COLUMN_REVERSE);
|
||||
break;
|
||||
case LV_DIR_LEFT:
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW);
|
||||
break;
|
||||
case LV_DIR_RIGHT:
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW_REVERSE);
|
||||
break;
|
||||
}
|
||||
|
||||
lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100));
|
||||
@ -202,19 +206,19 @@ static void lv_tabview_constructor(const lv_obj_class_t * class_p, lv_obj_t * ob
|
||||
lv_obj_set_scrollbar_mode(cont, LV_SCROLLBAR_MODE_OFF);
|
||||
|
||||
switch(tabview->tab_pos) {
|
||||
case LV_DIR_TOP:
|
||||
case LV_DIR_BOTTOM:
|
||||
lv_obj_set_size(btnm, LV_PCT(100), tabsize_create);
|
||||
lv_obj_set_width(cont, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(cont, 1);
|
||||
break;
|
||||
case LV_DIR_LEFT:
|
||||
case LV_DIR_RIGHT:
|
||||
lv_obj_set_size(btnm, tabsize_create, LV_PCT(100));
|
||||
lv_obj_set_height(cont, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(cont, 1);
|
||||
break;
|
||||
}
|
||||
case LV_DIR_TOP:
|
||||
case LV_DIR_BOTTOM:
|
||||
lv_obj_set_size(btnm, LV_PCT(100), tabsize_create);
|
||||
lv_obj_set_width(cont, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(cont, 1);
|
||||
break;
|
||||
case LV_DIR_LEFT:
|
||||
case LV_DIR_RIGHT:
|
||||
lv_obj_set_size(btnm, tabsize_create, LV_PCT(100));
|
||||
lv_obj_set_height(cont, LV_PCT(100));
|
||||
lv_obj_set_flex_grow(cont, 1);
|
||||
break;
|
||||
}
|
||||
|
||||
lv_group_t * g = lv_group_get_default();
|
||||
if(g) lv_group_add_obj(g, btnm);
|
||||
@ -289,8 +293,8 @@ static void cont_scroll_end_event_cb(lv_event_t * e)
|
||||
lv_coord_t w = lv_obj_get_content_width(cont);
|
||||
lv_coord_t t;
|
||||
|
||||
if(lv_obj_get_style_base_dir(tv, LV_PART_MAIN) == LV_BASE_DIR_RTL) t = -(p.x - w/ 2) / w;
|
||||
else t = (p.x + w/ 2) / w;
|
||||
if(lv_obj_get_style_base_dir(tv, LV_PART_MAIN) == LV_BASE_DIR_RTL) t = -(p.x - w / 2) / w;
|
||||
else t = (p.x + w / 2) / w;
|
||||
|
||||
if(t < 0) t = 0;
|
||||
bool new_tab = false;
|
||||
|
@ -25,14 +25,13 @@ extern "C" {
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef struct
|
||||
{
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
char ** map;
|
||||
uint16_t tab_cnt;
|
||||
uint16_t tab_cur;
|
||||
lv_dir_t tab_pos;
|
||||
}lv_tabview_t;
|
||||
} lv_tabview_t;
|
||||
|
||||
extern const lv_obj_class_t lv_tabview_class;
|
||||
|
||||
|
@ -29,12 +29,14 @@ static void tileview_event_cb(lv_event_t * e);
|
||||
**********************/
|
||||
|
||||
const lv_obj_class_t lv_tileview_class = {.constructor_cb = lv_tileview_constructor,
|
||||
.base_class = &lv_obj_class,
|
||||
.instance_size = sizeof(lv_tileview_t)};
|
||||
.base_class = &lv_obj_class,
|
||||
.instance_size = sizeof(lv_tileview_t)
|
||||
};
|
||||
|
||||
const lv_obj_class_t lv_tileview_tile_class = {.constructor_cb = lv_tileview_tile_constructor,
|
||||
.base_class = &lv_obj_class,
|
||||
.instance_size = sizeof(lv_tileview_tile_t)};
|
||||
.base_class = &lv_obj_class,
|
||||
.instance_size = sizeof(lv_tileview_tile_t)
|
||||
};
|
||||
|
||||
static lv_dir_t create_dir;
|
||||
static uint32_t create_col_id;
|
||||
@ -135,7 +137,8 @@ static void lv_tileview_tile_constructor(const lv_obj_class_t * class_p, lv_obj_
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
lv_obj_set_size(obj, LV_PCT(100), LV_PCT(100));
|
||||
lv_obj_update_layout(obj); /*Be sure the size is correct*/
|
||||
lv_obj_set_pos(obj, create_col_id * lv_obj_get_content_width(parent), create_row_id * lv_obj_get_content_height(parent));
|
||||
lv_obj_set_pos(obj, create_col_id * lv_obj_get_content_width(parent),
|
||||
create_row_id * lv_obj_get_content_height(parent));
|
||||
|
||||
lv_tileview_tile_t * tile = (lv_tileview_tile_t *)obj;
|
||||
tile->dir = create_dir;
|
||||
|
@ -27,12 +27,12 @@ extern "C" {
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
lv_obj_t * tile_act;
|
||||
}lv_tileview_t;
|
||||
} lv_tileview_t;
|
||||
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
lv_dir_t dir;
|
||||
}lv_tileview_tile_t;
|
||||
} lv_tileview_tile_t;
|
||||
|
||||
extern const lv_obj_class_t lv_tileview_class;
|
||||
extern const lv_obj_class_t lv_tileview_tile_class;
|
||||
|
@ -27,11 +27,11 @@ static void lv_win_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj);
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
const lv_obj_class_t lv_win_class = {
|
||||
.constructor_cb = lv_win_constructor,
|
||||
.width_def = LV_PCT(100),
|
||||
.height_def = LV_PCT(100),
|
||||
.base_class = &lv_obj_class,
|
||||
.instance_size = sizeof(lv_win_t)
|
||||
.constructor_cb = lv_win_constructor,
|
||||
.width_def = LV_PCT(100),
|
||||
.height_def = LV_PCT(100),
|
||||
.base_class = &lv_obj_class,
|
||||
.instance_size = sizeof(lv_win_t)
|
||||
};
|
||||
static lv_coord_t create_header_height;
|
||||
/**********************
|
||||
|
@ -24,7 +24,7 @@ extern "C" {
|
||||
**********************/
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
}lv_win_t;
|
||||
} lv_win_t;
|
||||
|
||||
extern const lv_obj_class_t lv_win_class;
|
||||
|
||||
|
@ -128,7 +128,7 @@ const uint8_t * lv_font_get_bitmap_fmt_txt(const lv_font_t * font, uint32_t unic
|
||||
(uint8_t)fdsc->bpp, prefilter);
|
||||
return LV_GC_ROOT(_lv_font_decompr_buf);
|
||||
#else /*!LV_USE_FONT_COMPRESSED*/
|
||||
// LV_LOG_WARN("Compressed fonts is used but LV_USE_FONT_COMPRESSED is not enabled in lv_conf.h");
|
||||
LV_LOG_WARN("Compressed fonts is used but LV_USE_FONT_COMPRESSED is not enabled in lv_conf.h");
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
@ -5,13 +5,13 @@
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
|
||||
#include "lvgl.h"
|
||||
#include "lvgl.h"
|
||||
#else
|
||||
#include "../../lvgl.h"
|
||||
#include "../../lvgl.h"
|
||||
#endif
|
||||
|
||||
#ifndef LV_FONT_MONTSERRAT_10
|
||||
#define LV_FONT_MONTSERRAT_10 1
|
||||
#define LV_FONT_MONTSERRAT_10 1
|
||||
#endif
|
||||
|
||||
#if LV_FONT_MONTSERRAT_10
|
||||
@ -1155,8 +1155,7 @@ static const uint16_t unicode_list_1[] = {
|
||||
};
|
||||
|
||||
/*Collect the unicode lists and glyph_id offsets*/
|
||||
static const lv_font_fmt_txt_cmap_t cmaps[] =
|
||||
{
|
||||
static const lv_font_fmt_txt_cmap_t cmaps[] = {
|
||||
{
|
||||
.range_start = 32, .range_length = 95, .glyph_id_start = 1,
|
||||
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
|
||||
@ -1173,8 +1172,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] =
|
||||
|
||||
|
||||
/*Map glyph_ids to kern left classes*/
|
||||
static const uint8_t kern_left_class_mapping[] =
|
||||
{
|
||||
static const uint8_t kern_left_class_mapping[] = {
|
||||
0, 0, 1, 2, 0, 3, 4, 5,
|
||||
2, 6, 7, 8, 9, 10, 9, 10,
|
||||
11, 12, 0, 13, 14, 15, 16, 17,
|
||||
@ -1198,8 +1196,7 @@ static const uint8_t kern_left_class_mapping[] =
|
||||
};
|
||||
|
||||
/*Map glyph_ids to kern right classes*/
|
||||
static const uint8_t kern_right_class_mapping[] =
|
||||
{
|
||||
static const uint8_t kern_right_class_mapping[] = {
|
||||
0, 0, 1, 2, 0, 3, 4, 5,
|
||||
2, 6, 7, 8, 9, 10, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 12,
|
||||
@ -1223,8 +1220,7 @@ static const uint8_t kern_right_class_mapping[] =
|
||||
};
|
||||
|
||||
/*Kern values between classes*/
|
||||
static const int8_t kern_class_values[] =
|
||||
{
|
||||
static const int8_t kern_class_values[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 2, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
@ -1603,8 +1599,7 @@ static const int8_t kern_class_values[] =
|
||||
|
||||
|
||||
/*Collect the kern class' data in one place*/
|
||||
static const lv_font_fmt_txt_kern_classes_t kern_classes =
|
||||
{
|
||||
static const lv_font_fmt_txt_kern_classes_t kern_classes = {
|
||||
.class_pair_values = kern_class_values,
|
||||
.left_class_mapping = kern_left_class_mapping,
|
||||
.right_class_mapping = kern_right_class_mapping,
|
||||
|
@ -5,13 +5,13 @@
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
|
||||
#include "lvgl.h"
|
||||
#include "lvgl.h"
|
||||
#else
|
||||
#include "../../lvgl.h"
|
||||
#include "../../lvgl.h"
|
||||
#endif
|
||||
|
||||
#ifndef LV_FONT_MONTSERRAT_8
|
||||
#define LV_FONT_MONTSERRAT_8 1
|
||||
#define LV_FONT_MONTSERRAT_8 1
|
||||
#endif
|
||||
|
||||
#if LV_FONT_MONTSERRAT_8
|
||||
@ -941,8 +941,7 @@ static const uint16_t unicode_list_1[] = {
|
||||
};
|
||||
|
||||
/*Collect the unicode lists and glyph_id offsets*/
|
||||
static const lv_font_fmt_txt_cmap_t cmaps[] =
|
||||
{
|
||||
static const lv_font_fmt_txt_cmap_t cmaps[] = {
|
||||
{
|
||||
.range_start = 32, .range_length = 95, .glyph_id_start = 1,
|
||||
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
|
||||
@ -959,8 +958,7 @@ static const lv_font_fmt_txt_cmap_t cmaps[] =
|
||||
|
||||
|
||||
/*Map glyph_ids to kern left classes*/
|
||||
static const uint8_t kern_left_class_mapping[] =
|
||||
{
|
||||
static const uint8_t kern_left_class_mapping[] = {
|
||||
0, 0, 1, 2, 0, 3, 4, 5,
|
||||
2, 6, 7, 8, 9, 10, 9, 10,
|
||||
11, 12, 0, 13, 14, 15, 16, 17,
|
||||
@ -984,8 +982,7 @@ static const uint8_t kern_left_class_mapping[] =
|
||||
};
|
||||
|
||||
/*Map glyph_ids to kern right classes*/
|
||||
static const uint8_t kern_right_class_mapping[] =
|
||||
{
|
||||
static const uint8_t kern_right_class_mapping[] = {
|
||||
0, 0, 1, 2, 0, 3, 4, 5,
|
||||
2, 6, 7, 8, 9, 10, 9, 10,
|
||||
11, 12, 13, 14, 15, 16, 17, 12,
|
||||
@ -1009,8 +1006,7 @@ static const uint8_t kern_right_class_mapping[] =
|
||||
};
|
||||
|
||||
/*Kern values between classes*/
|
||||
static const int8_t kern_class_values[] =
|
||||
{
|
||||
static const int8_t kern_class_values[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 1, 0, 0, 0,
|
||||
0, 1, 0, 0, 0, 0, 0, 0,
|
||||
@ -1389,8 +1385,7 @@ static const int8_t kern_class_values[] =
|
||||
|
||||
|
||||
/*Collect the kern class' data in one place*/
|
||||
static const lv_font_fmt_txt_kern_classes_t kern_classes =
|
||||
{
|
||||
static const lv_font_fmt_txt_kern_classes_t kern_classes = {
|
||||
.class_pair_values = kern_class_values,
|
||||
.left_class_mapping = kern_left_class_mapping,
|
||||
.right_class_mapping = kern_right_class_mapping,
|
||||
|
@ -5,13 +5,13 @@
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
|
||||
#include "lvgl.h"
|
||||
#include "lvgl.h"
|
||||
#else
|
||||
#include "../../lvgl.h"
|
||||
#include "../../lvgl.h"
|
||||
#endif
|
||||
|
||||
#ifndef LV_FONT_UNSCII_16
|
||||
#define LV_FONT_UNSCII_16 1
|
||||
#define LV_FONT_UNSCII_16 1
|
||||
#endif
|
||||
|
||||
#if LV_FONT_UNSCII_16
|
||||
@ -587,8 +587,7 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
|
||||
|
||||
|
||||
/*Collect the unicode lists and glyph_id offsets*/
|
||||
static const lv_font_fmt_txt_cmap_t cmaps[] =
|
||||
{
|
||||
static const lv_font_fmt_txt_cmap_t cmaps[] = {
|
||||
{
|
||||
.range_start = 32, .range_length = 96, .glyph_id_start = 1,
|
||||
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
|
||||
|
@ -5,13 +5,13 @@
|
||||
******************************************************************************/
|
||||
|
||||
#ifdef LV_LVGL_H_INCLUDE_SIMPLE
|
||||
#include "lvgl.h"
|
||||
#include "lvgl.h"
|
||||
#else
|
||||
#include "../../lvgl.h"
|
||||
#include "../../lvgl.h"
|
||||
#endif
|
||||
|
||||
#ifndef LV_FONT_UNSCII_8
|
||||
#define LV_FONT_UNSCII_8 1
|
||||
#define LV_FONT_UNSCII_8 1
|
||||
#endif
|
||||
|
||||
#if LV_FONT_UNSCII_8
|
||||
@ -423,8 +423,7 @@ static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
|
||||
|
||||
|
||||
/*Collect the unicode lists and glyph_id offsets*/
|
||||
static const lv_font_fmt_txt_cmap_t cmaps[] =
|
||||
{
|
||||
static const lv_font_fmt_txt_cmap_t cmaps[] = {
|
||||
{
|
||||
.range_start = 32, .range_length = 96, .glyph_id_start = 1,
|
||||
.unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY
|
||||
|
@ -79,9 +79,9 @@
|
||||
defined(CPU_MIMXRT595SFFOC) || defined(CPU_MIMXRT595SFFOC_cm33)) && \
|
||||
((LV_HOR_RES_MAX > RT595_BLIT_WRKRND_THR) || (LV_VER_RES_MAX > RT595_BLIT_WRKRND_THR)) && \
|
||||
RT595_BLIT_WRKRND_ENABLED
|
||||
#define _BLIT_SPLIT_ENABLED 1
|
||||
#define _BLIT_SPLIT_ENABLED 1
|
||||
#else
|
||||
#define _BLIT_SPLIT_ENABLED 0
|
||||
#define _BLIT_SPLIT_ENABLED 0
|
||||
#endif
|
||||
|
||||
/* BLIT split threshold - BLITs with width or height higher than this value will be done
|
||||
@ -153,7 +153,8 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv
|
||||
lv_color32_t col32 = {.full = lv_color_to32(color)}; /*Convert color to RGBA8888*/
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
|
||||
if(_init_vg_buf(&rt, (uint32_t) dest_width, (uint32_t) dest_height, (uint32_t) dest_width * sizeof(lv_color_t), (const lv_color_t *) dest_buf, false) != LV_RES_OK) {
|
||||
if(_init_vg_buf(&rt, (uint32_t) dest_width, (uint32_t) dest_height, (uint32_t) dest_width * sizeof(lv_color_t),
|
||||
(const lv_color_t *) dest_buf, false) != LV_RES_OK) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("init_vg_buf reported error. Fill failed.");
|
||||
#endif
|
||||
@ -171,17 +172,17 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv
|
||||
}
|
||||
|
||||
err = vg_lite_clear(&rt, &rect, col32.full);
|
||||
if (err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_clear reported error. Fill failed.");
|
||||
#endif
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
err = vg_lite_finish();
|
||||
if (err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_finish reported error. Fill failed.");
|
||||
#endif
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
}
|
||||
@ -199,7 +200,8 @@ lv_res_t lv_gpu_nxp_vglite_fill(lv_color_t * dest_buf, lv_coord_t dest_width, lv
|
||||
};
|
||||
|
||||
err = vg_lite_init_path(&path, VG_LITE_S16, VG_LITE_LOW, sizeof(path_data), path_data,
|
||||
(vg_lite_float_t) fill_area->x1, (vg_lite_float_t) fill_area->y1, ((vg_lite_float_t) fill_area->x2) + 1.0f, ((vg_lite_float_t) fill_area->y2) + 1.0f);
|
||||
(vg_lite_float_t) fill_area->x1, (vg_lite_float_t) fill_area->y1, ((vg_lite_float_t) fill_area->x2) + 1.0f,
|
||||
((vg_lite_float_t) fill_area->y2) + 1.0f);
|
||||
if(err != VG_LITE_SUCCESS) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("vg_lite_init_path() failed.");
|
||||
@ -449,8 +451,8 @@ static lv_res_t _lv_gpu_nxp_vglite_blit_single(lv_gpu_nxp_vglite_blit_info_t * b
|
||||
lv_disp_t * disp = _lv_refr_get_disp_refreshing();
|
||||
|
||||
if(blit == NULL) {
|
||||
/*Wrong parameter*/
|
||||
return LV_RES_INV;
|
||||
/*Wrong parameter*/
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(blit->opa < (lv_opa_t) LV_OPA_MIN) {
|
||||
@ -458,14 +460,16 @@ static lv_res_t _lv_gpu_nxp_vglite_blit_single(lv_gpu_nxp_vglite_blit_info_t * b
|
||||
}
|
||||
|
||||
/*Wrap src/dst buffer into VG-Lite buffer*/
|
||||
if(_init_vg_buf(&src_vgbuf, (uint32_t) blit->src_width, (uint32_t) blit->src_height, (uint32_t) blit->src_stride, blit->src, true) != LV_RES_OK) {
|
||||
if(_init_vg_buf(&src_vgbuf, (uint32_t) blit->src_width, (uint32_t) blit->src_height, (uint32_t) blit->src_stride,
|
||||
blit->src, true) != LV_RES_OK) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("init_vg_buf reported error. BLIT failed.");
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(_init_vg_buf(&dst_vgbuf, (uint32_t) blit->dst_width, (uint32_t) blit->dst_height, (uint32_t) blit->dst_stride, blit->dst, false) != LV_RES_OK) {
|
||||
if(_init_vg_buf(&dst_vgbuf, (uint32_t) blit->dst_width, (uint32_t) blit->dst_height, (uint32_t) blit->dst_stride,
|
||||
blit->dst, false) != LV_RES_OK) {
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("init_vg_buf reported error. BLIT failed.");
|
||||
#endif
|
||||
@ -543,9 +547,11 @@ static lv_res_t _init_vg_buf(vg_lite_buffer_t * dst, uint32_t width, uint32_t he
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if(source && (stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * sizeof(lv_color_t))) != 0x0U) { /*Test for stride alignment*/
|
||||
if(source &&
|
||||
(stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * sizeof(lv_color_t))) != 0x0U) { /*Test for stride alignment*/
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("Buffer stride (%d px) not aligned to %d bytes.", stride, LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * sizeof(lv_color_t));
|
||||
LV_LOG_ERROR("Buffer stride (%d px) not aligned to %d bytes.", stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * sizeof(lv_color_t));
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@ -559,8 +565,8 @@ static lv_res_t _init_vg_buf(vg_lite_buffer_t * dst, uint32_t width, uint32_t he
|
||||
dst->height = (int32_t) height;
|
||||
dst->stride = (int32_t) stride;
|
||||
|
||||
void *r_ptr = memset(&dst->yuv, 0, sizeof(dst->yuv));
|
||||
if (r_ptr == NULL) {
|
||||
void * r_ptr = memset(&dst->yuv, 0, sizeof(dst->yuv));
|
||||
if(r_ptr == NULL) {
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
@ -642,16 +648,20 @@ static lv_res_t _lv_gpu_nxp_vglite_check_blit(lv_gpu_nxp_vglite_blit_info_t * bl
|
||||
}
|
||||
/* No alignment requirement for destination pixel buffer when using mode VG_LITE_LINEAR */
|
||||
|
||||
if((blit->src_stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * LV_COLOR_DEPTH / 8)) != 0x0) { /* Test for stride alignment */
|
||||
if((blit->src_stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * LV_COLOR_DEPTH / 8)) !=
|
||||
0x0) { /* Test for stride alignment */
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("source buffer stride (%d px) not aligned to %d px.", blit->src_stride, LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
LV_LOG_ERROR("source buffer stride (%d px) not aligned to %d px.", blit->src_stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if((blit->dst_stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * LV_COLOR_DEPTH / 8)) != 0x0) { /* Test for stride alignment */
|
||||
if((blit->dst_stride % (LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX * LV_COLOR_DEPTH / 8)) !=
|
||||
0x0) { /* Test for stride alignment */
|
||||
#if LV_GPU_NXP_VG_LITE_LOG_ERRORS
|
||||
LV_LOG_ERROR("destination buffer stride (%d px) not aligned to %d px.", blit->dst_stride, LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
LV_LOG_ERROR("destination buffer stride (%d px) not aligned to %d px.", blit->dst_stride,
|
||||
LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
#endif
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@ -675,7 +685,7 @@ static lv_res_t _lv_gpu_nxp_vglite_check_blit(lv_gpu_nxp_vglite_blit_info_t * bl
|
||||
static void _align_x(lv_area_t * area, lv_color_t ** buf)
|
||||
{
|
||||
|
||||
int alignedAreaStartPx = area->x1 - (area->x1 % (LV_ATTRIBUTE_MEM_ALIGN_SIZE * 8 / LV_COLOR_DEPTH) );
|
||||
int alignedAreaStartPx = area->x1 - (area->x1 % (LV_ATTRIBUTE_MEM_ALIGN_SIZE * 8 / LV_COLOR_DEPTH));
|
||||
CHECK(alignedAreaStartPx < 0, "Should never happen.");
|
||||
|
||||
area->x1 -= alignedAreaStartPx;
|
||||
@ -696,9 +706,11 @@ static void _align_y(lv_area_t * area, lv_color_t ** buf, uint32_t stridePx)
|
||||
/* find how many lines of pixels will respect memory alignment requirement */
|
||||
if(stridePx % LV_ATTRIBUTE_MEM_ALIGN_SIZE == 0) {
|
||||
alignedAreaStartPy = area->y1;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
LineToAlignMem = LV_ATTRIBUTE_MEM_ALIGN_SIZE / (sizeof(lv_color_t) * LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX);
|
||||
CHECK(LV_ATTRIBUTE_MEM_ALIGN_SIZE % (sizeof(lv_color_t) * LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX) != 0, "Complex case: need gcd function.");
|
||||
CHECK(LV_ATTRIBUTE_MEM_ALIGN_SIZE % (sizeof(lv_color_t) * LV_GPU_NXP_VG_LITE_STRIDE_ALIGN_PX) != 0,
|
||||
"Complex case: need gcd function.");
|
||||
alignedAreaStartPy = area->y1 - (area->y1 % LineToAlignMem);
|
||||
CHECK(alignedAreaStartPy < 0, "Should never happen.");
|
||||
}
|
||||
|
@ -18,7 +18,7 @@
|
||||
#include "../core/lv_refr.h"
|
||||
#include "../core/lv_theme.h"
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
#include "../extra/themes/default/lv_theme_default.h"
|
||||
#include "../extra/themes/default/lv_theme_default.h"
|
||||
#endif
|
||||
|
||||
/*********************
|
||||
@ -77,7 +77,7 @@ void lv_disp_drv_init(lv_disp_drv_t * driver)
|
||||
|
||||
driver->hor_res = 320;
|
||||
driver->ver_res = 240;
|
||||
driver->antialiasing = LV_COLOR_DEPTH > 8 ? 1: 0;
|
||||
driver->antialiasing = LV_COLOR_DEPTH > 8 ? 1 : 0;
|
||||
driver->screen_transp = LV_COLOR_SCREEN_TRANSP;
|
||||
driver->dpi = LV_DPI_DEF;
|
||||
driver->color_chroma_key = LV_COLOR_CHROMA_KEY;
|
||||
@ -151,7 +151,8 @@ lv_disp_t * lv_disp_drv_register(lv_disp_drv_t * driver)
|
||||
|
||||
#if LV_USE_THEME_DEFAULT
|
||||
if(lv_theme_default_is_inited() == false) {
|
||||
disp->theme = lv_theme_default_init(disp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED), LV_THEME_DEFAULT_DARK, LV_FONT_DEFAULT);
|
||||
disp->theme = lv_theme_default_init(disp, lv_palette_main(LV_PALETTE_BLUE), lv_palette_main(LV_PALETTE_RED),
|
||||
LV_THEME_DEFAULT_DARK, LV_FONT_DEFAULT);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -185,7 +186,8 @@ void lv_disp_drv_update(lv_disp_t * disp, lv_disp_drv_t * new_drv)
|
||||
{
|
||||
disp->driver = new_drv;
|
||||
|
||||
if(disp->driver->full_refresh && disp->driver->draw_buf->size < (uint32_t)disp->driver->hor_res * disp->driver->ver_res) {
|
||||
if(disp->driver->full_refresh &&
|
||||
disp->driver->draw_buf->size < (uint32_t)disp->driver->hor_res * disp->driver->ver_res) {
|
||||
disp->driver->full_refresh = 0;
|
||||
LV_LOG_WARN("full_refresh requires at least screen sized draw buffer(s)");
|
||||
}
|
||||
@ -237,15 +239,15 @@ void lv_disp_remove(lv_disp_t * disp)
|
||||
}
|
||||
|
||||
/** delete screen and other obj */
|
||||
if (disp->sys_layer) {
|
||||
if(disp->sys_layer) {
|
||||
lv_obj_del(disp->sys_layer);
|
||||
disp->sys_layer = NULL;
|
||||
}
|
||||
if (disp->top_layer) {
|
||||
if(disp->top_layer) {
|
||||
lv_obj_del(disp->top_layer);
|
||||
disp->top_layer = NULL;
|
||||
}
|
||||
while (disp->screen_cnt != 0) {
|
||||
while(disp->screen_cnt != 0) {
|
||||
/*Delete the screenst*/
|
||||
lv_obj_del(disp->screens[0]);
|
||||
}
|
||||
@ -286,7 +288,8 @@ lv_coord_t lv_disp_get_hor_res(lv_disp_t * disp)
|
||||
|
||||
if(disp == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
switch(disp->driver->rotated) {
|
||||
case LV_DISP_ROT_90:
|
||||
case LV_DISP_ROT_270:
|
||||
@ -308,7 +311,8 @@ lv_coord_t lv_disp_get_ver_res(lv_disp_t * disp)
|
||||
|
||||
if(disp == NULL) {
|
||||
return 0;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
switch(disp->driver->rotated) {
|
||||
case LV_DISP_ROT_90:
|
||||
case LV_DISP_ROT_270:
|
||||
|
@ -47,7 +47,7 @@ struct _lv_theme_t;
|
||||
/**
|
||||
* Structure for holding display buffer information.
|
||||
*/
|
||||
typedef struct _lv_disp_draw_buf_t{
|
||||
typedef struct _lv_disp_draw_buf_t {
|
||||
void * buf1; /**< First display buffer.*/
|
||||
void * buf2; /**< Second display buffer.*/
|
||||
|
||||
@ -161,7 +161,8 @@ typedef struct _lv_disp_t {
|
||||
struct _lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top*/
|
||||
struct _lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys*/
|
||||
uint32_t screen_cnt;
|
||||
uint8_t del_prev : 1; /**< 1: Automatically delete the previous screen when the screen load animation is ready*/
|
||||
uint8_t del_prev :
|
||||
1; /**< 1: Automatically delete the previous screen when the screen load animation is ready*/
|
||||
|
||||
lv_opa_t bg_opa; /**<Opacity of the background color or wallpaper*/
|
||||
lv_color_t bg_color; /**< Default display color when screens are transparent*/
|
||||
|
@ -39,9 +39,9 @@
|
||||
* MACROS
|
||||
**********************/
|
||||
#if LV_LOG_TRACE_INDEV
|
||||
# define INDEV_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#define INDEV_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#else
|
||||
# define INDEV_TRACE(...)
|
||||
#define INDEV_TRACE(...)
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
|
@ -52,9 +52,9 @@ static inline LV_ATTRIBUTE_TIMER_HANDLER uint32_t lv_task_handler(void)
|
||||
* It also means it can cover any of the siblings.
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
static inline void lv_obj_move_foreground(lv_obj_t* obj)
|
||||
static inline void lv_obj_move_foreground(lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_t* parent = lv_obj_get_parent(obj);
|
||||
lv_obj_t * parent = lv_obj_get_parent(obj);
|
||||
lv_obj_move_to_index(obj, lv_obj_get_child_cnt(parent) - 1);
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ static inline void lv_obj_move_foreground(lv_obj_t* obj)
|
||||
* It also means any of the siblings can cover the object.
|
||||
* @param obj pointer to an object
|
||||
*/
|
||||
static inline void lv_obj_move_background(lv_obj_t* obj)
|
||||
static inline void lv_obj_move_background(lv_obj_t * obj)
|
||||
{
|
||||
lv_obj_move_to_index(obj, 0);
|
||||
}
|
||||
@ -75,7 +75,7 @@ static inline void lv_obj_move_background(lv_obj_t* obj)
|
||||
* DEPRECATED FUNCTIONS
|
||||
**********************/
|
||||
|
||||
static inline uint32_t lv_obj_get_child_id(const struct _lv_obj_t* obj)
|
||||
static inline uint32_t lv_obj_get_child_id(const struct _lv_obj_t * obj)
|
||||
{
|
||||
LV_LOG_WARN("lv_obj_get_child_id(obj) is deprecated, please use lv_obj_get_index(obj).");
|
||||
return lv_obj_get_index(obj);
|
||||
|
@ -46,9 +46,9 @@ static lv_timer_t * _lv_anim_tmr;
|
||||
* MACROS
|
||||
**********************/
|
||||
#if LV_LOG_TRACE_ANIM
|
||||
# define TRACE_ANIM(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#define TRACE_ANIM(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#else
|
||||
# define TRACE_ANIM(...)
|
||||
#define TRACE_ANIM(...)
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ extern "C" {
|
||||
typedef enum {
|
||||
LV_ANIM_OFF,
|
||||
LV_ANIM_ON,
|
||||
}lv_anim_enable_t;
|
||||
} lv_anim_enable_t;
|
||||
|
||||
#define LV_ANIM_REPEAT_INFINITE 0xFFFF
|
||||
LV_EXPORT_CONST_INT(LV_ANIM_REPEAT_INFINITE);
|
||||
|
@ -293,79 +293,79 @@ lv_color_t lv_palette_main(lv_palette_t p)
|
||||
lv_color_t lv_palette_lighten(lv_palette_t p, uint8_t lvl)
|
||||
{
|
||||
static const lv_color_t colors[][5] = {
|
||||
{LV_COLOR_MAKE(0xEF, 0x53, 0x50), LV_COLOR_MAKE(0xE5, 0x73, 0x73), LV_COLOR_MAKE(0xEF, 0x9A, 0x9A), LV_COLOR_MAKE(0xFF, 0xCD, 0xD2), LV_COLOR_MAKE(0xFF, 0xEB, 0xEE)},
|
||||
{LV_COLOR_MAKE(0xEC, 0x40, 0x7A), LV_COLOR_MAKE(0xF0, 0x62, 0x92), LV_COLOR_MAKE(0xF4, 0x8F, 0xB1), LV_COLOR_MAKE(0xF8, 0xBB, 0xD0), LV_COLOR_MAKE(0xFC, 0xE4, 0xEC)},
|
||||
{LV_COLOR_MAKE(0xAB, 0x47, 0xBC), LV_COLOR_MAKE(0xBA, 0x68, 0xC8), LV_COLOR_MAKE(0xCE, 0x93, 0xD8), LV_COLOR_MAKE(0xE1, 0xBE, 0xE7), LV_COLOR_MAKE(0xF3, 0xE5, 0xF5)},
|
||||
{LV_COLOR_MAKE(0x7E, 0x57, 0xC2), LV_COLOR_MAKE(0x95, 0x75, 0xCD), LV_COLOR_MAKE(0xB3, 0x9D, 0xDB), LV_COLOR_MAKE(0xD1, 0xC4, 0xE9), LV_COLOR_MAKE(0xED, 0xE7, 0xF6)},
|
||||
{LV_COLOR_MAKE(0x5C, 0x6B, 0xC0), LV_COLOR_MAKE(0x79, 0x86, 0xCB), LV_COLOR_MAKE(0x9F, 0xA8, 0xDA), LV_COLOR_MAKE(0xC5, 0xCA, 0xE9), LV_COLOR_MAKE(0xE8, 0xEA, 0xF6)},
|
||||
{LV_COLOR_MAKE(0x42, 0xA5, 0xF5), LV_COLOR_MAKE(0x64, 0xB5, 0xF6), LV_COLOR_MAKE(0x90, 0xCA, 0xF9), LV_COLOR_MAKE(0xBB, 0xDE, 0xFB), LV_COLOR_MAKE(0xE3, 0xF2, 0xFD)},
|
||||
{LV_COLOR_MAKE(0x29, 0xB6, 0xF6), LV_COLOR_MAKE(0x4F, 0xC3, 0xF7), LV_COLOR_MAKE(0x81, 0xD4, 0xFA), LV_COLOR_MAKE(0xB3, 0xE5, 0xFC), LV_COLOR_MAKE(0xE1, 0xF5, 0xFE)},
|
||||
{LV_COLOR_MAKE(0x26, 0xC6, 0xDA), LV_COLOR_MAKE(0x4D, 0xD0, 0xE1), LV_COLOR_MAKE(0x80, 0xDE, 0xEA), LV_COLOR_MAKE(0xB2, 0xEB, 0xF2), LV_COLOR_MAKE(0xE0, 0xF7, 0xFA)},
|
||||
{LV_COLOR_MAKE(0x26, 0xA6, 0x9A), LV_COLOR_MAKE(0x4D, 0xB6, 0xAC), LV_COLOR_MAKE(0x80, 0xCB, 0xC4), LV_COLOR_MAKE(0xB2, 0xDF, 0xDB), LV_COLOR_MAKE(0xE0, 0xF2, 0xF1)},
|
||||
{LV_COLOR_MAKE(0x66, 0xBB, 0x6A), LV_COLOR_MAKE(0x81, 0xC7, 0x84), LV_COLOR_MAKE(0xA5, 0xD6, 0xA7), LV_COLOR_MAKE(0xC8, 0xE6, 0xC9), LV_COLOR_MAKE(0xE8, 0xF5, 0xE9)},
|
||||
{LV_COLOR_MAKE(0x9C, 0xCC, 0x65), LV_COLOR_MAKE(0xAE, 0xD5, 0x81), LV_COLOR_MAKE(0xC5, 0xE1, 0xA5), LV_COLOR_MAKE(0xDC, 0xED, 0xC8), LV_COLOR_MAKE(0xF1, 0xF8, 0xE9)},
|
||||
{LV_COLOR_MAKE(0xD4, 0xE1, 0x57), LV_COLOR_MAKE(0xDC, 0xE7, 0x75), LV_COLOR_MAKE(0xE6, 0xEE, 0x9C), LV_COLOR_MAKE(0xF0, 0xF4, 0xC3), LV_COLOR_MAKE(0xF9, 0xFB, 0xE7)},
|
||||
{LV_COLOR_MAKE(0xFF, 0xEE, 0x58), LV_COLOR_MAKE(0xFF, 0xF1, 0x76), LV_COLOR_MAKE(0xFF, 0xF5, 0x9D), LV_COLOR_MAKE(0xFF, 0xF9, 0xC4), LV_COLOR_MAKE(0xFF, 0xFD, 0xE7)},
|
||||
{LV_COLOR_MAKE(0xFF, 0xCA, 0x28), LV_COLOR_MAKE(0xFF, 0xD5, 0x4F), LV_COLOR_MAKE(0xFF, 0xE0, 0x82), LV_COLOR_MAKE(0xFF, 0xEC, 0xB3), LV_COLOR_MAKE(0xFF, 0xF8, 0xE1)},
|
||||
{LV_COLOR_MAKE(0xFF, 0xA7, 0x26), LV_COLOR_MAKE(0xFF, 0xB7, 0x4D), LV_COLOR_MAKE(0xFF, 0xCC, 0x80), LV_COLOR_MAKE(0xFF, 0xE0, 0xB2), LV_COLOR_MAKE(0xFF, 0xF3, 0xE0)},
|
||||
{LV_COLOR_MAKE(0xFF, 0x70, 0x43), LV_COLOR_MAKE(0xFF, 0x8A, 0x65), LV_COLOR_MAKE(0xFF, 0xAB, 0x91), LV_COLOR_MAKE(0xFF, 0xCC, 0xBC), LV_COLOR_MAKE(0xFB, 0xE9, 0xE7)},
|
||||
{LV_COLOR_MAKE(0x8D, 0x6E, 0x63), LV_COLOR_MAKE(0xA1, 0x88, 0x7F), LV_COLOR_MAKE(0xBC, 0xAA, 0xA4), LV_COLOR_MAKE(0xD7, 0xCC, 0xC8), LV_COLOR_MAKE(0xEF, 0xEB, 0xE9)},
|
||||
{LV_COLOR_MAKE(0x78, 0x90, 0x9C), LV_COLOR_MAKE(0x90, 0xA4, 0xAE), LV_COLOR_MAKE(0xB0, 0xBE, 0xC5), LV_COLOR_MAKE(0xCF, 0xD8, 0xDC), LV_COLOR_MAKE(0xEC, 0xEF, 0xF1)},
|
||||
{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)},
|
||||
{LV_COLOR_MAKE(0xEF, 0x53, 0x50), LV_COLOR_MAKE(0xE5, 0x73, 0x73), LV_COLOR_MAKE(0xEF, 0x9A, 0x9A), LV_COLOR_MAKE(0xFF, 0xCD, 0xD2), LV_COLOR_MAKE(0xFF, 0xEB, 0xEE)},
|
||||
{LV_COLOR_MAKE(0xEC, 0x40, 0x7A), LV_COLOR_MAKE(0xF0, 0x62, 0x92), LV_COLOR_MAKE(0xF4, 0x8F, 0xB1), LV_COLOR_MAKE(0xF8, 0xBB, 0xD0), LV_COLOR_MAKE(0xFC, 0xE4, 0xEC)},
|
||||
{LV_COLOR_MAKE(0xAB, 0x47, 0xBC), LV_COLOR_MAKE(0xBA, 0x68, 0xC8), LV_COLOR_MAKE(0xCE, 0x93, 0xD8), LV_COLOR_MAKE(0xE1, 0xBE, 0xE7), LV_COLOR_MAKE(0xF3, 0xE5, 0xF5)},
|
||||
{LV_COLOR_MAKE(0x7E, 0x57, 0xC2), LV_COLOR_MAKE(0x95, 0x75, 0xCD), LV_COLOR_MAKE(0xB3, 0x9D, 0xDB), LV_COLOR_MAKE(0xD1, 0xC4, 0xE9), LV_COLOR_MAKE(0xED, 0xE7, 0xF6)},
|
||||
{LV_COLOR_MAKE(0x5C, 0x6B, 0xC0), LV_COLOR_MAKE(0x79, 0x86, 0xCB), LV_COLOR_MAKE(0x9F, 0xA8, 0xDA), LV_COLOR_MAKE(0xC5, 0xCA, 0xE9), LV_COLOR_MAKE(0xE8, 0xEA, 0xF6)},
|
||||
{LV_COLOR_MAKE(0x42, 0xA5, 0xF5), LV_COLOR_MAKE(0x64, 0xB5, 0xF6), LV_COLOR_MAKE(0x90, 0xCA, 0xF9), LV_COLOR_MAKE(0xBB, 0xDE, 0xFB), LV_COLOR_MAKE(0xE3, 0xF2, 0xFD)},
|
||||
{LV_COLOR_MAKE(0x29, 0xB6, 0xF6), LV_COLOR_MAKE(0x4F, 0xC3, 0xF7), LV_COLOR_MAKE(0x81, 0xD4, 0xFA), LV_COLOR_MAKE(0xB3, 0xE5, 0xFC), LV_COLOR_MAKE(0xE1, 0xF5, 0xFE)},
|
||||
{LV_COLOR_MAKE(0x26, 0xC6, 0xDA), LV_COLOR_MAKE(0x4D, 0xD0, 0xE1), LV_COLOR_MAKE(0x80, 0xDE, 0xEA), LV_COLOR_MAKE(0xB2, 0xEB, 0xF2), LV_COLOR_MAKE(0xE0, 0xF7, 0xFA)},
|
||||
{LV_COLOR_MAKE(0x26, 0xA6, 0x9A), LV_COLOR_MAKE(0x4D, 0xB6, 0xAC), LV_COLOR_MAKE(0x80, 0xCB, 0xC4), LV_COLOR_MAKE(0xB2, 0xDF, 0xDB), LV_COLOR_MAKE(0xE0, 0xF2, 0xF1)},
|
||||
{LV_COLOR_MAKE(0x66, 0xBB, 0x6A), LV_COLOR_MAKE(0x81, 0xC7, 0x84), LV_COLOR_MAKE(0xA5, 0xD6, 0xA7), LV_COLOR_MAKE(0xC8, 0xE6, 0xC9), LV_COLOR_MAKE(0xE8, 0xF5, 0xE9)},
|
||||
{LV_COLOR_MAKE(0x9C, 0xCC, 0x65), LV_COLOR_MAKE(0xAE, 0xD5, 0x81), LV_COLOR_MAKE(0xC5, 0xE1, 0xA5), LV_COLOR_MAKE(0xDC, 0xED, 0xC8), LV_COLOR_MAKE(0xF1, 0xF8, 0xE9)},
|
||||
{LV_COLOR_MAKE(0xD4, 0xE1, 0x57), LV_COLOR_MAKE(0xDC, 0xE7, 0x75), LV_COLOR_MAKE(0xE6, 0xEE, 0x9C), LV_COLOR_MAKE(0xF0, 0xF4, 0xC3), LV_COLOR_MAKE(0xF9, 0xFB, 0xE7)},
|
||||
{LV_COLOR_MAKE(0xFF, 0xEE, 0x58), LV_COLOR_MAKE(0xFF, 0xF1, 0x76), LV_COLOR_MAKE(0xFF, 0xF5, 0x9D), LV_COLOR_MAKE(0xFF, 0xF9, 0xC4), LV_COLOR_MAKE(0xFF, 0xFD, 0xE7)},
|
||||
{LV_COLOR_MAKE(0xFF, 0xCA, 0x28), LV_COLOR_MAKE(0xFF, 0xD5, 0x4F), LV_COLOR_MAKE(0xFF, 0xE0, 0x82), LV_COLOR_MAKE(0xFF, 0xEC, 0xB3), LV_COLOR_MAKE(0xFF, 0xF8, 0xE1)},
|
||||
{LV_COLOR_MAKE(0xFF, 0xA7, 0x26), LV_COLOR_MAKE(0xFF, 0xB7, 0x4D), LV_COLOR_MAKE(0xFF, 0xCC, 0x80), LV_COLOR_MAKE(0xFF, 0xE0, 0xB2), LV_COLOR_MAKE(0xFF, 0xF3, 0xE0)},
|
||||
{LV_COLOR_MAKE(0xFF, 0x70, 0x43), LV_COLOR_MAKE(0xFF, 0x8A, 0x65), LV_COLOR_MAKE(0xFF, 0xAB, 0x91), LV_COLOR_MAKE(0xFF, 0xCC, 0xBC), LV_COLOR_MAKE(0xFB, 0xE9, 0xE7)},
|
||||
{LV_COLOR_MAKE(0x8D, 0x6E, 0x63), LV_COLOR_MAKE(0xA1, 0x88, 0x7F), LV_COLOR_MAKE(0xBC, 0xAA, 0xA4), LV_COLOR_MAKE(0xD7, 0xCC, 0xC8), LV_COLOR_MAKE(0xEF, 0xEB, 0xE9)},
|
||||
{LV_COLOR_MAKE(0x78, 0x90, 0x9C), LV_COLOR_MAKE(0x90, 0xA4, 0xAE), LV_COLOR_MAKE(0xB0, 0xBE, 0xC5), LV_COLOR_MAKE(0xCF, 0xD8, 0xDC), LV_COLOR_MAKE(0xEC, 0xEF, 0xF1)},
|
||||
{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) {
|
||||
LV_LOG_WARN("Invalid palette: %d", p);
|
||||
return lv_color_black();
|
||||
}
|
||||
if(p >= _LV_PALETTE_LAST) {
|
||||
LV_LOG_WARN("Invalid palette: %d", p);
|
||||
return lv_color_black();
|
||||
}
|
||||
|
||||
if(lvl == 0 || lvl > 5) {
|
||||
LV_LOG_WARN("Invalid level: %d. Must be 1..5", lvl);
|
||||
return lv_color_black();
|
||||
}
|
||||
if(lvl == 0 || lvl > 5) {
|
||||
LV_LOG_WARN("Invalid level: %d. Must be 1..5", lvl);
|
||||
return lv_color_black();
|
||||
}
|
||||
|
||||
lvl--;
|
||||
lvl--;
|
||||
|
||||
return colors[p][lvl];
|
||||
return colors[p][lvl];
|
||||
}
|
||||
|
||||
lv_color_t lv_palette_darken(lv_palette_t p, uint8_t lvl)
|
||||
{
|
||||
static const lv_color_t colors[][4] = {
|
||||
{LV_COLOR_MAKE(0xE5, 0x39, 0x35), LV_COLOR_MAKE(0xD3, 0x2F, 0x2F), LV_COLOR_MAKE(0xC6, 0x28, 0x28), LV_COLOR_MAKE(0xB7, 0x1C, 0x1C)},
|
||||
{LV_COLOR_MAKE(0xD8, 0x1B, 0x60), LV_COLOR_MAKE(0xC2, 0x18, 0x5B), LV_COLOR_MAKE(0xAD, 0x14, 0x57), LV_COLOR_MAKE(0x88, 0x0E, 0x4F)},
|
||||
{LV_COLOR_MAKE(0x8E, 0x24, 0xAA), LV_COLOR_MAKE(0x7B, 0x1F, 0xA2), LV_COLOR_MAKE(0x6A, 0x1B, 0x9A), LV_COLOR_MAKE(0x4A, 0x14, 0x8C)},
|
||||
{LV_COLOR_MAKE(0x5E, 0x35, 0xB1), LV_COLOR_MAKE(0x51, 0x2D, 0xA8), LV_COLOR_MAKE(0x45, 0x27, 0xA0), LV_COLOR_MAKE(0x31, 0x1B, 0x92)},
|
||||
{LV_COLOR_MAKE(0x39, 0x49, 0xAB), LV_COLOR_MAKE(0x30, 0x3F, 0x9F), LV_COLOR_MAKE(0x28, 0x35, 0x93), LV_COLOR_MAKE(0x1A, 0x23, 0x7E)},
|
||||
{LV_COLOR_MAKE(0x1E, 0x88, 0xE5), LV_COLOR_MAKE(0x19, 0x76, 0xD2), LV_COLOR_MAKE(0x15, 0x65, 0xC0), LV_COLOR_MAKE(0x0D, 0x47, 0xA1)},
|
||||
{LV_COLOR_MAKE(0x03, 0x9B, 0xE5), LV_COLOR_MAKE(0x02, 0x88, 0xD1), LV_COLOR_MAKE(0x02, 0x77, 0xBD), LV_COLOR_MAKE(0x01, 0x57, 0x9B)},
|
||||
{LV_COLOR_MAKE(0x00, 0xAC, 0xC1), LV_COLOR_MAKE(0x00, 0x97, 0xA7), LV_COLOR_MAKE(0x00, 0x83, 0x8F), LV_COLOR_MAKE(0x00, 0x60, 0x64)},
|
||||
{LV_COLOR_MAKE(0x00, 0x89, 0x7B), LV_COLOR_MAKE(0x00, 0x79, 0x6B), LV_COLOR_MAKE(0x00, 0x69, 0x5C), LV_COLOR_MAKE(0x00, 0x4D, 0x40)},
|
||||
{LV_COLOR_MAKE(0x43, 0xA0, 0x47), LV_COLOR_MAKE(0x38, 0x8E, 0x3C), LV_COLOR_MAKE(0x2E, 0x7D, 0x32), LV_COLOR_MAKE(0x1B, 0x5E, 0x20)},
|
||||
{LV_COLOR_MAKE(0x7C, 0xB3, 0x42), LV_COLOR_MAKE(0x68, 0x9F, 0x38), LV_COLOR_MAKE(0x55, 0x8B, 0x2F), LV_COLOR_MAKE(0x33, 0x69, 0x1E)},
|
||||
{LV_COLOR_MAKE(0xC0, 0xCA, 0x33), LV_COLOR_MAKE(0xAF, 0xB4, 0x2B), LV_COLOR_MAKE(0x9E, 0x9D, 0x24), LV_COLOR_MAKE(0x82, 0x77, 0x17)},
|
||||
{LV_COLOR_MAKE(0xFD, 0xD8, 0x35), LV_COLOR_MAKE(0xFB, 0xC0, 0x2D), LV_COLOR_MAKE(0xF9, 0xA8, 0x25), LV_COLOR_MAKE(0xF5, 0x7F, 0x17)},
|
||||
{LV_COLOR_MAKE(0xFF, 0xB3, 0x00), LV_COLOR_MAKE(0xFF, 0xA0, 0x00), LV_COLOR_MAKE(0xFF, 0x8F, 0x00), LV_COLOR_MAKE(0xFF, 0x6F, 0x00)},
|
||||
{LV_COLOR_MAKE(0xFB, 0x8C, 0x00), LV_COLOR_MAKE(0xF5, 0x7C, 0x00), LV_COLOR_MAKE(0xEF, 0x6C, 0x00), LV_COLOR_MAKE(0xE6, 0x51, 0x00)},
|
||||
{LV_COLOR_MAKE(0xF4, 0x51, 0x1E), LV_COLOR_MAKE(0xE6, 0x4A, 0x19), LV_COLOR_MAKE(0xD8, 0x43, 0x15), LV_COLOR_MAKE(0xBF, 0x36, 0x0C)},
|
||||
{LV_COLOR_MAKE(0x6D, 0x4C, 0x41), LV_COLOR_MAKE(0x5D, 0x40, 0x37), LV_COLOR_MAKE(0x4E, 0x34, 0x2E), LV_COLOR_MAKE(0x3E, 0x27, 0x23)},
|
||||
{LV_COLOR_MAKE(0x54, 0x6E, 0x7A), LV_COLOR_MAKE(0x45, 0x5A, 0x64), LV_COLOR_MAKE(0x37, 0x47, 0x4F), LV_COLOR_MAKE(0x26, 0x32, 0x38)},
|
||||
{LV_COLOR_MAKE(0x75, 0x75, 0x75), LV_COLOR_MAKE(0x61, 0x61, 0x61), LV_COLOR_MAKE(0x42, 0x42, 0x42), LV_COLOR_MAKE(0x21, 0x21, 0x21)},
|
||||
{LV_COLOR_MAKE(0xE5, 0x39, 0x35), LV_COLOR_MAKE(0xD3, 0x2F, 0x2F), LV_COLOR_MAKE(0xC6, 0x28, 0x28), LV_COLOR_MAKE(0xB7, 0x1C, 0x1C)},
|
||||
{LV_COLOR_MAKE(0xD8, 0x1B, 0x60), LV_COLOR_MAKE(0xC2, 0x18, 0x5B), LV_COLOR_MAKE(0xAD, 0x14, 0x57), LV_COLOR_MAKE(0x88, 0x0E, 0x4F)},
|
||||
{LV_COLOR_MAKE(0x8E, 0x24, 0xAA), LV_COLOR_MAKE(0x7B, 0x1F, 0xA2), LV_COLOR_MAKE(0x6A, 0x1B, 0x9A), LV_COLOR_MAKE(0x4A, 0x14, 0x8C)},
|
||||
{LV_COLOR_MAKE(0x5E, 0x35, 0xB1), LV_COLOR_MAKE(0x51, 0x2D, 0xA8), LV_COLOR_MAKE(0x45, 0x27, 0xA0), LV_COLOR_MAKE(0x31, 0x1B, 0x92)},
|
||||
{LV_COLOR_MAKE(0x39, 0x49, 0xAB), LV_COLOR_MAKE(0x30, 0x3F, 0x9F), LV_COLOR_MAKE(0x28, 0x35, 0x93), LV_COLOR_MAKE(0x1A, 0x23, 0x7E)},
|
||||
{LV_COLOR_MAKE(0x1E, 0x88, 0xE5), LV_COLOR_MAKE(0x19, 0x76, 0xD2), LV_COLOR_MAKE(0x15, 0x65, 0xC0), LV_COLOR_MAKE(0x0D, 0x47, 0xA1)},
|
||||
{LV_COLOR_MAKE(0x03, 0x9B, 0xE5), LV_COLOR_MAKE(0x02, 0x88, 0xD1), LV_COLOR_MAKE(0x02, 0x77, 0xBD), LV_COLOR_MAKE(0x01, 0x57, 0x9B)},
|
||||
{LV_COLOR_MAKE(0x00, 0xAC, 0xC1), LV_COLOR_MAKE(0x00, 0x97, 0xA7), LV_COLOR_MAKE(0x00, 0x83, 0x8F), LV_COLOR_MAKE(0x00, 0x60, 0x64)},
|
||||
{LV_COLOR_MAKE(0x00, 0x89, 0x7B), LV_COLOR_MAKE(0x00, 0x79, 0x6B), LV_COLOR_MAKE(0x00, 0x69, 0x5C), LV_COLOR_MAKE(0x00, 0x4D, 0x40)},
|
||||
{LV_COLOR_MAKE(0x43, 0xA0, 0x47), LV_COLOR_MAKE(0x38, 0x8E, 0x3C), LV_COLOR_MAKE(0x2E, 0x7D, 0x32), LV_COLOR_MAKE(0x1B, 0x5E, 0x20)},
|
||||
{LV_COLOR_MAKE(0x7C, 0xB3, 0x42), LV_COLOR_MAKE(0x68, 0x9F, 0x38), LV_COLOR_MAKE(0x55, 0x8B, 0x2F), LV_COLOR_MAKE(0x33, 0x69, 0x1E)},
|
||||
{LV_COLOR_MAKE(0xC0, 0xCA, 0x33), LV_COLOR_MAKE(0xAF, 0xB4, 0x2B), LV_COLOR_MAKE(0x9E, 0x9D, 0x24), LV_COLOR_MAKE(0x82, 0x77, 0x17)},
|
||||
{LV_COLOR_MAKE(0xFD, 0xD8, 0x35), LV_COLOR_MAKE(0xFB, 0xC0, 0x2D), LV_COLOR_MAKE(0xF9, 0xA8, 0x25), LV_COLOR_MAKE(0xF5, 0x7F, 0x17)},
|
||||
{LV_COLOR_MAKE(0xFF, 0xB3, 0x00), LV_COLOR_MAKE(0xFF, 0xA0, 0x00), LV_COLOR_MAKE(0xFF, 0x8F, 0x00), LV_COLOR_MAKE(0xFF, 0x6F, 0x00)},
|
||||
{LV_COLOR_MAKE(0xFB, 0x8C, 0x00), LV_COLOR_MAKE(0xF5, 0x7C, 0x00), LV_COLOR_MAKE(0xEF, 0x6C, 0x00), LV_COLOR_MAKE(0xE6, 0x51, 0x00)},
|
||||
{LV_COLOR_MAKE(0xF4, 0x51, 0x1E), LV_COLOR_MAKE(0xE6, 0x4A, 0x19), LV_COLOR_MAKE(0xD8, 0x43, 0x15), LV_COLOR_MAKE(0xBF, 0x36, 0x0C)},
|
||||
{LV_COLOR_MAKE(0x6D, 0x4C, 0x41), LV_COLOR_MAKE(0x5D, 0x40, 0x37), LV_COLOR_MAKE(0x4E, 0x34, 0x2E), LV_COLOR_MAKE(0x3E, 0x27, 0x23)},
|
||||
{LV_COLOR_MAKE(0x54, 0x6E, 0x7A), LV_COLOR_MAKE(0x45, 0x5A, 0x64), LV_COLOR_MAKE(0x37, 0x47, 0x4F), LV_COLOR_MAKE(0x26, 0x32, 0x38)},
|
||||
{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) {
|
||||
LV_LOG_WARN("Invalid palette: %d", p);
|
||||
return lv_color_black();
|
||||
}
|
||||
if(p >= _LV_PALETTE_LAST) {
|
||||
LV_LOG_WARN("Invalid palette: %d", p);
|
||||
return lv_color_black();
|
||||
}
|
||||
|
||||
if(lvl == 0 || lvl > 4) {
|
||||
LV_LOG_WARN("Invalid level: %d. Must be 1..4", lvl);
|
||||
return lv_color_black();
|
||||
}
|
||||
if(lvl == 0 || lvl > 4) {
|
||||
LV_LOG_WARN("Invalid level: %d. Must be 1..4", lvl);
|
||||
return lv_color_black();
|
||||
}
|
||||
|
||||
lvl--;
|
||||
lvl--;
|
||||
|
||||
return colors[p][lvl];
|
||||
return colors[p][lvl];
|
||||
}
|
||||
|
||||
|
||||
|
@ -272,7 +272,7 @@ typedef lv_color_t (*lv_color_filter_cb_t)(const struct _lv_color_filter_dsc_t *
|
||||
typedef struct _lv_color_filter_dsc_t {
|
||||
lv_color_filter_cb_t filter_cb;
|
||||
void * user_data;
|
||||
}lv_color_filter_dsc_t;
|
||||
} lv_color_filter_dsc_t;
|
||||
|
||||
|
||||
typedef enum {
|
||||
@ -297,7 +297,7 @@ typedef enum {
|
||||
LV_PALETTE_GREY,
|
||||
_LV_PALETTE_LAST,
|
||||
LV_PALETTE_NONE = 0xff,
|
||||
}lv_palette_t;
|
||||
} lv_palette_t;
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
@ -462,19 +462,20 @@ LV_ATTRIBUTE_FAST_MEM static inline lv_color_t lv_color_mix(lv_color_t c1, lv_co
|
||||
|
||||
#if LV_COLOR_DEPTH == 16 && LV_COLOR_16_SWAP == 0
|
||||
/*Source: https://stackoverflow.com/a/50012418/1999969*/
|
||||
mix = ( mix + 4 ) >> 3;
|
||||
uint32_t bg = (uint32_t)((uint32_t)c2.full | ((uint32_t)c2.full << 16)) & 0x7E0F81F; /*0b00000111111000001111100000011111*/
|
||||
mix = (mix + 4) >> 3;
|
||||
uint32_t bg = (uint32_t)((uint32_t)c2.full | ((uint32_t)c2.full << 16)) &
|
||||
0x7E0F81F; /*0b00000111111000001111100000011111*/
|
||||
uint32_t fg = (uint32_t)((uint32_t)c1.full | ((uint32_t)c1.full << 16)) & 0x7E0F81F;
|
||||
uint32_t result = ((((fg - bg) * mix) >> 5) + bg) & 0x7E0F81F;
|
||||
ret.full = (uint16_t)((result >> 16) | result);
|
||||
#elif LV_COLOR_DEPTH != 1
|
||||
/*LV_COLOR_DEPTH == 8, 16 or 32*/
|
||||
LV_COLOR_SET_R(ret, LV_UDIV255((uint16_t) LV_COLOR_GET_R(c1) * mix + LV_COLOR_GET_R(c2) *
|
||||
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
||||
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
||||
LV_COLOR_SET_G(ret, LV_UDIV255((uint16_t) LV_COLOR_GET_G(c1) * mix + LV_COLOR_GET_G(c2) *
|
||||
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
||||
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
||||
LV_COLOR_SET_B(ret, LV_UDIV255((uint16_t) LV_COLOR_GET_B(c1) * mix + LV_COLOR_GET_B(c2) *
|
||||
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
||||
(255 - mix) + LV_COLOR_MIX_ROUND_OFS));
|
||||
LV_COLOR_SET_A(ret, 0xFF);
|
||||
#else
|
||||
/*LV_COLOR_DEPTH == 1*/
|
||||
@ -679,8 +680,14 @@ static inline lv_color_t lv_color_chroma_key(void)
|
||||
/*Source: https://vuetifyjs.com/en/styles/colors/#material-colors*/
|
||||
|
||||
lv_color_t lv_palette_main(lv_palette_t p);
|
||||
static inline lv_color_t lv_color_white(void) { return lv_color_make(0xff, 0xff, 0xff);}
|
||||
static inline lv_color_t lv_color_black(void) { return lv_color_make(0x00, 0x0, 0x00);}
|
||||
static inline lv_color_t lv_color_white(void)
|
||||
{
|
||||
return lv_color_make(0xff, 0xff, 0xff);
|
||||
}
|
||||
static inline lv_color_t lv_color_black(void)
|
||||
{
|
||||
return lv_color_make(0x00, 0x0, 0x00);
|
||||
}
|
||||
lv_color_t lv_palette_lighten(lv_palette_t p, uint8_t lvl);
|
||||
lv_color_t lv_palette_darken(lv_palette_t p, uint8_t lvl);
|
||||
|
||||
|
@ -91,9 +91,9 @@ lv_fs_res_t lv_fs_open(lv_fs_file_t * file_p, const char * path, lv_fs_mode_t mo
|
||||
}
|
||||
|
||||
const char * real_path = lv_fs_get_real_path(path);
|
||||
void *file_d = drv->open_cb(drv, real_path, mode);
|
||||
void * file_d = drv->open_cb(drv, real_path, mode);
|
||||
|
||||
if(file_d == NULL || file_d == (void*)(-1)) {
|
||||
if(file_d == NULL || file_d == (void *)(-1)) {
|
||||
return LV_FS_RES_UNKNOWN;
|
||||
}
|
||||
|
||||
@ -207,9 +207,9 @@ lv_fs_res_t lv_fs_dir_open(lv_fs_dir_t * rddir_p, const char * path)
|
||||
}
|
||||
|
||||
const char * real_path = lv_fs_get_real_path(path);
|
||||
void *dir_d = drv->dir_open_cb(drv, real_path);
|
||||
void * dir_d = drv->dir_open_cb(drv, real_path);
|
||||
|
||||
if(dir_d == NULL || dir_d == (void*)(-1)) {
|
||||
if(dir_d == NULL || dir_d == (void *)(-1)) {
|
||||
return LV_FS_RES_UNKNOWN;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ typedef enum {
|
||||
LV_FS_SEEK_SET = 0x00, /**< Set the position from absolutely (from the start of file)*/
|
||||
LV_FS_SEEK_CUR = 0x01, /**< Set the position from the current position*/
|
||||
LV_FS_SEEK_END = 0x02, /**< Set the position from the end of the file*/
|
||||
}lv_fs_whence_t;
|
||||
} lv_fs_whence_t;
|
||||
|
||||
typedef struct _lv_fs_drv_t {
|
||||
char letter;
|
||||
|
@ -88,7 +88,8 @@ void _lv_log_add(lv_log_level_t level, const char * file, int line, const char *
|
||||
char buf[512];
|
||||
uint32_t t = lv_tick_get();
|
||||
static const char * lvl_prefix[] = {"Trace", "Info", "Warn", "Error", "User"};
|
||||
lv_snprintf(buf, sizeof(buf), "[%s]\t(%" LV_PRId32 ".%03" LV_PRId32 ", +%" LV_PRId32 ")\t %s: %s \t(in %s line #%d)\n", lvl_prefix[level], t / 1000, t % 1000, t - last_log_time, func, msg, &file[p], line);
|
||||
lv_snprintf(buf, sizeof(buf), "[%s]\t(%" LV_PRId32 ".%03" LV_PRId32 ", +%" LV_PRId32 ")\t %s: %s \t(in %s line #%d)\n",
|
||||
lvl_prefix[level], t / 1000, t % 1000, t - last_log_time, func, msg, &file[p], line);
|
||||
last_log_time = t;
|
||||
lv_log(buf);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ typedef int8_t lv_log_level_t;
|
||||
/**
|
||||
* Log print function. Receives a string buffer to print".
|
||||
*/
|
||||
typedef void (*lv_log_print_g_cb_t)(const char *buf);
|
||||
typedef void (*lv_log_print_g_cb_t)(const char * buf);
|
||||
|
||||
/**********************
|
||||
* GLOBAL PROTOTYPES
|
||||
|
@ -26,15 +26,15 @@
|
||||
*********************/
|
||||
/*memset the allocated memories to 0xaa and freed memories to 0xbb (just for testing purposes)*/
|
||||
#ifndef LV_MEM_ADD_JUNK
|
||||
# define LV_MEM_ADD_JUNK 0
|
||||
#define LV_MEM_ADD_JUNK 0
|
||||
#endif
|
||||
|
||||
#ifdef LV_ARCH_64
|
||||
# define MEM_UNIT uint64_t
|
||||
# define ALIGN_MASK 0x7
|
||||
#define MEM_UNIT uint64_t
|
||||
#define ALIGN_MASK 0x7
|
||||
#else
|
||||
# define MEM_UNIT uint32_t
|
||||
# define ALIGN_MASK 0x7
|
||||
#define MEM_UNIT uint32_t
|
||||
#define ALIGN_MASK 0x7
|
||||
#endif
|
||||
|
||||
#define ZERO_MEM_SENTINEL 0xa1b2c3d4
|
||||
@ -63,9 +63,9 @@ static uint32_t zero_mem = ZERO_MEM_SENTINEL; /*Give the address of this variabl
|
||||
* MACROS
|
||||
**********************/
|
||||
#if LV_LOG_TRACE_MEM
|
||||
# define MEM_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#define MEM_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#else
|
||||
# define MEM_TRACE(...)
|
||||
#define MEM_TRACE(...)
|
||||
#endif
|
||||
|
||||
#define COPY32 *d32 = *s32; d32++; s32++;
|
||||
@ -143,8 +143,8 @@ void * lv_mem_alloc(size_t size)
|
||||
lv_mem_monitor_t mon;
|
||||
lv_mem_monitor(&mon);
|
||||
LV_LOG_ERROR("used: %6d (%3d %%), frag: %3d %%, biggest free: %6d",
|
||||
(int)mon.total_size - mon.free_size, mon.used_pct, mon.frag_pct,
|
||||
(int)mon.free_biggest_size);
|
||||
(int)mon.total_size - mon.free_size, mon.used_pct, mon.frag_pct,
|
||||
(int)mon.free_biggest_size);
|
||||
}
|
||||
|
||||
MEM_TRACE("allocated at %p", alloc);
|
||||
@ -216,7 +216,7 @@ lv_res_t lv_mem_test(void)
|
||||
return LV_RES_INV;
|
||||
}
|
||||
|
||||
if (lv_tlsf_check_pool(lv_tlsf_get_pool(tlsf))) {
|
||||
if(lv_tlsf_check_pool(lv_tlsf_get_pool(tlsf))) {
|
||||
LV_LOG_WARN("pool failed");
|
||||
return LV_RES_INV;
|
||||
}
|
||||
@ -284,7 +284,8 @@ void * lv_mem_buf_get(uint32_t size)
|
||||
|
||||
if(i_guess >= 0) {
|
||||
LV_GC_ROOT(lv_mem_buf[i_guess]).used = 1;
|
||||
MEM_TRACE("returning already allocated buffer (buffer id: %d, address: %p)", i_guess, LV_GC_ROOT(lv_mem_buf[i_guess]).p);
|
||||
MEM_TRACE("returning already allocated buffer (buffer id: %d, address: %p)", i_guess,
|
||||
LV_GC_ROOT(lv_mem_buf[i_guess]).p);
|
||||
return LV_GC_ROOT(lv_mem_buf[i_guess]).p;
|
||||
}
|
||||
|
||||
|
@ -35,12 +35,12 @@
|
||||
#define _LV_PRINTF_H_
|
||||
|
||||
#if defined(__has_include) && __has_include(<inttypes.h>)
|
||||
#include<inttypes.h>
|
||||
/* platform-specific printf format for int32_t, usually "d" or "ld" */
|
||||
#define LV_PRId32 PRId32
|
||||
#include<inttypes.h>
|
||||
/* platform-specific printf format for int32_t, usually "d" or "ld" */
|
||||
#define LV_PRId32 PRId32
|
||||
#else
|
||||
/* hope this is correct for ports without __has_include or without inttypes.h */
|
||||
#define LV_PRId32 "d"
|
||||
/* hope this is correct for ports without __has_include or without inttypes.h */
|
||||
#define LV_PRId32 "d"
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -106,7 +106,8 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop)
|
||||
style->prop_cnt = 1;
|
||||
style->prop1 = i == 0 ? old_props[1] : old_props[0];
|
||||
style->v_p.value1 = i == 0 ? old_values[1] : old_values[0];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
size_t size = (style->prop_cnt - 1) * (sizeof(lv_style_value_t) + sizeof(uint16_t));
|
||||
uint8_t * new_values_and_props = lv_mem_alloc(size);
|
||||
if(new_values_and_props == NULL) return false;
|
||||
@ -118,7 +119,8 @@ bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop)
|
||||
lv_style_value_t * new_values = (lv_style_value_t *)new_values_and_props;
|
||||
|
||||
uint32_t j;
|
||||
for(i = j = 0; j <= style->prop_cnt; j++) { /*<=: because prop_cnt already reduced but all the old props. needs to be checked.*/
|
||||
for(i = j = 0; j <= style->prop_cnt;
|
||||
j++) { /*<=: because prop_cnt already reduced but all the old props. needs to be checked.*/
|
||||
if(old_props[j] != prop) {
|
||||
new_values[i] = old_values[j];
|
||||
new_props[i++] = old_props[j];
|
||||
@ -164,7 +166,7 @@ void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_
|
||||
props = (uint16_t *)tmp;
|
||||
/*Shift all props to make place for the value before them*/
|
||||
for(i = style->prop_cnt - 1; i >= 0; i--) {
|
||||
props[i + sizeof(lv_style_value_t) /sizeof(uint16_t)] = props[i];
|
||||
props[i + sizeof(lv_style_value_t) / sizeof(uint16_t)] = props[i];
|
||||
}
|
||||
style->prop_cnt++;
|
||||
|
||||
@ -176,7 +178,8 @@ void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_
|
||||
/*Set the new property and value*/
|
||||
props[style->prop_cnt - 1] = prop;
|
||||
values[style->prop_cnt - 1] = value;
|
||||
} else if(style->prop_cnt == 1) {
|
||||
}
|
||||
else if(style->prop_cnt == 1) {
|
||||
if(style->prop1 == prop) {
|
||||
style->v_p.value1 = value;
|
||||
return;
|
||||
@ -195,7 +198,8 @@ void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_
|
||||
props[1] = prop;
|
||||
values[0] = value_tmp;
|
||||
values[1] = value;
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
style->prop_cnt = 1;
|
||||
style->prop1 = prop;
|
||||
style->v_p.value1 = value;
|
||||
@ -207,10 +211,11 @@ void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_
|
||||
|
||||
lv_res_t lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value)
|
||||
{
|
||||
return lv_style_get_prop_inlined(style, prop, value);
|
||||
return lv_style_get_prop_inlined(style, prop, value);
|
||||
}
|
||||
|
||||
void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t props[], lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay, void * user_data)
|
||||
void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t props[],
|
||||
lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay, void * user_data)
|
||||
{
|
||||
lv_memset_00(tr, sizeof(lv_style_transition_dsc_t));
|
||||
tr->props = props;
|
||||
|
@ -110,7 +110,7 @@ typedef union {
|
||||
int32_t num; /**< Number integer number (opacity, enums, booleans or "normal" numbers)*/
|
||||
const void * ptr; /**< Constant pointers (font, cone text, etc)*/
|
||||
lv_color_t color; /**< Colors*/
|
||||
}lv_style_value_t;
|
||||
} lv_style_value_t;
|
||||
|
||||
/**
|
||||
* Enumeration of all built in style properties
|
||||
@ -229,7 +229,7 @@ typedef enum {
|
||||
_LV_STYLE_LAST_BUILT_IN_PROP = 111,
|
||||
|
||||
LV_STYLE_PROP_ANY = 0xFFFF
|
||||
}lv_style_prop_t;
|
||||
} lv_style_prop_t;
|
||||
|
||||
/**
|
||||
* Descriptor for style transitions
|
||||
@ -242,7 +242,7 @@ typedef struct {
|
||||
lv_anim_path_cb_t path_xcb; /**< A path for the animation.*/
|
||||
uint32_t time; /**< Duration of the transition in [ms]*/
|
||||
uint32_t delay; /**< Delay before the transition in [ms]*/
|
||||
}lv_style_transition_dsc_t;
|
||||
} lv_style_transition_dsc_t;
|
||||
|
||||
/**
|
||||
* Descriptor of a constant style property.
|
||||
@ -269,8 +269,8 @@ typedef struct {
|
||||
const lv_style_const_prop_t * const_props;
|
||||
} v_p;
|
||||
|
||||
uint16_t prop1 :15;
|
||||
uint16_t is_const :1;
|
||||
uint16_t prop1 : 15;
|
||||
uint16_t is_const : 1;
|
||||
uint8_t has_group;
|
||||
uint8_t prop_cnt;
|
||||
} lv_style_t;
|
||||
@ -353,7 +353,7 @@ lv_res_t lv_style_get_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_va
|
||||
static inline lv_res_t lv_style_get_prop_inlined(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value)
|
||||
{
|
||||
if(style->is_const) {
|
||||
const lv_style_const_prop_t *const_prop;
|
||||
const lv_style_const_prop_t * const_prop;
|
||||
for(const_prop = style->v_p.const_props; const_prop->prop != LV_STYLE_PROP_INV; const_prop++) {
|
||||
if(const_prop->prop == prop) {
|
||||
*value = const_prop->value;
|
||||
@ -376,7 +376,8 @@ static inline lv_res_t lv_style_get_prop_inlined(lv_style_t * style, lv_style_pr
|
||||
return LV_RES_OK;
|
||||
}
|
||||
}
|
||||
} else if(style->prop1 == prop) {
|
||||
}
|
||||
else if(style->prop1 == prop) {
|
||||
*value = style->v_p.value1;
|
||||
return LV_RES_OK;
|
||||
}
|
||||
@ -396,7 +397,8 @@ static inline lv_res_t lv_style_get_prop_inlined(lv_style_t * style, lv_style_pr
|
||||
* static lv_style_transition_dsc_t trans1;
|
||||
* lv_style_transition_dsc_init(&trans1, trans_props, NULL, 300, 0, NULL);
|
||||
*/
|
||||
void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t props[], lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay, void * user_data);
|
||||
void lv_style_transition_dsc_init(lv_style_transition_dsc_t * tr, const lv_style_prop_t props[],
|
||||
lv_anim_path_cb_t path_cb, uint32_t time, uint32_t delay, void * user_data);
|
||||
|
||||
/**
|
||||
* Get the default value of a property
|
||||
@ -422,29 +424,34 @@ uint8_t _lv_style_get_prop_group(lv_style_prop_t prop);
|
||||
|
||||
#include "lv_style_gen.h"
|
||||
|
||||
static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value) {
|
||||
static inline void lv_style_set_pad_all(lv_style_t * style, lv_coord_t value)
|
||||
{
|
||||
lv_style_set_pad_left(style, value);
|
||||
lv_style_set_pad_right(style, value);
|
||||
lv_style_set_pad_top(style, value);
|
||||
lv_style_set_pad_bottom(style, value);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_pad_hor(lv_style_t * style, lv_coord_t value) {
|
||||
static inline void lv_style_set_pad_hor(lv_style_t * style, lv_coord_t value)
|
||||
{
|
||||
lv_style_set_pad_left(style, value);
|
||||
lv_style_set_pad_right(style, value);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_pad_ver(lv_style_t * style, lv_coord_t value) {
|
||||
static inline void lv_style_set_pad_ver(lv_style_t * style, lv_coord_t value)
|
||||
{
|
||||
lv_style_set_pad_top(style, value);
|
||||
lv_style_set_pad_bottom(style, value);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_pad_gap(lv_style_t * style, lv_coord_t value) {
|
||||
static inline void lv_style_set_pad_gap(lv_style_t * style, lv_coord_t value)
|
||||
{
|
||||
lv_style_set_pad_row(style, value);
|
||||
lv_style_set_pad_column(style, value);
|
||||
}
|
||||
|
||||
static inline void lv_style_set_size(lv_style_t * style, lv_coord_t value) {
|
||||
static inline void lv_style_set_size(lv_style_t * style, lv_coord_t value)
|
||||
{
|
||||
lv_style_set_width(style, value);
|
||||
lv_style_set_height(style, value);
|
||||
}
|
||||
@ -460,7 +467,7 @@ static inline void lv_style_set_size(lv_style_t * style, lv_coord_t value) {
|
||||
|
||||
#if LV_USE_ASSERT_STYLE
|
||||
# define LV_ASSERT_STYLE(style_p) LV_ASSERT_MSG(style_p != NULL, "The style is NULL"); \
|
||||
LV_ASSERT_MSG(style_p->sentinel == LV_STYLE_SENTINEL_VALUE, "Style is not initialized or corrupted");
|
||||
LV_ASSERT_MSG(style_p->sentinel == LV_STYLE_SENTINEL_VALUE, "Style is not initialized or corrupted");
|
||||
#else
|
||||
# define LV_ASSERT_STYLE(p)
|
||||
#endif
|
||||
|
@ -90,712 +90,712 @@ void lv_style_set_arc_img_src(lv_style_t * style, const void * value);
|
||||
#define LV_STYLE_CONST_WIDTH(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_WIDTH, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_MIN_WIDTH(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_MIN_WIDTH, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_MAX_WIDTH(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_MAX_WIDTH, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_HEIGHT(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_HEIGHT, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_MIN_HEIGHT(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_MIN_HEIGHT, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_MAX_HEIGHT(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_MAX_HEIGHT, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_X(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_X, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_Y(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_Y, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_ALIGN(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_ALIGN, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TRANSFORM_WIDTH(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TRANSFORM_WIDTH, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TRANSFORM_HEIGHT(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TRANSFORM_HEIGHT, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TRANSLATE_X(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TRANSLATE_X, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TRANSLATE_Y(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TRANSLATE_Y, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TRANSFORM_ZOOM(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TRANSFORM_ZOOM, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TRANSFORM_ANGLE(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TRANSFORM_ANGLE, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_PAD_TOP(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_PAD_TOP, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_PAD_BOTTOM(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_PAD_BOTTOM, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_PAD_LEFT(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_PAD_LEFT, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_PAD_RIGHT(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_PAD_RIGHT, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_PAD_ROW(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_PAD_ROW, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_PAD_COLUMN(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_PAD_COLUMN, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_RADIUS(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_RADIUS, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_CLIP_CORNER(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_CLIP_CORNER, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_COLOR_FILTER_DSC(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_COLOR_FILTER_DSC, \
|
||||
.value = { \
|
||||
.ptr = val \
|
||||
} \
|
||||
.value = { \
|
||||
.ptr = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_COLOR_FILTER_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_COLOR_FILTER_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_ANIM_TIME(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_ANIM_TIME, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_ANIM_SPEED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_ANIM_SPEED, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TRANSITION(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TRANSITION, \
|
||||
.value = { \
|
||||
.ptr = val \
|
||||
} \
|
||||
.value = { \
|
||||
.ptr = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BLEND_MODE(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BLEND_MODE, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_LAYOUT(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_LAYOUT, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BASE_DIR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BASE_DIR, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_COLOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_COLOR, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_COLOR_FILTERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_COLOR_FILTERED, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_GRAD_COLOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_GRAD_COLOR, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_GRAD_COLOR_FILTERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_GRAD_COLOR_FILTERED, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_GRAD_DIR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_GRAD_DIR, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_MAIN_STOP(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_MAIN_STOP, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_GRAD_STOP(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_GRAD_STOP, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_IMG_SRC(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_IMG_SRC, \
|
||||
.value = { \
|
||||
.ptr = val \
|
||||
} \
|
||||
.value = { \
|
||||
.ptr = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_IMG_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_IMG_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_IMG_RECOLOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_IMG_RECOLOR, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_IMG_RECOLOR_FILTERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_IMG_RECOLOR_FILTERED, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_IMG_RECOLOR_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_IMG_RECOLOR_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BG_IMG_TILED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BG_IMG_TILED, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BORDER_COLOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BORDER_COLOR, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BORDER_COLOR_FILTERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BORDER_COLOR_FILTERED, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BORDER_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BORDER_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BORDER_WIDTH(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BORDER_WIDTH, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BORDER_SIDE(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BORDER_SIDE, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_BORDER_POST(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_BORDER_POST, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TEXT_COLOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TEXT_COLOR, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TEXT_COLOR_FILTERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TEXT_COLOR_FILTERED, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TEXT_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TEXT_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TEXT_FONT(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TEXT_FONT, \
|
||||
.value = { \
|
||||
.ptr = val \
|
||||
} \
|
||||
.value = { \
|
||||
.ptr = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TEXT_LETTER_SPACE(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TEXT_LETTER_SPACE, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TEXT_LINE_SPACE(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TEXT_LINE_SPACE, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TEXT_DECOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TEXT_DECOR, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_TEXT_ALIGN(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_TEXT_ALIGN, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_IMG_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_IMG_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_IMG_RECOLOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_IMG_RECOLOR, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_IMG_RECOLOR_FILTERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_IMG_RECOLOR_FILTERED, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_IMG_RECOLOR_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_IMG_RECOLOR_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_OUTLINE_WIDTH(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_OUTLINE_WIDTH, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_OUTLINE_COLOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_OUTLINE_COLOR, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_OUTLINE_COLOR_FILTERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_OUTLINE_COLOR_FILTERED, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_OUTLINE_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_OUTLINE_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_OUTLINE_PAD(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_OUTLINE_PAD, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_SHADOW_WIDTH(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_SHADOW_WIDTH, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_SHADOW_OFS_X(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_SHADOW_OFS_X, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_SHADOW_OFS_Y(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_SHADOW_OFS_Y, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_SHADOW_SPREAD(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_SHADOW_SPREAD, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_SHADOW_COLOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_SHADOW_COLOR, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_SHADOW_COLOR_FILTERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_SHADOW_COLOR_FILTERED, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_SHADOW_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_SHADOW_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_LINE_WIDTH(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_LINE_WIDTH, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_LINE_DASH_WIDTH(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_LINE_DASH_WIDTH, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_LINE_DASH_GAP(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_LINE_DASH_GAP, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_LINE_ROUNDED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_LINE_ROUNDED, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_LINE_COLOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_LINE_COLOR, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_LINE_COLOR_FILTERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_LINE_COLOR_FILTERED, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_LINE_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_LINE_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_ARC_WIDTH(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_ARC_WIDTH, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_ARC_ROUNDED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_ARC_ROUNDED, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_ARC_COLOR(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_ARC_COLOR, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_ARC_COLOR_FILTERED(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_ARC_COLOR_FILTERED, \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
.value = { \
|
||||
.color = val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_ARC_OPA(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_ARC_OPA, \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
.value = { \
|
||||
.num = (int32_t)val \
|
||||
} \
|
||||
}
|
||||
|
||||
#define LV_STYLE_CONST_ARC_IMG_SRC(val) \
|
||||
{ \
|
||||
.prop = LV_STYLE_ARC_IMG_SRC, \
|
||||
.value = { \
|
||||
.ptr = val \
|
||||
} \
|
||||
.value = { \
|
||||
.ptr = val \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -39,9 +39,9 @@ static bool timer_created;
|
||||
* MACROS
|
||||
**********************/
|
||||
#if LV_LOG_TRACE_TIMER
|
||||
# define TIMER_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#define TIMER_TRACE(...) LV_LOG_TRACE( __VA_ARGS__)
|
||||
#else
|
||||
# define TIMER_TRACE(...)
|
||||
#define TIMER_TRACE(...)
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
|
@ -48,7 +48,7 @@ typedef struct _lv_timer_t {
|
||||
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 paused : 1;
|
||||
} lv_timer_t;
|
||||
|
||||
/**********************
|
||||
|
2525
src/misc/lv_tlsf.c
2525
src/misc/lv_tlsf.c
File diff suppressed because it is too large
Load Diff
@ -1,95 +1,95 @@
|
||||
#include "../lv_conf_internal.h"
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
|
||||
#ifndef INCLUDED_tlsf
|
||||
#define INCLUDED_tlsf
|
||||
|
||||
/*
|
||||
** Two Level Segregated Fit memory allocator, version 3.1.
|
||||
** Written by Matthew Conte
|
||||
** http://tlsf.baisoku.org
|
||||
**
|
||||
** Based on the original documentation by Miguel Masmano:
|
||||
** http://www.gii.upv.es/tlsf/main/docs
|
||||
**
|
||||
** This implementation was written to the specification
|
||||
** of the document, therefore no GPL restrictions apply.
|
||||
**
|
||||
** Copyright (c) 2006-2016, Matthew Conte
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** * Neither the name of the copyright holder nor the
|
||||
** names of its contributors may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** DISCLAIMED. IN NO EVENT SHALL MATTHEW CONTE BE LIABLE FOR ANY
|
||||
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* lv_tlsf_t: a TLSF structure. Can contain 1 to N pools. */
|
||||
/* lv_pool_t: a block of memory that TLSF can manage. */
|
||||
typedef void* lv_tlsf_t;
|
||||
typedef void* lv_pool_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);
|
||||
void lv_tlsf_destroy(lv_tlsf_t tlsf);
|
||||
lv_pool_t lv_tlsf_get_pool(lv_tlsf_t tlsf);
|
||||
|
||||
/* Add/remove memory pools. */
|
||||
lv_pool_t lv_tlsf_add_pool(lv_tlsf_t tlsf, void* mem, size_t bytes);
|
||||
void lv_tlsf_remove_pool(lv_tlsf_t tlsf, lv_pool_t pool);
|
||||
|
||||
/* malloc/memalign/realloc/free replacements. */
|
||||
void* lv_tlsf_malloc(lv_tlsf_t tlsf, size_t bytes);
|
||||
void* lv_tlsf_memalign(lv_tlsf_t tlsf, size_t align, size_t bytes);
|
||||
void* lv_tlsf_realloc(lv_tlsf_t tlsf, void* ptr, size_t size);
|
||||
void lv_tlsf_free(lv_tlsf_t tlsf, void* ptr);
|
||||
|
||||
/* Returns internal block size, not original request size */
|
||||
size_t lv_tlsf_block_size(void* ptr);
|
||||
|
||||
/* Overheads/limits of internal structures. */
|
||||
size_t lv_tlsf_size(void);
|
||||
size_t lv_tlsf_align_size(void);
|
||||
size_t lv_tlsf_block_size_min(void);
|
||||
size_t lv_tlsf_block_size_max(void);
|
||||
size_t lv_tlsf_pool_overhead(void);
|
||||
size_t lv_tlsf_alloc_overhead(void);
|
||||
|
||||
/* Debugging. */
|
||||
typedef void (*lv_tlsf_walker)(void* ptr, size_t size, int used, void* user);
|
||||
void lv_tlsf_walk_pool(lv_pool_t pool, lv_tlsf_walker walker, void* user);
|
||||
/* Returns nonzero if any internal consistency check fails. */
|
||||
int lv_tlsf_check(lv_tlsf_t tlsf);
|
||||
int lv_tlsf_check_pool(lv_pool_t pool);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* LV_MEM_CUSTOM == 0 */
|
||||
#include "../lv_conf_internal.h"
|
||||
#if LV_MEM_CUSTOM == 0
|
||||
|
||||
#ifndef INCLUDED_tlsf
|
||||
#define INCLUDED_tlsf
|
||||
|
||||
/*
|
||||
** Two Level Segregated Fit memory allocator, version 3.1.
|
||||
** Written by Matthew Conte
|
||||
** http://tlsf.baisoku.org
|
||||
**
|
||||
** Based on the original documentation by Miguel Masmano:
|
||||
** http://www.gii.upv.es/tlsf/main/docs
|
||||
**
|
||||
** This implementation was written to the specification
|
||||
** of the document, therefore no GPL restrictions apply.
|
||||
**
|
||||
** Copyright (c) 2006-2016, Matthew Conte
|
||||
** All rights reserved.
|
||||
**
|
||||
** Redistribution and use in source and binary forms, with or without
|
||||
** modification, are permitted provided that the following conditions are met:
|
||||
** * Redistributions of source code must retain the above copyright
|
||||
** notice, this list of conditions and the following disclaimer.
|
||||
** * Redistributions in binary form must reproduce the above copyright
|
||||
** notice, this list of conditions and the following disclaimer in the
|
||||
** documentation and/or other materials provided with the distribution.
|
||||
** * Neither the name of the copyright holder nor the
|
||||
** names of its contributors may be used to endorse or promote products
|
||||
** derived from this software without specific prior written permission.
|
||||
**
|
||||
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
** DISCLAIMED. IN NO EVENT SHALL MATTHEW CONTE BE LIABLE FOR ANY
|
||||
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* lv_tlsf_t: a TLSF structure. Can contain 1 to N pools. */
|
||||
/* lv_pool_t: a block of memory that TLSF can manage. */
|
||||
typedef void * lv_tlsf_t;
|
||||
typedef void * lv_pool_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);
|
||||
void lv_tlsf_destroy(lv_tlsf_t tlsf);
|
||||
lv_pool_t lv_tlsf_get_pool(lv_tlsf_t tlsf);
|
||||
|
||||
/* Add/remove memory pools. */
|
||||
lv_pool_t lv_tlsf_add_pool(lv_tlsf_t tlsf, void * mem, size_t bytes);
|
||||
void lv_tlsf_remove_pool(lv_tlsf_t tlsf, lv_pool_t pool);
|
||||
|
||||
/* malloc/memalign/realloc/free replacements. */
|
||||
void * lv_tlsf_malloc(lv_tlsf_t tlsf, size_t bytes);
|
||||
void * lv_tlsf_memalign(lv_tlsf_t tlsf, size_t align, size_t bytes);
|
||||
void * lv_tlsf_realloc(lv_tlsf_t tlsf, void * ptr, size_t size);
|
||||
void lv_tlsf_free(lv_tlsf_t tlsf, void * ptr);
|
||||
|
||||
/* Returns internal block size, not original request size */
|
||||
size_t lv_tlsf_block_size(void * ptr);
|
||||
|
||||
/* Overheads/limits of internal structures. */
|
||||
size_t lv_tlsf_size(void);
|
||||
size_t lv_tlsf_align_size(void);
|
||||
size_t lv_tlsf_block_size_min(void);
|
||||
size_t lv_tlsf_block_size_max(void);
|
||||
size_t lv_tlsf_pool_overhead(void);
|
||||
size_t lv_tlsf_alloc_overhead(void);
|
||||
|
||||
/* Debugging. */
|
||||
typedef void (*lv_tlsf_walker)(void * ptr, size_t size, int used, void * user);
|
||||
void lv_tlsf_walk_pool(lv_pool_t pool, lv_tlsf_walker walker, void * user);
|
||||
/* Returns nonzero if any internal consistency check fails. */
|
||||
int lv_tlsf_check(lv_tlsf_t tlsf);
|
||||
int lv_tlsf_check_pool(lv_pool_t pool);
|
||||
|
||||
#if defined(__cplusplus)
|
||||
};
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* LV_MEM_CUSTOM == 0 */
|
||||
|
@ -94,7 +94,7 @@
|
||||
* line breaks
|
||||
*/
|
||||
void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_coord_t line_space, lv_coord_t max_width, lv_text_flag_t flag)
|
||||
lv_coord_t line_space, lv_coord_t max_width, lv_text_flag_t flag)
|
||||
{
|
||||
size_res->x = 0;
|
||||
size_res->y = 0;
|
||||
@ -123,7 +123,7 @@ void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t *
|
||||
|
||||
/*Calculate the longest line*/
|
||||
lv_coord_t act_line_length = lv_txt_get_width(&text[line_start], new_line_start - line_start, font, letter_space,
|
||||
flag);
|
||||
flag);
|
||||
|
||||
size_res->x = LV_MAX(act_line_length, size_res->x);
|
||||
line_start = new_line_start;
|
||||
@ -353,7 +353,7 @@ uint32_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font,
|
||||
* @return length of a char_num long text
|
||||
*/
|
||||
lv_coord_t lv_txt_get_width(const char * txt, uint32_t length, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_text_flag_t flag)
|
||||
lv_text_flag_t flag)
|
||||
{
|
||||
if(txt == NULL) return 0;
|
||||
if(font == NULL) return 0;
|
||||
@ -526,7 +526,7 @@ LV_FORMAT_ATTRIBUTE(1, 0) char * _lv_txt_set_text_vfmt(const char * fmt, va_list
|
||||
return text;
|
||||
}
|
||||
|
||||
void _lv_txt_encoded_letter_next_2(const char * txt, uint32_t * letter, uint32_t * letter_next, uint32_t *ofs)
|
||||
void _lv_txt_encoded_letter_next_2(const char * txt, uint32_t * letter, uint32_t * letter_next, uint32_t * ofs)
|
||||
{
|
||||
*letter = _lv_txt_encoded_next(txt, ofs);
|
||||
*letter_next = *letter != '\0' ? _lv_txt_encoded_next(&txt[*ofs], NULL) : 0;
|
||||
|
@ -81,7 +81,7 @@ typedef uint8_t lv_text_align_t;
|
||||
* line breaks
|
||||
*/
|
||||
void lv_txt_get_size(lv_point_t * size_res, const char * text, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_coord_t line_space, lv_coord_t max_width, lv_text_flag_t flag);
|
||||
lv_coord_t line_space, lv_coord_t max_width, lv_text_flag_t flag);
|
||||
|
||||
/**
|
||||
* Get the next line of text. Check line length and break chars too.
|
||||
@ -108,7 +108,7 @@ uint32_t _lv_txt_get_next_line(const char * txt, const lv_font_t * font, lv_coor
|
||||
* @return length of a char_num long text
|
||||
*/
|
||||
lv_coord_t lv_txt_get_width(const char * txt, uint32_t length, const lv_font_t * font, lv_coord_t letter_space,
|
||||
lv_text_flag_t flag);
|
||||
lv_text_flag_t flag);
|
||||
|
||||
/**
|
||||
* Check next character in a string and decide if the character is part of the command or not
|
||||
@ -153,7 +153,7 @@ char * _lv_txt_set_text_vfmt(const char * fmt, va_list ap) LV_FORMAT_ATTRIBUTE(1
|
||||
* After the call it will point to the next encoded char in 'txt'.
|
||||
* NULL to use txt[0] as index
|
||||
*/
|
||||
void _lv_txt_encoded_letter_next_2(const char * txt, uint32_t * letter, uint32_t * letter_next, uint32_t *ofs);
|
||||
void _lv_txt_encoded_letter_next_2(const char * txt, uint32_t * letter, uint32_t * letter_next, uint32_t * ofs);
|
||||
|
||||
/**
|
||||
* Test if char is break char or not (a text can broken here or not)
|
||||
@ -166,7 +166,7 @@ static inline bool _lv_txt_is_break_char(uint32_t letter)
|
||||
bool ret = false;
|
||||
|
||||
/* each chinese character can be break */
|
||||
if (letter >= 0x4E00 && letter <= 0x9FA5) {
|
||||
if(letter >= 0x4E00 && letter <= 0x9FA5) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user