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

Side by Side Diff: bench/Benchmark.h

Issue 1215033002: Add benchmarkstream to visualbench (Closed) Base URL: https://skia.googlesource.com/skia.git@microbenches
Patch Set: tweaks 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 | gyp/visualbench.gyp » ('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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 * uint32_t flags = paint.getFlags(); 95 * uint32_t flags = paint.getFlags();
96 * flags &= ~clearMask; 96 * flags &= ~clearMask;
97 * flags |= orMask; 97 * flags |= orMask;
98 * paint.setFlags(flags); 98 * paint.setFlags(flags);
99 */ 99 */
100 void setPaintMasks(uint32_t orMask, uint32_t clearMask) { 100 void setPaintMasks(uint32_t orMask, uint32_t clearMask) {
101 fOrMask = orMask; 101 fOrMask = orMask;
102 fClearMask = clearMask; 102 fClearMask = clearMask;
103 } 103 }
104 104
105 /*
106 * Benches which support running in a visual mode can advertise this functio nality
107 */
108 virtual bool isVisual() { return false; }
109
105 protected: 110 protected:
106 virtual void setupPaint(SkPaint* paint); 111 virtual void setupPaint(SkPaint* paint);
107 112
108 virtual const char* onGetName() = 0; 113 virtual const char* onGetName() = 0;
109 virtual const char* onGetUniqueName() { return this->onGetName(); } 114 virtual const char* onGetUniqueName() { return this->onGetName(); }
110 virtual void onPreDraw() {} 115 virtual void onPreDraw() {}
111 virtual void onPerCanvasPreDraw(SkCanvas*) {} 116 virtual void onPerCanvasPreDraw(SkCanvas*) {}
112 virtual void onPerCanvasPostDraw(SkCanvas*) {} 117 virtual void onPerCanvasPostDraw(SkCanvas*) {}
113 // Each bench should do its main work in a loop like this: 118 // Each bench should do its main work in a loop like this:
114 // for (int i = 0; i < loops; i++) { <work here> } 119 // for (int i = 0; i < loops; i++) { <work here> }
115 virtual void onDraw(const int loops, SkCanvas*) = 0; 120 virtual void onDraw(const int loops, SkCanvas*) = 0;
116 121
117 virtual SkIPoint onGetSize(); 122 virtual SkIPoint onGetSize();
118 123
119 private: 124 private:
120 int fForceAlpha; 125 int fForceAlpha;
121 SkTriState::State fDither; 126 SkTriState::State fDither;
122 uint32_t fOrMask, fClearMask; 127 uint32_t fOrMask, fClearMask;
123 128
124 typedef SkRefCnt INHERITED; 129 typedef SkRefCnt INHERITED;
125 }; 130 };
126 131
127 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; 132 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry;
128 133
129 #endif 134 #endif
OLDNEW
« no previous file with comments | « no previous file | gyp/visualbench.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698