• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2 * Copyright 2024 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 AnimatedImageSlide_DEFINED
9 #define AnimatedImageSlide_DEFINED
10 
11 #include "include/core/SkString.h"
12 #include "modules/skresources/include/SkResources.h"
13 #include "tools/viewer/Slide.h"
14 
15 class SkCanvas;
16 
17 class AnimatedImageSlide final : public Slide {
18 public:
19     AnimatedImageSlide(const SkString& name, const SkString& path);
20 
21     void load(SkScalar winWidth, SkScalar winHeight) override;
22     void unload() override;
23 
24     void draw(SkCanvas*) override;
25     bool animate(double nanos) override;
26 
27 private:
28     const SkString                           fPath;
29     sk_sp<skresources::MultiFrameImageAsset> fImageAsset;
30     SkSize                                   fWinSize;
31 
32     double                                   fTimeBase = 0;
33     float                                    fFrameMs  = 0;
34 };
35 
36 #endif  // AnimatedImageSlide_DEFINED
37