00d4f535c9
- shift the revalidation phase from Scene::render() to Scene::animate() - pass an optional inval controller to Scene::animate() and Animation::seek() - hoist the showInval logic out of SkSG, into clients This allows clients to track dirty regions and detect cases where no updates are needed. Bug: skia:9267 Change-Id: I3d35bf58b6eee9bfeb6e127ba58e2b96713b772d Reviewed-on: https://skia-review.googlesource.com/c/skia/+/229001 Commit-Queue: Florin Malita <fmalita@chromium.org> Reviewed-by: Mike Reed <reed@google.com>
51 lines
1.4 KiB
C++
51 lines
1.4 KiB
C++
/*
|
|
* 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 "tools/viewer/Slide.h"
|
|
|
|
#if defined(SK_ENABLE_SKOTTIE)
|
|
#include "modules/skottie/include/Skottie.h"
|
|
#include "modules/sksg/include/SkSGInvalidationController.h"
|
|
|
|
namespace sksg { class Scene; }
|
|
|
|
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(double) override;
|
|
|
|
bool onChar(SkUnichar) override;
|
|
bool onMouse(SkScalar x, SkScalar y, InputState, ModifierKey modifiers) override;
|
|
|
|
private:
|
|
SkString fPath;
|
|
sk_sp<skottie::Animation> fAnimation;
|
|
skottie::Animation::Builder::Stats fAnimationStats;
|
|
sksg::InvalidationController fInvalController;
|
|
SkSize fWinSize = SkSize::MakeEmpty();
|
|
SkMSec fTimeBase = 0;
|
|
bool fShowAnimationInval = false,
|
|
fShowAnimationStats = false;
|
|
|
|
typedef Slide INHERITED;
|
|
};
|
|
|
|
#endif // SK_ENABLE_SKOTTIE
|
|
|
|
#endif // SkottieSlide_DEFINED
|