Merge 700c1290ba into dev
This commit is contained in:
@@ -6,26 +6,12 @@
|
||||
/*********************
|
||||
* INCLUDES
|
||||
*********************/
|
||||
#include "lv_obj.h"
|
||||
#include "lv_style.h"
|
||||
#include "../lv_misc/lv_mem.h"
|
||||
#include "../lv_misc/lv_anim.h"
|
||||
|
||||
/*********************
|
||||
* DEFINES
|
||||
*********************/
|
||||
#define STYLE_MIX_MAX 256
|
||||
#define STYLE_MIX_SHIFT 8 /*log2(STYLE_MIX_MAX)*/
|
||||
|
||||
#define VAL_PROP(v1, v2, r) v1 + (((v2 - v1) * r) >> STYLE_MIX_SHIFT)
|
||||
#define STYLE_ATTR_MIX(attr, r) \
|
||||
if(start->attr != end->attr) { \
|
||||
res->attr = VAL_PROP(start->attr, end->attr, r); \
|
||||
} else { \
|
||||
res->attr = start->attr; \
|
||||
}
|
||||
|
||||
#define LV_STYLE_PROP_TO_ID(prop) (prop & 0xFF);
|
||||
#define LV_STYLE_PROP_GET_TYPE(prop) ((prop >> 8) & 0xFF);
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
@@ -36,7 +22,7 @@
|
||||
**********************/
|
||||
LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t * style, lv_style_property_t prop);
|
||||
static lv_style_t * get_alloc_local_style(lv_style_list_t * list);
|
||||
static inline void style_resize(lv_style_t * style, size_t sz);
|
||||
static inline bool style_resize(lv_style_t * style, size_t sz);
|
||||
static inline lv_style_property_t get_style_prop(const lv_style_t * style, size_t idx);
|
||||
static inline uint8_t get_style_prop_id(const lv_style_t * style, size_t idx);
|
||||
static inline uint8_t get_style_prop_attr(const lv_style_t * style, size_t idx);
|
||||
@@ -78,16 +64,14 @@ void lv_style_init(lv_style_t * style)
|
||||
*/
|
||||
void lv_style_copy(lv_style_t * style_dest, const lv_style_t * style_src)
|
||||
{
|
||||
if(style_src == NULL) return;
|
||||
|
||||
LV_ASSERT_STYLE(style_dest);
|
||||
LV_ASSERT_STYLE(style_src);
|
||||
|
||||
if(style_src->map == NULL) return;
|
||||
|
||||
uint16_t size = _lv_style_get_mem_size(style_src);
|
||||
if(size == 0) return;
|
||||
|
||||
style_dest->map = lv_mem_alloc(size);
|
||||
_lv_memcpy(style_dest->map, style_src->map, size);
|
||||
if(style_dest->map)
|
||||
_lv_memcpy(style_dest->map, style_src->map, size);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,9 +83,6 @@ void lv_style_copy(lv_style_t * style_dest, const lv_style_t * style_src)
|
||||
*/
|
||||
bool lv_style_remove_prop(lv_style_t * style, lv_style_property_t prop)
|
||||
{
|
||||
if(style == NULL) return false;
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
int32_t id = get_property_index(style, prop);
|
||||
/*The property exists but not sure it's state is the same*/
|
||||
if(id >= 0) {
|
||||
@@ -154,35 +135,44 @@ void lv_style_list_copy(lv_style_list_t * list_dest, const lv_style_list_t * lis
|
||||
|
||||
_lv_style_list_reset(list_dest);
|
||||
|
||||
if(list_src->style_list == NULL) return;
|
||||
if(list_src == NULL || list_src->style_list == NULL) return;
|
||||
|
||||
/*Copy the styles but skip the transitions*/
|
||||
if(list_src->has_local == 0) {
|
||||
if(list_src->has_trans) {
|
||||
list_dest->style_list = lv_mem_alloc((list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt - 1;
|
||||
if(list_dest->style_list) {
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt - 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
list_dest->style_list = lv_mem_alloc(list_src->style_cnt * sizeof(lv_style_t *));
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list, list_src->style_cnt * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt;
|
||||
if(list_dest->style_list) {
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list, list_src->style_cnt * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(list_src->has_trans) {
|
||||
list_dest->style_list = lv_mem_alloc((list_src->style_cnt - 2) * sizeof(lv_style_t *));
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list + 2, (list_src->style_cnt - 2) * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt - 2;
|
||||
if(list_dest->style_list) {
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list + 2, (list_src->style_cnt - 2) * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt - 2;
|
||||
}
|
||||
}
|
||||
else {
|
||||
list_dest->style_list = lv_mem_alloc((list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt - 1;
|
||||
if(list_dest->style_list) {
|
||||
_lv_memcpy(list_dest->style_list, list_src->style_list + 1, (list_src->style_cnt - 1) * sizeof(lv_style_t *));
|
||||
list_dest->style_cnt = list_src->style_cnt - 1;
|
||||
}
|
||||
}
|
||||
|
||||
lv_style_t * local_style = get_alloc_local_style(list_dest);
|
||||
lv_style_copy(local_style, get_alloc_local_style((lv_style_list_t *)list_src));
|
||||
if (local_style)
|
||||
lv_style_copy(local_style, get_alloc_local_style((lv_style_list_t *)list_src));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,12 +193,12 @@ void _lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style)
|
||||
/*Remove the style first if already exists*/
|
||||
_lv_style_list_remove_style(list, style);
|
||||
|
||||
lv_style_t ** new_classes;
|
||||
if(list->style_cnt == 0) new_classes = lv_mem_alloc(sizeof(lv_style_t *));
|
||||
else new_classes = lv_mem_realloc(list->style_list, sizeof(lv_style_t *) * (list->style_cnt + 1));
|
||||
LV_ASSERT_MEM(new_classes);
|
||||
if(new_classes == NULL) {
|
||||
LV_LOG_WARN("lv_style_list_add_style: couldn't add the class");
|
||||
lv_style_t ** new_styles;
|
||||
if(list->style_cnt == 0) new_styles = lv_mem_alloc(sizeof(lv_style_t *));
|
||||
else new_styles = lv_mem_realloc(list->style_list, sizeof(lv_style_t *) * (list->style_cnt + 1));
|
||||
LV_ASSERT_MEM(new_styles);
|
||||
if(new_styles == NULL) {
|
||||
LV_LOG_WARN("lv_style_list_add_style: couldn't add the style");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -218,12 +208,12 @@ void _lv_style_list_add_style(lv_style_list_t * list, lv_style_t * style)
|
||||
if(list->has_trans) first_style++;
|
||||
if(list->has_local) first_style++;
|
||||
for(i = list->style_cnt; i > first_style; i--) {
|
||||
new_classes[i] = new_classes[i - 1];
|
||||
new_styles[i] = new_styles[i - 1];
|
||||
}
|
||||
|
||||
new_classes[first_style] = style;
|
||||
new_styles[first_style] = style;
|
||||
list->style_cnt++;
|
||||
list->style_list = new_classes;
|
||||
list->style_list = new_styles;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -257,24 +247,22 @@ void _lv_style_list_remove_style(lv_style_list_t * list, lv_style_t * style)
|
||||
return;
|
||||
}
|
||||
|
||||
lv_style_t ** new_classes = lv_mem_alloc(sizeof(lv_style_t *) * (list->style_cnt - 1));
|
||||
LV_ASSERT_MEM(new_classes);
|
||||
if(new_classes == NULL) {
|
||||
LV_LOG_WARN("lv_style_list_remove_style: couldn't reallocate class list");
|
||||
lv_style_t ** new_styles = lv_mem_alloc(sizeof(lv_style_t *) * (list->style_cnt - 1));
|
||||
LV_ASSERT_MEM(new_styles);
|
||||
if(new_styles == NULL) {
|
||||
LV_LOG_WARN("lv_style_list_remove_style: couldn't reallocate style list");
|
||||
return;
|
||||
}
|
||||
uint8_t j;
|
||||
for(i = 0, j = 0; i < list->style_cnt; i++) {
|
||||
if(list->style_list[i] == style) continue;
|
||||
new_classes[j] = list->style_list[i];
|
||||
j++;
|
||||
|
||||
new_styles[j++] = list->style_list[i];
|
||||
}
|
||||
|
||||
lv_mem_free(list->style_list);
|
||||
|
||||
list->style_cnt--;
|
||||
list->style_list = new_classes;
|
||||
list->style_list = new_styles;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,7 +322,7 @@ uint16_t _lv_style_get_mem_size(const lv_style_t * style)
|
||||
{
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
if(style->map == NULL) return 0;
|
||||
if(style == NULL || style->map == NULL) return 0;
|
||||
|
||||
size_t i = 0;
|
||||
uint8_t prop_id;
|
||||
@@ -357,8 +345,6 @@ uint16_t _lv_style_get_mem_size(const lv_style_t * style)
|
||||
*/
|
||||
void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_int_t value)
|
||||
{
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
int32_t id = get_property_index(style, prop);
|
||||
/*The property already exists but not sure it's state is the same*/
|
||||
if(id >= 0) {
|
||||
@@ -375,16 +361,15 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
|
||||
}
|
||||
|
||||
/*Add new property if not exists yet*/
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(lv_style_int_t));
|
||||
uint8_t new_prop_size = sizeof(lv_style_property_t) + sizeof(lv_style_int_t);
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
if(size == 0) size += end_mark_size;
|
||||
size += sizeof(lv_style_property_t) + sizeof(lv_style_int_t);
|
||||
style_resize(style, size);
|
||||
LV_ASSERT_MEM(style->map);
|
||||
if(style == NULL) return;
|
||||
|
||||
size += new_prop_size;
|
||||
if(!style_resize(style, size)) return;
|
||||
|
||||
_lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
_lv_memcpy_small(style->map + size - sizeof(lv_style_int_t) - end_mark_size, &value, sizeof(lv_style_int_t));
|
||||
@@ -403,8 +388,6 @@ void _lv_style_set_int(lv_style_t * style, lv_style_property_t prop, lv_style_in
|
||||
*/
|
||||
void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_t color)
|
||||
{
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
int32_t id = get_property_index(style, prop);
|
||||
/*The property already exists but not sure it's state is the same*/
|
||||
if(id >= 0) {
|
||||
@@ -421,17 +404,15 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
|
||||
}
|
||||
|
||||
/*Add new property if not exists yet*/
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(lv_color_t));
|
||||
uint8_t new_prop_size = sizeof(lv_style_property_t) + sizeof(lv_color_t);
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
if(size == 0) size += end_mark_size;
|
||||
|
||||
size += sizeof(lv_style_property_t) + sizeof(lv_color_t);
|
||||
style_resize(style, size);
|
||||
LV_ASSERT_MEM(style->map);
|
||||
if(style == NULL) return;
|
||||
size += new_prop_size;
|
||||
if(!style_resize(style, size)) return;
|
||||
|
||||
_lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
_lv_memcpy_small(style->map + size - sizeof(lv_color_t) - end_mark_size, &color, sizeof(lv_color_t));
|
||||
@@ -450,8 +431,6 @@ void _lv_style_set_color(lv_style_t * style, lv_style_property_t prop, lv_color_
|
||||
*/
|
||||
void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t opa)
|
||||
{
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
int32_t id = get_property_index(style, prop);
|
||||
/*The property already exists but not sure it's state is the same*/
|
||||
if(id >= 0) {
|
||||
@@ -468,17 +447,15 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
|
||||
}
|
||||
|
||||
/*Add new property if not exists yet*/
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(lv_opa_t));
|
||||
uint8_t new_prop_size = sizeof(lv_style_property_t) + sizeof(lv_opa_t);
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
if(size == 0) size += end_mark_size;
|
||||
|
||||
size += sizeof(lv_style_property_t) + sizeof(lv_opa_t);
|
||||
style_resize(style, size);
|
||||
LV_ASSERT_MEM(style->map);
|
||||
if(style == NULL) return;
|
||||
size += new_prop_size;
|
||||
if(!style_resize(style, size)) return;
|
||||
|
||||
_lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
_lv_memcpy_small(style->map + size - sizeof(lv_opa_t) - end_mark_size, &opa, sizeof(lv_opa_t));
|
||||
@@ -497,8 +474,6 @@ void _lv_style_set_opa(lv_style_t * style, lv_style_property_t prop, lv_opa_t op
|
||||
*/
|
||||
void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void * p)
|
||||
{
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
int32_t id = get_property_index(style, prop);
|
||||
/*The property already exists but not sure it's state is the same*/
|
||||
if(id >= 0) {
|
||||
@@ -515,17 +490,15 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
||||
}
|
||||
|
||||
/*Add new property if not exists yet*/
|
||||
uint8_t new_prop_size = (sizeof(lv_style_property_t) + sizeof(const void *));
|
||||
uint8_t new_prop_size = sizeof(lv_style_property_t) + sizeof(const void *);
|
||||
lv_style_property_t end_mark = _LV_STYLE_CLOSING_PROP;
|
||||
uint8_t end_mark_size = sizeof(end_mark);
|
||||
|
||||
uint16_t size = _lv_style_get_mem_size(style);
|
||||
if(size == 0) size += end_mark_size;
|
||||
|
||||
size += sizeof(lv_style_property_t) + sizeof(const void *);
|
||||
style_resize(style, size);
|
||||
LV_ASSERT_MEM(style->map);
|
||||
if(style == NULL) return;
|
||||
size += new_prop_size;
|
||||
if(!style_resize(style, size)) return;
|
||||
|
||||
_lv_memcpy_small(style->map + size - new_prop_size - end_mark_size, &prop, sizeof(lv_style_property_t));
|
||||
_lv_memcpy_small(style->map + size - sizeof(const void *) - end_mark_size, &p, sizeof(const void *));
|
||||
@@ -533,7 +506,7 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the a property from a style.
|
||||
* Get an integer typed property from a style.
|
||||
* Take into account the style state and return the property which matches the best.
|
||||
* @param style pointer to a style where to search
|
||||
* @param prop the property, might contain ORed style states too
|
||||
@@ -542,14 +515,8 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
||||
* Higher number is means better fit
|
||||
* -1 if the not found (`res` will be undefined)
|
||||
*/
|
||||
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, void * v_res)
|
||||
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res)
|
||||
{
|
||||
lv_style_int_t * res = (lv_style_int_t *)v_res;
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
if(style == NULL) return -1;
|
||||
if(style->map == NULL) return -1;
|
||||
|
||||
int32_t id = get_property_index(style, prop);
|
||||
if(id < 0) {
|
||||
return -1;
|
||||
@@ -559,10 +526,7 @@ int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, vo
|
||||
lv_style_attr_t attr_act;
|
||||
attr_act = get_style_prop_attr(style, id);
|
||||
|
||||
lv_style_attr_t attr_goal;
|
||||
attr_goal = (prop >> 8) & 0xFF;
|
||||
|
||||
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
|
||||
return LV_STYLE_ATTR_GET_STATE(attr_act);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -579,14 +543,8 @@ int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, vo
|
||||
* For example: `lv_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, void * v_res)
|
||||
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res)
|
||||
{
|
||||
lv_opa_t * res = (lv_opa_t *)v_res;
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
if(style == NULL) return -1;
|
||||
if(style->map == NULL) return -1;
|
||||
|
||||
int32_t id = get_property_index(style, prop);
|
||||
if(id < 0) {
|
||||
return -1;
|
||||
@@ -596,10 +554,7 @@ int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, vo
|
||||
lv_style_attr_t attr_act;
|
||||
attr_act = get_style_prop_attr(style, id);
|
||||
|
||||
lv_style_attr_t attr_goal;
|
||||
attr_goal = (prop >> 8) & 0xFF;
|
||||
|
||||
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
|
||||
return LV_STYLE_ATTR_GET_STATE(attr_act);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -616,11 +571,8 @@ int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, vo
|
||||
* For example: `lv_style_get_border_color()`
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, void * v_res)
|
||||
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, lv_color_t * res)
|
||||
{
|
||||
lv_color_t * res = (lv_color_t *)v_res;
|
||||
if(style == NULL) return -1;
|
||||
if(style->map == NULL) return -1;
|
||||
int32_t id = get_property_index(style, prop);
|
||||
if(id < 0) {
|
||||
return -1;
|
||||
@@ -630,10 +582,7 @@ int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop,
|
||||
lv_style_attr_t attr_act;
|
||||
attr_act = get_style_prop_attr(style, id);
|
||||
|
||||
lv_style_attr_t attr_goal;
|
||||
attr_goal = (prop >> 8) & 0xFF;
|
||||
|
||||
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
|
||||
return LV_STYLE_ATTR_GET_STATE(attr_act);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,12 +599,8 @@ int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop,
|
||||
* For example: `lv_style_get_text_font()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void * v_res)
|
||||
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, const void ** res)
|
||||
{
|
||||
const void ** res = (const void **)v_res;
|
||||
if(style == NULL) return -1;
|
||||
if(style->map == NULL) return -1;
|
||||
|
||||
int32_t id = get_property_index(style, prop);
|
||||
if(id < 0) {
|
||||
return -1;
|
||||
@@ -665,10 +610,7 @@ int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, vo
|
||||
lv_style_attr_t attr_act;
|
||||
attr_act = get_style_prop_attr(style, id);
|
||||
|
||||
lv_style_attr_t attr_goal;
|
||||
attr_goal = (prop >> 8) & 0xFF;
|
||||
|
||||
return LV_STYLE_ATTR_GET_STATE(attr_act) & LV_STYLE_ATTR_GET_STATE(attr_goal);
|
||||
return LV_STYLE_ATTR_GET_STATE(attr_act);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -822,9 +764,8 @@ lv_res_t _lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop
|
||||
|
||||
int16_t ci;
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
/* changed class to _class to allow compilation as c++ */
|
||||
lv_style_t * _class = lv_style_list_get_style(list, ci);
|
||||
int16_t weight_act = _lv_style_get_int(_class, prop, &value_act);
|
||||
lv_style_t * style = lv_style_list_get_style(list, ci);
|
||||
int16_t weight_act = _lv_style_get_int(style, prop, &value_act);
|
||||
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
@@ -844,7 +785,6 @@ lv_res_t _lv_style_list_get_int(lv_style_list_t * list, lv_style_property_t prop
|
||||
|
||||
if(weight >= 0) return LV_RES_OK;
|
||||
else return LV_RES_INV;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -876,8 +816,8 @@ lv_res_t _lv_style_list_get_color(lv_style_list_t * list, lv_style_property_t pr
|
||||
|
||||
int16_t ci;
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * _class = lv_style_list_get_style(list, ci);
|
||||
int16_t weight_act = _lv_style_get_color(_class, prop, &value_act);
|
||||
lv_style_t * style = lv_style_list_get_style(list, ci);
|
||||
int16_t weight_act = _lv_style_get_color(style, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*res = value_act;
|
||||
@@ -926,8 +866,8 @@ lv_res_t _lv_style_list_get_opa(lv_style_list_t * list, lv_style_property_t prop
|
||||
|
||||
int16_t ci;
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * _class = lv_style_list_get_style(list, ci);
|
||||
int16_t weight_act = _lv_style_get_opa(_class, prop, &value_act);
|
||||
lv_style_t * style = lv_style_list_get_style(list, ci);
|
||||
int16_t weight_act = _lv_style_get_opa(style, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*res = value_act;
|
||||
@@ -976,8 +916,8 @@ lv_res_t _lv_style_list_get_ptr(lv_style_list_t * list, lv_style_property_t prop
|
||||
|
||||
int16_t ci;
|
||||
for(ci = 0; ci < list->style_cnt; ci++) {
|
||||
lv_style_t * _class = lv_style_list_get_style(list, ci);
|
||||
int16_t weight_act = _lv_style_get_ptr(_class, prop, &value_act);
|
||||
lv_style_t * style = lv_style_list_get_style(list, ci);
|
||||
int16_t weight_act = _lv_style_get_ptr(style, prop, &value_act);
|
||||
/*On perfect match return the value immediately*/
|
||||
if(weight_act == weight_goal) {
|
||||
*res = value_act;
|
||||
@@ -1052,6 +992,7 @@ LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t
|
||||
{
|
||||
LV_ASSERT_STYLE(style);
|
||||
|
||||
if(style == NULL) return -1;
|
||||
if(style->map == NULL) return -1;
|
||||
|
||||
uint8_t id_to_find = prop & 0xFF;
|
||||
@@ -1092,7 +1033,7 @@ LV_ATTRIBUTE_FAST_MEM static inline int32_t get_property_index(const lv_style_t
|
||||
}
|
||||
|
||||
/**
|
||||
* Get he local style from a style list. Allocate it if not exists yet.
|
||||
* Get the local style from a style list. Allocate it if not exists yet.
|
||||
* @param list pointer to a style list
|
||||
* @return pointer to the local style
|
||||
*/
|
||||
@@ -1122,9 +1063,12 @@ static lv_style_t * get_alloc_local_style(lv_style_list_t * list)
|
||||
* @param style pointer to the style to be resized.
|
||||
* @param size new size
|
||||
*/
|
||||
static inline void style_resize(lv_style_t * style, size_t sz)
|
||||
static inline bool style_resize(lv_style_t * style, size_t sz)
|
||||
{
|
||||
style->map = lv_mem_realloc(style->map, sz);
|
||||
uint8_t * new_map = lv_mem_realloc(style->map, sz);
|
||||
if(sz && new_map == NULL) return false;
|
||||
style->map = new_map;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1136,9 +1080,7 @@ static inline void style_resize(lv_style_t * style, size_t sz)
|
||||
static inline lv_style_property_t get_style_prop(const lv_style_t * style, size_t idx)
|
||||
{
|
||||
lv_style_property_t prop;
|
||||
uint8_t * prop_p = (uint8_t *)∝
|
||||
prop_p[0] = style->map[idx];
|
||||
prop_p[1] = style->map[idx + 1];
|
||||
_lv_memcpy_small(&prop, &style->map[idx], sizeof(lv_style_property_t));
|
||||
return prop;
|
||||
}
|
||||
|
||||
@@ -1167,8 +1109,7 @@ static inline uint8_t get_style_prop_attr(const lv_style_t * style, size_t idx)
|
||||
/**
|
||||
* Get property size.
|
||||
* @param prop_id property id.
|
||||
* @param idx index of the style in style->map
|
||||
* @return attribute of property in style->map + idx
|
||||
* @return size of property
|
||||
*/
|
||||
static inline size_t get_prop_size(uint8_t prop_id)
|
||||
{
|
||||
|
||||
@@ -100,7 +100,7 @@ enum {
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_HEIGHT, 0x0, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ANGLE, 0x0, LV_STYLE_ID_VALUE + 6, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSFORM_ZOOM, 0x0, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OPA_SCALE, 0x0, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OPA_SCALE, 0x0, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
|
||||
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PAD_TOP, 0x1, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PAD_BOTTOM, 0x1, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
@@ -127,11 +127,11 @@ enum {
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_BORDER_COLOR, 0x3, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_BORDER_OPA, 0x3, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
|
||||
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_WIDTH, 0x4, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_PAD, 0x4, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_BLEND_MODE, 0x4, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_COLOR, 0x4, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_OPA, 0x4, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_WIDTH, 0x4, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_PAD, 0x4, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_BLEND_MODE, 0x4, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_COLOR, 0x4, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_OUTLINE_OPA, 0x4, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
|
||||
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_WIDTH, 0x5, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OFS_X, 0x5, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
@@ -141,33 +141,33 @@ enum {
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_COLOR, 0x5, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_SHADOW_OPA, 0x5, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
|
||||
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_BLEND_MODE, 0x6, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_REPEAT, 0x6, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_RECOLOR, 0x6, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_OPA, 0x6, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_RECOLOR_OPA, 0x6, LV_STYLE_ID_OPA + 1, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_IMAGE, 0x6, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_BLEND_MODE, 0x6, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_REPEAT, 0x6, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_RECOLOR, 0x6, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_OPA, 0x6, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_RECOLOR_OPA,0x6, LV_STYLE_ID_OPA + 1, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_PATTERN_IMAGE, 0x6, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
|
||||
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_LETTER_SPACE, 0x7, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_LINE_SPACE, 0x7, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_BLEND_MODE, 0x7, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_OFS_X, 0x7, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_OFS_Y, 0x7, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_ALIGN, 0x7, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_COLOR, 0x7, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_OPA, 0x7, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_FONT, 0x7, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_STR, 0x7, LV_STYLE_ID_PTR + 1, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_LETTER_SPACE, 0x7, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_LINE_SPACE, 0x7, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_BLEND_MODE, 0x7, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_OFS_X, 0x7, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_OFS_Y, 0x7, LV_STYLE_ID_VALUE + 4, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_ALIGN, 0x7, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_COLOR, 0x7, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_OPA, 0x7, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_FONT, 0x7, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_VALUE_STR, 0x7, LV_STYLE_ID_PTR + 1, LV_STYLE_ATTR_NONE),
|
||||
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LETTER_SPACE, 0x8, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LINE_SPACE, 0x8, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_DECOR, 0x8, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_BLEND_MODE, 0x8, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_COLOR, 0x8, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_SEL_COLOR, 0x8, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_SEL_BG_COLOR, 0x8, LV_STYLE_ID_COLOR + 2, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_OPA, 0x8, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_FONT, 0x8, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LETTER_SPACE, 0x8, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_LINE_SPACE, 0x8, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_DECOR, 0x8, LV_STYLE_ID_VALUE + 2, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_BLEND_MODE, 0x8, LV_STYLE_ID_VALUE + 3, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_COLOR, 0x8, LV_STYLE_ID_COLOR + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_SEL_COLOR, 0x8, LV_STYLE_ID_COLOR + 1, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_SEL_BG_COLOR, 0x8, LV_STYLE_ID_COLOR + 2, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_OPA, 0x8, LV_STYLE_ID_OPA + 0, LV_STYLE_ATTR_INHERIT),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TEXT_FONT, 0x8, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_INHERIT),
|
||||
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_LINE_WIDTH, 0x9, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_LINE_BLEND_MODE, 0x9, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
@@ -190,7 +190,7 @@ enum {
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_4, 0xB, LV_STYLE_ID_VALUE + 5, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_5, 0xB, LV_STYLE_ID_VALUE + 6, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PROP_6, 0xB, LV_STYLE_ID_VALUE + 7, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PATH, 0xB, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_TRANSITION_PATH, 0xB, LV_STYLE_ID_PTR + 0, LV_STYLE_ATTR_NONE),
|
||||
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_WIDTH, 0xC, LV_STYLE_ID_VALUE + 0, LV_STYLE_ATTR_NONE),
|
||||
LV_STYLE_PROP_INIT(LV_STYLE_SCALE_BORDER_WIDTH, 0xC, LV_STYLE_ID_VALUE + 1, LV_STYLE_ATTR_NONE),
|
||||
@@ -231,9 +231,9 @@ typedef struct {
|
||||
uint32_t ignore_cache : 1; /*1: Ignore cache while getting value of properties*/
|
||||
|
||||
uint32_t radius_zero : 1;
|
||||
uint32_t opa_scale_cover : 1;
|
||||
uint32_t clip_corner_off : 1;
|
||||
uint32_t transform_all_zero : 1;
|
||||
uint32_t opa_scale_cover : 1;
|
||||
uint32_t clip_corner_off : 1;
|
||||
uint32_t transform_all_zero : 1;
|
||||
uint32_t pad_all_zero : 1;
|
||||
uint32_t margin_all_zero : 1;
|
||||
uint32_t blend_mode_all_normal : 1;
|
||||
@@ -405,7 +405,7 @@ void _lv_style_set_ptr(lv_style_t * style, lv_style_property_t prop, const void
|
||||
* For example: `lv_style_get_border_width()`
|
||||
* @note for performance reasons it's not checked if the property really has integer type
|
||||
*/
|
||||
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, void * res);
|
||||
int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, lv_style_int_t * res);
|
||||
|
||||
/**
|
||||
* Get a color typed property from a style.
|
||||
@@ -420,7 +420,7 @@ int16_t _lv_style_get_int(const lv_style_t * style, lv_style_property_t prop, vo
|
||||
* For example: `lv_style_get_border_color()`
|
||||
* @note for performance reasons it's not checked if the property really has color type
|
||||
*/
|
||||
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, void * res);
|
||||
int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop, lv_color_t * res);
|
||||
|
||||
/**
|
||||
* Get an opacity typed property from a style.
|
||||
@@ -435,7 +435,7 @@ int16_t _lv_style_get_color(const lv_style_t * style, lv_style_property_t prop,
|
||||
* For example: `lv_style_get_border_opa()`
|
||||
* @note for performance reasons it's not checked if the property really has opacity type
|
||||
*/
|
||||
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, void * res);
|
||||
int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, lv_opa_t * res);
|
||||
|
||||
/**
|
||||
* Get a pointer typed property from a style.
|
||||
@@ -450,7 +450,7 @@ int16_t _lv_style_get_opa(const lv_style_t * style, lv_style_property_t prop, vo
|
||||
* For example: `lv_style_get_text_font()`
|
||||
* @note for performance reasons it's not checked if the property really has pointer type
|
||||
*/
|
||||
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, void * res);
|
||||
int16_t _lv_style_get_ptr(const lv_style_t * style, lv_style_property_t prop, const void ** res);
|
||||
|
||||
/**
|
||||
* Get the local style of a style list
|
||||
@@ -461,7 +461,7 @@ lv_style_t * lv_style_list_get_local_style(lv_style_list_t * list);
|
||||
|
||||
/**
|
||||
* Get the transition style of a style list
|
||||
* @param list pointer to a style list where the local property should be set
|
||||
* @param list pointer to a style list where the transition property should be set
|
||||
* @return pointer to the transition style if exists else `NULL`.
|
||||
*/
|
||||
lv_style_t * _lv_style_list_get_transition_style(lv_style_list_t * list);
|
||||
@@ -574,7 +574,7 @@ bool lv_debug_check_style(const lv_style_t * style);
|
||||
|
||||
/**
|
||||
* Check whether a style list is valid (initialized correctly)
|
||||
* @param style pointer to a style
|
||||
* @param list pointer to a style list
|
||||
* @return true: valid
|
||||
*/
|
||||
bool lv_debug_check_style_list(const lv_style_list_t * list);
|
||||
@@ -596,7 +596,7 @@ bool lv_debug_check_style_list(const lv_style_list_t * list);
|
||||
* lv_style_init(&my_style);
|
||||
* lv_style_copy(&my_style, &style_to_copy);
|
||||
*/
|
||||
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy_p);
|
||||
#define LV_STYLE_CREATE(name, copy_p) static lv_style_t name; lv_style_init(&name); lv_style_copy(&name, copy_p)
|
||||
|
||||
#if LV_USE_DEBUG
|
||||
|
||||
|
||||
Reference in New Issue
Block a user