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

Unified Diff: src/codec/SkPngCodec.cpp

Issue 2318253004: Revert of Add color xform support to SkWebpCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
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/SkCodecPriv.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 ac7238d3e904f284ac182fc769a90c1166946b6f..1b8cadbf5ee00835b9b7783e5d10250739693d8f 100644
--- a/src/codec/SkPngCodec.cpp
+++ b/src/codec/SkPngCodec.cpp
@@ -94,6 +94,10 @@
};
#define AutoCleanPng(...) SK_REQUIRE_LOCAL_VAR(AutoCleanPng)
+static inline SkAlphaType xform_alpha_type(SkAlphaType dstAlphaType, SkAlphaType srcAlphaType) {
+ return (kOpaque_SkAlphaType == srcAlphaType) ? kOpaque_SkAlphaType : dstAlphaType;
+}
+
// Note: SkColorTable claims to store SkPMColors, which is not necessarily the case here.
bool SkPngCodec::createColorTable(const SkImageInfo& dstInfo, int* ctableCount) {
@@ -151,8 +155,8 @@
if (fColorXform && kRGBA_F16_SkColorType != dstInfo.colorType()) {
SkColorType xformColorType = is_rgba(dstInfo.colorType()) ?
kRGBA_8888_SkColorType : kBGRA_8888_SkColorType;
- SkAlphaType xformAlphaType = select_alpha_xform(dstInfo.alphaType(),
- this->getInfo().alphaType());
+ SkAlphaType xformAlphaType = xform_alpha_type(dstInfo.alphaType(),
+ this->getInfo().alphaType());
fColorXform->apply(colorTable, colorTable, numColors, xformColorType, xformAlphaType);
}
@@ -443,8 +447,8 @@
return y;
}
- SkAlphaType xformAlphaType = select_alpha_xform(dstInfo.alphaType(),
- this->getInfo().alphaType());
+ SkAlphaType xformAlphaType = xform_alpha_type(dstInfo.alphaType(),
+ this->getInfo().alphaType());
int width = fSwizzler ? fSwizzler->swizzleWidth() : dstInfo.width();
for (; y < count; y++) {
@@ -529,8 +533,8 @@
}
}
- SkAlphaType xformAlphaType = select_alpha_xform(dstInfo.alphaType(),
- this->getInfo().alphaType());
+ SkAlphaType xformAlphaType = xform_alpha_type(dstInfo.alphaType(),
+ this->getInfo().alphaType());
int width = fSwizzler ? fSwizzler->swizzleWidth() : dstInfo.width();
srcRow = storage.get();
for (int y = 0; y < count; y++) {
« no previous file with comments | « src/codec/SkCodecPriv.h ('k') | src/codec/SkWebpCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698