skia2/tools/viewer/SkottieSlide.h
Florin Malita 40c37426b3 [skottie] Plumb external SkFontMgr
Allow embedders to pass a font manager.

In order to avoid excessive factory API clutter, introduce an
Animation::Builder helper to wrap factory options.

Also clean up various bits:

  * hoist scene parsing out of the Animation ctor
  * store the animation duration explicitly (instead of unused fps)
  * plumb const SkFontMgr& internally (instead of a ref)

Change-Id: I3e180dfa85ba18c8462cfeb5a7385bef985ed6c4
Reviewed-on: https://skia-review.googlesource.com/148800
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
2018-08-23 13:13:30 +00:00

49 lines
1.3 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 "Slide.h"
#if defined(SK_ENABLE_SKOTTIE)
#include "Skottie.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(const SkAnimTimer&) override;
bool onChar(SkUnichar) override;
bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override;
private:
SkString fPath;
sk_sp<skottie::Animation> fAnimation;
skottie::Animation::Builder::Stats fAnimationStats;
SkSize fWinSize = SkSize::MakeEmpty();
SkMSec fTimeBase = 0;
bool fShowAnimationInval = false,
fShowAnimationStats = false;
typedef Slide INHERITED;
};
#endif // SK_ENABLE_SKOTTIE
#endif // SkottieSlide_DEFINED