diff --git a/src/draw/vg_lite/lv_draw_vg_lite_arc.c b/src/draw/vg_lite/lv_draw_vg_lite_arc.c index 8046b1b2d..cbb94e6a2 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_arc.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_arc.c @@ -162,6 +162,7 @@ void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * d LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); LV_VG_LITE_ASSERT_PATH(vg_lite_path); + LV_VG_LITE_ASSERT_MATRIX(&matrix); LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( @@ -184,6 +185,8 @@ void lv_draw_vg_lite_arc(lv_draw_unit_t * draw_unit, const lv_draw_arc_dsc_t * d /* move image to center */ vg_lite_translate(cx - radius_out, cy - radius_out, &matrix); + LV_VG_LITE_ASSERT_MATRIX(&path_matrix); + LV_PROFILER_BEGIN_TAG("vg_lite_draw_pattern"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw_pattern( &u->target_buffer, diff --git a/src/draw/vg_lite/lv_draw_vg_lite_border.c b/src/draw/vg_lite/lv_draw_vg_lite_border.c index 4301d01be..f60b72f33 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_border.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_border.c @@ -98,6 +98,7 @@ void lv_draw_vg_lite_border(lv_draw_unit_t * draw_unit, const lv_draw_border_dsc LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); LV_VG_LITE_ASSERT_PATH(vg_lite_path); + LV_VG_LITE_ASSERT_MATRIX(&matrix); LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( diff --git a/src/draw/vg_lite/lv_draw_vg_lite_fill.c b/src/draw/vg_lite/lv_draw_vg_lite_fill.c index 20225ef9d..ea52815eb 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_fill.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_fill.c @@ -82,6 +82,7 @@ void lv_draw_vg_lite_fill(lv_draw_unit_t * draw_unit, const lv_draw_fill_dsc_t * LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); LV_VG_LITE_ASSERT_PATH(vg_lite_path); + LV_VG_LITE_ASSERT_MATRIX(&matrix); if(dsc->grad.dir != LV_GRAD_DIR_NONE) { vg_lite_matrix_t grad_matrix; diff --git a/src/draw/vg_lite/lv_draw_vg_lite_label.c b/src/draw/vg_lite/lv_draw_vg_lite_label.c index 164abe6b5..307216113 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_label.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_label.c @@ -285,6 +285,7 @@ static void draw_letter_outline(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_ LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); LV_VG_LITE_ASSERT_PATH(vg_lite_path); + LV_VG_LITE_ASSERT_MATRIX(&matrix); LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( diff --git a/src/draw/vg_lite/lv_draw_vg_lite_line.c b/src/draw/vg_lite/lv_draw_vg_lite_line.c index d3b8ef219..f986950cc 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_line.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_line.c @@ -194,6 +194,7 @@ void lv_draw_vg_lite_line(lv_draw_unit_t * draw_unit, const lv_draw_line_dsc_t * LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer); LV_VG_LITE_ASSERT_PATH(vg_lite_path); + LV_VG_LITE_ASSERT_MATRIX(&matrix); LV_PROFILER_BEGIN_TAG("vg_lite_draw"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw( diff --git a/src/draw/vg_lite/lv_draw_vg_lite_triangle.c b/src/draw/vg_lite/lv_draw_vg_lite_triangle.c index bafbb50e8..868f23a54 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_triangle.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_triangle.c @@ -75,6 +75,7 @@ void lv_draw_vg_lite_triangle(lv_draw_unit_t * draw_unit, const lv_draw_triangle vg_lite_matrix_t matrix; vg_lite_identity(&matrix); lv_vg_lite_matrix_multiply(&matrix, &u->global_matrix); + LV_VG_LITE_ASSERT_MATRIX(&matrix); if(dsc->bg_grad.dir != LV_GRAD_DIR_NONE) { vg_lite_matrix_t grad_matrix; diff --git a/src/draw/vg_lite/lv_draw_vg_lite_vector.c b/src/draw/vg_lite/lv_draw_vg_lite_vector.c index 09adaafeb..262049013 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_vector.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_vector.c @@ -101,6 +101,7 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec /* transform matrix */ vg_lite_matrix_t matrix; lv_matrix_to_vg(&matrix, &dsc->matrix); + LV_VG_LITE_ASSERT_MATRIX(&matrix); /* convert path */ lv_vg_lite_path_t * lv_vg_path = lv_vg_lite_path_get(u, VG_LITE_FP32); @@ -169,6 +170,8 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec vg_lite_color_t recolor = lv_vg_lite_color(dsc->fill_dsc.img_dsc.recolor, dsc->fill_dsc.img_dsc.recolor_opa, true); + LV_VG_LITE_ASSERT_MATRIX(&pattern_matrix); + LV_PROFILER_BEGIN_TAG("vg_lite_draw_pattern"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw_pattern( &u->target_buffer, diff --git a/src/draw/vg_lite/lv_vg_lite_grad.c b/src/draw/vg_lite/lv_vg_lite_grad.c index 60c002563..10731e283 100644 --- a/src/draw/vg_lite/lv_vg_lite_grad.c +++ b/src/draw/vg_lite/lv_vg_lite_grad.c @@ -130,6 +130,8 @@ void lv_vg_lite_draw_linear_grad( LV_VG_LITE_ASSERT_DEST_BUFFER(buffer); LV_VG_LITE_ASSERT_SRC_BUFFER(&gradient->image); LV_VG_LITE_ASSERT_PATH(path); + LV_VG_LITE_ASSERT_MATRIX(grad_mat_p); + LV_VG_LITE_ASSERT_MATRIX(matrix); LV_PROFILER_BEGIN_TAG("vg_lite_draw_grad"); LV_VG_LITE_CHECK_ERROR(vg_lite_draw_grad( diff --git a/src/draw/vg_lite/lv_vg_lite_utils.c b/src/draw/vg_lite/lv_vg_lite_utils.c index a6feef2e9..06f3d3b5d 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.c +++ b/src/draw/vg_lite/lv_vg_lite_utils.c @@ -297,7 +297,7 @@ void lv_vg_lite_buffer_dump_info(const vg_lite_buffer_t * buffer) void lv_vg_lite_matrix_dump_info(const vg_lite_matrix_t * matrix) { for(int i = 0; i < 3; i++) { - LV_LOG_USER("| %0.2f, %0.2f, %0.2f |", + LV_LOG_USER("| %f, %f, %f |", (matrix)->m[i][0], (matrix)->m[i][1], (matrix)->m[i][2]); } } @@ -904,6 +904,23 @@ bool lv_vg_lite_path_check(const vg_lite_path_t * path) return true; } +bool lv_vg_lite_matrix_check(const vg_lite_matrix_t * matrix) +{ + if(matrix == NULL) { + LV_LOG_ERROR("matrix is NULL"); + return false; + } + + vg_lite_matrix_t result; + if(!lv_vg_lite_matrix_inverse(&result, matrix)) { + LV_LOG_ERROR("matrix is not invertible"); + lv_vg_lite_matrix_dump_info(matrix); + return false; + } + + return true; +} + bool lv_vg_lite_support_blend_normal(void) { return vg_lite_query_feature(gcFEATURE_BIT_VG_LVGL_SUPPORT); diff --git a/src/draw/vg_lite/lv_vg_lite_utils.h b/src/draw/vg_lite/lv_vg_lite_utils.h index eb46324f1..971dfc970 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.h +++ b/src/draw/vg_lite/lv_vg_lite_utils.h @@ -54,6 +54,7 @@ extern "C" { #define LV_VG_LITE_ASSERT_PATH(path) LV_VG_LITE_ASSERT(lv_vg_lite_path_check(path)) #define LV_VG_LITE_ASSERT_SRC_BUFFER(buffer) LV_VG_LITE_ASSERT(lv_vg_lite_buffer_check(buffer, true)) #define LV_VG_LITE_ASSERT_DEST_BUFFER(buffer) LV_VG_LITE_ASSERT(lv_vg_lite_buffer_check(buffer, false)) +#define LV_VG_LITE_ASSERT_MATRIX(matrix) LV_VG_LITE_ASSERT(lv_vg_lite_matrix_check(matrix)) #define LV_VG_LITE_ALIGN(number, align_bytes) \ (((number) + ((align_bytes)-1)) & ~((align_bytes)-1)) @@ -145,6 +146,8 @@ bool lv_vg_lite_buffer_check(const vg_lite_buffer_t * buffer, bool is_src); bool lv_vg_lite_path_check(const vg_lite_path_t * path); +bool lv_vg_lite_matrix_check(const vg_lite_matrix_t * matrix); + /* Wrapper */ bool lv_vg_lite_support_blend_normal(void);