diff --git a/include/mbgl/platform/default/png_reader.hpp b/include/mbgl/platform/default/png_reader.hpp index f6b5aaf9c..db20d85e2 100644 --- a/include/mbgl/platform/default/png_reader.hpp +++ b/include/mbgl/platform/default/png_reader.hpp @@ -49,7 +49,7 @@ public: unsigned width() const; unsigned height() const; inline bool has_alpha() const { return has_alpha_; } - bool premultiplied_alpha() const { return false; } //http://www.libpng.org/pub/png/spec/1.1/PNG-Rationale.html + bool premultiplied_alpha() const { return true; } // png_set_alpha_mode(png, PNG_ALPHA_PREMULTIPLIED, 2.2) void read(unsigned x,unsigned y, unsigned width, unsigned height, char * image); private: void init(); diff --git a/platform/default/png_reader.cpp b/platform/default/png_reader.cpp index e9f38a9d3..507db715a 100644 --- a/platform/default/png_reader.cpp +++ b/platform/default/png_reader.cpp @@ -157,6 +157,7 @@ void png_reader::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); + png_set_alpha_mode(png_ptr, PNG_ALPHA_PREMULTIPLIED, 2.2); if (x0 == 0 && y0 == 0 && w >= width_ && h >= height_) {