blob: 75615f0735cd075c88494acfbcacd8e63fc442c9 [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"
bsalomon45171e22015-06-16 13:52:18 -070015#include "SkString.h"
joshualittda7b8432015-05-27 09:19:03 -070016#include "SkSurface.h"
joshualitt189aef72015-09-08 07:08:11 -070017#include "VisualFlags.h"
18#include "VisualModule.h"
joshualittda7b8432015-05-27 09:19:03 -070019#include "gl/SkGLContext.h"
20
21class GrContext;
22struct GrGLInterface;
23class GrRenderTarget;
24class SkCanvas;
25
26/*
27 * A Visual benchmarking tool for gpu benchmarking
28 */
29class VisualBench : public SkOSWindow {
30public:
31 VisualBench(void* hwnd, int argc, char** argv);
32 ~VisualBench() override;
33
joshualitt189aef72015-09-08 07:08:11 -070034 void reset() { this->resetContext(); }
35
joshualittda7b8432015-05-27 09:19:03 -070036protected:
37 SkSurface* createSurface() override;
38
39 void draw(SkCanvas* canvas) override;
40
41 void onSizeChange() override;
42
43private:
44 void setTitle();
45 bool setupBackend();
joshualitt7fe8ee42015-06-01 10:03:54 -070046 void resetContext();
joshualittda7b8432015-05-27 09:19:03 -070047 void setupRenderTarget();
48 bool onHandleChar(SkUnichar unichar) override;
joshualittda7b8432015-05-27 09:19:03 -070049
50 // support framework
joshualitt189aef72015-09-08 07:08:11 -070051 SkAutoTDelete<VisualModule> fModule;
joshualittda7b8432015-05-27 09:19:03 -070052 SkAutoTUnref<SkSurface> fSurface;
53 SkAutoTUnref<GrContext> fContext;
54 SkAutoTUnref<GrRenderTarget> fRenderTarget;
55 AttachmentInfo fAttachmentInfo;
56 SkAutoTUnref<const GrGLInterface> fInterface;
joshualittda7b8432015-05-27 09:19:03 -070057
58 typedef SkOSWindow INHERITED;
59};
60
61#endif