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

Unified Diff: src/codec/SkScaledCodec.cpp

Issue 1389053002: Focus SkScaledCodec on BitmapRegionDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@silenceNanobench
Patch Set: Disable SkScaledCodec non BRD types in CodexTest 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 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) {
« 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