aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkPngCodec.cpp
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2016-03-04 14:20:49 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-04 14:20:50 -0800
commite244322a9db64b3b54068904a333203ae166d86d (patch)
treebbc0a8940253904ba3fc742b8a10dbf6a3f43461 /src/codec/SkPngCodec.cpp
parent91fcb3ed58845ddd5afa98a7150f3024d87c7425 (diff)
Check libpng version before reading color space
Diffstat (limited to 'src/codec/SkPngCodec.cpp')
-rw-r--r--src/codec/SkPngCodec.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 1b51432e5e..23f7bee0cf 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.