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;
|
|
|
|
bool animate(const SkAnimTimer&) override;
|
|
|
|
|
|
|
|
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-02-23 16:10:22 +00:00
|
|
|
SkString fPath;
|
|
|
|
sk_sp<skottie::Animation> fAnimation;
|
2018-04-30 14:32:18 +00:00
|
|
|
skottie::Animation::Stats fAnimationStats;
|
2018-02-23 16:10:22 +00:00
|
|
|
SkSize fWinSize = SkSize::MakeEmpty();
|
|
|
|
SkMSec fTimeBase = 0;
|
2018-04-30 14:32:18 +00:00
|
|
|
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
|