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

Side by Side Diff: bench/SkBenchmark.cpp

Issue 23478013: Major bench refactoring. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: merge with head agani Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « bench/SkBenchmark.h ('k') | bench/SortBench.cpp » ('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 /* 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 const char* SkTriState::Name[] = { "default", "true", "false" };
13
12 SK_DEFINE_INST_COUNT(SkBenchmark) 14 SK_DEFINE_INST_COUNT(SkBenchmark)
13 15
14 template BenchRegistry* BenchRegistry::gHead; 16 template BenchRegistry* BenchRegistry::gHead;
15 17
16 SkBenchmark::SkBenchmark(void* defineDict) { 18 SkBenchmark::SkBenchmark(void* /*ignored*/) {
17 fDict = reinterpret_cast<const SkTDict<const char*>*>(defineDict);
18 fForceAlpha = 0xFF; 19 fForceAlpha = 0xFF;
19 fForceAA = true; 20 fForceAA = true;
20 fDither = SkTriState::kDefault; 21 fDither = SkTriState::kDefault;
21 fHasStrokeWidth = false;
22 fIsRendering = true; 22 fIsRendering = true;
23 fOrMask = fClearMask = 0; 23 fOrMask = fClearMask = 0;
24 fLoops = 1;
24 } 25 }
25 26
26 const char* SkBenchmark::getName() { 27 const char* SkBenchmark::getName() {
27 return this->onGetName(); 28 return this->onGetName();
28 } 29 }
29 30
30 SkIPoint SkBenchmark::getSize() { 31 SkIPoint SkBenchmark::getSize() {
31 return this->onGetSize(); 32 return this->onGetSize();
32 } 33 }
33 34
(...skipping 14 matching lines...) Expand all
48 paint->setAntiAlias(fForceAA); 49 paint->setAntiAlias(fForceAA);
49 paint->setFilterBitmap(fForceFilter); 50 paint->setFilterBitmap(fForceFilter);
50 51
51 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask); 52 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask);
52 53
53 if (SkTriState::kDefault != fDither) { 54 if (SkTriState::kDefault != fDither) {
54 paint->setDither(SkTriState::kTrue == fDither); 55 paint->setDither(SkTriState::kTrue == fDither);
55 } 56 }
56 } 57 }
57 58
58 const char* SkBenchmark::findDefine(const char* key) const {
59 if (fDict) {
60 const char* value;
61 if (fDict->find(key, &value)) {
62 return value;
63 }
64 }
65 return NULL;
66 }
67
68 bool SkBenchmark::findDefine32(const char* key, int32_t* value) const {
69 const char* valueStr = this->findDefine(key);
70 if (valueStr) {
71 SkParse::FindS32(valueStr, value);
72 return true;
73 }
74 return false;
75 }
76
77 bool SkBenchmark::findDefineScalar(const char* key, SkScalar* value) const {
78 const char* valueStr = this->findDefine(key);
79 if (valueStr) {
80 SkParse::FindScalar(valueStr, value);
81 return true;
82 }
83 return false;
84 }
85 59
86 /////////////////////////////////////////////////////////////////////////////// 60 ///////////////////////////////////////////////////////////////////////////////
87 61
88 SkIPoint SkBenchmark::onGetSize() { 62 SkIPoint SkBenchmark::onGetSize() {
89 return SkIPoint::Make(640, 480); 63 return SkIPoint::Make(640, 480);
90 } 64 }
OLDNEW
« no previous file with comments | « bench/SkBenchmark.h ('k') | bench/SortBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698