don't require PNG_ALPHA_PREMULTIPLIED to support older versions of libpng

This commit is contained in:
Konstantin Käfer
2015-07-29 10:02:56 +02:00
committed by Konstantin Käfer
parent daaa643bbf
commit 19e5d9af22

View File

@@ -157,7 +157,12 @@ void PngReader<T>::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_)
{