Florin Malita | 54f65c4 | 2018-01-16 17:04:30 -0500 | [diff] [blame] | 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" |
Florin Malita | 6eb85a1 | 2018-04-30 10:32:18 -0400 | [diff] [blame^] | 12 | #include "Skottie.h" |
Florin Malita | 54f65c4 | 2018-01-16 17:04:30 -0500 | [diff] [blame] | 13 | |
Florin Malita | bcd0723 | 2018-01-31 11:08:58 -0500 | [diff] [blame] | 14 | namespace sksg { class Scene; } |
Florin Malita | 54f65c4 | 2018-01-16 17:04:30 -0500 | [diff] [blame] | 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; |
Florin Malita | 60d3bfc | 2018-02-20 16:49:20 -0500 | [diff] [blame] | 30 | bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override; |
Florin Malita | 54f65c4 | 2018-01-16 17:04:30 -0500 | [diff] [blame] | 31 | |
| 32 | private: |
Florin Malita | 1022f74 | 2018-02-23 11:10:22 -0500 | [diff] [blame] | 33 | SkString fPath; |
| 34 | sk_sp<skottie::Animation> fAnimation; |
Florin Malita | 6eb85a1 | 2018-04-30 10:32:18 -0400 | [diff] [blame^] | 35 | skottie::Animation::Stats fAnimationStats; |
Florin Malita | 1022f74 | 2018-02-23 11:10:22 -0500 | [diff] [blame] | 36 | SkSize fWinSize = SkSize::MakeEmpty(); |
| 37 | SkMSec fTimeBase = 0; |
Florin Malita | 6eb85a1 | 2018-04-30 10:32:18 -0400 | [diff] [blame^] | 38 | bool fShowAnimationInval = false, |
| 39 | fShowAnimationStats = false; |
Florin Malita | 54f65c4 | 2018-01-16 17:04:30 -0500 | [diff] [blame] | 40 | |
| 41 | typedef Slide INHERITED; |
| 42 | }; |
| 43 | |
Florin Malita | 54f65c4 | 2018-01-16 17:04:30 -0500 | [diff] [blame] | 44 | #endif // SkottieSlide_DEFINED |