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

Side by Side Diff: gm/blurrect.cpp

Issue 21835004: Blur refactoring (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Removed unneeded #includes Created 7 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 | Annotate | Revision Log
« no previous file with comments | « bench/BlurRectBench.cpp ('k') | gm/blurs.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 2012 Google Inc. 2 * Copyright 2012 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 "gm.h" 8 #include "gm.h"
9 #include "SkBlurMaskFilter.h" 9 #include "SkBlurMaskFilter.h"
10 #include "SkBlurMask.h" 10 #include "SkBlurMask.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 "inner" 64 "inner"
65 }; 65 };
66 66
67 class BlurRectGM : public skiagm::GM { 67 class BlurRectGM : public skiagm::GM {
68 SkAutoTUnref<SkMaskFilter> fMaskFilter; 68 SkAutoTUnref<SkMaskFilter> fMaskFilter;
69 SkString fName; 69 SkString fName;
70 PaintProc fPProc; 70 PaintProc fPProc;
71 SkAlpha fAlpha; 71 SkAlpha fAlpha;
72 public: 72 public:
73 BlurRectGM(const char name[], PaintProc pproc, U8CPU alpha, 73 BlurRectGM(const char name[], PaintProc pproc, U8CPU alpha,
74 SkBlurMaskFilter::BlurStyle bs) : 74 SkBlurMaskFilter::BlurStyle bs)
75 fMaskFilter(SkBlurMaskFilter::Create(STROKE_WIDTH/2, bs, 75 : fMaskFilter(SkBlurMaskFilter::Create(STROKE_WIDTH/2, bs,
76 SkBlurMaskFilter::kHighQuality_BlurFlag)) 76 SkBlurMaskFilter::kHighQuality_BlurFlag))
77 , fName(name) 77 , fName(name)
78 , fPProc(pproc) 78 , fPProc(pproc)
79 , fAlpha(SkToU8(alpha)) { 79 , fAlpha(SkToU8(alpha)) {
80 fName.appendf("_%s", gBlurStyle2Name[bs]); 80 fName.appendf("_%s", gBlurStyle2Name[bs]);
81 } 81 }
82 82
83 protected: 83 protected:
84 virtual SkString onShortName() { 84 virtual SkString onShortName() {
85 return fName; 85 return fName;
86 } 86 }
87 87
88 virtual SkISize onISize() { 88 virtual SkISize onISize() {
89 return SkISize::Make(640, 480); 89 return SkISize::Make(640, 480);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 202
203 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; } 203 virtual uint32_t onGetFlags() const { return kSkipPipe_Flag; }
204 204
205 private: 205 private:
206 typedef GM INHERITED; 206 typedef GM INHERITED;
207 }; 207 };
208 208
209 class BlurRectFastGM: public BlurRectCompareGM { 209 class BlurRectFastGM: public BlurRectCompareGM {
210 public: 210 public:
211 BlurRectFastGM(const char name[], unsigned int rect_width, 211 BlurRectFastGM(const char name[], unsigned int rectWidth,
212 unsigned int rect_height, float blur_radius, 212 unsigned int rectHeight, float blurRadius,
213 SkBlurMask::Style style) : 213 SkBlurMask::Style style) :
214 INHERITED(name, rect_width, rect_height, blur_radius, style) 214 INHERITED(name, rectWidth, rectHeight, blurRadius, style) {
215 { 215 }
216 216
217 }
218 protected: 217 protected:
219 virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE { 218 virtual bool makeMask(SkMask *m, const SkRect& r) SK_OVERRIDE {
220 return SkBlurMask::BlurRect(m, r, this->radius(), this->style()); 219 return SkBlurMask::BlurRect(m, r, this->radius(), this->style());
221 } 220 }
222 private: 221 private:
223 typedef BlurRectCompareGM INHERITED; 222 typedef BlurRectCompareGM INHERITED;
224 }; 223 };
225 224
226 class BlurRectSlowGM: public BlurRectCompareGM { 225 class BlurRectSlowGM: public BlurRectCompareGM {
227 public: 226 public:
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_11_simple", 25, 100, 11 );) 369 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_11_simple", 25, 100, 11 );)
371 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_12_simple", 25, 100, 12 );) 370 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_12_simple", 25, 100, 12 );)
372 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_13_simple", 25, 100, 13 );) 371 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_13_simple", 25, 100, 13 );)
373 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_14_simple", 25, 100, 14 );) 372 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_14_simple", 25, 100, 14 );)
374 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_15_simple", 25, 100, 15 );) 373 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_15_simple", 25, 100, 15 );)
375 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_16_simple", 25, 100, 16 );) 374 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_16_simple", 25, 100, 16 );)
376 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_17_simple", 25, 100, 17 );) 375 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_17_simple", 25, 100, 17 );)
377 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_18_simple", 25, 100, 18 );) 376 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_18_simple", 25, 100, 18 );)
378 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_19_simple", 25, 100, 19 );) 377 DEF_GM(return new BlurRectGroundTruthGM("blurrect_25_100_19_simple", 25, 100, 19 );)
379 #endif 378 #endif
OLDNEW
« no previous file with comments | « bench/BlurRectBench.cpp ('k') | gm/blurs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698