refactor(nuttx_image_cache): remove LV_CACHE_DEF_SIZE dependency (#6178)

This commit is contained in:
Benign X
2024-05-07 20:28:14 +08:00
committed by GitHub
parent 417d78bead
commit 01b6861384
4 changed files with 5 additions and 15 deletions

View File

@@ -104,9 +104,7 @@ void lv_nuttx_init(const lv_nuttx_dsc_t * dsc, lv_nuttx_result_t * result)
lv_nuttx_cache_init();
#if LV_CACHE_DEF_SIZE > 0
lv_nuttx_image_cache_init();
#endif
#if LV_USE_PROFILER && LV_USE_PROFILER_BUILTIN
lv_nuttx_profiler_init();

View File

@@ -44,13 +44,7 @@ typedef struct {
} lv_nuttx_result_t;
typedef struct _lv_nuttx_ctx_t {
#if LV_CACHE_DEF_SIZE > 0
void * image_cache;
#else
void * dummy;
#endif
} lv_nuttx_ctx_t;
/**********************

View File

@@ -10,8 +10,6 @@
#include "lv_nuttx_image_cache.h"
#include "../../../lvgl.h"
#if LV_CACHE_DEF_SIZE > 0
#if LV_USE_NUTTX
#include <nuttx/mm/mm.h>
@@ -78,6 +76,11 @@ static bool defer_init(void)
return true;
}
if(img_cache_p->max_size == 0) {
LV_LOG_INFO("Image cache is not initialized yet. Skipping deferred initialization. Because max_size is 0.");
return false;
}
ctx->mem_size = img_cache_p->max_size;
ctx->mem = malloc(ctx->mem_size);
LV_ASSERT_MALLOC(ctx->mem);
@@ -150,4 +153,3 @@ static void free_cb(void * draw_buf)
}
#endif /* LV_USE_NUTTX */
#endif /* LV_CACHE_DEF_SIZE > 0 */

View File

@@ -16,8 +16,6 @@ extern "C" {
#include "../../lv_conf_internal.h"
#if LV_CACHE_DEF_SIZE > 0
/*********************
* DEFINES
*********************/
@@ -36,8 +34,6 @@ void lv_nuttx_image_cache_init(void);
* MACROS
**********************/
#endif /*LV_CACHE_DEF_SIZE > 0*/
#ifdef __cplusplus
} /*extern "C"*/
#endif