diff --git a/Kconfig b/Kconfig index 1fef7e293a..3e39d428ef 100644 --- a/Kconfig +++ b/Kconfig @@ -392,6 +392,11 @@ menu "LVGL configuration" bool "Enable VGLite asserts" depends on LV_USE_DRAW_VGLITE default n + + config LV_USE_VGLITE_CHECK_ERROR + bool "Enable VGLite error checks" + depends on LV_USE_DRAW_VGLITE + default n config LV_USE_PXP bool "Use NXP's PXP on iMX RTxxx platforms" diff --git a/lv_conf_template.h b/lv_conf_template.h index 7199c510bc..83b63d2a72 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -268,6 +268,9 @@ /** Enable VGLite asserts. */ #define LV_USE_VGLITE_ASSERT 0 + + /** Enable VGLite error checks. */ + #define LV_USE_VGLITE_CHECK_ERROR 0 #endif /** Use NXP's PXP on iMX RTxxx platforms. */ diff --git a/src/draw/nxp/vglite/lv_draw_vglite.c b/src/draw/nxp/vglite/lv_draw_vglite.c index e66ba6c731..55f7112137 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite.c +++ b/src/draw/nxp/vglite/lv_draw_vglite.c @@ -500,11 +500,11 @@ static void _vglite_execute_drawing(lv_draw_vglite_unit_t * u) static inline void _vglite_cleanup_task(vglite_draw_task_t * task) { if(task->path != NULL) { - vg_lite_clear_path(task->path); + VGLITE_CHECK_ERROR(vg_lite_clear_path(task->path)); lv_free(task->path); } if(task->gradient != NULL) { - vg_lite_clear_grad(task->gradient); + VGLITE_CHECK_ERROR(vg_lite_clear_grad(task->gradient)); lv_free(task->gradient); } if(task->path_data != NULL) diff --git a/src/draw/nxp/vglite/lv_draw_vglite_label.c b/src/draw/nxp/vglite/lv_draw_vglite_label.c index 3290378bfb..da6a6ce8e7 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_label.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_label.c @@ -114,9 +114,9 @@ static void _draw_vglite_letter(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyph_ lv_draw_vglite_border(vglite_task); /** Cleanup for vglite_task */ - vg_lite_finish(); + VGLITE_CHECK_ERROR(vg_lite_finish()); if(vglite_task->path) { - vg_lite_clear_path(vglite_task->path); + VGLITE_CHECK_ERROR(vg_lite_clear_path(vglite_task->path)); lv_free(vglite_task->path_data); lv_free(vglite_task->path); } @@ -199,7 +199,7 @@ static void _draw_vglite_letter(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyph_ /** Cleanup for vglite_task */ vg_lite_finish(); if(vglite_task->path) { - vg_lite_clear_path(vglite_task->path); + VGLITE_CHECK_ERROR(vg_lite_clear_path(vglite_task->path)); lv_free(vglite_task->path_data); lv_free(vglite_task->path); } @@ -228,12 +228,12 @@ static void _draw_vglite_letter(lv_draw_task_t * t, lv_draw_glyph_dsc_t * glyph_ /** Cleanup for vglite_task */ vg_lite_finish(); if(vglite_task->path) { - vg_lite_clear_path(vglite_task->path); + VGLITE_CHECK_ERROR(vg_lite_clear_path(vglite_task->path)); lv_free(vglite_task->path_data); lv_free(vglite_task->path); } if(vglite_task->gradient) { - vg_lite_clear_grad(vglite_task->gradient); + VGLITE_CHECK_ERROR(vg_lite_clear_grad(vglite_task->gradient)); lv_free(vglite_task->gradient); } lv_free(vglite_task); diff --git a/src/draw/nxp/vglite/lv_draw_vglite_triangle.c b/src/draw/nxp/vglite/lv_draw_vglite_triangle.c index bec80eb0ca..95da987909 100644 --- a/src/draw/nxp/vglite/lv_draw_vglite_triangle.c +++ b/src/draw/nxp/vglite/lv_draw_vglite_triangle.c @@ -190,15 +190,15 @@ static void _vglite_draw_triangle(vglite_draw_task_t * vglite_task, const lv_are VGLITE_CHECK_ERROR(vg_lite_update_grad(gradient)); grad_matrix = vg_lite_get_grad_matrix(gradient); - vg_lite_identity(grad_matrix); - vg_lite_translate((float)coords->x1, (float)coords->y1, grad_matrix); + VGLITE_CHECK_ERROR(vg_lite_identity(grad_matrix)); + VGLITE_CHECK_ERROR(vg_lite_translate((float)coords->x1, (float)coords->y1, grad_matrix)); if(dsc->grad.dir == (lv_grad_dir_t)LV_GRAD_DIR_VER) { - vg_lite_scale(1.0f, (float)height / 256.0f, grad_matrix); - vg_lite_rotate(90.0f, grad_matrix); + VGLITE_CHECK_ERROR(vg_lite_scale(1.0f, (float)height / 256.0f, grad_matrix)); + VGLITE_CHECK_ERROR(vg_lite_rotate(90.0f, grad_matrix)); } else { /*LV_GRAD_DIR_HOR*/ - vg_lite_scale((float)width / 256.0f, 1.0f, grad_matrix); + VGLITE_CHECK_ERROR(vg_lite_scale((float)width / 256.0f, 1.0f, grad_matrix)); } VGLITE_CHECK_ERROR(vg_lite_draw_gradient(dest_buf, path, VG_LITE_FILL_EVEN_ODD, NULL, gradient, diff --git a/src/draw/nxp/vglite/lv_vglite_utils.h b/src/draw/nxp/vglite/lv_vglite_utils.h index 03eafc2b62..c61e04ecdf 100644 --- a/src/draw/nxp/vglite/lv_vglite_utils.h +++ b/src/draw/nxp/vglite/lv_vglite_utils.h @@ -49,6 +49,7 @@ extern "C" { } \ } while(0) +#if LV_USE_VGLITE_CHECK_ERROR #define VGLITE_CHECK_ERROR(function) \ do { \ vg_lite_error_t error = function; \ @@ -58,6 +59,9 @@ extern "C" { VGLITE_ASSERT(false); \ } \ } while (0) +#else +#define VGLITE_CHECK_ERROR(function) function +#endif /********************** * TYPEDEFS diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index a2e269f3d7..f606d1e47a 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -747,6 +747,15 @@ #define LV_USE_VGLITE_ASSERT 0 #endif #endif + + /** Enable VGLite error checks. */ + #ifndef LV_USE_VGLITE_CHECK_ERROR + #ifdef CONFIG_LV_USE_VGLITE_CHECK_ERROR + #define LV_USE_VGLITE_CHECK_ERROR CONFIG_LV_USE_VGLITE_CHECK_ERROR + #else + #define LV_USE_VGLITE_CHECK_ERROR 0 + #endif + #endif #endif /** Use NXP's PXP on iMX RTxxx platforms. */