| Index: src/codec/SkScaledCodec.cpp
|
| diff --git a/src/codec/SkScaledCodec.cpp b/src/codec/SkScaledCodec.cpp
|
| index 65fd93c8c0e50fc1e018573c162cc707d31877b2..fc51613f3191071cfe0e45775d031ad3387eefb9 100644
|
| --- a/src/codec/SkScaledCodec.cpp
|
| +++ b/src/codec/SkScaledCodec.cpp
|
| @@ -12,22 +12,25 @@
|
|
|
|
|
| SkCodec* SkScaledCodec::NewFromStream(SkStream* stream) {
|
| - bool isWebp = SkWebpCodec::IsWebp(stream);
|
| - if (!stream->rewind()) {
|
| - return nullptr;
|
| - }
|
| - if (isWebp) {
|
| - // Webp codec supports scaling and subsetting natively
|
| - return SkWebpCodec::NewFromStream(stream);
|
| - }
|
| -
|
| SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream));
|
| if (nullptr == codec) {
|
| return nullptr;
|
| }
|
|
|
| - // wrap in new SkScaledCodec
|
| - return new SkScaledCodec(codec.detach());
|
| + switch (codec->getEncodedFormat()) {
|
| + case kWEBP_SkEncodedFormat:
|
| + // Webp codec supports scaling and subsetting natively
|
| + return codec.detach();
|
| + case kPNG_SkEncodedFormat:
|
| + case kJPEG_SkEncodedFormat:
|
| + // wrap in new SkScaledCodec
|
| + return new SkScaledCodec(codec.detach());
|
| + default:
|
| + // FIXME: SkScaledCodec is temporarily disabled for other formats
|
| + // while focusing on the formats that are supported by
|
| + // BitmapRegionDecoder.
|
| + return nullptr;
|
| + }
|
| }
|
|
|
| SkCodec* SkScaledCodec::NewFromData(SkData* data) {
|
|
|