chore(decoder): only premultiply for images have alpha (#5370)

Signed-off-by: Xu Xingliang <xuxingliang@xiaomi.com>
This commit is contained in:
Neo Xu
2024-01-18 09:34:55 +01:00
committed by GitHub
parent 0d3f2990fd
commit 8d67e9c488
2 changed files with 8 additions and 0 deletions
+2
View File
@@ -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.");
+6
View File
@@ -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: