aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author_VIFEXTech <vifextech@foxmail.com>2024-01-17 21:35:48 +0800
committerGitHub <noreply@github.com>2024-01-17 14:35:48 +0100
commit0379088110631f9d60d3d01b295efe47d46bdefc (patch)
tree4f7daf33cb038ba0c5f582c79dd41da0d782ea7a /src
parent32828206d14722560e369f1281667938bce12426 (diff)
downloadlvgl-0379088110631f9d60d3d01b295efe47d46bdefc.tar.gz
lvgl-0379088110631f9d60d3d01b295efe47d46bdefc.zip
chore(vg_lite): clean useless function and macro (#5346)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
Diffstat (limited to 'src')
-rw-r--r--src/draw/vg_lite/lv_draw_buf_vg_lite.c39
-rw-r--r--src/draw/vg_lite/lv_vg_lite_decoder.c4
-rw-r--r--src/draw/vg_lite/lv_vg_lite_utils.c4
-rw-r--r--src/draw/vg_lite/lv_vg_lite_utils.h4
4 files changed, 7 insertions, 44 deletions
diff --git a/src/draw/vg_lite/lv_draw_buf_vg_lite.c b/src/draw/vg_lite/lv_draw_buf_vg_lite.c
index 28de3ecfe..65b085ca0 100644
--- a/src/draw/vg_lite/lv_draw_buf_vg_lite.c
+++ b/src/draw/vg_lite/lv_draw_buf_vg_lite.c
@@ -7,15 +7,11 @@
* INCLUDES
*********************/
-/*Fix warning for aligned_alloc. See https://stackoverflow.com/questions/29247065/compiler-cant-find-aligned-alloc-function*/
-#define _ISOC11_SOURCE
-
#include "lv_draw_vg_lite.h"
#if LV_USE_DRAW_VG_LITE
#include "lv_vg_lite_utils.h"
-#include <stdlib.h>
/*********************
* DEFINES
@@ -29,10 +25,6 @@
* STATIC PROTOTYPES
**********************/
-static void * buf_malloc(size_t size, lv_color_format_t color_format);
-static void buf_free(void * buf);
-static void * buf_align(void * buf, lv_color_format_t color_format);
-static void invalidate_cache(void * buf, uint32_t stride, lv_color_format_t color_format, const lv_area_t * area);
static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format);
/**********************
@@ -50,11 +42,6 @@ static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format);
void lv_draw_buf_vg_lite_init_handlers(void)
{
lv_draw_buf_handlers_t * handlers = lv_draw_buf_get_handlers();
-
- handlers->buf_malloc_cb = buf_malloc;
- handlers->buf_free_cb = buf_free;
- handlers->align_pointer_cb = buf_align;
- handlers->invalidate_cache_cb = invalidate_cache;
handlers->width_to_stride_cb = width_to_stride;
}
@@ -62,32 +49,6 @@ void lv_draw_buf_vg_lite_init_handlers(void)
* STATIC FUNCTIONS
**********************/
-static void * buf_malloc(size_t size_bytes, lv_color_format_t color_format)
-{
- LV_UNUSED(color_format);
- size_bytes = LV_VG_LITE_ALIGN(size_bytes, LV_VG_LITE_BUF_ALIGN);
- return aligned_alloc(LV_VG_LITE_BUF_ALIGN, size_bytes);
-}
-
-static void buf_free(void * buf)
-{
- free(buf);
-}
-
-static void * buf_align(void * buf, lv_color_format_t color_format)
-{
- LV_UNUSED(color_format);
- return (void *)LV_VG_LITE_ALIGN((lv_uintptr_t)buf, LV_VG_LITE_BUF_ALIGN);
-}
-
-static void invalidate_cache(void * buf, uint32_t stride, lv_color_format_t color_format, const lv_area_t * area)
-{
- LV_UNUSED(buf);
- LV_UNUSED(stride);
- LV_UNUSED(color_format);
- LV_UNUSED(area);
-}
-
static uint32_t width_to_stride(uint32_t w, lv_color_format_t color_format)
{
return lv_vg_lite_width_to_stride(w, lv_vg_lite_vg_fmt(color_format));
diff --git a/src/draw/vg_lite/lv_vg_lite_decoder.c b/src/draw/vg_lite/lv_vg_lite_decoder.c
index 69f66b82d..8e3b479cc 100644
--- a/src/draw/vg_lite/lv_vg_lite_decoder.c
+++ b/src/draw/vg_lite/lv_vg_lite_decoder.c
@@ -231,7 +231,7 @@ static lv_result_t decoder_open_variable(lv_image_decoder_t * decoder, lv_image_
/* Since the palette and index image are next to each other,
* the palette size needs to be aligned to ensure that the image is aligned.
*/
- uint32_t palette_size_bytes_aligned = LV_VG_LITE_ALIGN(palette_size_bytes, LV_VG_LITE_BUF_ALIGN);
+ uint32_t palette_size_bytes_aligned = LV_VG_LITE_ALIGN(palette_size_bytes, LV_DRAW_BUF_ALIGN);
lv_draw_buf_t * draw_buf = lv_draw_buf_create(width, height, cf, stride);
if(draw_buf == NULL) {
@@ -305,7 +305,7 @@ static lv_result_t decoder_open_file(lv_image_decoder_t * decoder, lv_image_deco
/* Since the palette and index image are next to each other,
* the palette size needs to be aligned to ensure that the image is aligned.
*/
- uint32_t palette_size_bytes_aligned = LV_VG_LITE_ALIGN(palette_size_bytes, LV_VG_LITE_BUF_ALIGN);
+ uint32_t palette_size_bytes_aligned = LV_VG_LITE_ALIGN(palette_size_bytes, LV_DRAW_BUF_ALIGN);
lv_draw_buf_t * draw_buf = lv_draw_buf_create(width, height, cf, stride);
if(draw_buf == NULL) {
diff --git a/src/draw/vg_lite/lv_vg_lite_utils.c b/src/draw/vg_lite/lv_vg_lite_utils.c
index d26cb804a..eab81a8bd 100644
--- a/src/draw/vg_lite/lv_vg_lite_utils.c
+++ b/src/draw/vg_lite/lv_vg_lite_utils.c
@@ -759,8 +759,8 @@ bool lv_vg_lite_buffer_check(const vg_lite_buffer_t * buffer, bool is_src)
return false;
}
- if(!LV_VG_LITE_IS_ALIGNED(buffer->memory, LV_VG_LITE_BUF_ALIGN)) {
- LV_LOG_ERROR("buffer address(%p) is not aligned to %d", buffer->memory, LV_VG_LITE_BUF_ALIGN);
+ if(!LV_VG_LITE_IS_ALIGNED(buffer->memory, LV_DRAW_BUF_ALIGN)) {
+ LV_LOG_ERROR("buffer address(%p) is not aligned to %d", buffer->memory, LV_DRAW_BUF_ALIGN);
return false;
}
diff --git a/src/draw/vg_lite/lv_vg_lite_utils.h b/src/draw/vg_lite/lv_vg_lite_utils.h
index 0df1c0743..3c24375bd 100644
--- a/src/draw/vg_lite/lv_vg_lite_utils.h
+++ b/src/draw/vg_lite/lv_vg_lite_utils.h
@@ -29,7 +29,9 @@ extern "C" {
* DEFINES
*********************/
-#define LV_VG_LITE_BUF_ALIGN 64
+#if LV_DRAW_BUF_ALIGN != 64
+#error "LV_DRAW_BUF_ALIGN must be 64"
+#endif
#define LV_VG_LITE_IS_ERROR(err) (err > 0)