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 "SkBenchmark.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 SkBenchmark::SkBenchmark() { | 17 Benchmark::Benchmark() { |
18 fForceAlpha = 0xFF; | 18 fForceAlpha = 0xFF; |
19 fForceAA = true; | 19 fForceAA = true; |
20 fForceFilter = false; | 20 fForceFilter = false; |
21 fDither = SkTriState::kDefault; | 21 fDither = SkTriState::kDefault; |
22 fOrMask = fClearMask = 0; | 22 fOrMask = fClearMask = 0; |
23 } | 23 } |
24 | 24 |
25 const char* SkBenchmark::getName() { | 25 const char* Benchmark::getName() { |
26 return this->onGetName(); | 26 return this->onGetName(); |
27 } | 27 } |
28 | 28 |
29 SkIPoint SkBenchmark::getSize() { | 29 SkIPoint Benchmark::getSize() { |
30 return this->onGetSize(); | 30 return this->onGetSize(); |
31 } | 31 } |
32 | 32 |
33 void SkBenchmark::preDraw() { | 33 void Benchmark::preDraw() { |
34 this->onPreDraw(); | 34 this->onPreDraw(); |
35 } | 35 } |
36 | 36 |
37 void SkBenchmark::draw(const int loops, SkCanvas* canvas) { | 37 void Benchmark::draw(const int loops, SkCanvas* canvas) { |
38 this->onDraw(loops, canvas); | 38 this->onDraw(loops, canvas); |
39 } | 39 } |
40 | 40 |
41 void SkBenchmark::setupPaint(SkPaint* paint) { | 41 void Benchmark::setupPaint(SkPaint* paint) { |
42 paint->setAlpha(fForceAlpha); | 42 paint->setAlpha(fForceAlpha); |
43 paint->setAntiAlias(fForceAA); | 43 paint->setAntiAlias(fForceAA); |
44 paint->setFilterLevel(fForceFilter ? SkPaint::kLow_FilterLevel | 44 paint->setFilterLevel(fForceFilter ? SkPaint::kLow_FilterLevel |
45 : SkPaint::kNone_FilterLevel); | 45 : SkPaint::kNone_FilterLevel); |
46 | 46 |
47 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask); | 47 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask); |
48 | 48 |
49 if (SkTriState::kDefault != fDither) { | 49 if (SkTriState::kDefault != fDither) { |
50 paint->setDither(SkTriState::kTrue == fDither); | 50 paint->setDither(SkTriState::kTrue == fDither); |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 SkIPoint SkBenchmark::onGetSize() { | 54 SkIPoint Benchmark::onGetSize() { |
55 return SkIPoint::Make(640, 480); | 55 return SkIPoint::Make(640, 480); |
56 } | 56 } |
OLD | NEW |