| OLD | NEW |
| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 // before the initial draw. | 69 // before the initial draw. |
| 70 void preDraw(); | 70 void preDraw(); |
| 71 | 71 |
| 72 // Bench framework can tune loops to be large enough for stable timing. | 72 // Bench framework can tune loops to be large enough for stable timing. |
| 73 void draw(const int loops, SkCanvas*); | 73 void draw(const int loops, SkCanvas*); |
| 74 | 74 |
| 75 void setForceAlpha(int alpha) { | 75 void setForceAlpha(int alpha) { |
| 76 fForceAlpha = alpha; | 76 fForceAlpha = alpha; |
| 77 } | 77 } |
| 78 | 78 |
| 79 void setForceAA(bool aa) { | |
| 80 fForceAA = aa; | |
| 81 } | |
| 82 | |
| 83 void setForceFilter(bool filter) { | |
| 84 fForceFilter = filter; | |
| 85 } | |
| 86 | |
| 87 void setDither(SkTriState::State state) { | 79 void setDither(SkTriState::State state) { |
| 88 fDither = state; | 80 fDither = state; |
| 89 } | 81 } |
| 90 | 82 |
| 91 /** Assign masks for paint-flags. These will be applied when setupPaint() | 83 /** Assign masks for paint-flags. These will be applied when setupPaint() |
| 92 * is called. | 84 * is called. |
| 93 * | 85 * |
| 94 * Performs the following on the paint: | 86 * Performs the following on the paint: |
| 95 * uint32_t flags = paint.getFlags(); | 87 * uint32_t flags = paint.getFlags(); |
| 96 * flags &= ~clearMask; | 88 * flags &= ~clearMask; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 108 virtual const char* onGetName() = 0; | 100 virtual const char* onGetName() = 0; |
| 109 virtual void onPreDraw() {} | 101 virtual void onPreDraw() {} |
| 110 // Each bench should do its main work in a loop like this: | 102 // Each bench should do its main work in a loop like this: |
| 111 // for (int i = 0; i < loops; i++) { <work here> } | 103 // for (int i = 0; i < loops; i++) { <work here> } |
| 112 virtual void onDraw(const int loops, SkCanvas*) = 0; | 104 virtual void onDraw(const int loops, SkCanvas*) = 0; |
| 113 | 105 |
| 114 virtual SkIPoint onGetSize(); | 106 virtual SkIPoint onGetSize(); |
| 115 | 107 |
| 116 private: | 108 private: |
| 117 int fForceAlpha; | 109 int fForceAlpha; |
| 118 bool fForceAA; | |
| 119 bool fForceFilter; | |
| 120 SkTriState::State fDither; | 110 SkTriState::State fDither; |
| 121 uint32_t fOrMask, fClearMask; | 111 uint32_t fOrMask, fClearMask; |
| 122 | 112 |
| 123 typedef SkRefCnt INHERITED; | 113 typedef SkRefCnt INHERITED; |
| 124 }; | 114 }; |
| 125 | 115 |
| 126 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; | 116 typedef SkTRegistry<Benchmark*(*)(void*)> BenchRegistry; |
| 127 | 117 |
| 128 #endif | 118 #endif |
| OLD | NEW |