diff --git a/Kconfig b/Kconfig index 16f41d33ac..40bd102144 100644 --- a/Kconfig +++ b/Kconfig @@ -502,6 +502,11 @@ menu "LVGL configuration" default n depends on LV_USE_DRAW_VG_LITE + config LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET + bool "Disable blit rectangular offset to resolve certain hardware errors." + default n + depends on LV_USE_DRAW_VG_LITE + config LV_VG_LITE_PATH_DUMP_MAX_LEN int "Maximum path dump print length (in points)" default 1000 diff --git a/lv_conf_template.h b/lv_conf_template.h index d845a236e2..0d57fdb6f6 100644 --- a/lv_conf_template.h +++ b/lv_conf_template.h @@ -328,6 +328,9 @@ /** Remove VLC_OP_CLOSE path instruction (Workaround for NXP) **/ #define LV_VG_LITE_DISABLE_VLC_OP_CLOSE 0 + /** Disable blit rectangular offset to resolve certain hardware errors. */ + #define LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET 0 + /** Disable linear gradient extension for some older versions of drivers. */ #define LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT 0 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 fb9f5ea6f9..ebc142acbe 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_label.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_label.c @@ -321,11 +321,22 @@ static void draw_letter_bitmap(lv_draw_task_t * t, const lv_draw_glyph_dsc_t * d const vg_lite_color_t color = lv_vg_lite_color(dsc->color, dsc->opa, true); + const int32_t clip_offset_x = clip_area.x1 - image_area.x1; + const int32_t clip_offset_y = clip_area.y1 - image_area.y1; + /* If rotation is not required, blit directly */ - if(!dsc->rotation) { + if(!dsc->rotation +#if LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET + /** + * For some hardware, the rect.x/y parameters of vg_lite_blit_rect do not work correctly, + * so the fallback is to vg_lite_draw_pattern for processing. + */ + && (clip_offset_x == 0 && clip_offset_y == 0) +#endif + ) { vg_lite_rectangle_t rect = { - .x = clip_area.x1 - image_area.x1, - .y = clip_area.y1 - image_area.y1, + .x = clip_offset_x, + .y = clip_offset_y, .width = lv_area_get_width(&clip_area), .height = lv_area_get_height(&clip_area) }; diff --git a/src/lv_conf_internal.h b/src/lv_conf_internal.h index 7c8f0f9dd4..8c7ea432ff 100644 --- a/src/lv_conf_internal.h +++ b/src/lv_conf_internal.h @@ -931,6 +931,15 @@ #endif #endif + /** Disable blit rectangular offset to resolve certain hardware errors. */ + #ifndef LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET + #ifdef CONFIG_LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET + #define LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET CONFIG_LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET + #else + #define LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET 0 + #endif + #endif + /** Disable linear gradient extension for some older versions of drivers. */ #ifndef LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT #ifdef CONFIG_LV_VG_LITE_DISABLE_LINEAR_GRADIENT_EXT diff --git a/tests/src/lv_test_conf_vg_lite.h b/tests/src/lv_test_conf_vg_lite.h index 1cc5d88a40..0e20c98310 100644 --- a/tests/src/lv_test_conf_vg_lite.h +++ b/tests/src/lv_test_conf_vg_lite.h @@ -41,4 +41,11 @@ The rendering engine needs to support 3x3 matrix transformations.*/ #define LV_DRAW_TRANSFORM_USE_MATRIX 1 +/* Used to test coverage of different configuration combinations */ +#ifdef NON_AMD64_BUILD + #define LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET 1 +#else + #define LV_VG_LITE_DISABLE_BLIT_RECT_OFFSET 0 +#endif + #endif /* LV_TEST_CONF_VG_LITE_H */