joshualitt | da7b843 | 2015-05-27 09:19:03 -0700 | [diff] [blame] | 1 | /* |
| 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" |
bsalomon | 45171e2 | 2015-06-16 13:52:18 -0700 | [diff] [blame] | 15 | #include "SkString.h" |
joshualitt | da7b843 | 2015-05-27 09:19:03 -0700 | [diff] [blame] | 16 | #include "SkSurface.h" |
joshualitt | 189aef7 | 2015-09-08 07:08:11 -0700 | [diff] [blame] | 17 | #include "VisualFlags.h" |
| 18 | #include "VisualModule.h" |
joshualitt | da7b843 | 2015-05-27 09:19:03 -0700 | [diff] [blame] | 19 | #include "gl/SkGLContext.h" |
| 20 | |
| 21 | class GrContext; |
| 22 | struct GrGLInterface; |
| 23 | class GrRenderTarget; |
| 24 | class SkCanvas; |
| 25 | |
| 26 | /* |
| 27 | * A Visual benchmarking tool for gpu benchmarking |
| 28 | */ |
| 29 | class VisualBench : public SkOSWindow { |
| 30 | public: |
| 31 | VisualBench(void* hwnd, int argc, char** argv); |
| 32 | ~VisualBench() override; |
| 33 | |
joshualitt | 189aef7 | 2015-09-08 07:08:11 -0700 | [diff] [blame] | 34 | void reset() { this->resetContext(); } |
| 35 | |
jvanverth | f5d1b2d | 2015-09-15 07:40:56 -0700 | [diff] [blame^] | 36 | void clear(SkCanvas* canvas, SkColor color, int frames); |
| 37 | |
joshualitt | da7b843 | 2015-05-27 09:19:03 -0700 | [diff] [blame] | 38 | protected: |
| 39 | SkSurface* createSurface() override; |
| 40 | |
| 41 | void draw(SkCanvas* canvas) override; |
| 42 | |
| 43 | void onSizeChange() override; |
| 44 | |
| 45 | private: |
| 46 | void setTitle(); |
| 47 | bool setupBackend(); |
joshualitt | 7fe8ee4 | 2015-06-01 10:03:54 -0700 | [diff] [blame] | 48 | void resetContext(); |
joshualitt | da7b843 | 2015-05-27 09:19:03 -0700 | [diff] [blame] | 49 | void setupRenderTarget(); |
| 50 | bool onHandleChar(SkUnichar unichar) override; |
joshualitt | da7b843 | 2015-05-27 09:19:03 -0700 | [diff] [blame] | 51 | |
| 52 | // support framework |
joshualitt | 189aef7 | 2015-09-08 07:08:11 -0700 | [diff] [blame] | 53 | SkAutoTDelete<VisualModule> fModule; |
joshualitt | da7b843 | 2015-05-27 09:19:03 -0700 | [diff] [blame] | 54 | SkAutoTUnref<SkSurface> fSurface; |
| 55 | SkAutoTUnref<GrContext> fContext; |
| 56 | SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| 57 | AttachmentInfo fAttachmentInfo; |
| 58 | SkAutoTUnref<const GrGLInterface> fInterface; |
joshualitt | da7b843 | 2015-05-27 09:19:03 -0700 | [diff] [blame] | 59 | |
| 60 | typedef SkOSWindow INHERITED; |
| 61 | }; |
| 62 | |
| 63 | #endif |