Check libpng version before reading color space

TBR=scroggo@google.com

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1767723003

Review URL: https://codereview.chromium.org/1767723003
This commit is contained in:
msarett 2016-03-04 14:20:49 -08:00 committed by Commit bot
parent 91fcb3ed58
commit e244322a9d

View File

@ -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.