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

Side by Side Diff: bench/SkBenchmark.cpp

Issue 99893003: Simplify benchmark internal API. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years 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/SkipZeroesBench.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 * 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 #include "SkBenchmark.h" 7 #include "SkBenchmark.h"
8 #include "SkPaint.h" 8 #include "SkPaint.h"
9 #include "SkParse.h" 9 #include "SkParse.h"
10 10
11 const char* SkTriState::Name[] = { "default", "true", "false" }; 11 const char* SkTriState::Name[] = { "default", "true", "false" };
12 12
13 SK_DEFINE_INST_COUNT(SkBenchmark) 13 SK_DEFINE_INST_COUNT(SkBenchmark)
14 14
15 template BenchRegistry* BenchRegistry::gHead; 15 template BenchRegistry* BenchRegistry::gHead;
16 16
17 SkString SkBenchmark::gResourcePath; 17 SkString SkBenchmark::gResourcePath;
18 18
19 SkBenchmark::SkBenchmark() { 19 SkBenchmark::SkBenchmark() {
20 fForceAlpha = 0xFF; 20 fForceAlpha = 0xFF;
21 fForceAA = true; 21 fForceAA = true;
22 fForceFilter = false; 22 fForceFilter = false;
23 fDither = SkTriState::kDefault; 23 fDither = SkTriState::kDefault;
24 fOrMask = fClearMask = 0; 24 fOrMask = fClearMask = 0;
25 fLoops = 1;
26 } 25 }
27 26
28 const char* SkBenchmark::getName() { 27 const char* SkBenchmark::getName() {
29 return this->onGetName(); 28 return this->onGetName();
30 } 29 }
31 30
32 SkIPoint SkBenchmark::getSize() { 31 SkIPoint SkBenchmark::getSize() {
33 return this->onGetSize(); 32 return this->onGetSize();
34 } 33 }
35 34
36 void SkBenchmark::preDraw() { 35 void SkBenchmark::preDraw() {
37 this->onPreDraw(); 36 this->onPreDraw();
38 } 37 }
39 38
40 void SkBenchmark::draw(SkCanvas* canvas) { 39 void SkBenchmark::draw(const int loops, SkCanvas* canvas) {
41 this->onDraw(canvas); 40 this->onDraw(loops, canvas);
42 } 41 }
43 42
44 void SkBenchmark::postDraw() { 43 void SkBenchmark::postDraw() {
45 this->onPostDraw(); 44 this->onPostDraw();
46 } 45 }
47 46
48 void SkBenchmark::setupPaint(SkPaint* paint) { 47 void SkBenchmark::setupPaint(SkPaint* paint) {
49 paint->setAlpha(fForceAlpha); 48 paint->setAlpha(fForceAlpha);
50 paint->setAntiAlias(fForceAA); 49 paint->setAntiAlias(fForceAA);
51 paint->setFilterLevel(fForceFilter ? SkPaint::kLow_FilterLevel 50 paint->setFilterLevel(fForceFilter ? SkPaint::kLow_FilterLevel
52 : SkPaint::kNone_FilterLevel); 51 : SkPaint::kNone_FilterLevel);
53 52
54 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask); 53 paint->setFlags((paint->getFlags() & ~fClearMask) | fOrMask);
55 54
56 if (SkTriState::kDefault != fDither) { 55 if (SkTriState::kDefault != fDither) {
57 paint->setDither(SkTriState::kTrue == fDither); 56 paint->setDither(SkTriState::kTrue == fDither);
58 } 57 }
59 } 58 }
60 59
61 60
62 /////////////////////////////////////////////////////////////////////////////// 61 ///////////////////////////////////////////////////////////////////////////////
63 62
64 SkIPoint SkBenchmark::onGetSize() { 63 SkIPoint SkBenchmark::onGetSize() {
65 return SkIPoint::Make(640, 480); 64 return SkIPoint::Make(640, 480);
66 } 65 }
OLDNEW
« no previous file with comments | « bench/SkBenchmark.h ('k') | bench/SkipZeroesBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698