diff options
author | Florin Malita <fmalita@chromium.org> | 2018-02-15 18:40:48 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-02-16 14:40:45 +0000 |
commit | 76a076bbdfe3e3837ff9e422d94124991062f583 (patch) | |
tree | df8e5226b4811512a4774dea123d23183f1cfca1 /tools/viewer/Viewer.cpp | |
parent | db78cba957889285604aeacb75e47af4600880c4 (diff) |
Generic "directory" viewer slide
This is a generalization of "skottie-dir", based on SkSG and operating
at the Slide API level.
For now it is only instantiated for Json slides, but could be used for
other slide "directories" in the future.
TBR=
NOTRY=true
Change-Id: If12429084bddeb172b234344f23eabcdadedcceb
Reviewed-on: https://skia-review.googlesource.com/108002
Commit-Queue: Florin Malita <fmalita@chromium.org>
Reviewed-by: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'tools/viewer/Viewer.cpp')
-rw-r--r-- | tools/viewer/Viewer.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index 2a58f2dc62..92741fea97 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -13,6 +13,7 @@ #include "SampleSlide.h" #include "SkottieSlide.h" #include "SKPSlide.h" +#include "SlideDir.h" #include "GrContext.h" #include "SkCanvas.h" @@ -556,14 +557,23 @@ void Viewer::initSlides() { for (const auto& json : FLAGS_jsons) { fSlides.push_back(sk_make_sp<SkottieSlide2>(json)); + SkTArray<sk_sp<Slide>, true> dirSlides; + SkOSFile::Iter it(json.c_str(), ".json"); SkString jsonName; while (it.next(&jsonName)) { if (SkCommandLineFlags::ShouldSkip(FLAGS_match, jsonName.c_str())) { continue; } - fSlides.push_back(sk_make_sp<SkottieSlide>(jsonName, SkOSPath::Join(json.c_str(), - jsonName.c_str()))); + auto slide = sk_make_sp<SkottieSlide>(jsonName, SkOSPath::Join(json.c_str(), + jsonName.c_str())); + dirSlides.push_back(slide); + fSlides.push_back(std::move(slide)); + } + + if (!dirSlides.empty()) { + fSlides.push_back(sk_make_sp<SlideDir>(SkStringPrintf("skottie-dir[%s]", json.c_str()), + std::move(dirSlides))); } } } |