Lines Matching refs:style

40 void lv_style_init(lv_style_t * style)  in lv_style_init()  argument
43 if(style->sentinel == LV_STYLE_SENTINEL_VALUE && style->prop_cnt > 1) { in lv_style_init()
48 lv_memset_00(style, sizeof(lv_style_t)); in lv_style_init()
50 style->sentinel = LV_STYLE_SENTINEL_VALUE; in lv_style_init()
54 void lv_style_reset(lv_style_t * style) in lv_style_reset() argument
56 LV_ASSERT_STYLE(style); in lv_style_reset()
58 if(style->is_const) { in lv_style_reset()
63 if(style->prop_cnt > 1) lv_mem_free(style->v_p.values_and_props); in lv_style_reset()
64 lv_memset_00(style, sizeof(lv_style_t)); in lv_style_reset()
66 style->sentinel = LV_STYLE_SENTINEL_VALUE; in lv_style_reset()
77 bool lv_style_remove_prop(lv_style_t * style, lv_style_prop_t prop) in lv_style_remove_prop() argument
79 LV_ASSERT_STYLE(style); in lv_style_remove_prop()
81 if(style->is_const) { in lv_style_remove_prop()
86 if(style->prop_cnt == 0) return false; in lv_style_remove_prop()
88 if(style->prop_cnt == 1) { in lv_style_remove_prop()
89 if(style->prop1 == prop) { in lv_style_remove_prop()
90 style->prop1 = LV_STYLE_PROP_INV; in lv_style_remove_prop()
91 style->prop_cnt = 0; in lv_style_remove_prop()
97 uint8_t * tmp = style->v_p.values_and_props + style->prop_cnt * sizeof(lv_style_value_t); in lv_style_remove_prop()
100 for(i = 0; i < style->prop_cnt; i++) { in lv_style_remove_prop()
102 lv_style_value_t * old_values = (lv_style_value_t *)style->v_p.values_and_props; in lv_style_remove_prop()
104 if(style->prop_cnt == 2) { in lv_style_remove_prop()
105 style->prop_cnt = 1; in lv_style_remove_prop()
106 style->prop1 = i == 0 ? old_props[1] : old_props[0]; in lv_style_remove_prop()
107 style->v_p.value1 = i == 0 ? old_values[1] : old_values[0]; in lv_style_remove_prop()
110 size_t size = (style->prop_cnt - 1) * (sizeof(lv_style_value_t) + sizeof(uint16_t)); in lv_style_remove_prop()
113 style->v_p.values_and_props = new_values_and_props; in lv_style_remove_prop()
114 style->prop_cnt--; in lv_style_remove_prop()
116 tmp = new_values_and_props + style->prop_cnt * sizeof(lv_style_value_t); in lv_style_remove_prop()
121 for(i = j = 0; j <= style->prop_cnt; in lv_style_remove_prop()
138 void lv_style_set_prop(lv_style_t * style, lv_style_prop_t prop, lv_style_value_t value) in lv_style_set_prop() argument
140 LV_ASSERT_STYLE(style); in lv_style_set_prop()
142 if(style->is_const) { in lv_style_set_prop()
147 if(style->prop_cnt > 1) { in lv_style_set_prop()
148 uint8_t * tmp = style->v_p.values_and_props + style->prop_cnt * sizeof(lv_style_value_t); in lv_style_set_prop()
151 for(i = style->prop_cnt - 1; i >= 0; i--) { in lv_style_set_prop()
153 lv_style_value_t * values = (lv_style_value_t *)style->v_p.values_and_props; in lv_style_set_prop()
159 size_t size = (style->prop_cnt + 1) * (sizeof(lv_style_value_t) + sizeof(uint16_t)); in lv_style_set_prop()
160 uint8_t * values_and_props = lv_mem_realloc(style->v_p.values_and_props, size); in lv_style_set_prop()
162 style->v_p.values_and_props = values_and_props; in lv_style_set_prop()
164 tmp = values_and_props + style->prop_cnt * sizeof(lv_style_value_t); in lv_style_set_prop()
167 for(i = style->prop_cnt - 1; i >= 0; i--) { in lv_style_set_prop()
170 style->prop_cnt++; in lv_style_set_prop()
173 tmp = values_and_props + style->prop_cnt * sizeof(lv_style_value_t); in lv_style_set_prop()
178 props[style->prop_cnt - 1] = prop; in lv_style_set_prop()
179 values[style->prop_cnt - 1] = value; in lv_style_set_prop()
181 else if(style->prop_cnt == 1) { in lv_style_set_prop()
182 if(style->prop1 == prop) { in lv_style_set_prop()
183 style->v_p.value1 = value; in lv_style_set_prop()
186 size_t size = (style->prop_cnt + 1) * (sizeof(lv_style_value_t) + sizeof(uint16_t)); in lv_style_set_prop()
189 lv_style_value_t value_tmp = style->v_p.value1; in lv_style_set_prop()
190 style->v_p.values_and_props = values_and_props; in lv_style_set_prop()
191 style->prop_cnt++; in lv_style_set_prop()
193 uint8_t * tmp = values_and_props + style->prop_cnt * sizeof(lv_style_value_t); in lv_style_set_prop()
196 props[0] = style->prop1; in lv_style_set_prop()
202 style->prop_cnt = 1; in lv_style_set_prop()
203 style->prop1 = prop; in lv_style_set_prop()
204 style->v_p.value1 = value; in lv_style_set_prop()
208 style->has_group |= 1 << group; in lv_style_set_prop()
211 lv_res_t lv_style_get_prop(const lv_style_t * style, lv_style_prop_t prop, lv_style_value_t * value) in lv_style_get_prop() argument
213 return lv_style_get_prop_inlined(style, prop, value); in lv_style_get_prop()
284 bool lv_style_is_empty(const lv_style_t * style) in lv_style_is_empty() argument
286 LV_ASSERT_STYLE(style); in lv_style_is_empty()
288 return style->prop_cnt == 0 ? true : false; in lv_style_is_empty()