mirror of
https://github.com/lvgl/lvgl.git
synced 2024-11-23 09:43:41 +08:00
fix(vg_lite): fix vector rendering missing image opa processing (#7293)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
parent
3516dae336
commit
3d06f0b7bc
@ -82,17 +82,7 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t *
|
||||
return;
|
||||
}
|
||||
|
||||
vg_lite_color_t color = 0;
|
||||
if(LV_COLOR_FORMAT_IS_ALPHA_ONLY(decoder_dsc.decoded->header.cf) || dsc->recolor_opa > LV_OPA_TRANSP) {
|
||||
/* alpha image and image recolor */
|
||||
src_buf.image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
||||
color = lv_vg_lite_color(dsc->recolor, LV_OPA_MIX2(dsc->opa, dsc->recolor_opa), true);
|
||||
}
|
||||
else if(dsc->opa < LV_OPA_COVER) {
|
||||
/* normal image opa */
|
||||
src_buf.image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
||||
lv_memset(&color, dsc->opa, sizeof(color));
|
||||
}
|
||||
vg_lite_color_t color = lv_vg_lite_image_recolor(&src_buf, dsc);
|
||||
|
||||
/* convert the blend mode to vg-lite blend mode, considering the premultiplied alpha */
|
||||
bool has_pre_mul = lv_draw_buf_has_flag(decoder_dsc.decoded, LV_IMAGE_FLAGS_PREMULTIPLIED);
|
||||
|
@ -246,7 +246,7 @@ static void task_draw_cb(void * ctx, const lv_vector_path_t * path, const lv_vec
|
||||
vg_lite_matrix_t pattern_matrix;
|
||||
lv_vg_lite_matrix(&pattern_matrix, &m);
|
||||
|
||||
vg_lite_color_t recolor = lv_vg_lite_color(dsc->fill_dsc.img_dsc.recolor, dsc->fill_dsc.img_dsc.recolor_opa, true);
|
||||
vg_lite_color_t recolor = lv_vg_lite_image_recolor(&image_buffer, &dsc->fill_dsc.img_dsc);
|
||||
|
||||
LV_VG_LITE_ASSERT_MATRIX(&pattern_matrix);
|
||||
|
||||
|
@ -780,6 +780,28 @@ void lv_vg_lite_image_matrix(vg_lite_matrix_t * matrix, int32_t x, int32_t y, co
|
||||
}
|
||||
}
|
||||
|
||||
vg_lite_color_t lv_vg_lite_image_recolor(vg_lite_buffer_t * buffer, const lv_draw_image_dsc_t * dsc)
|
||||
{
|
||||
LV_ASSERT_NULL(buffer);
|
||||
LV_ASSERT_NULL(dsc);
|
||||
|
||||
if((buffer->format == VG_LITE_A4 || buffer->format == VG_LITE_A8) || dsc->recolor_opa > LV_OPA_TRANSP) {
|
||||
/* alpha image and image recolor */
|
||||
buffer->image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
||||
return lv_vg_lite_color(dsc->recolor, LV_OPA_MIX2(dsc->opa, dsc->recolor_opa), true);
|
||||
}
|
||||
|
||||
if(dsc->opa < LV_OPA_COVER) {
|
||||
/* normal image opa */
|
||||
buffer->image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
||||
vg_lite_color_t color;
|
||||
lv_memset(&color, dsc->opa, sizeof(color));
|
||||
return color;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_dsc_t * decoder_dsc, const void * src,
|
||||
bool no_cache, bool premultiply)
|
||||
{
|
||||
|
@ -130,7 +130,7 @@ void lv_vg_lite_buffer_from_draw_buf(vg_lite_buffer_t * buffer, const lv_draw_bu
|
||||
|
||||
void lv_vg_lite_image_matrix(vg_lite_matrix_t * matrix, int32_t x, int32_t y, const lv_draw_image_dsc_t * dsc);
|
||||
|
||||
void lv_vg_lite_image_dec_init(vg_lite_matrix_t * matrix, int32_t x, int32_t y, const lv_draw_image_dsc_t * dsc);
|
||||
vg_lite_color_t lv_vg_lite_image_recolor(vg_lite_buffer_t * buffer, const lv_draw_image_dsc_t * dsc);
|
||||
|
||||
bool lv_vg_lite_buffer_open_image(vg_lite_buffer_t * buffer, lv_image_decoder_dsc_t * decoder_dsc, const void * src,
|
||||
bool no_cache, bool premultiply);
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 47 KiB |
Binary file not shown.
Before Width: | Height: | Size: 63 KiB After Width: | Height: | Size: 47 KiB |
Loading…
Reference in New Issue
Block a user