feat(cache): image cache supports dynamic setting of cache size (#5926)
This commit is contained in:
@@ -393,7 +393,10 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
|
||||
|
||||
if(dsc->args.no_cache) return res;
|
||||
|
||||
#if LV_CACHE_DEF_SIZE > 0
|
||||
/*If the image cache is disabled, just return the decoded image*/
|
||||
if(!lv_image_cache_is_enabled()) return res;
|
||||
|
||||
/*Add the decoded image to the cache*/
|
||||
if(res == LV_RESULT_OK) {
|
||||
lv_image_cache_data_t search_key;
|
||||
search_key.src_type = dsc->src_type;
|
||||
@@ -409,7 +412,6 @@ static lv_result_t decoder_open(lv_image_decoder_t * decoder, lv_image_decoder_d
|
||||
}
|
||||
dsc->cache_entry = entry;
|
||||
}
|
||||
#endif
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -418,7 +420,7 @@ static void decoder_close(lv_image_decoder_t * decoder, lv_image_decoder_dsc_t *
|
||||
{
|
||||
LV_UNUSED(decoder); /*Unused*/
|
||||
|
||||
if(dsc->args.no_cache || LV_CACHE_DEF_SIZE == 0)
|
||||
if(dsc->args.no_cache || !lv_image_cache_is_enabled())
|
||||
decoder_draw_buf_free((lv_draw_buf_t *)dsc->decoded);
|
||||
else
|
||||
lv_cache_release(dsc->cache, dsc->cache_entry, NULL);
|
||||
|
||||
Reference in New Issue
Block a user