aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/codec/SkWebpCodec.cpp
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2017-08-15 12:24:02 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-17 16:09:31 +0000
commit0741818e7ab4e9ea8505b8a8687412f0e3804c65 (patch)
treeac183b3107e97b0717319fd403f6d552fdbd840f /src/codec/SkWebpCodec.cpp
parentde44c2df9469e70f57f05d262cd1a245b2ff5e90 (diff)
Move calls to conversion_possible to SkCodec
Move common code into the base class, so subclasses need not call conversion_possible. Use SkEncodedInfo rather than SkImageInfo, and use the proper frame. API Changes: - SkAndroidCodec: - Add getEncodedInfo(), for SkBitmapRegionCodec - SkEncodedInfo: - Add opaque() helper - SkBitmapRegionDecoder: - Remove unused conversionSupported (Split off from skia-review.googlesource.com/c/25746) Bug: skia:5601 Change-Id: If4a40d4b98a3dd0afde2b6058f92315a393a5baf Reviewed-on: https://skia-review.googlesource.com/34361 Reviewed-by: Mike Klein <mtklein@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com> Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'src/codec/SkWebpCodec.cpp')
-rw-r--r--src/codec/SkWebpCodec.cpp17
1 files changed, 4 insertions, 13 deletions
diff --git a/src/codec/SkWebpCodec.cpp b/src/codec/SkWebpCodec.cpp
index 94fa175f82..38feb827e4 100644
--- a/src/codec/SkWebpCodec.cpp
+++ b/src/codec/SkWebpCodec.cpp
@@ -398,23 +398,14 @@ static void blend_line(SkColorType dstCT, void* dst,
SkCodec::Result SkWebpCodec::onGetPixels(const SkImageInfo& dstInfo, void* dst, size_t rowBytes,
const Options& options, int* rowsDecodedPtr) {
+ if (!this->initializeColorXform(dstInfo, options.fPremulBehavior)) {
+ return kInvalidConversion;
+ }
+
const int index = options.fFrameIndex;
SkASSERT(0 == index || index < fFrameHolder.size());
const auto& srcInfo = this->getInfo();
- {
- auto info = srcInfo;
- if (index > 0) {
- auto alphaType = alpha_type(fFrameHolder.frame(index)->hasAlpha());
- info = info.makeAlphaType(alphaType);
- }
- if (!conversion_possible(dstInfo, info) ||
- !this->initializeColorXform(dstInfo, options.fPremulBehavior))
- {
- return kInvalidConversion;
- }
- }
-
SkASSERT(0 == index || (!options.fSubset && dstInfo.dimensions() == srcInfo.dimensions()));
WebPDecoderConfig config;