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

Side by Side Diff: bench/BlurRectBench.cpp

Issue 471473002: Optimize CSS box-shadow performance (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: backed blur mask with a bitmap Created 6 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
« no previous file with comments | « no previous file | gm/blurrect.cpp » ('j') | src/core/SkBitmapCache.cpp » ('J')
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 virtual 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);
96 } 95 }
97 private: 96 private:
98 typedef BlurRectBench INHERITED; 97 typedef BlurRectBench INHERITED;
99 }; 98 };
100 99
101 class BlurRectSeparableBench: public BlurRectBench { 100 class BlurRectSeparableBench: public BlurRectBench {
102 101
103 public: 102 public:
104 BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) { 103 BlurRectSeparableBench(SkScalar rad) : INHERITED(rad) {
105 fSrcMask.fImage = NULL; 104 fSrcMask.fImage = NULL;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 this->setName(name); 139 this->setName(name);
141 } 140 }
142 141
143 protected: 142 protected:
144 143
145 virtual void makeBlurryRect(const SkRect&) SK_OVERRIDE { 144 virtual void makeBlurryRect(const SkRect&) SK_OVERRIDE {
146 SkMask mask; 145 SkMask mask;
147 mask.fImage = NULL; 146 mask.fImage = NULL;
148 SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(th is->radius()), 147 SkBlurMask::BoxBlur(&mask, fSrcMask, SkBlurMask::ConvertRadiusToSigma(th is->radius()),
149 kNormal_SkBlurStyle, kHigh_SkBlurQuality); 148 kNormal_SkBlurStyle, kHigh_SkBlurQuality);
150 SkMask::FreeImage(mask.fImage);
151 } 149 }
152 private: 150 private:
153 typedef BlurRectSeparableBench INHERITED; 151 typedef BlurRectSeparableBench INHERITED;
154 }; 152 };
155 153
156 class BlurRectGaussianBench: public BlurRectSeparableBench { 154 class BlurRectGaussianBench: public BlurRectSeparableBench {
157 public: 155 public:
158 BlurRectGaussianBench(SkScalar rad) : INHERITED(rad) { 156 BlurRectGaussianBench(SkScalar rad) : INHERITED(rad) {
159 SkString name; 157 SkString name;
160 158
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(12));) 217 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(12));)
220 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(13));) 218 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(13));)
221 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(14));) 219 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(14));)
222 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(15));) 220 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(15));)
223 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(16));) 221 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(16));)
224 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(17));) 222 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(17));)
225 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(18));) 223 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(18));)
226 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(19));) 224 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(19));)
227 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(20));) 225 DEF_BENCH(return new BlurRectGaussianBench(SkIntToScalar(20));)
228 #endif 226 #endif
OLDNEW
« no previous file with comments | « no previous file | gm/blurrect.cpp » ('j') | src/core/SkBitmapCache.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698