OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 * | 6 * |
7 */ | 7 */ |
8 | 8 |
9 #ifndef VisualBench_DEFINED | 9 #ifndef VisualBench_DEFINED |
10 #define VisualBench_DEFINED | 10 #define VisualBench_DEFINED |
11 | 11 |
12 #include "SkWindow.h" | 12 #include "SkWindow.h" |
13 | 13 |
14 #include "SkPicture.h" | 14 #include "SkPicture.h" |
| 15 #include "SkString.h" |
15 #include "SkSurface.h" | 16 #include "SkSurface.h" |
16 #include "Timer.h" | 17 #include "Timer.h" |
17 #include "gl/SkGLContext.h" | 18 #include "gl/SkGLContext.h" |
18 | 19 |
19 class GrContext; | 20 class GrContext; |
20 struct GrGLInterface; | 21 struct GrGLInterface; |
21 class GrRenderTarget; | 22 class GrRenderTarget; |
22 class SkCanvas; | 23 class SkCanvas; |
23 | 24 |
24 /* | 25 /* |
(...skipping 11 matching lines...) Expand all Loading... |
36 | 37 |
37 void onSizeChange() override; | 38 void onSizeChange() override; |
38 | 39 |
39 private: | 40 private: |
40 void setTitle(); | 41 void setTitle(); |
41 bool setupBackend(); | 42 bool setupBackend(); |
42 void resetContext(); | 43 void resetContext(); |
43 void setupRenderTarget(); | 44 void setupRenderTarget(); |
44 bool onHandleChar(SkUnichar unichar) override; | 45 bool onHandleChar(SkUnichar unichar) override; |
45 void printStats(); | 46 void printStats(); |
46 inline void timePicture(SkCanvas*); | 47 bool loadPicture(); |
| 48 bool advanceRecordIfNecessary(); |
47 inline void renderFrame(SkCanvas*); | 49 inline void renderFrame(SkCanvas*); |
48 | 50 |
49 struct Timing { | 51 struct Record { |
50 SkString fName; | 52 SkString fFilename; |
51 SkTArray<double> fMeasurements; | 53 SkTArray<double> fMeasurements; |
52 }; | 54 }; |
53 | 55 |
54 enum State { | 56 enum State { |
55 kPreWarm_State, | 57 kPreWarm_State, |
56 kTiming_State, | 58 kTiming_State, |
57 }; | 59 }; |
58 | 60 |
59 int fLoop; | 61 int fLoop; |
60 int fCurrentPicture; | 62 int fCurrentPictureIdx; |
| 63 SkAutoTUnref<SkPicture> fPicture; |
61 int fCurrentSample; | 64 int fCurrentSample; |
62 SkTArray<Timing> fTimings; | 65 SkTArray<Record> fRecords; |
63 SkTArray<SkPicture*> fPictures; | |
64 WallTimer fTimer; | 66 WallTimer fTimer; |
65 State fState; | 67 State fState; |
66 | 68 |
67 // support framework | 69 // support framework |
68 SkAutoTUnref<SkSurface> fSurface; | 70 SkAutoTUnref<SkSurface> fSurface; |
69 SkAutoTUnref<GrContext> fContext; | 71 SkAutoTUnref<GrContext> fContext; |
70 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 72 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
71 AttachmentInfo fAttachmentInfo; | 73 AttachmentInfo fAttachmentInfo; |
72 SkAutoTUnref<const GrGLInterface> fInterface; | 74 SkAutoTUnref<const GrGLInterface> fInterface; |
73 | 75 |
74 typedef SkOSWindow INHERITED; | 76 typedef SkOSWindow INHERITED; |
75 }; | 77 }; |
76 | 78 |
77 #endif | 79 #endif |
OLD | NEW |