Fix bug decoding JCS_RGB jpeg files
Bug: chromium:897031
Bug: chromium:896776
Prior to this fix, we would treat the output from such a JPEG
as if it were a 16 bit per component RGB PNG. We hit an assert
in debug, but in release mode we do the wrong thing.
Split up SkSwizzler::CreateSwizzler into two public factories
(and a private one) based on whether format conversion is desired.
Without format conversion, we may have already converted (as is
the case with this JPEG), so the SkEncodedInfo::Color is not relevant.
That flavor of the factory just needs to know the bytes per pixel,
so provide that info instead.
Add a test file to Google Storage: apron.jpg, from Chromium's
benchmark files.
Change-Id: If1337d58a508466299f9e4666778727c6cdc879a
Reviewed-on: https://skia-review.googlesource.com/c/164619
Auto-Submit: Leon Scroggins <scroggo@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/codec/SkBmpStandardCodec.cpp b/src/codec/SkBmpStandardCodec.cpp
index 784b8f5..1f7593e 100644
--- a/src/codec/SkBmpStandardCodec.cpp
+++ b/src/codec/SkBmpStandardCodec.cpp
@@ -189,9 +189,7 @@
swizzlerOptions.fZeroInitialized = kNo_ZeroInitialized;
}
-
- fSwizzler.reset(SkSwizzler::CreateSwizzler(encodedInfo, colorPtr, swizzlerInfo,
- swizzlerOptions));
+ fSwizzler = SkSwizzler::Make(encodedInfo, colorPtr, swizzlerInfo, swizzlerOptions);
SkASSERT(fSwizzler);
}