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

Side by Side Diff: bench/BlurBench.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/BitmapScaleBench.cpp ('k') | bench/BlurImageFilterBench.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 "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 } else { 45 } else {
46 fName.printf("blur_%d_%s_%s", SkScalarRound(rad), name, quality); 46 fName.printf("blur_%d_%s_%s", SkScalarRound(rad), name, quality);
47 } 47 }
48 } 48 }
49 49
50 protected: 50 protected:
51 virtual const char* onGetName() { 51 virtual const char* onGetName() {
52 return fName.c_str(); 52 return fName.c_str();
53 } 53 }
54 54
55 virtual void onDraw(SkCanvas* canvas) { 55 virtual void onDraw(const int loops, SkCanvas* canvas) {
56 SkPaint paint; 56 SkPaint paint;
57 this->setupPaint(&paint); 57 this->setupPaint(&paint);
58 58
59 paint.setAntiAlias(true); 59 paint.setAntiAlias(true);
60 60
61 SkRandom rand; 61 SkRandom rand;
62 for (int i = 0; i < this->getLoops(); i++) { 62 for (int i = 0; i < loops; i++) {
63 SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400, 63 SkRect r = SkRect::MakeWH(rand.nextUScalar1() * 400,
64 rand.nextUScalar1() * 400); 64 rand.nextUScalar1() * 400);
65 r.offset(fRadius, fRadius); 65 r.offset(fRadius, fRadius);
66 66
67 if (fRadius > 0) { 67 if (fRadius > 0) {
68 SkMaskFilter* mf = SkBlurMaskFilter::Create(fStyle, 68 SkMaskFilter* mf = SkBlurMaskFilter::Create(fStyle,
69 SkBlurMask::ConvertRadiusToSigma(fRa dius), 69 SkBlurMask::ConvertRadiusToSigma(fRa dius),
70 fFlags); 70 fFlags);
71 paint.setMaskFilter(mf)->unref(); 71 paint.setMaskFilter(mf)->unref();
72 } 72 }
(...skipping 27 matching lines...) Expand all
100 100
101 DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kNormal_BlurStyle, SkBlu rMaskFilter::kHighQuality_BlurFlag);) 101 DEF_BENCH(return new BlurBench(SMALL, SkBlurMaskFilter::kNormal_BlurStyle, SkBlu rMaskFilter::kHighQuality_BlurFlag);)
102 102
103 DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurM askFilter::kHighQuality_BlurFlag);) 103 DEF_BENCH(return new BlurBench(BIG, SkBlurMaskFilter::kNormal_BlurStyle, SkBlurM askFilter::kHighQuality_BlurFlag);)
104 104
105 DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kNormal_BlurStyle, SkB lurMaskFilter::kHighQuality_BlurFlag);) 105 DEF_BENCH(return new BlurBench(REALBIG, SkBlurMaskFilter::kNormal_BlurStyle, SkB lurMaskFilter::kHighQuality_BlurFlag);)
106 106
107 DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kNormal_BlurStyle, SkBlur MaskFilter::kHighQuality_BlurFlag);) 107 DEF_BENCH(return new BlurBench(REAL, SkBlurMaskFilter::kNormal_BlurStyle, SkBlur MaskFilter::kHighQuality_BlurFlag);)
108 108
109 DEF_BENCH(return new BlurBench(0, SkBlurMaskFilter::kNormal_BlurStyle);) 109 DEF_BENCH(return new BlurBench(0, SkBlurMaskFilter::kNormal_BlurStyle);)
OLDNEW
« no previous file with comments | « bench/BitmapScaleBench.cpp ('k') | bench/BlurImageFilterBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698