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

Unified Diff: src/codec/SkPngCodec.cpp

Issue 2347473007: Revert of Support Float32 output from SkColorSpaceXform (Closed)
Patch Set: Created 4 years, 3 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/SkPngCodec.h ('k') | src/codec/SkWebpCodec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/codec/SkPngCodec.cpp
diff --git a/src/codec/SkPngCodec.cpp b/src/codec/SkPngCodec.cpp
index 1e633eaaed3b76b5e9aae380e8a1605b498d84cf..04c88212035664d4e5d15f93d534f98a0faf3467 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -267,12 +267,11 @@
// If we are not decoding to F16, we can color xform now and store the results
// in the color table.
if (fColorXform && kRGBA_F16_SkColorType != dstInfo.colorType()) {
- SkColorSpaceXform::ColorFormat xformColorFormat = is_rgba(dstInfo.colorType()) ?
- SkColorSpaceXform::kRGBA_8888_ColorFormat :
- SkColorSpaceXform::kBGRA_8888_ColorFormat;
- SkAlphaType xformAlphaType = select_xform_alpha(dstInfo.alphaType(),
+ SkColorType xformColorType = is_rgba(dstInfo.colorType()) ?
+ kRGBA_8888_SkColorType : kBGRA_8888_SkColorType;
+ SkAlphaType xformAlphaType = select_alpha_xform(dstInfo.alphaType(),
this->getInfo().alphaType());
- fColorXform->apply(colorTable, colorTable, numColors, xformColorFormat, xformAlphaType);
+ fColorXform->apply(colorTable, colorTable, numColors, xformColorType, xformAlphaType);
}
// Pad the color table with the last color in the table (or black) in the case that
@@ -493,18 +492,17 @@
}
void SkPngCodec::applyXformRow(void* dst, const void* src) {
+ const SkColorType colorType = this->dstInfo().colorType();
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);
+ fColorXform->apply(dst, (const uint32_t*) src, fXformWidth, colorType, fXformAlphaType);
break;
case kSwizzleColor_XformMode:
fSwizzler->swizzle(fColorXformSrcRow, (const uint8_t*) src);
- fColorXform->apply(dst, fColorXformSrcRow, fXformWidth, fXformColorFormat,
- fXformAlphaType);
+ fColorXform->apply(dst, fColorXformSrcRow, fXformWidth, colorType, fXformAlphaType);
break;
}
}
@@ -1139,23 +1137,9 @@
return true;
}
-void SkPngCodec::initializeXformParams() {
- switch (fXformMode) {
- case kColorOnly_XformMode:
- fXformColorFormat = select_xform_format(this->dstInfo().colorType());
- fXformAlphaType = select_xform_alpha(this->dstInfo().alphaType(),
- this->getInfo().alphaType());
- fXformWidth = this->dstInfo().width();
- break;
- case kSwizzleColor_XformMode:
- fXformColorFormat = select_xform_format(this->dstInfo().colorType());
- fXformAlphaType = select_xform_alpha(this->dstInfo().alphaType(),
- this->getInfo().alphaType());
- fXformWidth = this->swizzler()->swizzleWidth();
- break;
- default:
- break;
- }
+void SkPngCodec::initializeXformAlphaAndWidth() {
+ fXformAlphaType = select_alpha_xform(this->dstInfo().alphaType(), this->getInfo().alphaType());
+ fXformWidth = this->swizzler() ? this->swizzler()->swizzleWidth() : this->dstInfo().width();
}
static inline bool apply_xform_on_decode(SkColorType dstColorType, SkEncodedInfo::Color srcColor) {
@@ -1242,7 +1226,7 @@
}
this->allocateStorage(dstInfo);
- this->initializeXformParams();
+ this->initializeXformAlphaAndWidth();
return this->decodeAllRows(dst, rowBytes, rowsDecoded);
}
@@ -1277,7 +1261,7 @@
SkCodec::Result SkPngCodec::onIncrementalDecode(int* rowsDecoded) {
// FIXME: Only necessary on the first call.
- this->initializeXformParams();
+ this->initializeXformAlphaAndWidth();
return this->decode(rowsDecoded);
}
@@ -1285,7 +1269,7 @@
uint64_t SkPngCodec::onGetFillValue(const SkImageInfo& dstInfo) const {
const SkPMColor* colorPtr = get_color_ptr(fColorTable.get());
if (colorPtr) {
- SkAlphaType alphaType = select_xform_alpha(dstInfo.alphaType(),
+ SkAlphaType alphaType = select_alpha_xform(dstInfo.alphaType(),
this->getInfo().alphaType());
return get_color_table_fill_value(dstInfo.colorType(), alphaType, colorPtr, 0,
fColorXform.get());
« no previous file with comments | « src/codec/SkPngCodec.h ('k') | src/codec/SkWebpCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698