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

Side by Side Diff: bench/Benchmark.h

Issue 750583002: Revert of Add MultiPictureDraw to nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | bench/Benchmark.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 2011 Google Inc. 2 * Copyright 2011 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 #ifndef Benchmark_DEFINED 8 #ifndef Benchmark_DEFINED
9 #define Benchmark_DEFINED 9 #define Benchmark_DEFINED
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // the rendering mode. 63 // the rendering mode.
64 virtual bool isSuitableFor(Backend backend) { 64 virtual bool isSuitableFor(Backend backend) {
65 return backend != kNonRendering_Backend; 65 return backend != kNonRendering_Backend;
66 } 66 }
67 67
68 // Call before draw, allows the benchmark to do setup work outside of the 68 // Call before draw, allows the benchmark to do setup work outside of the
69 // timer. When a benchmark is repeatedly drawn, this should be called once 69 // timer. When a benchmark is repeatedly drawn, this should be called once
70 // before the initial draw. 70 // before the initial draw.
71 void preDraw(); 71 void preDraw();
72 72
73 // Called once before and after a series of draw calls to a single canvas.
74 // The setup/break down in these calls is not timed.
75 void perCanvasPreDraw(SkCanvas*);
76 void perCanvasPostDraw(SkCanvas*);
77
78 // Bench framework can tune loops to be large enough for stable timing. 73 // Bench framework can tune loops to be large enough for stable timing.
79 void draw(const int loops, SkCanvas*); 74 void draw(const int loops, SkCanvas*);
80 75
81 void setForceAlpha(int alpha) { 76 void setForceAlpha(int alpha) {
82 fForceAlpha = alpha; 77 fForceAlpha = alpha;
83 } 78 }
84 79
85 void setDither(SkTriState::State state) { 80 void setDither(SkTriState::State state) {
86 fDither = state; 81 fDither = state;
87 } 82 }
(...skipping 11 matching lines...) Expand all
99 fOrMask = orMask; 94 fOrMask = orMask;
100 fClearMask = clearMask; 95 fClearMask = clearMask;
101 } 96 }
102 97
103 protected: 98 protected:
104 virtual void setupPaint(SkPaint* paint); 99 virtual void setupPaint(SkPaint* paint);
105 100
106 virtual const char* onGetName() = 0; 101 virtual const char* onGetName() = 0;
107 virtual const char* onGetUniqueName() { return this->onGetName(); } 102 virtual const char* onGetUniqueName() { return this->onGetName(); }
108 virtual void onPreDraw() {} 103 virtual void onPreDraw() {}
109 virtual void onPerCanvasPreDraw(SkCanvas*) {}
110 virtual void onPerCanvasPostDraw(SkCanvas*) {}
111 // Each bench should do its main work in a loop like this: 104 // Each bench should do its main work in a loop like this:
112 // for (int i = 0; i < loops; i++) { <work here> } 105 // for (int i = 0; i < loops; i++) { <work here> }
113 virtual void onDraw(const int loops, SkCanvas*) = 0; 106 virtual void onDraw(const int loops, SkCanvas*) = 0;
114 107
115 virtual SkIPoint onGetSize(); 108 virtual SkIPoint onGetSize();
116 109
117 private: 110 private:
118 int fForceAlpha; 111 int fForceAlpha;
119 SkTriState::State fDither; 112 SkTriState::State fDither;
120 uint32_t fOrMask, fClearMask; 113 uint32_t fOrMask, fClearMask;
121 114
122 typedef SkRefCnt INHERITED; 115 typedef SkRefCnt INHERITED;
123 }; 116 };
124 117
125 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; 118 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry;
126 119
127 #endif 120 #endif
OLDNEW
« no previous file with comments | « no previous file | bench/Benchmark.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698