mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-28 07:03:00 +08:00
fix(draw_img): move the image color format check to draw_img_decoded (#3863)
Co-authored-by: pengyiqiang <pengyiqiang@xiaomi.com>
This commit is contained in:
parent
101400158e
commit
eaea0c4cc8
@ -236,13 +236,6 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx,
|
||||
|
||||
if(cdsc == NULL) return LV_RES_INV;
|
||||
|
||||
lv_img_cf_t cf;
|
||||
if(lv_img_cf_is_chroma_keyed(cdsc->dec_dsc.header.cf)) cf = LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED;
|
||||
else if(LV_IMG_CF_ALPHA_8BIT == cdsc->dec_dsc.header.cf) cf = LV_IMG_CF_ALPHA_8BIT;
|
||||
else if(LV_IMG_CF_RGB565A8 == cdsc->dec_dsc.header.cf) cf = LV_IMG_CF_RGB565A8;
|
||||
else if(lv_img_cf_has_alpha(cdsc->dec_dsc.header.cf)) cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
|
||||
else cf = LV_IMG_CF_TRUE_COLOR;
|
||||
|
||||
if(cdsc->dec_dsc.error_msg != NULL) {
|
||||
LV_LOG_WARN("Image draw error");
|
||||
|
||||
@ -276,7 +269,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx,
|
||||
|
||||
const lv_area_t * clip_area_ori = draw_ctx->clip_area;
|
||||
draw_ctx->clip_area = &clip_com;
|
||||
lv_draw_img_decoded(draw_ctx, draw_dsc, coords, cdsc->dec_dsc.img_data, cf);
|
||||
lv_draw_img_decoded(draw_ctx, draw_dsc, coords, cdsc->dec_dsc.img_data, cdsc->dec_dsc.header.cf);
|
||||
draw_ctx->clip_area = clip_area_ori;
|
||||
}
|
||||
/*The whole uncompressed image is not available. Try to read it line-by-line*/
|
||||
@ -317,7 +310,7 @@ LV_ATTRIBUTE_FAST_MEM static lv_res_t decode_and_draw(lv_draw_ctx_t * draw_ctx,
|
||||
}
|
||||
|
||||
draw_ctx->clip_area = &mask_line;
|
||||
lv_draw_img_decoded(draw_ctx, draw_dsc, &line, buf, cf);
|
||||
lv_draw_img_decoded(draw_ctx, draw_dsc, &line, buf, cdsc->dec_dsc.header.cf);
|
||||
line.y1++;
|
||||
line.y2++;
|
||||
y++;
|
||||
|
@ -62,6 +62,12 @@ LV_ATTRIBUTE_FAST_MEM void lv_draw_sw_img_decoded(struct _lv_draw_ctx_t * draw_c
|
||||
blend_dsc.blend_mode = draw_dsc->blend_mode;
|
||||
blend_dsc.blend_area = &blend_area;
|
||||
|
||||
if(lv_img_cf_is_chroma_keyed(cf)) cf = LV_IMG_CF_TRUE_COLOR_CHROMA_KEYED;
|
||||
else if(cf == LV_IMG_CF_ALPHA_8BIT) {}
|
||||
else if(cf == LV_IMG_CF_RGB565A8) {}
|
||||
else if(lv_img_cf_has_alpha(cf)) cf = LV_IMG_CF_TRUE_COLOR_ALPHA;
|
||||
else cf = LV_IMG_CF_TRUE_COLOR;
|
||||
|
||||
/*The simplest case just copy the pixels into the draw_buf*/
|
||||
if(!mask_any && !transform && cf == LV_IMG_CF_TRUE_COLOR && draw_dsc->recolor_opa == LV_OPA_TRANSP) {
|
||||
blend_dsc.src_buf = (const lv_color_t *)src_buf;
|
||||
|
Loading…
x
Reference in New Issue
Block a user