Home | History | Annotate | Download | only in viewer
      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 namespace skottie { class Animation; }
     14 namespace sksg    { class Scene;     }
     15 
     16 class SkottieSlide : public Slide {
     17 public:
     18     SkottieSlide(const SkString& name, const SkString& path);
     19     ~SkottieSlide() override = default;
     20 
     21     void load(SkScalar winWidth, SkScalar winHeight) override;
     22     void unload() override;
     23 
     24     SkISize getDimensions() const override;
     25 
     26     void draw(SkCanvas*) override;
     27     bool animate(const SkAnimTimer&) override;
     28 
     29     bool onChar(SkUnichar) override;
     30     bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override;
     31 
     32 private:
     33     SkString                  fPath;
     34     sk_sp<skottie::Animation> fAnimation;
     35     SkSize                    fWinSize = SkSize::MakeEmpty();
     36     SkMSec                    fTimeBase  = 0;
     37     bool                      fShowAnimationInval = false;
     38 
     39     typedef Slide INHERITED;
     40 };
     41 
     42 #endif // SkottieSlide_DEFINED
     43