feat(decoder): do not even try cache if 'no_cache' is set (#5688)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Neo Xu
2024-02-20 09:34:46 +08:00
committed by GitHub
parent f5f19ca7f0
commit c81184db45
2 changed files with 8 additions and 5 deletions

View File

@@ -123,10 +123,13 @@ lv_result_t lv_image_decoder_open(lv_image_decoder_dsc_t * dsc, const void * src
#if LV_CACHE_DEF_SIZE > 0
dsc->cache = img_cache_p;
/*Try cache first, unless we are told to ignore cache.*/
if(!(args && args->no_cache)) {
/*
* Check the cache first
* If the image is found in the cache, just return it.*/
if(try_cache(dsc) == LV_RESULT_OK) return LV_RESULT_OK;
}
#endif
/*Find the decoder that can open the image source, and get the header info in the same time.*/

View File

@@ -61,7 +61,7 @@ typedef struct _lv_image_decoder_dsc_t lv_image_decoder_dsc_t;
typedef struct _lv_image_decoder_args_t {
bool stride_align; /*Whether stride should be aligned*/
bool premultiply; /*Whether image should be premultiplied or not after decoding*/
bool no_cache; /*Whether this image should be kept out of cache*/
bool no_cache; /*When set, decoded image won't be put to cache, and decoder open will also ignore cache.*/
bool use_indexed; /*Decoded indexed image as is. Convert to ARGB8888 if false.*/
} lv_image_decoder_args_t;