From 0b54a69c36d80352dbc6ca8be7eb09b864b07334 Mon Sep 17 00:00:00 2001 From: _VIFEXTech Date: Fri, 5 Jan 2024 21:21:43 +0800 Subject: [PATCH] fix(vg_lite): fix drawing A8 label error (#5199) Signed-off-by: pengyiqiang Co-authored-by: pengyiqiang --- src/draw/vg_lite/lv_draw_vg_lite_label.c | 6 ++++++ src/draw/vg_lite/lv_vg_lite_utils.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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 f3626ab5a..93b6488f7 100644 --- a/src/draw/vg_lite/lv_draw_vg_lite_label.c +++ b/src/draw/vg_lite/lv_draw_vg_lite_label.c @@ -198,6 +198,12 @@ static void draw_letter_bitmap(lv_draw_vg_lite_unit_t * u, const lv_draw_glyph_d lv_vg_lite_path_drop(u, path); } + + /* TODO: The temporary buffer of the built-in font is reused. + * You need to wait for the GPU to finish using the buffer before releasing it. + * Later, use the font cache for management to improve efficiency. + */ + LV_VG_LITE_CHECK_ERROR(vg_lite_finish()); } #if SUPPORT_OUTLINE_FONT diff --git a/src/draw/vg_lite/lv_vg_lite_utils.c b/src/draw/vg_lite/lv_vg_lite_utils.c index aee95e014..592123ae6 100644 --- a/src/draw/vg_lite/lv_vg_lite_utils.c +++ b/src/draw/vg_lite/lv_vg_lite_utils.c @@ -541,7 +541,7 @@ void lv_vg_lite_buffer_from_draw_buf(vg_lite_buffer_t * buffer, const lv_draw_bu LV_ASSERT_NULL(buffer); LV_ASSERT_NULL(draw_buf); - const void * ptr = draw_buf->data; + const uint8_t * ptr = draw_buf->data; int32_t width = draw_buf->header.w; int32_t height = draw_buf->header.h; vg_lite_buffer_format_t format = lv_vg_lite_vg_fmt(draw_buf->header.cf); @@ -552,6 +552,11 @@ void lv_vg_lite_buffer_from_draw_buf(vg_lite_buffer_t * buffer, const lv_draw_bu width = lv_vg_lite_width_align(width); lv_vg_lite_buffer_init(buffer, ptr, width, height, format, false); + + /* Alpha image need to be multiplied by color */ + if(LV_COLOR_FORMAT_IS_ALPHA_ONLY(draw_buf->header.cf)) { + buffer->image_mode = VG_LITE_MULTIPLY_IMAGE_MODE; + } } void lv_vg_lite_image_matrix(vg_lite_matrix_t * matrix, int32_t x, int32_t y, const lv_draw_image_dsc_t * dsc)