Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: tools/VisualBench/VisualBench.h

Issue 1240633005: Some cleanups of VisualBench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/VisualBench/VisualBench.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 21 matching lines...) Expand all
32 ~VisualBench() override; 32 ~VisualBench() override;
33 33
34 protected: 34 protected:
35 SkSurface* createSurface() override; 35 SkSurface* createSurface() override;
36 36
37 void draw(SkCanvas* canvas) override; 37 void draw(SkCanvas* canvas) override;
38 38
39 void onSizeChange() override; 39 void onSizeChange() override;
40 40
41 private: 41 private:
42 enum State {
bsalomon 2015/07/17 15:18:22 Needs some comments here... This is pretty complic
43 kPreWarmLoopsPerCanvasPreDraw_State,
44 kPreWarmLoops_State,
45 kTuneLoops_State,
46 kPreWarmTimingPerCanvasPreDraw_State,
47 kPreWarmTiming_State,
48 kTiming_State,
49 };
42 void setTitle(); 50 void setTitle();
43 bool setupBackend(); 51 bool setupBackend();
44 void resetContext(); 52 void resetContext();
45 void setupRenderTarget(); 53 void setupRenderTarget();
46 bool onHandleChar(SkUnichar unichar) override; 54 bool onHandleChar(SkUnichar unichar) override;
47 void printStats(); 55 void printStats();
48 bool advanceRecordIfNecessary(SkCanvas*); 56 bool advanceRecordIfNecessary(SkCanvas*);
49 inline void renderFrame(SkCanvas*); 57 inline void renderFrame(SkCanvas*);
58 inline void nextState(State);
59 void perCanvasPreDraw(SkCanvas*, State);
60 void preWarm(State nextState);
61 void scaleLoops(double elapsedMs);
62 inline void tuneLoops();
63 inline void timing(SkCanvas*);
64 inline double elapsed();
65 void resetTimingState();
66 void postDraw(SkCanvas*);
67 void recordMeasurement();
50 68
51 struct Record { 69 struct Record {
52 SkTArray<double> fMeasurements; 70 SkTArray<double> fMeasurements;
53 }; 71 };
54 72
55 enum State {
56 kPreWarmLoops_State,
57 kTuneLoops_State,
58 kPreWarmTiming_State,
59 kTiming_State,
60 };
61 void preWarm(State nextState);
62
63 int fCurrentSample; 73 int fCurrentSample;
64 int fCurrentFrame; 74 int fCurrentFrame;
65 int fFlushes; 75 int fFlushes;
66 int fLoops; 76 int fLoops;
67 SkTArray<Record> fRecords; 77 SkTArray<Record> fRecords;
68 WallTimer fTimer; 78 WallTimer fTimer;
69 State fState; 79 State fState;
70 SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream; 80 SkAutoTDelete<VisualBenchmarkStream> fBenchmarkStream;
71 SkAutoTUnref<Benchmark> fBenchmark; 81 SkAutoTUnref<Benchmark> fBenchmark;
72 82
73 // support framework 83 // support framework
74 SkAutoTUnref<SkSurface> fSurface; 84 SkAutoTUnref<SkSurface> fSurface;
75 SkAutoTUnref<GrContext> fContext; 85 SkAutoTUnref<GrContext> fContext;
76 SkAutoTUnref<GrRenderTarget> fRenderTarget; 86 SkAutoTUnref<GrRenderTarget> fRenderTarget;
77 AttachmentInfo fAttachmentInfo; 87 AttachmentInfo fAttachmentInfo;
78 SkAutoTUnref<const GrGLInterface> fInterface; 88 SkAutoTUnref<const GrGLInterface> fInterface;
79 89
80 typedef SkOSWindow INHERITED; 90 typedef SkOSWindow INHERITED;
81 }; 91 };
82 92
83 #endif 93 #endif
OLDNEW
« no previous file with comments | « no previous file | tools/VisualBench/VisualBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698