skia2/tools/viewer/MSKPSlide.h
Brian Salomon 8e880af78e Choose background color and whether to draw mskp bounds in viewer
Default the background color to transparent black, which is correct for
mskps captures from Android framework.

Bug: skia:11900
Change-Id: I97cab04993c0f85259e831f3d0c44f9b962365af
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/403077
Reviewed-by: Nathaniel Nifong <nifong@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
2021-04-30 19:33:49 +00:00

47 lines
1.1 KiB
C++

/*
* Copyright 2021 Google LLC
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef MSKPSlide_DEFINED
#define MSKPSlide_DEFINED
#include "tools/MSKPPlayer.h"
#include "tools/viewer/Slide.h"
class SkStreamSeekable;
class MSKPSlide : public Slide {
public:
MSKPSlide(const SkString& name, const SkString& path);
MSKPSlide(const SkString& name, std::unique_ptr<SkStreamSeekable>);
SkISize getDimensions() const override;
void draw(SkCanvas* canvas) override;
bool animate(double nanos) override;
void load(SkScalar winWidth, SkScalar winHeight) override;
void unload() override;
void gpuTeardown() override;
private:
std::unique_ptr<SkStreamSeekable> fStream;
std::unique_ptr<MSKPPlayer> fPlayer;
int fFrame = 0;
int fFPS = 15;
bool fPaused = false;
double fLastFrameTime = -1;
bool fShowFrameBounds = false;
// Default to transparent black, which is correct for Android MSKPS.
float fBackgroundColor[4] = {0, 0, 0, 0};
using INHERITED = Slide;
};
#endif