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."
This commit is contained in:
Robert Osfield
2010-02-26 08:55:50 +00:00
parent bc202cd4bb
commit 8c4da68338

View File

@@ -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);