Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: src/codec/SkJpegCodec.cpp

Issue 1911613002: Use SkEncodedInfo in place of SkSwizzler::SrcConfig (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix bmp bug Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkGifCodec.cpp ('k') | src/codec/SkPngCodec.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkJpegCodec.cpp
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp
index 88b7fcbde1b17c8c97209663e18f5b7b86dbec1c..8d32f2b44d36f400756ce5ab7a60ff052168b420 100644
--- a/src/codec/SkJpegCodec.cpp
+++ b/src/codec/SkJpegCodec.cpp
@@ -510,30 +510,19 @@ SkCodec::Result SkJpegCodec::onGetPixels(const SkImageInfo& dstInfo,
}
void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& options) {
- SkSwizzler::SrcConfig srcConfig = SkSwizzler::kUnknown;
- if (JCS_CMYK == fDecoderMgr->dinfo()->out_color_space) {
- srcConfig = SkSwizzler::kCMYK;
- } else {
- // If the out_color_space is not CMYK, the only reason we would need a swizzler is
- // for sampling and/or subsetting.
- switch (dstInfo.colorType()) {
- case kGray_8_SkColorType:
- srcConfig = SkSwizzler::kNoOp8;
- break;
- case kN32_SkColorType:
- srcConfig = SkSwizzler::kNoOp32;
- break;
- case kRGB_565_SkColorType:
- srcConfig = SkSwizzler::kNoOp16;
- break;
- default:
- // This function should only be called if the colorType is supported by jpeg
- SkASSERT(false);
- }
- }
-
- if (JCS_RGB == fDecoderMgr->dinfo()->out_color_space) {
- srcConfig = SkSwizzler::kRGB;
+ // libjpeg-turbo may have already performed color conversion. We must indicate the
+ // appropriate format to the swizzler.
+ SkEncodedInfo swizzlerInfo = this->getEncodedInfo();
+ switch (fDecoderMgr->dinfo()->out_color_space) {
+ case JCS_RGB:
+ swizzlerInfo.setColor(SkEncodedInfo::kRGB_Color);
+ break;
+ case JCS_CMYK:
+ swizzlerInfo.setColor(SkEncodedInfo::kInvertedCMYK_Color);
+ break;
+ default:
+ swizzlerInfo.setColor(SkEncodedInfo::kPreSwizzled_Color);
+ break;
}
Options swizzlerOptions = options;
@@ -545,7 +534,7 @@ void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options&
fSwizzlerSubset.width() == options.fSubset->width());
swizzlerOptions.fSubset = &fSwizzlerSubset;
}
- fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, nullptr, dstInfo, swizzlerOptions));
+ fSwizzler.reset(SkSwizzler::CreateSwizzler(swizzlerInfo, nullptr, dstInfo, swizzlerOptions));
SkASSERT(fSwizzler);
fStorage.reset(get_row_bytes(fDecoderMgr->dinfo()));
fSrcRow = fStorage.get();
« no previous file with comments | « src/codec/SkGifCodec.cpp ('k') | src/codec/SkPngCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698