From 6538d78d9ff80c9afe1628422ae18c4e4241a0a6 Mon Sep 17 00:00:00 2001 From: Joseph Davies Date: Sat, 25 Jun 2011 20:22:53 -0700 Subject: [PATCH] Fix for plPNG::IRead improperly handling 24-bit RGB and non-transparent paletted images. --- .../Plasma20/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp index 0cd4ccb1..71f887a0 100644 --- a/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp +++ b/MOULOpenSourceClientPlugin/Plasma20/Sources/Plasma/PubUtilLib/plGImage/plPNG.cpp @@ -127,6 +127,10 @@ plMipmap* plPNG::IRead(hsStream* inStream) if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) { png_set_tRNS_to_alpha(png_ptr); channels += 1; + } else if (channels == 3) { + // Add an opaque alpha channel if still none exists + png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER); + channels = 4; } // Invert color byte-order as used by plMipmap for DirectX