mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(vg_lite): unify recolor behavior (#5085)
Signed-off-by: pengyiqiang <pengyiqiang@xiaomi.com> Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
parent
4b995448bc
commit
2fa9847201
@ -75,15 +75,18 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t *
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* image opa */
|
|
||||||
lv_opa_t opa = dsc->opa;
|
|
||||||
vg_lite_color_t color = 0;
|
vg_lite_color_t color = 0;
|
||||||
if(opa < LV_OPA_MAX) {
|
if(LV_COLOR_FORMAT_IS_ALPHA_ONLY(decoder_dsc.header.cf) || dsc->recolor_opa > LV_OPA_MIN) {
|
||||||
lv_memset(&color, opa, sizeof(color));
|
/* alpha image and image recolor */
|
||||||
src_buf.image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
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_MAX) {
|
||||||
|
/* normal image opa */
|
||||||
|
src_buf.image_mode = VG_LITE_MULTIPLY_IMAGE_MODE;
|
||||||
|
lv_memset(&color, dsc->opa, sizeof(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_recolor = dsc->recolor_opa >= LV_OPA_MIN;
|
|
||||||
bool has_trasform = (dsc->rotation != 0 || dsc->scale_x != LV_SCALE_NONE || dsc->scale_y != LV_SCALE_NONE);
|
bool has_trasform = (dsc->rotation != 0 || dsc->scale_x != LV_SCALE_NONE || dsc->scale_y != LV_SCALE_NONE);
|
||||||
vg_lite_filter_t filter = has_trasform ? VG_LITE_FILTER_BI_LINEAR : VG_LITE_FILTER_POINT;
|
vg_lite_filter_t filter = has_trasform ? VG_LITE_FILTER_BI_LINEAR : VG_LITE_FILTER_POINT;
|
||||||
|
|
||||||
@ -96,7 +99,7 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t *
|
|||||||
LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer);
|
LV_VG_LITE_ASSERT_DEST_BUFFER(&u->target_buffer);
|
||||||
|
|
||||||
/* If clipping is not required, blit directly */
|
/* If clipping is not required, blit directly */
|
||||||
if(_lv_area_is_in(&image_tf_area, draw_unit->clip_area, false) && !has_recolor) {
|
if(_lv_area_is_in(&image_tf_area, draw_unit->clip_area, false)) {
|
||||||
/* The image area is the coordinates relative to the image itself */
|
/* The image area is the coordinates relative to the image itself */
|
||||||
lv_area_t src_area = *coords;
|
lv_area_t src_area = *coords;
|
||||||
lv_area_move(&src_area, -coords->x1, -coords->y1);
|
lv_area_move(&src_area, -coords->x1, -coords->y1);
|
||||||
@ -138,7 +141,7 @@ void lv_draw_vg_lite_img(lv_draw_unit_t * draw_unit, const lv_draw_image_dsc_t *
|
|||||||
&matrix,
|
&matrix,
|
||||||
lv_vg_lite_blend_mode(dsc->blend_mode),
|
lv_vg_lite_blend_mode(dsc->blend_mode),
|
||||||
VG_LITE_PATTERN_COLOR,
|
VG_LITE_PATTERN_COLOR,
|
||||||
lv_vg_lite_color(dsc->recolor, dsc->recolor_opa, true),
|
0,
|
||||||
color,
|
color,
|
||||||
filter));
|
filter));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user