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
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "tools/viewer/Slide.h"
|
2018-05-26 13:49:28 +00:00
|
|
|
|
|
|
|
#if defined(SK_ENABLE_SKOTTIE)
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "modules/skottie/include/Skottie.h"
|
2019-07-22 16:05:41 +00:00
|
|
|
#include "modules/sksg/include/SkSGInvalidationController.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-07-11 20:32:53 +00:00
|
|
|
bool animate(double) override;
|
2017-12-30 17:27:00 +00:00
|
|
|
|
|
|
|
bool onChar(SkUnichar) override;
|
2019-07-16 13:58:43 +00:00
|
|
|
bool onMouse(SkScalar x, SkScalar y, InputState, ModifierKey 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;
|
2019-07-22 16:05:41 +00:00
|
|
|
sksg::InvalidationController fInvalController;
|
2018-08-23 00:37:04 +00:00
|
|
|
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
|