Index: src/codec/SkScaledCodec.cpp |
diff --git a/src/codec/SkScaledCodec.cpp b/src/codec/SkScaledCodec.cpp |
index 078a0261a0c392c26e083532cddc358a9ac770b9..fb162939f71412f13089e2e2feaa5e34a3a41c21 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()) { |
msarett
2015/10/06 17:38:02
I'm opposed to this.
I think we've both done a si
scroggo
2015/10/06 17:52:41
Ignoring bugs is hard though. If we want to run na
|
+ 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) { |