• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2020 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SkRiveSlide_DEFINED
9 #define SkRiveSlide_DEFINED
10 
11 #include "tools/viewer/Slide.h"
12 
13 #if defined(SK_ENABLE_SKRIVE)
14 
15 #include "experimental/skrive/include/SkRive.h"
16 
17 class SkRiveSlide final : public Slide {
18 public:
19     SkRiveSlide(const SkString& name, const SkString& path);
20     ~SkRiveSlide() override;
21 
22 private:
23     void load(SkScalar winWidth, SkScalar winHeight) override;
24     void unload() override;
25     void resize(SkScalar, SkScalar) override;
26 
27     SkISize getDimensions() const override;
28 
29     void draw(SkCanvas*) override;
30 
31     const SkString        fPath;
32 
33     sk_sp<skrive::SkRive> fRive;
34     SkRect                fRiveBounds;
35     SkSize                fWinSize;
36 
37     using INHERITED = Slide;
38 };
39 
40 #endif // defined(SK_ENABLE_SKRIVE)
41 #endif // SkRiveSlide_DEFINED
42