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

Side by Side Diff: bench/BlurRectBench.cpp

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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
« no previous file with comments | « bench/BlurImageFilterBench.cpp ('k') | bench/BlurRectsBench.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 "Benchmark.h" 8 #include "Benchmark.h"
9 #include "SkBlurMask.h" 9 #include "SkBlurMask.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 if (SkScalarFraction(rad) != 0) { 82 if (SkScalarFraction(rad) != 0) {
83 name.printf("blurrect_direct_%.2f", SkScalarToFloat(rad)); 83 name.printf("blurrect_direct_%.2f", SkScalarToFloat(rad));
84 } else { 84 } else {
85 name.printf("blurrect_direct_%d", SkScalarRoundToInt(rad)); 85 name.printf("blurrect_direct_%d", SkScalarRoundToInt(rad));
86 } 86 }
87 87
88 this->setName(name); 88 this->setName(name);
89 } 89 }
90 protected: 90 protected:
91 virtual void makeBlurryRect(const SkRect& r) SK_OVERRIDE { 91 void makeBlurryRect(const SkRect& r) SK_OVERRIDE {
92 SkMask mask; 92 SkMask mask;
93 SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()), 93 SkBlurMask::BlurRect(SkBlurMask::ConvertRadiusToSigma(this->radius()),
94 &mask, r, kNormal_SkBlurStyle); 94 &mask, r, kNormal_SkBlurStyle);
95 SkMask::FreeImage(mask.fImage); 95 SkMask::FreeImage(mask.fImage);
96 } 96 }
97 private: 97 private:
98 typedef BlurRectBench INHERITED; 98 typedef BlurRectBench INHERITED;
99 }; 99 };
100 100
101 class BlurRectSeparableBench: public BlurRectBench { 101 class BlurRectSeparableBench: public BlurRectBench {
102 102
103 public: 103 public:
104 BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) { 104 BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) {
105 fSrcMask.fImage = NULL; 105 fSrcMask.fImage = NULL;
106 } 106 }
107 107
108 ~BlurRectSeparableBench() { 108 ~BlurRectSeparableBench() {
109 SkMask::FreeImage(fSrcMask.fImage); 109 SkMask::FreeImage(fSrcMask.fImage);
110 } 110 }
111 111
112 protected: 112 protected:
113 virtual void preBenchSetup(const SkRect& r) SK_OVERRIDE { 113 void preBenchSetup(const SkRect& r) SK_OVERRIDE {
114 SkMask::FreeImage(fSrcMask.fImage); 114 SkMask::FreeImage(fSrcMask.fImage);
115 115
116 r.roundOut(&fSrcMask.fBounds); 116 r.roundOut(&fSrcMask.fBounds);
117 fSrcMask.fFormat = SkMask::kA8_Format; 117 fSrcMask.fFormat = SkMask::kA8_Format;
118 fSrcMask.fRowBytes = fSrcMask.fBounds.width(); 118 fSrcMask.fRowBytes = fSrcMask.fBounds.width();
119 fSrcMask.fImage = SkMask::AllocImage(fSrcMask.computeTotalImageSize()); 119 fSrcMask.fImage = SkMask::AllocImage(fSrcMask.computeTotalImageSize());
120 120
121 memset(fSrcMask.fImage, 0xff, fSrcMask.computeTotalImageSize()); 121 memset(fSrcMask.fImage, 0xff, fSrcMask.computeTotalImageSize());
122 } 122 }
123 123
(...skipping 11 matching lines...) Expand all
135 name.printf("blurrect_boxfilter_%.2f", SkScalarToFloat(rad)); 135 name.printf("blurrect_boxfilter_%.2f", SkScalarToFloat(rad));
136 } else { 136 } else {
137 name.printf("blurrect_boxfilter_%d", SkScalarRoundToInt(rad)); 137 name.printf("blurrect_boxfilter_%d", SkScalarRoundToInt(rad));
138 } 138 }
139 139
140 this->setName(name); 140 this->setName(name);
141 } 141 }
142 142
143 protected: 143 protected:
144 144
145 virtual void makeBlurryRect(const SkRect&) SK_OVERRIDE { 145 void makeBlurryRect(const SkRect&) SK_OVERRIDE {
146 SkMask mask; 146 SkMask mask;
147 mask.fImage = NULL; 147 mask.fImage = NULL;
148 SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(th is->radius()), 148 SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(th is->radius()),
149 kNormal_SkBlurStyle, kHigh_SkBlurQuality); 149 kNormal_SkBlurStyle, kHigh_SkBlurQuality);
150 SkMask::FreeImage(mask.fImage); 150 SkMask::FreeImage(mask.fImage);
151 } 151 }
152 private: 152 private:
153 typedef BlurRectSeparableBench INHERITED; 153 typedef BlurRectSeparableBench INHERITED;
154 }; 154 };
155 155
156 class BlurRectGaussianBench: public BlurRectSeparableBench { 156 class BlurRectGaussianBench: public BlurRectSeparableBench {
157 public: 157 public:
158 BlurRectGaussianBench(SkScalar rad) : INHERITED(rad) { 158 BlurRectGaussianBench(SkScalar rad) : INHERITED(rad) {
159 SkString name; 159 SkString name;
160 160
161 if (SkScalarFraction(rad) != 0) { 161 if (SkScalarFraction(rad) != 0) {
162 name.printf("blurrect_gaussian_%.2f", SkScalarToFloat(rad)); 162 name.printf("blurrect_gaussian_%.2f", SkScalarToFloat(rad));
163 } else { 163 } else {
164 name.printf("blurrect_gaussian_%d", SkScalarRoundToInt(rad)); 164 name.printf("blurrect_gaussian_%d", SkScalarRoundToInt(rad));
165 } 165 }
166 166
167 this->setName(name); 167 this->setName(name);
168 } 168 }
169 169
170 protected: 170 protected:
171 171
172 virtual void makeBlurryRect(const SkRect&) SK_OVERRIDE { 172 void makeBlurryRect(const SkRect&) SK_OVERRIDE {
173 SkMask mask; 173 SkMask mask;
174 mask.fImage = NULL; 174 mask.fImage = NULL;
175 SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radiu s()), 175 SkBlurMask::BlurGroundTruth(SkBlurMask::ConvertRadiusToSigma(this->radiu s()),
176 &mask, fSrcMask, kNormal_SkBlurStyle); 176 &mask, fSrcMask, kNormal_SkBlurStyle);
177 SkMask::FreeImage(mask.fImage); 177 SkMask::FreeImage(mask.fImage);
178 } 178 }
179 private: 179 private:
180 typedef BlurRectSeparableBench INHERITED; 180 typedef BlurRectSeparableBench INHERITED;
181 }; 181 };
182 182
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(12));) 219 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(12));)
220 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(13));) 220 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(13));)
221 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(14));) 221 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(14));)
222 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(15));) 222 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(15));)
223 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(16));) 223 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(16));)
224 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(17));) 224 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(17));)
225 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(18));) 225 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(18));)
226 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(19));) 226 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(19));)
227 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(20));) 227 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(20));)
228 #endif 228 #endif
OLDNEW
« no previous file with comments | « bench/BlurImageFilterBench.cpp ('k') | bench/BlurRectsBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698