blob: f573c2ed0938db3af8f2aa7d5d88fa236176bbdc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkottieSlide_DEFINED
#define SkottieSlide_DEFINED
#include "Slide.h"
namespace skottie { class Animation; }
namespace sksg { class Scene; }
class SkottieSlide : public Slide {
public:
SkottieSlide(const SkString& name, const SkString& path);
~SkottieSlide() override = default;
void load(SkScalar winWidth, SkScalar winHeight) override;
void unload() override;
SkISize getDimensions() const override;
void draw(SkCanvas*) override;
bool animate(const SkAnimTimer&) override;
bool onChar(SkUnichar) override;
private:
SkString fPath;
std::unique_ptr<skottie::Animation> fAnimation;
SkMSec fTimeBase = 0;
bool fShowAnimationInval = false;
typedef Slide INHERITED;
};
class SkottieSlide2 : public Slide {
public:
SkottieSlide2(const SkString& path);
~SkottieSlide2() override = default;
void load(SkScalar winWidth, SkScalar winHeight) override;
void unload() override;
SkISize getDimensions() const override;
void draw(SkCanvas*) override;
bool animate(const SkAnimTimer&) override;
bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override;
private:
class AnimationWrapper;
struct Rec {
sk_sp<AnimationWrapper> fWrapper;
SkMSec fTimeBase = 0;
SkString fName;
bool fShowAnimationInval = false;
explicit Rec(sk_sp<AnimationWrapper>);
Rec(Rec&& o);
};
int findCell(float x, float y) const;
SkString fPath;
SkTArray<Rec> fAnims;
std::unique_ptr<sksg::Scene> fScene;
int fTrackingCell = -1;
typedef Slide INHERITED;
};
#endif // SkottieSlide_DEFINED
|