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/SkBmpCodec.cpp b/src/codec/SkBmpCodec.cpp
index 02d13dd..cb57f5b 100644
--- a/src/codec/SkBmpCodec.cpp
+++ b/src/codec/SkBmpCodec.cpp
@@ -481,7 +481,7 @@
SkASSERT(!inIco || nullptr != stream->getMemoryBase());
// Set the image info and create a codec.
- auto info = SkEncodedInfo::MakeSRGB(width, height, color, alpha, bitsPerComponent);
+ auto info = SkEncodedInfo::Make(width, height, color, alpha, bitsPerComponent);
codecOut->reset(new SkBmpStandardCodec(std::move(info),
std::unique_ptr<SkStream>(stream),
bitsPerPixel, numColors, bytesPerColor,
@@ -539,7 +539,7 @@
color = SkEncodedInfo::kBGR_Color;
alpha = SkEncodedInfo::kOpaque_Alpha;
}
- auto info = SkEncodedInfo::MakeSRGB(width, height, color, alpha, 8);
+ auto info = SkEncodedInfo::Make(width, height, color, alpha, 8);
codecOut->reset(new SkBmpMaskCodec(std::move(info),
std::unique_ptr<SkStream>(stream), bitsPerPixel,
masks.release(), rowOrder));
@@ -570,7 +570,7 @@
// is uncommon, but we cannot be certain that an RLE bmp will be
// opaque or that we will be able to represent it with a palette.
// For that reason, we always indicate that we are kBGRA.
- auto info = SkEncodedInfo::MakeSRGB(width, height, SkEncodedInfo::kBGRA_Color,
+ auto info = SkEncodedInfo::Make(width, height, SkEncodedInfo::kBGRA_Color,
SkEncodedInfo::kBinary_Alpha, 8);
codecOut->reset(new SkBmpRLECodec(std::move(info),
std::unique_ptr<SkStream>(stream), bitsPerPixel,