aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkWebpCodec.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins <scroggo@google.com>2017-11-15 13:49:19 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-11-15 13:49:27 +0000
commit2009c20309a2a91d1fb9020385b56eeae06a1fb1 (patch)
tree57bd836a783eaa2d0eec1ab7ab283f79c2e48003 /src/codec/SkWebpCodec.cpp
parent2b6f614dac7c984ffd10cb59c499c9bd872d9695 (diff)
Revert "Fix webp bug compositing alpha frames on opaque"
This reverts commit 42bae8faa4b9b6a3341b15c6ac7c6b466e95625c. Reason for revert: Breaking GMs. A more extensive fix is needed. Original change's description: > Fix webp bug compositing alpha frames on opaque > > select_xform_alpha is used to determine how the color transform should > handle alpha values. In a similar way, we're using it here to determine > whether to premultiply pixels before blending them. In this case, the > source is unpremul, so we should be premultiplying them, but since we > are compositing on an opaque frame, the dst must be opaque and > select_xform_alpha returns kOpaque. As a result, we do not premultiply > (and even hint to the transform that the pixels are opaque). Since this > all applies to the pre-blended pixels, we should not care that the dst > is opaque. So drop the call to select_xform_alpha and just use the alpha > type of the source. This matches the comment on the lines above. > > Add the test image that failed (https://mathiasbynens.be/demo/animated-webp) > > Change-Id: Ibd13c1f067bdf369ce1c882d4f6057aadccfa313 > Reviewed-on: https://skia-review.googlesource.com/71560 > Commit-Queue: Leon Scroggins <scroggo@google.com> > Reviewed-by: Mike Klein <mtklein@chromium.org> TBR=mtklein@chromium.org,scroggo@google.com Change-Id: I6f535ff9b773a93e02a0358b830291594a6e738c No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/71720 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec/SkWebpCodec.cpp')
-rw-r--r--src/codec/SkWebpCodec.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index 9cb44d275e..6287617373 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -571,6 +571,7 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
// We're only transforming the new part of the frame, so no need to worry about the
// final composited alpha.
const auto srcAlpha = 0 == index ? srcInfo.alphaType() : alpha_type(frame.has_alpha);
+ const auto xformAlphaType = select_xform_alpha(dstInfo.alphaType(), srcAlpha);
const bool needsSrgbToLinear = dstInfo.gammaCloseToSRGB() &&
options.fPremulBehavior == SkTransferFunctionBehavior::kRespect;
@@ -592,9 +593,9 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
xformDst = dst;
}
for (int y = 0; y < rowsDecoded; y++) {
- this->applyColorXform(xformDst, xformSrc, scaledWidth, srcAlpha);
+ this->applyColorXform(xformDst, xformSrc, scaledWidth, xformAlphaType);
if (blendWithPrevFrame) {
- blend_line(dstCT, dst, dstCT, xformDst, needsSrgbToLinear, srcAlpha,
+ blend_line(dstCT, dst, dstCT, xformDst, needsSrgbToLinear, xformAlphaType,
scaledWidth);
dst = SkTAddOffset<void>(dst, rowBytes);
} else {
@@ -607,7 +608,7 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
for (int y = 0; y < rowsDecoded; y++) {
blend_line(dstCT, dst, webpDst.colorType(), src, needsSrgbToLinear,
- srcAlpha, scaledWidth);
+ xformAlphaType, scaledWidth);
src = SkTAddOffset<const uint8_t>(src, srcRowBytes);
dst = SkTAddOffset<void>(dst, rowBytes);
}