Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(713)

Unified Diff: src/codec/SkScaledCodec.cpp

Issue 1389053002: Focus SkScaledCodec on BitmapRegionDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@silenceNanobench
Patch Set: Detach returned codec Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/CodexTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « no previous file | tests/CodexTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698