Add BGRA as input format to SkColorSpaceXform
This is immediately useful for webp and I think it's a fair guess
that BGRA src formats are not uncommon.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2353363008
Review-Url: https://codereview.chromium.org/2353363008
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 3fdb858..30fffe1 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -272,7 +272,8 @@
SkColorSpaceXform::kBGRA_8888_ColorFormat;
SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
this->getInfo().alphaType());
- fColorXform->apply(colorTable, colorTable, numColors, xformColorFormat, xformAlphaType);
+ fColorXform->apply(colorTable, colorTable, numColors, xformColorFormat,
+ SkColorSpaceXform::kRGBA_8888_ColorFormat, xformAlphaType);
}
// Pad the color table with the last color in the table (or black) in the case that
@@ -493,18 +494,19 @@
}
void SkPngCodec::applyXformRow(void* dst, const void* src) {
+ const SkColorSpaceXform::ColorFormat srcColorFormat = SkColorSpaceXform::kRGBA_8888_ColorFormat;
switch (fXformMode) {
case kSwizzleOnly_XformMode:
fSwizzler->swizzle(dst, (const uint8_t*) src);
break;
case kColorOnly_XformMode:
fColorXform->apply(dst, (const uint32_t*) src, fXformWidth, fXformColorFormat,
- fXformAlphaType);
+ srcColorFormat, fXformAlphaType);
break;
case kSwizzleColor_XformMode:
fSwizzler->swizzle(fColorXformSrcRow, (const uint8_t*) src);
fColorXform->apply(dst, fColorXformSrcRow, fXformWidth, fXformColorFormat,
- fXformAlphaType);
+ srcColorFormat, fXformAlphaType);
break;
}
}