Lines Matching +full:- +full:w
43 static lv_grad_t * allocate_item(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord_t h);
48 static uint32_t compute_key(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord_t h);
64 static uint32_t compute_key(const lv_grad_dsc_t * g, lv_coord_t size, lv_coord_t w) in compute_key() argument
68 …return (v.value ^ size ^ (w >> 1)); /*Yes, this is correct, it's like a hash that changes if the w… in compute_key()
73 size_t s = ALIGN(sizeof(*c)) + ALIGN(c->alloc_size * sizeof(lv_color_t)); in get_cache_item_size()
75 s += ALIGN(c->size * sizeof(lv_color32_t)); in get_cache_item_size()
77 s += ALIGN(c->w * sizeof(lv_scolor24_t)); in get_cache_item_size()
99 while(first != NULL && first->life) { in iterate_cache()
112 if(c->life < *min_life) *min_life = c->life; in find_oldest_item_life()
119 size_t next_items_size = (size_t)(grad_cache_end - (uint8_t *)c) - size; in free_item()
120 grad_cache_end -= size; in free_item()
126 c->map = (lv_color_t *)(((uint8_t *)c->map) - size); in free_item()
128 c->hmap = (lv_color32_t *)(((uint8_t *)c->hmap) - size); in free_item()
130 c->error_acc = (lv_scolor24_t *)(((uint8_t *)c->error_acc) - size); in free_item()
142 if(c->life == *min_life) { in kill_oldest_item()
153 if(c->key == *k) return LV_RES_OK; in find_item()
157 static lv_grad_t * allocate_item(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord_t h) in allocate_item() argument
159 lv_coord_t size = g->dir == LV_GRAD_DIR_HOR ? w : h; in allocate_item()
160 lv_coord_t map_size = LV_MAX(w, h); /* The map is being used horizontally (width) unless in allocate_item()
167 req_size += ALIGN(w * sizeof(lv_scolor24_t)); in allocate_item()
171 size_t act_size = (size_t)(grad_cache_end - LV_GC_ROOT(_lv_grad_cache_mem)); in allocate_item()
175 item->not_cached = 0; in allocate_item()
184 act_size = (size_t)(grad_cache_end - LV_GC_ROOT(_lv_grad_cache_mem)); in allocate_item()
187 item->not_cached = 0; in allocate_item()
194 item->not_cached = 1; in allocate_item()
198 item->key = compute_key(g, size, w); in allocate_item()
199 item->life = 1; in allocate_item()
200 item->filled = 0; in allocate_item()
201 item->alloc_size = map_size; in allocate_item()
202 item->size = size; in allocate_item()
203 if(item->not_cached) { in allocate_item()
205 item->map = (lv_color_t *)(p + ALIGN(sizeof(*item))); in allocate_item()
207 … item->hmap = (lv_color32_t *)(p + ALIGN(sizeof(*item)) + ALIGN(map_size * sizeof(lv_color_t))); in allocate_item()
209 …item->error_acc = (lv_scolor24_t *)(p + ALIGN(sizeof(*item)) + ALIGN(size * sizeof(lv_grad_color_t… in allocate_item()
211 item->w = w; in allocate_item()
216 item->map = (lv_color_t *)(grad_cache_end + ALIGN(sizeof(*item))); in allocate_item()
218 …item->hmap = (lv_color32_t *)(grad_cache_end + ALIGN(sizeof(*item)) + ALIGN(map_size * sizeof(lv_c… in allocate_item()
220 …item->error_acc = (lv_scolor24_t *)(grad_cache_end + ALIGN(sizeof(*item)) + ALIGN(size * sizeof(lv… in allocate_item()
222 item->w = w; in allocate_item()
249 lv_grad_t * lv_gradient_get(const lv_grad_dsc_t * g, lv_coord_t w, lv_coord_t h) in lv_gradient_get() argument
252 if(g->dir == LV_GRAD_DIR_NONE) return NULL; in lv_gradient_get()
262 lv_coord_t size = g->dir == LV_GRAD_DIR_HOR ? w : h; in lv_gradient_get()
263 uint32_t key = compute_key(g, size, w); in lv_gradient_get()
266 item->life++; /* Don't forget to bump the counter */ in lv_gradient_get()
271 item = allocate_item(g, w, h); in lv_gradient_get()
279 for(lv_coord_t i = 0; i < item->size; i++) { in lv_gradient_get()
280 item->hmap[i] = lv_gradient_calculate(g, item->size, i); in lv_gradient_get()
283 lv_memset_00(item->error_acc, w * sizeof(lv_scolor24_t)); in lv_gradient_get()
286 for(lv_coord_t i = 0; i < item->size; i++) { in lv_gradient_get()
287 item->map[i] = lv_gradient_calculate(g, item->size, i); in lv_gradient_get()
299 /*Clip out-of-bounds first*/ in lv_gradient_calculate()
300 int32_t min = (dsc->stops[0].frac * range) >> 8; in lv_gradient_calculate()
302 GRAD_CONV(tmp, dsc->stops[0].color); in lv_gradient_calculate()
306 int32_t max = (dsc->stops[dsc->stops_count - 1].frac * range) >> 8; in lv_gradient_calculate()
308 GRAD_CONV(tmp, dsc->stops[dsc->stops_count - 1].color); in lv_gradient_calculate()
314 for(uint8_t i = 1; i < dsc->stops_count; i++) { in lv_gradient_calculate()
315 int32_t cur = (dsc->stops[i].frac * range) >> 8; in lv_gradient_calculate()
317 one.full = lv_color_to32(dsc->stops[i - 1].color); in lv_gradient_calculate()
318 two.full = lv_color_to32(dsc->stops[i].color); in lv_gradient_calculate()
319 min = (dsc->stops[i - 1].frac * range) >> 8; in lv_gradient_calculate()
320 max = (dsc->stops[i].frac * range) >> 8; in lv_gradient_calculate()
321 d = max - min; in lv_gradient_calculate()
329 frac -= min; in lv_gradient_calculate()
331 lv_opa_t imix = 255 - mix; in lv_gradient_calculate()
341 if(grad->not_cached) { in lv_gradient_cleanup()