Make SkCodec truly default to sRGB
Remove SkEncodedInfo::ICCProfile::MakeSRGB. Instead of creating
this object whenever there is no encoded color profile, just
treat null as sRGB, like skcms does.
This may help with crbug.com/887372. Regardless it simplifies the
code.
Also fix a bug where SkCodec could have passed a null
skcms_ICCProfile to skcms_ApproximatelyEqualProfiles (related
to b/116608007).
Bug: chromium:887372
Change-Id: I2374e8d8a1aed261f1291b7f6fd6c7ea662f26fd
Reviewed-on: https://skia-review.googlesource.com/157561
Auto-Submit: Leon Scroggins <scroggo@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index ece8f7b..288870a 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -371,10 +371,10 @@
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sRGB)) {
// sRGB chunks also store a rendering intent: Absolute, Relative,
// Perceptual, and Saturation.
- // FIXME (msarett): Extract this information from the sRGB chunk once
+ // FIXME (scroggo): Extract this information from the sRGB chunk once
// we are able to handle this information in
- // SkColorSpace.
- return SkEncodedInfo::ICCProfile::MakeSRGB();
+ // skcms_ICCProfile
+ return nullptr;
}
// Default to SRGB gamut.
@@ -422,7 +422,7 @@
return SkEncodedInfo::ICCProfile::Make(skcmsProfile);
#else // LIBPNG >= 1.6
- return SkEncodedInfo::ICCProfile::MakeSRGB();
+ return nullptr;
#endif // LIBPNG >= 1.6
}
@@ -930,10 +930,6 @@
break;
}
}
- if (!profile) {
- // Treat unsupported/invalid color spaces as sRGB.
- profile = SkEncodedInfo::ICCProfile::MakeSRGB();
- }
if (encodedColorType == PNG_COLOR_TYPE_GRAY_ALPHA) {
png_color_8p sigBits;