From 776a4f4d2fab0a40c7ed672ca8bfc2bb3dd5ff48 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Fri, 10 Feb 2023 10:50:16 +0900 Subject: [PATCH] png_loader(static): Fix the colorspace of an image with an alpha channel Set colorspace to ABGR when colortype of lodepng is LCT_RGBA. Since an image without an alpha channel becomes an ARGB colorspace with LCT_RGB, it is the same as the default colorspace. Change-Id: Ia33ca50ab3340fe72f1b7af2ced35850854fc835 --- src/loaders/png/tvgPngLoader.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/loaders/png/tvgPngLoader.cpp b/src/loaders/png/tvgPngLoader.cpp index 7233f30..d415332 100644 --- a/src/loaders/png/tvgPngLoader.cpp +++ b/src/loaders/png/tvgPngLoader.cpp @@ -213,5 +213,7 @@ void PngLoader::run(unsigned tid) lodepng_decode(&image, &width, &height, &state, data, size); + if (state.info_png.color.colortype == LCT_RGBA) colorSpace = SwCanvas::ABGR8888; + _premultiply((uint32_t*)(image), width, height); } -- 2.7.4