Remove SkEncodedInfo kPreSwizzled_Color from public API
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1918943002 Review URL: https://codereview.chromium.org/1918943002
This commit is contained in:
parent
7bedaf5606
commit
68758aed88
@ -64,10 +64,6 @@ public:
|
|||||||
// be treated as inverted CMYK.
|
// be treated as inverted CMYK.
|
||||||
kInvertedCMYK_Color,
|
kInvertedCMYK_Color,
|
||||||
kYCCK_Color,
|
kYCCK_Color,
|
||||||
|
|
||||||
// Used internally to indicate that the decoding library has
|
|
||||||
// pre-swizzled to the desired output format.
|
|
||||||
kPreSwizzled_Color,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static SkEncodedInfo Make(Color color, Alpha alpha, int bitsPerComponent) {
|
static SkEncodedInfo Make(Color color, Alpha alpha, int bitsPerComponent) {
|
||||||
|
@ -518,15 +518,17 @@ void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options&
|
|||||||
// libjpeg-turbo may have already performed color conversion. We must indicate the
|
// libjpeg-turbo may have already performed color conversion. We must indicate the
|
||||||
// appropriate format to the swizzler.
|
// appropriate format to the swizzler.
|
||||||
SkEncodedInfo swizzlerInfo = this->getEncodedInfo();
|
SkEncodedInfo swizzlerInfo = this->getEncodedInfo();
|
||||||
|
bool preSwizzled = true;
|
||||||
switch (fDecoderMgr->dinfo()->out_color_space) {
|
switch (fDecoderMgr->dinfo()->out_color_space) {
|
||||||
case JCS_RGB:
|
case JCS_RGB:
|
||||||
|
preSwizzled = false;
|
||||||
swizzlerInfo.setColor(SkEncodedInfo::kRGB_Color);
|
swizzlerInfo.setColor(SkEncodedInfo::kRGB_Color);
|
||||||
break;
|
break;
|
||||||
case JCS_CMYK:
|
case JCS_CMYK:
|
||||||
|
preSwizzled = false;
|
||||||
swizzlerInfo.setColor(SkEncodedInfo::kInvertedCMYK_Color);
|
swizzlerInfo.setColor(SkEncodedInfo::kInvertedCMYK_Color);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
swizzlerInfo.setColor(SkEncodedInfo::kPreSwizzled_Color);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -539,7 +541,8 @@ void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options&
|
|||||||
fSwizzlerSubset.width() == options.fSubset->width());
|
fSwizzlerSubset.width() == options.fSubset->width());
|
||||||
swizzlerOptions.fSubset = &fSwizzlerSubset;
|
swizzlerOptions.fSubset = &fSwizzlerSubset;
|
||||||
}
|
}
|
||||||
fSwizzler.reset(SkSwizzler::CreateSwizzler(swizzlerInfo, nullptr, dstInfo, swizzlerOptions));
|
fSwizzler.reset(SkSwizzler::CreateSwizzler(swizzlerInfo, nullptr, dstInfo, swizzlerOptions,
|
||||||
|
nullptr, preSwizzled));
|
||||||
SkASSERT(fSwizzler);
|
SkASSERT(fSwizzler);
|
||||||
fStorage.reset(get_row_bytes(fDecoderMgr->dinfo()));
|
fStorage.reset(get_row_bytes(fDecoderMgr->dinfo()));
|
||||||
fSrcRow = fStorage.get();
|
fSrcRow = fStorage.get();
|
||||||
|
@ -651,318 +651,326 @@ SkSwizzler* SkSwizzler::CreateSwizzler(const SkEncodedInfo& encodedInfo,
|
|||||||
const SkPMColor* ctable,
|
const SkPMColor* ctable,
|
||||||
const SkImageInfo& dstInfo,
|
const SkImageInfo& dstInfo,
|
||||||
const SkCodec::Options& options,
|
const SkCodec::Options& options,
|
||||||
const SkIRect* frame) {
|
const SkIRect* frame,
|
||||||
|
bool preSwizzled) {
|
||||||
if (SkEncodedInfo::kPalette_Color == encodedInfo.color() && nullptr == ctable) {
|
if (SkEncodedInfo::kPalette_Color == encodedInfo.color() && nullptr == ctable) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
RowProc fastProc = nullptr;
|
RowProc fastProc = nullptr;
|
||||||
RowProc proc = nullptr;
|
RowProc proc = nullptr;
|
||||||
SkCodec::ZeroInitialized zeroInit = options.fZeroInitialized;
|
if (preSwizzled) {
|
||||||
const bool premultiply = (SkEncodedInfo::kOpaque_Alpha != encodedInfo.alpha()) &&
|
switch (dstInfo.colorType()) {
|
||||||
(kPremul_SkAlphaType == dstInfo.alphaType());
|
case kGray_8_SkColorType:
|
||||||
switch (encodedInfo.color()) {
|
proc = &sample1;
|
||||||
case SkEncodedInfo::kGray_Color:
|
fastProc = ©
|
||||||
switch (encodedInfo.bitsPerComponent()) {
|
break;
|
||||||
case 1:
|
case kRGB_565_SkColorType:
|
||||||
switch (dstInfo.colorType()) {
|
proc = &sample2;
|
||||||
case kRGBA_8888_SkColorType:
|
fastProc = ©
|
||||||
case kBGRA_8888_SkColorType:
|
break;
|
||||||
proc = &swizzle_bit_to_n32;
|
case kRGBA_8888_SkColorType:
|
||||||
break;
|
case kBGRA_8888_SkColorType:
|
||||||
case kIndex_8_SkColorType:
|
proc = &sample4;
|
||||||
proc = &swizzle_bit_to_index;
|
fastProc = ©
|
||||||
break;
|
break;
|
||||||
case kRGB_565_SkColorType:
|
default:
|
||||||
proc = &swizzle_bit_to_565;
|
return nullptr;
|
||||||
break;
|
}
|
||||||
case kGray_8_SkColorType:
|
} else {
|
||||||
proc = &swizzle_bit_to_grayscale;
|
SkCodec::ZeroInitialized zeroInit = options.fZeroInitialized;
|
||||||
break;
|
const bool premultiply = (SkEncodedInfo::kOpaque_Alpha != encodedInfo.alpha()) &&
|
||||||
default:
|
(kPremul_SkAlphaType == dstInfo.alphaType());
|
||||||
return nullptr;
|
|
||||||
}
|
switch (encodedInfo.color()) {
|
||||||
break;
|
case SkEncodedInfo::kGray_Color:
|
||||||
case 8:
|
switch (encodedInfo.bitsPerComponent()) {
|
||||||
switch (dstInfo.colorType()) {
|
case 1:
|
||||||
case kRGBA_8888_SkColorType:
|
switch (dstInfo.colorType()) {
|
||||||
case kBGRA_8888_SkColorType:
|
case kRGBA_8888_SkColorType:
|
||||||
proc = &swizzle_gray_to_n32;
|
case kBGRA_8888_SkColorType:
|
||||||
fastProc = &fast_swizzle_gray_to_n32;
|
proc = &swizzle_bit_to_n32;
|
||||||
break;
|
break;
|
||||||
case kGray_8_SkColorType:
|
case kIndex_8_SkColorType:
|
||||||
proc = &sample1;
|
proc = &swizzle_bit_to_index;
|
||||||
fastProc = ©
|
break;
|
||||||
break;
|
case kRGB_565_SkColorType:
|
||||||
case kRGB_565_SkColorType:
|
proc = &swizzle_bit_to_565;
|
||||||
proc = &swizzle_gray_to_565;
|
break;
|
||||||
break;
|
case kGray_8_SkColorType:
|
||||||
default:
|
proc = &swizzle_bit_to_grayscale;
|
||||||
return nullptr;
|
break;
|
||||||
}
|
default:
|
||||||
break;
|
return nullptr;
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SkEncodedInfo::kGrayAlpha_Color:
|
|
||||||
switch (dstInfo.colorType()) {
|
|
||||||
case kRGBA_8888_SkColorType:
|
|
||||||
case kBGRA_8888_SkColorType:
|
|
||||||
if (premultiply) {
|
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
|
||||||
proc = &SkipLeadingGrayAlphaZerosThen<swizzle_grayalpha_to_n32_premul>;
|
|
||||||
fastProc = &SkipLeadingGrayAlphaZerosThen
|
|
||||||
<fast_swizzle_grayalpha_to_n32_premul>;
|
|
||||||
} else {
|
|
||||||
proc = &swizzle_grayalpha_to_n32_premul;
|
|
||||||
fastProc = &fast_swizzle_grayalpha_to_n32_premul;
|
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
case 8:
|
||||||
proc = &SkipLeadingGrayAlphaZerosThen
|
switch (dstInfo.colorType()) {
|
||||||
<swizzle_grayalpha_to_n32_unpremul>;
|
case kRGBA_8888_SkColorType:
|
||||||
fastProc = &SkipLeadingGrayAlphaZerosThen
|
case kBGRA_8888_SkColorType:
|
||||||
<fast_swizzle_grayalpha_to_n32_unpremul>;
|
proc = &swizzle_gray_to_n32;
|
||||||
} else {
|
fastProc = &fast_swizzle_gray_to_n32;
|
||||||
proc = &swizzle_grayalpha_to_n32_unpremul;
|
break;
|
||||||
fastProc = &fast_swizzle_grayalpha_to_n32_unpremul;
|
case kGray_8_SkColorType:
|
||||||
|
proc = &sample1;
|
||||||
|
fastProc = ©
|
||||||
|
break;
|
||||||
|
case kRGB_565_SkColorType:
|
||||||
|
proc = &swizzle_gray_to_565;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
return nullptr;
|
||||||
return nullptr;
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case SkEncodedInfo::kGrayAlpha_Color:
|
||||||
case SkEncodedInfo::kPalette_Color:
|
switch (dstInfo.colorType()) {
|
||||||
// We assume that the color table is premultiplied and swizzled
|
case kRGBA_8888_SkColorType:
|
||||||
// as desired.
|
case kBGRA_8888_SkColorType:
|
||||||
switch (encodedInfo.bitsPerComponent()) {
|
if (premultiply) {
|
||||||
case 1:
|
|
||||||
case 2:
|
|
||||||
case 4:
|
|
||||||
switch (dstInfo.colorType()) {
|
|
||||||
case kRGBA_8888_SkColorType:
|
|
||||||
case kBGRA_8888_SkColorType:
|
|
||||||
proc = &swizzle_small_index_to_n32;
|
|
||||||
break;
|
|
||||||
case kRGB_565_SkColorType:
|
|
||||||
proc = &swizzle_small_index_to_565;
|
|
||||||
break;
|
|
||||||
case kIndex_8_SkColorType:
|
|
||||||
proc = &swizzle_small_index_to_index;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
switch (dstInfo.colorType()) {
|
|
||||||
case kRGBA_8888_SkColorType:
|
|
||||||
case kBGRA_8888_SkColorType:
|
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
proc = &swizzle_index_to_n32_skipZ;
|
proc = &SkipLeadingGrayAlphaZerosThen
|
||||||
|
<swizzle_grayalpha_to_n32_premul>;
|
||||||
|
fastProc = &SkipLeadingGrayAlphaZerosThen
|
||||||
|
<fast_swizzle_grayalpha_to_n32_premul>;
|
||||||
} else {
|
} else {
|
||||||
proc = &swizzle_index_to_n32;
|
proc = &swizzle_grayalpha_to_n32_premul;
|
||||||
|
fastProc = &fast_swizzle_grayalpha_to_n32_premul;
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
case kRGB_565_SkColorType:
|
|
||||||
proc = &swizzle_index_to_565;
|
|
||||||
break;
|
|
||||||
case kIndex_8_SkColorType:
|
|
||||||
proc = &sample1;
|
|
||||||
fastProc = ©
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SkEncodedInfo::kRGB_Color:
|
|
||||||
switch (dstInfo.colorType()) {
|
|
||||||
case kRGBA_8888_SkColorType:
|
|
||||||
proc = &swizzle_rgb_to_rgba;
|
|
||||||
fastProc = &fast_swizzle_rgb_to_rgba;
|
|
||||||
break;
|
|
||||||
case kBGRA_8888_SkColorType:
|
|
||||||
proc = &swizzle_rgb_to_bgra;
|
|
||||||
fastProc = &fast_swizzle_rgb_to_bgra;
|
|
||||||
break;
|
|
||||||
case kRGB_565_SkColorType:
|
|
||||||
proc = &swizzle_rgb_to_565;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SkEncodedInfo::kRGBA_Color:
|
|
||||||
switch (dstInfo.colorType()) {
|
|
||||||
case kRGBA_8888_SkColorType:
|
|
||||||
if (premultiply) {
|
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
|
||||||
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_rgba_premul>;
|
|
||||||
fastProc = &SkipLeading8888ZerosThen<fast_swizzle_rgba_to_rgba_premul>;
|
|
||||||
} else {
|
} else {
|
||||||
proc = &swizzle_rgba_to_rgba_premul;
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
fastProc = &fast_swizzle_rgba_to_rgba_premul;
|
proc = &SkipLeadingGrayAlphaZerosThen
|
||||||
|
<swizzle_grayalpha_to_n32_unpremul>;
|
||||||
|
fastProc = &SkipLeadingGrayAlphaZerosThen
|
||||||
|
<fast_swizzle_grayalpha_to_n32_unpremul>;
|
||||||
|
} else {
|
||||||
|
proc = &swizzle_grayalpha_to_n32_unpremul;
|
||||||
|
fastProc = &fast_swizzle_grayalpha_to_n32_unpremul;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
default:
|
||||||
proc = &SkipLeading8888ZerosThen<sample4>;
|
return nullptr;
|
||||||
fastProc = &SkipLeading8888ZerosThen<copy>;
|
}
|
||||||
|
break;
|
||||||
|
case SkEncodedInfo::kPalette_Color:
|
||||||
|
// We assume that the color table is premultiplied and swizzled
|
||||||
|
// as desired.
|
||||||
|
switch (encodedInfo.bitsPerComponent()) {
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 4:
|
||||||
|
switch (dstInfo.colorType()) {
|
||||||
|
case kRGBA_8888_SkColorType:
|
||||||
|
case kBGRA_8888_SkColorType:
|
||||||
|
proc = &swizzle_small_index_to_n32;
|
||||||
|
break;
|
||||||
|
case kRGB_565_SkColorType:
|
||||||
|
proc = &swizzle_small_index_to_565;
|
||||||
|
break;
|
||||||
|
case kIndex_8_SkColorType:
|
||||||
|
proc = &swizzle_small_index_to_index;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
switch (dstInfo.colorType()) {
|
||||||
|
case kRGBA_8888_SkColorType:
|
||||||
|
case kBGRA_8888_SkColorType:
|
||||||
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
|
proc = &swizzle_index_to_n32_skipZ;
|
||||||
|
} else {
|
||||||
|
proc = &swizzle_index_to_n32;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case kRGB_565_SkColorType:
|
||||||
|
proc = &swizzle_index_to_565;
|
||||||
|
break;
|
||||||
|
case kIndex_8_SkColorType:
|
||||||
|
proc = &sample1;
|
||||||
|
fastProc = ©
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SkEncodedInfo::kRGB_Color:
|
||||||
|
switch (dstInfo.colorType()) {
|
||||||
|
case kRGBA_8888_SkColorType:
|
||||||
|
proc = &swizzle_rgb_to_rgba;
|
||||||
|
fastProc = &fast_swizzle_rgb_to_rgba;
|
||||||
|
break;
|
||||||
|
case kBGRA_8888_SkColorType:
|
||||||
|
proc = &swizzle_rgb_to_bgra;
|
||||||
|
fastProc = &fast_swizzle_rgb_to_bgra;
|
||||||
|
break;
|
||||||
|
case kRGB_565_SkColorType:
|
||||||
|
proc = &swizzle_rgb_to_565;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SkEncodedInfo::kRGBA_Color:
|
||||||
|
switch (dstInfo.colorType()) {
|
||||||
|
case kRGBA_8888_SkColorType:
|
||||||
|
if (premultiply) {
|
||||||
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
|
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_rgba_premul>;
|
||||||
|
fastProc = &SkipLeading8888ZerosThen
|
||||||
|
<fast_swizzle_rgba_to_rgba_premul>;
|
||||||
|
} else {
|
||||||
|
proc = &swizzle_rgba_to_rgba_premul;
|
||||||
|
fastProc = &fast_swizzle_rgba_to_rgba_premul;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
proc = &sample4;
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
fastProc = ©
|
proc = &SkipLeading8888ZerosThen<sample4>;
|
||||||
|
fastProc = &SkipLeading8888ZerosThen<copy>;
|
||||||
|
} else {
|
||||||
|
proc = &sample4;
|
||||||
|
fastProc = ©
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case kBGRA_8888_SkColorType:
|
||||||
case kBGRA_8888_SkColorType:
|
if (premultiply) {
|
||||||
if (premultiply) {
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_premul>;
|
||||||
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_premul>;
|
fastProc = &SkipLeading8888ZerosThen
|
||||||
fastProc = &SkipLeading8888ZerosThen<fast_swizzle_rgba_to_bgra_premul>;
|
<fast_swizzle_rgba_to_bgra_premul>;
|
||||||
|
} else {
|
||||||
|
proc = &swizzle_rgba_to_bgra_premul;
|
||||||
|
fastProc = &fast_swizzle_rgba_to_bgra_premul;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
proc = &swizzle_rgba_to_bgra_premul;
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
fastProc = &fast_swizzle_rgba_to_bgra_premul;
|
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_unpremul>;
|
||||||
|
fastProc = &SkipLeading8888ZerosThen
|
||||||
|
<fast_swizzle_rgba_to_bgra_unpremul>;
|
||||||
|
} else {
|
||||||
|
proc = &swizzle_rgba_to_bgra_unpremul;
|
||||||
|
fastProc = &fast_swizzle_rgba_to_bgra_unpremul;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
default:
|
||||||
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_unpremul>;
|
return nullptr;
|
||||||
fastProc = &SkipLeading8888ZerosThen
|
}
|
||||||
<fast_swizzle_rgba_to_bgra_unpremul>;
|
break;
|
||||||
|
case SkEncodedInfo::kBGR_Color:
|
||||||
|
switch (dstInfo.colorType()) {
|
||||||
|
case kBGRA_8888_SkColorType:
|
||||||
|
proc = &swizzle_rgb_to_rgba;
|
||||||
|
fastProc = &fast_swizzle_rgb_to_rgba;
|
||||||
|
break;
|
||||||
|
case kRGBA_8888_SkColorType:
|
||||||
|
proc = &swizzle_rgb_to_bgra;
|
||||||
|
fastProc = &fast_swizzle_rgb_to_bgra;
|
||||||
|
break;
|
||||||
|
case kRGB_565_SkColorType:
|
||||||
|
proc = &swizzle_bgr_to_565;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SkEncodedInfo::kBGRX_Color:
|
||||||
|
switch (dstInfo.colorType()) {
|
||||||
|
case kBGRA_8888_SkColorType:
|
||||||
|
proc = &swizzle_rgb_to_rgba;
|
||||||
|
break;
|
||||||
|
case kRGBA_8888_SkColorType:
|
||||||
|
proc = &swizzle_rgb_to_bgra;
|
||||||
|
break;
|
||||||
|
case kRGB_565_SkColorType:
|
||||||
|
proc = &swizzle_bgr_to_565;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case SkEncodedInfo::kBGRA_Color:
|
||||||
|
switch (dstInfo.colorType()) {
|
||||||
|
case kBGRA_8888_SkColorType:
|
||||||
|
if (premultiply) {
|
||||||
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
|
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_rgba_premul>;
|
||||||
|
fastProc = &SkipLeading8888ZerosThen
|
||||||
|
<fast_swizzle_rgba_to_rgba_premul>;
|
||||||
|
} else {
|
||||||
|
proc = &swizzle_rgba_to_rgba_premul;
|
||||||
|
fastProc = &fast_swizzle_rgba_to_rgba_premul;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
proc = &swizzle_rgba_to_bgra_unpremul;
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
fastProc = &fast_swizzle_rgba_to_bgra_unpremul;
|
proc = &SkipLeading8888ZerosThen<sample4>;
|
||||||
|
fastProc = &SkipLeading8888ZerosThen<copy>;
|
||||||
|
} else {
|
||||||
|
proc = &sample4;
|
||||||
|
fastProc = ©
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case kRGBA_8888_SkColorType:
|
||||||
default:
|
if (premultiply) {
|
||||||
return nullptr;
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
}
|
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_premul>;
|
||||||
break;
|
fastProc = &SkipLeading8888ZerosThen
|
||||||
case SkEncodedInfo::kBGR_Color:
|
<fast_swizzle_rgba_to_bgra_premul>;
|
||||||
switch (dstInfo.colorType()) {
|
} else {
|
||||||
case kBGRA_8888_SkColorType:
|
proc = &swizzle_rgba_to_bgra_premul;
|
||||||
proc = &swizzle_rgb_to_rgba;
|
fastProc = &fast_swizzle_rgba_to_bgra_premul;
|
||||||
fastProc = &fast_swizzle_rgb_to_rgba;
|
}
|
||||||
break;
|
|
||||||
case kRGBA_8888_SkColorType:
|
|
||||||
proc = &swizzle_rgb_to_bgra;
|
|
||||||
fastProc = &fast_swizzle_rgb_to_bgra;
|
|
||||||
break;
|
|
||||||
case kRGB_565_SkColorType:
|
|
||||||
proc = &swizzle_bgr_to_565;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SkEncodedInfo::kBGRX_Color:
|
|
||||||
switch (dstInfo.colorType()) {
|
|
||||||
case kBGRA_8888_SkColorType:
|
|
||||||
proc = &swizzle_rgb_to_rgba;
|
|
||||||
break;
|
|
||||||
case kRGBA_8888_SkColorType:
|
|
||||||
proc = &swizzle_rgb_to_bgra;
|
|
||||||
break;
|
|
||||||
case kRGB_565_SkColorType:
|
|
||||||
proc = &swizzle_bgr_to_565;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SkEncodedInfo::kBGRA_Color:
|
|
||||||
switch (dstInfo.colorType()) {
|
|
||||||
case kBGRA_8888_SkColorType:
|
|
||||||
if (premultiply) {
|
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
|
||||||
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_rgba_premul>;
|
|
||||||
fastProc = &SkipLeading8888ZerosThen<fast_swizzle_rgba_to_rgba_premul>;
|
|
||||||
} else {
|
} else {
|
||||||
proc = &swizzle_rgba_to_rgba_premul;
|
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
||||||
fastProc = &fast_swizzle_rgba_to_rgba_premul;
|
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_unpremul>;
|
||||||
|
fastProc = &SkipLeading8888ZerosThen
|
||||||
|
<fast_swizzle_rgba_to_bgra_unpremul>;
|
||||||
|
} else {
|
||||||
|
proc = &swizzle_rgba_to_bgra_unpremul;
|
||||||
|
fastProc = &fast_swizzle_rgba_to_bgra_unpremul;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
break;
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
default:
|
||||||
proc = &SkipLeading8888ZerosThen<sample4>;
|
return nullptr;
|
||||||
fastProc = &SkipLeading8888ZerosThen<copy>;
|
}
|
||||||
} else {
|
break;
|
||||||
proc = &sample4;
|
case SkEncodedInfo::kInvertedCMYK_Color:
|
||||||
fastProc = ©
|
switch (dstInfo.colorType()) {
|
||||||
}
|
case kRGBA_8888_SkColorType:
|
||||||
}
|
proc = &swizzle_cmyk_to_rgba;
|
||||||
break;
|
fastProc = &fast_swizzle_cmyk_to_rgba;
|
||||||
case kRGBA_8888_SkColorType:
|
break;
|
||||||
if (premultiply) {
|
case kBGRA_8888_SkColorType:
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
proc = &swizzle_cmyk_to_bgra;
|
||||||
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_premul>;
|
fastProc = &fast_swizzle_cmyk_to_bgra;
|
||||||
fastProc = &SkipLeading8888ZerosThen<fast_swizzle_rgba_to_bgra_premul>;
|
break;
|
||||||
} else {
|
case kRGB_565_SkColorType:
|
||||||
proc = &swizzle_rgba_to_bgra_premul;
|
proc = &swizzle_cmyk_to_565;
|
||||||
fastProc = &fast_swizzle_rgba_to_bgra_premul;
|
break;
|
||||||
}
|
default:
|
||||||
} else {
|
return nullptr;
|
||||||
if (SkCodec::kYes_ZeroInitialized == zeroInit) {
|
}
|
||||||
proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgra_unpremul>;
|
break;
|
||||||
fastProc = &SkipLeading8888ZerosThen
|
default:
|
||||||
<fast_swizzle_rgba_to_bgra_unpremul>;
|
return nullptr;
|
||||||
} else {
|
}
|
||||||
proc = &swizzle_rgba_to_bgra_unpremul;
|
|
||||||
fastProc = &fast_swizzle_rgba_to_bgra_unpremul;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SkEncodedInfo::kInvertedCMYK_Color:
|
|
||||||
switch (dstInfo.colorType()) {
|
|
||||||
case kRGBA_8888_SkColorType:
|
|
||||||
proc = &swizzle_cmyk_to_rgba;
|
|
||||||
fastProc = &fast_swizzle_cmyk_to_rgba;
|
|
||||||
break;
|
|
||||||
case kBGRA_8888_SkColorType:
|
|
||||||
proc = &swizzle_cmyk_to_bgra;
|
|
||||||
fastProc = &fast_swizzle_cmyk_to_bgra;
|
|
||||||
break;
|
|
||||||
case kRGB_565_SkColorType:
|
|
||||||
proc = &swizzle_cmyk_to_565;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SkEncodedInfo::kPreSwizzled_Color:
|
|
||||||
switch (dstInfo.colorType()) {
|
|
||||||
case kGray_8_SkColorType:
|
|
||||||
proc = &sample1;
|
|
||||||
fastProc = ©
|
|
||||||
break;
|
|
||||||
case kRGB_565_SkColorType:
|
|
||||||
proc = &sample2;
|
|
||||||
fastProc = ©
|
|
||||||
break;
|
|
||||||
case kRGBA_8888_SkColorType:
|
|
||||||
case kBGRA_8888_SkColorType:
|
|
||||||
proc = &sample4;
|
|
||||||
fastProc = ©
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int dstBPP = SkColorTypeBytesPerPixel(dstInfo.colorType());
|
|
||||||
int srcBPP;
|
int srcBPP;
|
||||||
if (SkEncodedInfo::kPreSwizzled_Color == encodedInfo.color()) {
|
const int dstBPP = SkColorTypeBytesPerPixel(dstInfo.colorType());
|
||||||
|
if (preSwizzled) {
|
||||||
srcBPP = dstBPP;
|
srcBPP = dstBPP;
|
||||||
} else {
|
} else {
|
||||||
// Store bpp in bytes if it is an even multiple, otherwise use bits
|
// Store bpp in bytes if it is an even multiple, otherwise use bits
|
||||||
|
@ -27,6 +27,9 @@ public:
|
|||||||
* Contains partial scanline information.
|
* Contains partial scanline information.
|
||||||
* @param frame Is non-NULL if the source pixels are part of an image
|
* @param frame Is non-NULL if the source pixels are part of an image
|
||||||
* frame that is a subset of the full image.
|
* frame that is a subset of the full image.
|
||||||
|
* @param preSwizzled Indicates that the codec has already swizzled to the
|
||||||
|
* destination format. The swizzler only needs to sample
|
||||||
|
* and/or subset.
|
||||||
*
|
*
|
||||||
* Note that a deeper discussion of partial scanline subsets and image frame
|
* Note that a deeper discussion of partial scanline subsets and image frame
|
||||||
* subsets is below. Currently, we do not support both simultaneously. If
|
* subsets is below. Currently, we do not support both simultaneously. If
|
||||||
@ -36,7 +39,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
static SkSwizzler* CreateSwizzler(const SkEncodedInfo& encodedInfo, const SkPMColor* ctable,
|
static SkSwizzler* CreateSwizzler(const SkEncodedInfo& encodedInfo, const SkPMColor* ctable,
|
||||||
const SkImageInfo& dstInfo, const SkCodec::Options&,
|
const SkImageInfo& dstInfo, const SkCodec::Options&,
|
||||||
const SkIRect* frame = nullptr);
|
const SkIRect* frame = nullptr, bool preSwizzled = false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Swizzle a line. Generally this will be called height times, once
|
* Swizzle a line. Generally this will be called height times, once
|
||||||
|
Loading…
Reference in New Issue
Block a user