feat(vg_lite): add porting layer for VG-Lite simulator based on ThorVG (#5256)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Neo Xu
2024-01-10 20:20:46 +08:00
committed by GitHub
parent ac7ce449b9
commit c9386a1a93
7 changed files with 37 additions and 1 deletions

View File

@@ -355,6 +355,15 @@ menu "LVGL configuration"
default n default n
depends on LV_USE_DRAW_VG_LITE depends on LV_USE_DRAW_VG_LITE
config LV_USE_VG_LITE_THORVG
bool "Use ThorVG to simulate VG-Lite hardware."
default n
depends on LV_USE_DRAW_VG_LITE && LV_USE_THORVG
help
Use thorvg to simulate VG-Lite hardware behavior, it's useful
for debugging and testing on PC simulator. Enable LV_USE_THORVG,
Either internal ThorVG or external ThorVG library is required.
config LV_USE_GPU_SDL config LV_USE_GPU_SDL
bool "Use SDL renderer API" bool "Use SDL renderer API"
default n default n

View File

@@ -16,7 +16,7 @@ endif( LV_CONF_PATH )
option(BUILD_SHARED_LIBS "Build shared libraries" OFF) option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
# Set sources used for LVGL components # Set sources used for LVGL components
file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c ${LVGL_ROOT_DIR}/src/*.S) file(GLOB_RECURSE SOURCES ${LVGL_ROOT_DIR}/src/*.c ${LVGL_ROOT_DIR}/src/dev/vg_lite_tvg/*.cpp ${LVGL_ROOT_DIR}/src/*.S)
file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c) file(GLOB_RECURSE EXAMPLE_SOURCES ${LVGL_ROOT_DIR}/examples/*.c)
file(GLOB_RECURSE DEMO_SOURCES ${LVGL_ROOT_DIR}/demos/*.c) file(GLOB_RECURSE DEMO_SOURCES ${LVGL_ROOT_DIR}/demos/*.c)
file(GLOB_RECURSE THORVG_SOURCES ${LVGL_ROOT_DIR}/src/libs/thorvg/*.cpp) file(GLOB_RECURSE THORVG_SOURCES ${LVGL_ROOT_DIR}/src/libs/thorvg/*.cpp)

View File

@@ -140,6 +140,10 @@
/* Enable VG-Lite assert. */ /* Enable VG-Lite assert. */
#define LV_VG_LITE_USE_ASSERT 0 #define LV_VG_LITE_USE_ASSERT 0
/* Simulate VG-Lite hardware using ThorVG */
#define LV_USE_VG_LITE_THORVG 0
#endif #endif
/*================= /*=================

View File

@@ -19,7 +19,12 @@ extern "C" {
#if LV_USE_DRAW_VG_LITE #if LV_USE_DRAW_VG_LITE
#include "../lv_draw.h" #include "../lv_draw.h"
#if LV_USE_VG_LITE_THORVG
#include "../../dev/vg_lite_tvg/vg_lite.h"
#else
#include <vg_lite.h> #include <vg_lite.h>
#endif
/********************* /*********************
* DEFINES * DEFINES

View File

@@ -19,7 +19,11 @@ extern "C" {
#if LV_USE_DRAW_VG_LITE #if LV_USE_DRAW_VG_LITE
#include <stdbool.h> #include <stdbool.h>
#if LV_USE_VG_LITE_THORVG
#include "../../dev/vg_lite_tvg/vg_lite.h"
#else
#include <vg_lite.h> #include <vg_lite.h>
#endif
/********************* /*********************
* DEFINES * DEFINES

View File

@@ -446,7 +446,11 @@ bool SwRenderer::target(pixel_t* data, uint32_t stride, uint32_t w, uint32_t h,
bool SwRenderer::preRender() bool SwRenderer::preRender()
{ {
#if LV_USE_DRAW_VG_LITE && LV_USE_VG_LITE_THORVG
return true;
#else
return rasterClear(surface, 0, 0, surface->w, surface->h); return rasterClear(surface, 0, 0, surface->w, surface->h);
#endif
} }

View File

@@ -386,6 +386,16 @@
#define LV_VG_LITE_USE_ASSERT 0 #define LV_VG_LITE_USE_ASSERT 0
#endif #endif
#endif #endif
/* Simulate VG-Lite hardware using ThorVG */
#ifndef LV_USE_VG_LITE_THORVG
#ifdef CONFIG_LV_USE_VG_LITE_THORVG
#define LV_USE_VG_LITE_THORVG CONFIG_LV_USE_VG_LITE_THORVG
#else
#define LV_USE_VG_LITE_THORVG 0
#endif
#endif
#endif #endif
/*================= /*=================