skia2/tools/VisualBench/VisualBench.h
jvanverth f5d1b2de03 Add viewer mode to VisualBench.
Displays each benchmark/skp with a graph showing a series of frame times.
Use the space bar to skip to the next benchmark.

Adds an option to hit ESC to quit VisualBench. Useful in fullscreen mode.

Review URL: https://codereview.chromium.org/1336043003
2015-09-15 07:40:56 -07:00

64 lines
1.3 KiB
C++

/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
*/
#ifndef VisualBench_DEFINED
#define VisualBench_DEFINED
#include "SkWindow.h"
#include "SkPicture.h"
#include "SkString.h"
#include "SkSurface.h"
#include "VisualFlags.h"
#include "VisualModule.h"
#include "gl/SkGLContext.h"
class GrContext;
struct GrGLInterface;
class GrRenderTarget;
class SkCanvas;
/*
* A Visual benchmarking tool for gpu benchmarking
*/
class VisualBench : public SkOSWindow {
public:
VisualBench(void* hwnd, int argc, char** argv);
~VisualBench() override;
void reset() { this->resetContext(); }
void clear(SkCanvas* canvas, SkColor color, int frames);
protected:
SkSurface* createSurface() override;
void draw(SkCanvas* canvas) override;
void onSizeChange() override;
private:
void setTitle();
bool setupBackend();
void resetContext();
void setupRenderTarget();
bool onHandleChar(SkUnichar unichar) override;
// support framework
SkAutoTDelete<VisualModule> fModule;
SkAutoTUnref<SkSurface> fSurface;
SkAutoTUnref<GrContext> fContext;
SkAutoTUnref<GrRenderTarget> fRenderTarget;
AttachmentInfo fAttachmentInfo;
SkAutoTUnref<const GrGLInterface> fInterface;
typedef SkOSWindow INHERITED;
};
#endif