Flutter Engine
The Flutter Engine
MSKPSlide.h
Go to the documentation of this file.
1/*
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
12#include "include/core/SkSize.h"
15#include "tools/MSKPPlayer.h"
16#include "tools/viewer/Slide.h"
17
18#include <memory>
19#include <vector>
20
21class SkCanvas;
22
23class MSKPSlide : public Slide {
24public:
25 MSKPSlide(const SkString& name, const SkString& path);
26 MSKPSlide(const SkString& name, std::unique_ptr<SkStreamSeekable>);
27
28 SkISize getDimensions() const override;
29
30 void draw(SkCanvas* canvas) override;
31 bool animate(double nanos) override;
32 void load(SkScalar winWidth, SkScalar winHeight) override;
33 void unload() override;
34 void gpuTeardown() override;
35
36private:
37 // Call if layers need to be redrawn because we've looped playback or UI interaction.
38 void redrawLayers();
39
40 std::unique_ptr<SkStreamSeekable> fStream;
41 std::unique_ptr<MSKPPlayer> fPlayer;
42
43 int fFrame = 0;
44 int fFPS = 15;
45 bool fPaused = false;
46 double fLastFrameTime = -1;
47
48 bool fShowFrameBounds = false;
49
50 // Default to transparent black, which is correct for Android MSKPS.
51 float fBackgroundColor[4] = {0, 0, 0, 0};
52
53 std::vector<int> fAllLayerIDs;
54 std::vector<std::vector<int>> fFrameLayerIDs;
55 std::vector<SkString> fLayerIDStrings;
56 int fDrawLayerID = -1; // -1 means just draw the root layer
57 bool fListAllLayers = true;
58};
59
60#endif
bool animate(double nanos) override
Definition: MSKPSlide.cpp:153
void draw(SkCanvas *canvas) override
Definition: MSKPSlide.cpp:36
void unload() override
Definition: MSKPSlide.cpp:199
SkISize getDimensions() const override
Definition: MSKPSlide.cpp:32
void load(SkScalar winWidth, SkScalar winHeight) override
Definition: MSKPSlide.cpp:182
void gpuTeardown() override
Definition: MSKPSlide.cpp:201
MSKPSlide(const SkString &name, const SkString &path)
Definition: MSKPSlide.cpp:24
Definition: Slide.h:29
float SkScalar
Definition: extension.cpp:12
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
Definition: SkSize.h:16