OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "SkBenchmark.h" | 8 #include "SkBenchmark.h" |
9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
10 #include "SkParse.h" | 10 #include "SkParse.h" |
11 | 11 |
12 SK_DEFINE_INST_COUNT(SkBenchmark) | 12 SK_DEFINE_INST_COUNT(SkBenchmark) |
13 | 13 |
14 template BenchRegistry* BenchRegistry::gHead; | 14 template BenchRegistry* BenchRegistry::gHead; |
15 | 15 |
16 SkBenchmark::SkBenchmark(void* defineDict) { | 16 SkBenchmark::SkBenchmark(void* defineDict) { |
17 fDict = reinterpret_cast<const SkTDict<const char*>*>(defineDict); | 17 fDict = reinterpret_cast<const SkTDict<const char*>*>(defineDict); |
18 fForceAlpha = 0xFF; | 18 fForceAlpha = 0xFF; |
19 fForceAA = true; | 19 fForceAA = true; |
20 fDither = SkTriState::kDefault; | 20 fDither = SkTriState::kDefault; |
21 fHasStrokeWidth = false; | 21 fHasStrokeWidth = false; |
22 fIsRendering = true; | 22 fIsRendering = true; |
| 23 fOrMask = fClearMask = 0; |
23 } | 24 } |
24 | 25 |
25 const char* SkBenchmark::getName() { | 26 const char* SkBenchmark::getName() { |
26 return this->onGetName(); | 27 return this->onGetName(); |
27 } | 28 } |
28 | 29 |
29 SkIPoint SkBenchmark::getSize() { | 30 SkIPoint SkBenchmark::getSize() { |
30 return this->onGetSize(); | 31 return this->onGetSize(); |
31 } | 32 } |
32 | 33 |
33 void SkBenchmark::preDraw() { | 34 void SkBenchmark::preDraw() { |
34 this->onPreDraw(); | 35 this->onPreDraw(); |
35 } | 36 } |
36 | 37 |
37 void SkBenchmark::draw(SkCanvas* canvas) { | 38 void SkBenchmark::draw(SkCanvas* canvas) { |
38 this->onDraw(canvas); | 39 this->onDraw(canvas); |
39 } | 40 } |
40 | 41 |
41 void SkBenchmark::postDraw() { | 42 void SkBenchmark::postDraw() { |
42 this->onPostDraw(); | 43 this->onPostDraw(); |
43 } | 44 } |
44 | 45 |
45 void SkBenchmark::setupPaint(SkPaint* paint) { | 46 void SkBenchmark::setupPaint(SkPaint* paint) { |
46 paint->setAlpha(fForceAlpha); | 47 paint->setAlpha(fForceAlpha); |
47 paint->setAntiAlias(fForceAA); | 48 paint->setAntiAlias(fForceAA); |
48 paint->setFilterBitmap(fForceFilter); | 49 paint->setFilterBitmap(fForceFilter); |
49 | 50 |
| 51 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask); |
| 52 |
50 if (SkTriState::kDefault != fDither) { | 53 if (SkTriState::kDefault != fDither) { |
51 paint->setDither(SkTriState::kTrue == fDither); | 54 paint->setDither(SkTriState::kTrue == fDither); |
52 } | 55 } |
53 } | 56 } |
54 | 57 |
55 const char* SkBenchmark::findDefine(const char* key) const { | 58 const char* SkBenchmark::findDefine(const char* key) const { |
56 if (fDict) { | 59 if (fDict) { |
57 const char* value; | 60 const char* value; |
58 if (fDict->find(key, &value)) { | 61 if (fDict->find(key, &value)) { |
59 return value; | 62 return value; |
(...skipping 18 matching lines...) Expand all Loading... |
78 return true; | 81 return true; |
79 } | 82 } |
80 return false; | 83 return false; |
81 } | 84 } |
82 | 85 |
83 /////////////////////////////////////////////////////////////////////////////// | 86 /////////////////////////////////////////////////////////////////////////////// |
84 | 87 |
85 SkIPoint SkBenchmark::onGetSize() { | 88 SkIPoint SkBenchmark::onGetSize() { |
86 return SkIPoint::Make(640, 480); | 89 return SkIPoint::Make(640, 480); |
87 } | 90 } |
OLD | NEW |