aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/viewer/SkottieSlide.h
diff options
context:
space:
mode:
authorGravatar Florin Malita <fmalita@chromium.org>2018-01-16 17:04:30 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-17 14:15:36 +0000
commit54f65c473fd6bf6919dfcbad22e924dff7586568 (patch)
treee241fc08b1dff9c41621bd52afca21c6059ed34b /tools/viewer/SkottieSlide.h
parentd452434d1717aa42993a4c671ffc5625fe273957 (diff)
Skotty -> Skottie
Change-Id: If8b6516024c69b0fc256208874f6666a4e70e12c Reviewed-on: https://skia-review.googlesource.com/95241 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'tools/viewer/SkottieSlide.h')
-rw-r--r--tools/viewer/SkottieSlide.h73
1 files changed, 73 insertions, 0 deletions
diff --git a/tools/viewer/SkottieSlide.h b/tools/viewer/SkottieSlide.h
new file mode 100644
index 0000000000..6c278d484f
--- /dev/null
+++ b/tools/viewer/SkottieSlide.h
@@ -0,0 +1,73 @@
+/*
+ * 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; }
+
+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:
+ struct Rec {
+ std::unique_ptr<skottie::Animation> fAnimation;
+ SkMSec fTimeBase = 0;
+ SkString fName;
+ bool fShowAnimationInval = false;
+
+ Rec(std::unique_ptr<skottie::Animation> anim);
+ Rec(Rec&& o);
+ };
+
+ int findCell(float x, float y) const;
+
+ SkString fPath;
+ SkTArray<Rec> fAnims;
+
+ int fTrackingCell = -1;
+
+ typedef Slide INHERITED;
+};
+
+#endif // SkottieSlide_DEFINED