1 /* 2 * Copyright 2017 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkottieSlide_DEFINED 9 #define SkottieSlide_DEFINED 10 11 #include "Slide.h" 12 13 #if defined(SK_ENABLE_SKOTTIE) 14 #include "Skottie.h" 15 16 namespace sksg { class Scene; } 17 18 class SkottieSlide : public Slide { 19 public: 20 SkottieSlide(const SkString& name, const SkString& path); 21 ~SkottieSlide() override = default; 22 23 void load(SkScalar winWidth, SkScalar winHeight) override; 24 void unload() override; 25 26 SkISize getDimensions() const override; 27 28 void draw(SkCanvas*) override; 29 bool animate(const SkAnimTimer&) override; 30 31 bool onChar(SkUnichar) override; 32 bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override; 33 34 private: 35 SkString fPath; 36 sk_sp<skottie::Animation> fAnimation; 37 skottie::Animation::Builder::Stats fAnimationStats; 38 SkSize fWinSize = SkSize::MakeEmpty(); 39 SkMSec fTimeBase = 0; 40 bool fShowAnimationInval = false, 41 fShowAnimationStats = false; 42 43 typedef Slide INHERITED; 44 }; 45 46 #endif // SK_ENABLE_SKOTTIE 47 48 #endif // SkottieSlide_DEFINED 49