mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-21 06:53:01 +08:00
fix theme initialization
This commit is contained in:
parent
728cd17275
commit
c94fb96bb2
@ -35,7 +35,7 @@ static lv_theme_t * current_theme;
|
||||
* (The pointers in the theme points to the styles declared by the theme itself) */
|
||||
|
||||
/* Store the styles in this array. */
|
||||
static lv_style_t th_styles[sizeof(((lv_theme_t *)0)->style) / sizeof(lv_style_t *)];
|
||||
static lv_style_t th_styles[LV_THEME_STYLE_COUNT];
|
||||
static bool inited = false;
|
||||
static lv_theme_t current_theme;
|
||||
#endif
|
||||
|
@ -314,6 +314,9 @@ lv_theme_t * lv_theme_get_current(void);
|
||||
* MACROS
|
||||
**********************/
|
||||
|
||||
/* Returns number of styles within the `lv_theme_t` structure. */
|
||||
#define LV_THEME_STYLE_COUNT (sizeof(((lv_theme_t *)0)->style) / sizeof(lv_style_t *))
|
||||
|
||||
/**********************
|
||||
* POST INCLUDE
|
||||
*********************/
|
||||
|
@ -817,8 +817,8 @@ lv_theme_t * lv_theme_alien_init(uint16_t hue, lv_font_t * font)
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
@ -376,8 +376,8 @@ lv_theme_t * lv_theme_default_init(uint16_t hue, lv_font_t * font)
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
@ -801,8 +801,8 @@ lv_theme_t * lv_theme_material_init(uint16_t hue, lv_font_t * font)
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
@ -435,8 +435,8 @@ lv_theme_t * lv_theme_mono_init(uint16_t hue, lv_font_t * font)
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
@ -800,8 +800,8 @@ lv_theme_t * lv_theme_nemo_init(uint16_t hue, lv_font_t * font)
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
@ -710,8 +710,8 @@ lv_theme_t * lv_theme_night_init(uint16_t hue, lv_font_t * font)
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
@ -385,8 +385,8 @@ lv_theme_t * lv_theme_templ_init(uint16_t hue, lv_font_t * font)
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
@ -767,8 +767,8 @@ lv_theme_t * lv_theme_zen_init(uint16_t hue, lv_font_t * font)
|
||||
|
||||
/*For backward compatibility initialize all theme elements with a default style */
|
||||
uint16_t i;
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme;
|
||||
for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t *); i++) {
|
||||
lv_style_t ** style_p = (lv_style_t **) &theme.style;
|
||||
for(i = 0; i < LV_THEME_STYLE_COUNT; i++) {
|
||||
*style_p = &def;
|
||||
style_p++;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user