From 8c4da683386c81452d7f883ddf4d675877d3b158 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 26 Feb 2010 08:55:50 +0000 Subject: [PATCH] From Philip Lownman, "The libpng project decided to rename png_set_gray_1_2_4_to_8() to png_set_expand_gray_1_2_4_to_8() with the 1.2.9 release. This submission fixes builds of the OSG against versions of libpng < 1.2.9 that don't have the new symbol available. This affects platforms like Red Hat Enterprise Linux 4 which come with libpng 1.2.7." --- src/osgPlugins/png/ReaderWriterPNG.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/osgPlugins/png/ReaderWriterPNG.cpp b/src/osgPlugins/png/ReaderWriterPNG.cpp index 4ac82b8dd..53cb3b96f 100644 --- a/src/osgPlugins/png/ReaderWriterPNG.cpp +++ b/src/osgPlugins/png/ReaderWriterPNG.cpp @@ -229,7 +229,14 @@ class ReaderWriterPNG : public osgDB::ReaderWriter if (color == PNG_COLOR_TYPE_PALETTE) png_set_palette_to_rgb(png); if (color == PNG_COLOR_TYPE_GRAY && depth < 8) + { + #if PNG_LIBPNG_VER >= 10209 png_set_expand_gray_1_2_4_to_8(png); + #else + // use older now deprecated but identical call + png_set_gray_1_2_4_to_8(png); + #endif + } if (png_get_valid(png, info, PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png);