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

Unified Diff: dm/DMSrcSink.cpp

Issue 2447863002: Report repetition count in SkCodec (Closed)
Patch Set: Return a bool, with multiple out parameters Created 4 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 | « dm/DM.cpp ('k') | gm/animatedGif.cpp » ('j') | include/codec/SkCodec.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.cpp
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 30185a2ab1faf8babbb8d720e6ea950c0f5e0718..2c5849a34a5861456d6fa6afa7fe603b72e74431 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -430,8 +430,9 @@ Error CodecSrc::draw(SkCanvas* canvas) const {
switch (fMode) {
case kAnimated_Mode: {
- std::vector<SkCodec::FrameInfo> frameInfos = codec->getFrameInfo();
- if (frameInfos.size() <= 1) {
+ std::vector<SkCodec::FrameInfo> frameInfos;
+ const bool animated = codec->getFrameInfo(&frameInfos, nullptr);
+ if (!animated || frameInfos.size() <= 1) {
return SkStringPrintf("%s is not an animated image.", fPath.c_str());
}
@@ -725,7 +726,11 @@ SkISize CodecSrc::size() const {
// We'll draw one of each frame, so make it big enough to hold them all
// in a grid. The grid will be roughly square, with "factor" frames per
// row and up to "factor" rows.
- const size_t count = codec->getFrameInfo().size();
+ std::vector<SkCodec::FrameInfo> frameInfos;
+ if (!codec->getFrameInfo(&frameInfos, nullptr)) {
+ return imageSize;
+ }
+ const size_t count = frameInfos.size();
const float root = sqrt((float) count);
const int factor = sk_float_ceil2int(root);
imageSize.fWidth = imageSize.fWidth * factor;
« no previous file with comments | « dm/DM.cpp ('k') | gm/animatedGif.cpp » ('j') | include/codec/SkCodec.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698