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 #include "Benchmark.h" | 8 #include "Benchmark.h" |
9 | 9 |
10 #include "SkPaint.h" | 10 #include "SkPaint.h" |
11 #include "SkParse.h" | 11 #include "SkParse.h" |
12 | 12 |
13 const char* SkTriState::Name[] = { "default", "true", "false" }; | 13 const char* SkTriState::Name[] = { "default", "true", "false" }; |
14 | 14 |
15 template BenchRegistry* BenchRegistry::gHead; | 15 template BenchRegistry* BenchRegistry::gHead; |
16 | 16 |
17 Benchmark::Benchmark() { | 17 Benchmark::Benchmark() { |
18 fForceAlpha = 0xFF; | 18 fForceAlpha = 0xFF; |
19 fDither = SkTriState::kDefault; | 19 fDither = SkTriState::kDefault; |
20 fOrMask = fClearMask = 0; | 20 fOrMask = fClearMask = 0; |
21 } | 21 } |
22 | 22 |
23 const char* Benchmark::getName() { | 23 const char* Benchmark::getName() { |
24 return this->onGetName(); | 24 return this->onGetName(); |
25 } | 25 } |
26 | 26 |
| 27 const char* Benchmark::getUniqueName() { |
| 28 return this->onGetUniqueName(); |
| 29 } |
| 30 |
27 SkIPoint Benchmark::getSize() { | 31 SkIPoint Benchmark::getSize() { |
28 return this->onGetSize(); | 32 return this->onGetSize(); |
29 } | 33 } |
30 | 34 |
31 void Benchmark::preDraw() { | 35 void Benchmark::preDraw() { |
32 this->onPreDraw(); | 36 this->onPreDraw(); |
33 } | 37 } |
34 | 38 |
35 void Benchmark::draw(const int loops, SkCanvas* canvas) { | 39 void Benchmark::draw(const int loops, SkCanvas* canvas) { |
36 this->onDraw(loops, canvas); | 40 this->onDraw(loops, canvas); |
37 } | 41 } |
38 | 42 |
39 void Benchmark::setupPaint(SkPaint* paint) { | 43 void Benchmark::setupPaint(SkPaint* paint) { |
40 paint->setAlpha(fForceAlpha); | 44 paint->setAlpha(fForceAlpha); |
41 paint->setAntiAlias(true); | 45 paint->setAntiAlias(true); |
42 paint->setFilterLevel(SkPaint::kNone_FilterLevel); | 46 paint->setFilterLevel(SkPaint::kNone_FilterLevel); |
43 | 47 |
44 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask); | 48 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask); |
45 | 49 |
46 if (SkTriState::kDefault != fDither) { | 50 if (SkTriState::kDefault != fDither) { |
47 paint->setDither(SkTriState::kTrue == fDither); | 51 paint->setDither(SkTriState::kTrue == fDither); |
48 } | 52 } |
49 } | 53 } |
50 | 54 |
51 SkIPoint Benchmark::onGetSize() { | 55 SkIPoint Benchmark::onGetSize() { |
52 return SkIPoint::Make(640, 480); | 56 return SkIPoint::Make(640, 480); |
53 } | 57 } |
OLD | NEW |