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

Side by Side Diff: bench/BlurRoundRectBench.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/BlurRectBench.cpp ('k') | bench/ChartBench.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 2013 Google Inc. 2 * Copyright 2013 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 "SkBenchmark.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 21 matching lines...) Expand all
32 32
33 virtual const char* onGetName() SK_OVERRIDE { 33 virtual const char* onGetName() SK_OVERRIDE {
34 return fName.c_str(); 34 return fName.c_str();
35 } 35 }
36 36
37 virtual SkIPoint onGetSize() SK_OVERRIDE { 37 virtual SkIPoint onGetSize() SK_OVERRIDE {
38 return SkIPoint::Make(SkScalarCeilToInt(fRRect.rect().width()), 38 return SkIPoint::Make(SkScalarCeilToInt(fRRect.rect().width()),
39 SkScalarCeilToInt(fRRect.rect().height())); 39 SkScalarCeilToInt(fRRect.rect().height()));
40 } 40 }
41 41
42 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 42 virtual void onDraw(const int loops, SkCanvas* canvas) SK_OVERRIDE {
43 SkLayerDrawLooper* looper = new SkLayerDrawLooper; 43 SkLayerDrawLooper* looper = new SkLayerDrawLooper;
44 { 44 {
45 SkLayerDrawLooper::LayerInfo info; 45 SkLayerDrawLooper::LayerInfo info;
46 info.fFlagsMask = 0; 46 info.fFlagsMask = 0;
47 info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit 47 info.fPaintBits = SkLayerDrawLooper::kMaskFilter_Bit
48 | SkLayerDrawLooper::kColorFilter_Bit; 48 | SkLayerDrawLooper::kColorFilter_Bit;
49 info.fColorMode = SkXfermode::kSrc_Mode; 49 info.fColorMode = SkXfermode::kSrc_Mode;
50 info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0)); 50 info.fOffset = SkPoint::Make(SkIntToScalar(-1), SkIntToScalar(0));
51 info.fPostTranslate = false; 51 info.fPostTranslate = false;
52 SkPaint* paint = looper->addLayerOnTop(info); 52 SkPaint* paint = looper->addLayerOnTop(info);
(...skipping 12 matching lines...) Expand all
65 looper->addLayerOnTop(info); 65 looper->addLayerOnTop(info);
66 } 66 }
67 SkPaint dullPaint; 67 SkPaint dullPaint;
68 dullPaint.setAntiAlias(true); 68 dullPaint.setAntiAlias(true);
69 69
70 SkPaint loopedPaint; 70 SkPaint loopedPaint;
71 loopedPaint.setLooper(looper)->unref(); 71 loopedPaint.setLooper(looper)->unref();
72 loopedPaint.setAntiAlias(true); 72 loopedPaint.setAntiAlias(true);
73 loopedPaint.setColor(SK_ColorCYAN); 73 loopedPaint.setColor(SK_ColorCYAN);
74 74
75 for (int i = 0; i < this->getLoops(); i++) { 75 for (int i = 0; i < loops; i++) {
76 canvas->drawRect(fRRect.rect(), dullPaint); 76 canvas->drawRect(fRRect.rect(), dullPaint);
77 canvas->drawRRect(fRRect, loopedPaint); 77 canvas->drawRRect(fRRect, loopedPaint);
78 } 78 }
79 } 79 }
80 80
81 private: 81 private:
82 SkString fName; 82 SkString fName;
83 SkRRect fRRect; 83 SkRRect fRRect;
84 84
85 typedef SkBenchmark INHERITED; 85 typedef SkBenchmark INHERITED;
86 }; 86 };
87 87
88 // Create one with dimensions/rounded corners based on the skp 88 // Create one with dimensions/rounded corners based on the skp
89 DEF_BENCH(return new BlurRoundRectBench(600, 5514, 6);) 89 DEF_BENCH(return new BlurRoundRectBench(600, 5514, 6);)
90 // Same radii, much smaller rectangle 90 // Same radii, much smaller rectangle
91 DEF_BENCH(return new BlurRoundRectBench(100, 100, 6);) 91 DEF_BENCH(return new BlurRoundRectBench(100, 100, 6);)
92 // Other radii options 92 // Other radii options
93 DEF_BENCH(return new BlurRoundRectBench(100, 100, 30);) 93 DEF_BENCH(return new BlurRoundRectBench(100, 100, 30);)
94 DEF_BENCH(return new BlurRoundRectBench(100, 100, 90);) 94 DEF_BENCH(return new BlurRoundRectBench(100, 100, 90);)
OLDNEW
« no previous file with comments | « bench/BlurRectBench.cpp ('k') | bench/ChartBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698