diff --git a/src/draw/lv_image_decoder.c b/src/draw/lv_image_decoder.c index a22efffe27..52899266b9 100644 --- a/src/draw/lv_image_decoder.c +++ b/src/draw/lv_image_decoder.c @@ -308,6 +308,8 @@ lv_draw_buf_t * lv_image_decoder_post_process(lv_image_decoder_dsc_t * dsc, lv_d /*Premultiply alpha channel*/ if(args->premultiply + && !LV_COLOR_FORMAT_IS_ALPHA_ONLY(decoded->header.cf) + && lv_color_format_has_alpha(decoded->header.cf) && !lv_draw_buf_has_flag(decoded, LV_IMAGE_FLAGS_PREMULTIPLIED) /*Hasn't done yet*/ ) { LV_LOG_TRACE("Alpha premultiply."); diff --git a/src/misc/lv_color.c b/src/misc/lv_color.c index 2effb82e79..942b75427f 100644 --- a/src/misc/lv_color.c +++ b/src/misc/lv_color.c @@ -76,7 +76,13 @@ uint8_t lv_color_format_get_bpp(lv_color_format_t cf) bool lv_color_format_has_alpha(lv_color_format_t cf) { switch(cf) { + case LV_COLOR_FORMAT_A1: + case LV_COLOR_FORMAT_A2: + case LV_COLOR_FORMAT_A4: case LV_COLOR_FORMAT_A8: + case LV_COLOR_FORMAT_I1: + case LV_COLOR_FORMAT_I2: + case LV_COLOR_FORMAT_I4: case LV_COLOR_FORMAT_I8: case LV_COLOR_FORMAT_RGB565A8: case LV_COLOR_FORMAT_ARGB8888: