Lines Matching refs:item
38 static lv_grad_t * next_in_cache(lv_grad_t * item);
83 static lv_grad_t * next_in_cache(lv_grad_t * item) in next_in_cache() argument
87 if(item == NULL) in next_in_cache()
90 size_t s = get_cache_item_size(item); in next_in_cache()
92 if((uint8_t *)item + s >= grad_cache_end) return NULL; in next_in_cache()
93 else return (lv_grad_t *)((uint8_t *)item + s); in next_in_cache()
172 lv_grad_t * item = NULL; in allocate_item() local
174 item = (lv_grad_t *)grad_cache_end; in allocate_item()
175 item->not_cached = 0; in allocate_item()
186 item = (lv_grad_t *)grad_cache_end; in allocate_item()
187 item->not_cached = 0; in allocate_item()
191 item = lv_mem_alloc(req_size); in allocate_item()
192 LV_ASSERT_MALLOC(item); in allocate_item()
193 if(item == NULL) return NULL; 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()
204 uint8_t * p = (uint8_t *)item; 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()
227 return item; in allocate_item()
264 lv_grad_t * item = NULL; in lv_gradient_get() local
265 if(iterate_cache(&find_item, &key, &item) == LV_RES_OK) { in lv_gradient_get()
266 item->life++; /* Don't forget to bump the counter */ in lv_gradient_get()
267 return item; in lv_gradient_get()
271 item = allocate_item(g, w, h); in lv_gradient_get()
272 if(item == NULL) { in lv_gradient_get()
274 return item; 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()
291 return item; in lv_gradient_get()