Flutter Engine
The Flutter Engine
SkottieSlide.h
Go to the documentation of this file.
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 "tools/viewer/Slide.h"
12
13#if defined(SK_ENABLE_SKOTTIE)
16
17#include <vector>
18
19namespace skottie_utils {
20class TextEditor;
21}
22
23namespace sksg { class Scene; }
24
25class SkottieSlide : public Slide {
26public:
27 SkottieSlide(const SkString& name, const SkString& path);
28 ~SkottieSlide() override = default;
29
30 void load(SkScalar winWidth, SkScalar winHeight) override;
31 void unload() override;
32 void resize(SkScalar, SkScalar) override;
33
34 void draw(SkCanvas*) override;
35 bool animate(double) override;
36
37 bool onChar(SkUnichar) override;
38 bool onMouse(SkScalar x, SkScalar y, skui::InputState, skui::ModifierKey modifiers) override;
39
40 // Initializes the Skottie animation independent of window size.
41 void init();
42
43private:
44 SkRect UIArea() const;
45 void renderUI();
46
47 class TransformTracker;
48 class SlotManagerInterface;
49
50 const SkString fPath;
51
54 sksg::InvalidationController fInvalController;
55 sk_sp<TransformTracker> fTransformTracker;
56 std::unique_ptr<SlotManagerInterface>fSlotManagerInterface;
58 std::vector<float> fFrameTimes;
59 SkSize fWinSize = SkSize::MakeEmpty();
60 double fTimeBase = 0,
61 fFrameRate = 0;
62 const char* fFrameRateLabel = nullptr;
63 float fCurrentFrame = 0;
64 bool fShowAnimationInval = false,
65 fShowAnimationStats = false,
66 fShowUI = false,
67 fShowTrackerUI = false,
68 fShowSlotManager = false,
69 fDraggingProgress = false,
70 fPreferGlyphPaths = false;
71};
72
73#endif // SK_ENABLE_SKOTTIE
74
75#endif // SkottieSlide_DEFINED
SkPath fPath
int32_t SkUnichar
Definition: SkTypes.h:175
Definition: Slide.h:29
virtual bool onMouse(SkScalar x, SkScalar y, skui::InputState state, skui::ModifierKey modifiers)
Definition: Slide.h:45
virtual void unload()
Definition: Slide.h:42
virtual bool onChar(SkUnichar c)
Definition: Slide.h:44
virtual void resize(SkScalar winWidth, SkScalar winHeight)
Definition: Slide.h:41
virtual void load(SkScalar winWidth, SkScalar winHeight)
Definition: Slide.h:40
virtual bool animate(double nanos)
Definition: Slide.h:39
virtual void draw(SkCanvas *canvas)=0
float SkScalar
Definition: extension.cpp:12
double y
double x
static bool init()
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
Definition: Skottie.h:32
InputState
Definition: InputState.h:6
ModifierKey
Definition: ModifierKey.h:9
Definition: SkSize.h:52
static constexpr SkSize MakeEmpty()
Definition: SkSize.h:62