From 19e5d9af22cc76f4d3a1e911b1b6fabd352284eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Ka=CC=88fer?= Date: Wed, 29 Jul 2015 10:02:56 +0200 Subject: [PATCH] don't require PNG_ALPHA_PREMULTIPLIED to support older versions of libpng --- platform/default/png_reader.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/platform/default/png_reader.cpp b/platform/default/png_reader.cpp index 4f8596a7b..42b694609 100644 --- a/platform/default/png_reader.cpp +++ b/platform/default/png_reader.cpp @@ -157,7 +157,12 @@ void PngReader::read(unsigned x0, unsigned y0, unsigned w, unsigned h, char * double gamma; if (png_get_gAMA(png_ptr, info_ptr, &gamma)) png_set_gamma(png_ptr, 2.2, gamma); + +#ifdef PNG_ALPHA_PREMULTIPLIED png_set_alpha_mode(png_ptr, PNG_ALPHA_PREMULTIPLIED, PNG_GAMMA_LINEAR); +#else + // TODO: Manually premultiply the image data. +#endif if (x0 == 0 && y0 == 0 && w >= width_ && h >= height_) {