blob: 41b3c9c359d68973c47533b1620d2b25d0f609a6 [file] [log] [blame]
Brian Salomon06c9e292021-04-29 14:10:23 -04001/*
2 * Copyright 2021 Google LLC
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 MSKPSlide_DEFINED
9#define MSKPSlide_DEFINED
10
11#include "tools/MSKPPlayer.h"
12#include "tools/viewer/Slide.h"
13
14class SkStreamSeekable;
15
16class MSKPSlide : public Slide {
17public:
18 MSKPSlide(const SkString& name, const SkString& path);
19 MSKPSlide(const SkString& name, std::unique_ptr<SkStreamSeekable>);
20
21 SkISize getDimensions() const override;
22
23 void draw(SkCanvas* canvas) override;
24 bool animate(double nanos) override;
25 void load(SkScalar winWidth, SkScalar winHeight) override;
26 void unload() override;
27 void gpuTeardown() override;
28
29private:
30 std::unique_ptr<SkStreamSeekable> fStream;
31 std::unique_ptr<MSKPPlayer> fPlayer;
32 int fFrame = 0;
33 int fFPS = 15; // TODO: make this adjustable. This happens to work well for calendar.mskp
34 double fLastFrameTime = 0;
35
36 using INHERITED = Slide;
37};
38
39#endif