aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkWebpCodec.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2017-06-05 15:53:38 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-05 20:14:57 +0000
commitc6e6a5f45e54006e861275a6d5c165830f403dcd (patch)
tree3d4bc3a0c43d6c2986728a3dffdec43e8547f43f /src/codec/SkWebpCodec.cpp
parent348060fa820e1ee7a4fd246afe517a80a9ef311d (diff)
Simplify SkCodecs' call to SkColorSpaceXform::apply
Most SkCodec subclasses did the following to apply their SkColorSpaceXform: dstFormat = select_xform_format(dstInfo.colorType()); srcFormat = select_xform_format(<something that doesn't change>); xformAlphaType = select_xform_alpha(dstInfo.alphaType(), this->getInfo().alphaType()); this->colorXform()->apply(dstFormat, dst, srcFormat, src, width, xformAlphaType); Consolidate the computation of these parameters into SkCodec and add a new method to SkCodec that calls apply() with those parameters. Add a SkColorSpaceXform::ColorFormat to SkCodec. This allows the new method SkCodec::applyColorXform to supply the ColorFormat. TBR=reed@google.com (No change to public API.) Change-Id: I8ea7ba4c0024be827a9f9359796c778744330f6e Reviewed-on: https://skia-review.googlesource.com/18523 Reviewed-by: Leon Scroggins <scroggo@google.com> Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec/SkWebpCodec.cpp')
-rw-r--r--src/codec/SkWebpCodec.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index 700178ae9f..21d45da233 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -612,10 +612,6 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
const auto dstCT = dstInfo.colorType();
if (this->colorXform()) {
- const auto dstColorFormat = select_xform_format(dstInfo.colorType());
- const auto srcColorFormat = SkColorSpaceXform::kBGRA_8888_ColorFormat;
- SkASSERT(select_xform_format(webpDst.colorType()) == srcColorFormat);
-
uint32_t* xformSrc = (uint32_t*) config.output.u.RGBA.rgba;
SkBitmap tmp;
void* xformDst;
@@ -628,8 +624,7 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
xformDst = dst;
}
for (int y = 0; y < rowsDecoded; y++) {
- SkAssertResult(this->colorXform()->apply(dstColorFormat, xformDst,
- srcColorFormat, xformSrc, scaledWidth, xformAlphaType));
+ this->applyColorXform(xformDst, xformSrc, scaledWidth, xformAlphaType);
if (blendWithPrevFrame) {
blend_line(dstCT, &dst, dstCT, &xformDst, needsSrgbToLinear, xformAlphaType,
scaledWidth);
@@ -656,7 +651,8 @@ SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst,
SkWebpCodec::SkWebpCodec(int width, int height, const SkEncodedInfo& info,
sk_sp<SkColorSpace> colorSpace, SkStream* stream, WebPDemuxer* demux,
sk_sp<SkData> data)
- : INHERITED(width, height, info, stream, std::move(colorSpace))
+ : INHERITED(width, height, info, SkColorSpaceXform::kBGRA_8888_ColorFormat, stream,
+ std::move(colorSpace))
, fDemux(demux)
, fData(std::move(data))
, fFailed(false)