2017-12-30 17:27:00 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2018-01-16 22:04:30 +00:00
|
|
|
#ifndef SkottieSlide_DEFINED
|
|
|
|
#define SkottieSlide_DEFINED
|
2017-12-30 17:27:00 +00:00
|
|
|
|
|
|
|
#include "Slide.h"
|
2018-05-26 13:49:28 +00:00
|
|
|
|
|
|
|
#if defined(SK_ENABLE_SKOTTIE)
|
2018-04-30 14:32:18 +00:00
|
|
|
#include "Skottie.h"
|
2017-12-30 17:27:00 +00:00
|
|
|
|
2018-01-31 16:08:58 +00:00
|
|
|
namespace sksg { class Scene; }
|
2017-12-30 17:27:00 +00:00
|
|
|
|
2018-01-16 22:04:30 +00:00
|
|
|
class SkottieSlide : public Slide {
|
2017-12-30 17:27:00 +00:00
|
|
|
public:
|
2018-01-16 22:04:30 +00:00
|
|
|
SkottieSlide(const SkString& name, const SkString& path);
|
|
|
|
~SkottieSlide() override = default;
|
2017-12-30 17:27:00 +00:00
|
|
|
|
|
|
|
void load(SkScalar winWidth, SkScalar winHeight) override;
|
|
|
|
void unload() override;
|
|
|
|
|
|
|
|
SkISize getDimensions() const override;
|
|
|
|
|
|
|
|
void draw(SkCanvas*) override;
|
2019-03-20 16:55:08 +00:00
|
|
|
bool animate(const AnimTimer&) override;
|
2017-12-30 17:27:00 +00:00
|
|
|
|
|
|
|
bool onChar(SkUnichar) override;
|
2018-02-20 21:49:20 +00:00
|
|
|
bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override;
|
2017-12-30 17:27:00 +00:00
|
|
|
|
|
|
|
private:
|
2018-08-23 00:37:04 +00:00
|
|
|
SkString fPath;
|
|
|
|
sk_sp<skottie::Animation> fAnimation;
|
|
|
|
skottie::Animation::Builder::Stats fAnimationStats;
|
|
|
|
SkSize fWinSize = SkSize::MakeEmpty();
|
|
|
|
SkMSec fTimeBase = 0;
|
|
|
|
bool fShowAnimationInval = false,
|
|
|
|
fShowAnimationStats = false;
|
2017-12-30 17:27:00 +00:00
|
|
|
|
|
|
|
typedef Slide INHERITED;
|
|
|
|
};
|
|
|
|
|
2018-05-26 13:49:28 +00:00
|
|
|
#endif // SK_ENABLE_SKOTTIE
|
|
|
|
|
2018-01-16 22:04:30 +00:00
|
|
|
#endif // SkottieSlide_DEFINED
|