blob: d9e0b508669c34ad799f9b8e5adf49495cdb0319 [file] [log] [blame]
joshualittda7b8432015-05-27 09:19:03 -07001/*
2 * Copyright 2015 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
9#ifndef VisualBench_DEFINED
10#define VisualBench_DEFINED
11
12#include "SkWindow.h"
13
14#include "SkPicture.h"
15#include "SkSurface.h"
16#include "gl/SkGLContext.h"
17
18class GrContext;
19struct GrGLInterface;
20class GrRenderTarget;
21class SkCanvas;
22
23/*
24 * A Visual benchmarking tool for gpu benchmarking
25 */
26class VisualBench : public SkOSWindow {
27public:
28 VisualBench(void* hwnd, int argc, char** argv);
29 ~VisualBench() override;
30
31protected:
32 SkSurface* createSurface() override;
33
34 void draw(SkCanvas* canvas) override;
35
36 void onSizeChange() override;
37
38private:
39 void setTitle();
40 bool setupBackend();
41 void setupRenderTarget();
42 bool onHandleChar(SkUnichar unichar) override;
43
44 int fCurrentLoops;
45 int fCurrentPicture;
46 int fCurrentFrame;
47 SkTArray<SkPicture*> fPictures;
48
49 // support framework
50 SkAutoTUnref<SkSurface> fSurface;
51 SkAutoTUnref<GrContext> fContext;
52 SkAutoTUnref<GrRenderTarget> fRenderTarget;
53 AttachmentInfo fAttachmentInfo;
54 SkAutoTUnref<const GrGLInterface> fInterface;
55
56 typedef SkOSWindow INHERITED;
57};
58
59#endif