Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: src/codec/SkPngCodec.cpp

Issue 1767723003: Check libpng version before reading color space (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Future proof for version 2 Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkPngCodec.cpp
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 1b51432e5ec1c1bb143ca69972d08968ce1a8c5f..23f7bee0cfed33cd0f4c7c45caaca4f4e1d7aa5c 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -178,6 +178,8 @@ static float png_fixed_point_to_float(png_fixed_point x) {
// return NULL.
SkColorSpace* read_color_space(png_structp png_ptr, png_infop info_ptr) {
+#if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 6)
+
// First check for an ICC profile
png_bytep profile;
png_uint_32 length;
@@ -249,6 +251,8 @@ SkColorSpace* read_color_space(png_structp png_ptr, png_infop info_ptr) {
return SkColorSpace::NewRGB(toXYZD50, gammas);
}
+#endif // LIBPNG >= 1.6
+
// Finally, what should we do if there is no color space information in the PNG?
// The specification says that this indicates "gamma is unknown" and that the
// "color is device dependent". I'm assuming we can represent this with NULL.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698