png_loader(static): Fix the colorspace of an image with an alpha channel 04/289904/1
authorJunsuChoi <jsuya.choi@samsung.com>
Fri, 10 Feb 2023 01:50:16 +0000 (10:50 +0900)
committerMichal Szczecinski <m.szczecinsk@partner.samsung.com>
Wed, 15 Mar 2023 07:30:53 +0000 (08:30 +0100)
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

index 7233f30..d415332 100644 (file)
@@ -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);
 }