diff --git a/Kconfig b/Kconfig index 0bb8187e0..fd126c7ff 100644 --- a/Kconfig +++ b/Kconfig @@ -355,6 +355,15 @@ menu "LVGL configuration" default n 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 bool "Use SDL renderer API" default n diff --git a/env_support/cmake/custom.cmake b/env_support/cmake/custom.cmake index 5deeeb1ff..cd30207a0 100644 --- a/env_support/cmake/custom.cmake +++ b/env_support/cmake/custom.cmake @@ -16,7 +16,7 @@ endif( LV_CONF_PATH ) option(BUILD_SHARED_LIBS "Build shared libraries" OFF) # 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 DEMO_SOURCES ${LVGL_ROOT_DIR}/demos/*.c) file(GLOB_RECURSE THORVG_SOURCES ${LVGL_ROOT_DIR}/src/libs/thorvg/*.cpp) diff --git a/lv_conf_template.h b/lv_conf_template.h index 3894e44d8..d7f8328f9 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -140,6 +140,10 @@ /* Enable VG-Lite assert. */ #define LV_VG_LITE_USE_ASSERT 0 + +/* Simulate VG-Lite hardware using ThorVG */ +#define LV_USE_VG_LITE_THORVG 0 + #endif /*================= diff --git a/src/draw/vg_lite/lv_draw_vg_lite_type.h b/src/draw/vg_lite/lv_draw_vg_lite_type.h index d85983083..461995e5a 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_type.h +++ b/src/draw/vg_lite/lv_draw_vg_lite_type.h @@ -19,7 +19,12 @@ extern "C" { #if LV_USE_DRAW_VG_LITE #include "../lv_draw.h" + +#if LV_USE_VG_LITE_THORVG +#include "../../dev/vg_lite_tvg/vg_lite.h" +#else #include +#endif /********************* * DEFINES diff --git a/src/draw/vg_lite/lv_vg_lite_utils.h b/src/draw/vg_lite/lv_vg_lite_utils.h index 739f23947..5d901be92 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.h +++ b/src/draw/vg_lite/lv_vg_lite_utils.h @@ -19,7 +19,11 @@ extern "C" { #if LV_USE_DRAW_VG_LITE #include +#if LV_USE_VG_LITE_THORVG +#include "../../dev/vg_lite_tvg/vg_lite.h" +#else #include +#endif /********************* * DEFINES diff --git a/src/libs/thorvg/tvgSwRenderer.cpp b/src/libs/thorvg/tvgSwRenderer.cpp index d8e00dc86..007c09edb 100644 --- a/src/libs/thorvg/tvgSwRenderer.cpp +++ b/src/libs/thorvg/tvgSwRenderer.cpp @@ -446,7 +446,11 @@ bool SwRenderer::target(pixel_t* data, uint32_t stride, uint32_t w, uint32_t h, 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); +#endif } diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index c3ea48a49..5543a7460 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -386,6 +386,16 @@ #define LV_VG_LITE_USE_ASSERT 0 #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 /*=================