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" |
| 15 | #include "SkSurface.h" |
| 16 | #include "gl/SkGLContext.h" |
| 17 | |
| 18 | class GrContext; |
| 19 | struct GrGLInterface; |
| 20 | class GrRenderTarget; |
| 21 | class SkCanvas; |
| 22 | |
| 23 | /* |
| 24 | * A Visual benchmarking tool for gpu benchmarking |
| 25 | */ |
| 26 | class VisualBench : public SkOSWindow { |
| 27 | public: |
| 28 | VisualBench(void* hwnd, int argc, char** argv); |
| 29 | ~VisualBench() override; |
| 30 | |
| 31 | protected: |
| 32 | SkSurface* createSurface() override; |
| 33 | |
| 34 | void draw(SkCanvas* canvas) override; |
| 35 | |
| 36 | void onSizeChange() override; |
| 37 | |
| 38 | private: |
| 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 |