Support encoding/decoding F16 without a color space
Change encode-srgb-* to exercise this code. The encoders
handle this just fine, so just remove those checks. The
decoders still rely on having a color space, so detect
and fix this inside SkCodec. Eventually I'd like to get
rid of the swizzler, use skcms for all format conversion,
etc... but that's a really big change, and this will let
us land other changes without breaking layout tests.
Bug: skia:8382
Change-Id: I8d85bf44ee3a287ad295515a745ded2ff5051417
Reviewed-on: https://skia-review.googlesource.com/156627
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/codec/SkCodec.cpp b/src/codec/SkCodec.cpp
index ecf253f..929cc6e 100644
--- a/src/codec/SkCodec.cpp
+++ b/src/codec/SkCodec.cpp
@@ -299,8 +299,13 @@
? kSuccess : kInvalidConversion;
}
-SkCodec::Result SkCodec::getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
+SkCodec::Result SkCodec::getPixels(const SkImageInfo& dstInfo, void* pixels, size_t rowBytes,
const Options* options) {
+ SkImageInfo info = dstInfo;
+ if (!info.colorSpace()) {
+ info = info.makeColorSpace(SkColorSpace::MakeSRGB());
+ }
+
if (kUnknown_SkColorType == info.colorType()) {
return kInvalidConversion;
}