Admittedly I have no idea what this is but it was originally added by
Bit Blot because it's needed by Aquaria.
---
 include/GL/glpng.h | 1 +
 src/glpng.c        | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/GL/glpng.h b/include/GL/glpng.h
index 172a757..96e95e9 100644
--- a/include/GL/glpng.h
+++ b/include/GL/glpng.h
@@ -57,6 +57,7 @@ extern "C" {
 #define PNG_SIMPLEMIPMAP PNG_SIMPLEMIPMAPS
 
 /* Transparency parameters */
+#define PNG_LUMINANCEALPHA -4
 #define PNG_CALLBACKT -3 /* Call the callback function to generate alpha   */
 #define PNG_ALPHA     -2 /* Use alpha channel in PNG file, if there is one */
 #define PNG_SOLID     -1 /* No transparency                                */
diff --git a/src/glpng.c b/src/glpng.c
index e671bd1..e19c35d 100644
--- a/src/glpng.c
+++ b/src/glpng.c
@@ -503,7 +503,7 @@ static int pngLoadCommon(int mipmap, int trans, pngInfo 
*pinfo, png_structp png,
                }
                else
                #endif
-               if (trans == PNG_SOLID || trans == PNG_ALPHA || color == 
PNG_COLOR_TYPE_RGB_ALPHA || color == PNG_COLOR_TYPE_GRAY_ALPHA) {
+               if (trans == PNG_SOLID || trans == PNG_ALPHA || trans == 
PNG_LUMINANCEALPHA || color == PNG_COLOR_TYPE_RGB_ALPHA || color == 
PNG_COLOR_TYPE_GRAY_ALPHA) {
                        GLenum glformat;
                        GLint glcomponent;
 
@@ -528,6 +528,9 @@ static int pngLoadCommon(int mipmap, int trans, pngInfo 
*pinfo, png_structp png,
                                        goto finish;
                        }
 
+                       if (trans == PNG_LUMINANCEALPHA)
+                               glformat = GL_LUMINANCE_ALPHA;
+
                        if (mipmap == PNG_BUILDMIPMAPS)
                                Build2DMipmaps(glcomponent, width, height, 
glformat, data, 1);
                        else if (mipmap == PNG_SIMPLEMIPMAPS)
-- 
1.9.2

_______________________________________________
Games mailing list
Games@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/games

Reply via email to