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

Side by Side Diff: gm/rects.cpp

Issue 23701006: Push sigma-based blur interface into our GMs/benches/tests/samplecode (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Cleaned up 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
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 "gm.h" 8 #include "gm.h"
9 #include "SkTArray.h" 9 #include "SkTArray.h"
10 #include "SkMatrix.h" 10 #include "SkMatrix.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 p.setColor(SK_ColorWHITE); 46 p.setColor(SK_ColorWHITE);
47 p.setAntiAlias(true); 47 p.setAntiAlias(true);
48 fPaints.push_back(p); 48 fPaints.push_back(p);
49 } 49 }
50 50
51 { 51 {
52 // AA with mask filter 52 // AA with mask filter
53 SkPaint p; 53 SkPaint p;
54 p.setColor(SK_ColorWHITE); 54 p.setColor(SK_ColorWHITE);
55 p.setAntiAlias(true); 55 p.setAntiAlias(true);
56 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkIntToScalar(5), 56 SkMaskFilter* mf = SkBlurMaskFilter::Create(
57 SkBlurMaskFilter::kNormal_BlurStyle, 57 SkBlurMaskFilter::kNormal_BlurStyle,
58 SkFloatToScalar(3.38675f),
58 SkBlurMaskFilter::kHighQuality_BlurFlag); 59 SkBlurMaskFilter::kHighQuality_BlurFlag);
59 p.setMaskFilter(mf)->unref(); 60 p.setMaskFilter(mf)->unref();
60 fPaints.push_back(p); 61 fPaints.push_back(p);
61 } 62 }
62 63
63 { 64 {
64 // AA with radial shader 65 // AA with radial shader
65 SkPaint p; 66 SkPaint p;
66 p.setColor(SK_ColorWHITE); 67 p.setColor(SK_ColorWHITE);
67 p.setAntiAlias(true); 68 p.setAntiAlias(true);
68 SkPoint center = SkPoint::Make(SkIntToScalar(-5), SkIntToScalar(30)) ; 69 SkPoint center = SkPoint::Make(SkIntToScalar(-5), SkIntToScalar(30)) ;
69 SkColor colors[] = { SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN }; 70 SkColor colors[] = { SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN };
70 SkScalar pos[] = { 0, SK_ScalarHalf, SK_Scalar1 }; 71 SkScalar pos[] = { 0, SK_ScalarHalf, SK_Scalar1 };
71 SkShader* s = SkGradientShader::CreateRadial(center, 72 SkShader* s = SkGradientShader::CreateRadial(center,
72 SkIntToScalar(20), 73 SkIntToScalar(20),
73 colors, 74 colors,
74 pos, 75 pos,
75 SK_ARRAY_COUNT(colors), 76 SK_ARRAY_COUNT(colors),
76 SkShader::kClamp_TileMo de); 77 SkShader::kClamp_TileMo de);
77 p.setShader(s)->unref(); 78 p.setShader(s)->unref();
78 fPaints.push_back(p); 79 fPaints.push_back(p);
79 } 80 }
80 81
81 { 82 {
82 // AA with blur 83 // AA with blur
83 SkPaint p; 84 SkPaint p;
84 p.setColor(SK_ColorWHITE); 85 p.setColor(SK_ColorWHITE);
85 p.setAntiAlias(true); 86 p.setAntiAlias(true);
86 SkBlurDrawLooper* shadowLooper = 87 SkBlurDrawLooper* shadowLooper =
87 new SkBlurDrawLooper (SkIntToScalar(10), SkIntToScalar(5), 88 new SkBlurDrawLooper (SK_ColorWHITE, SkFloatToScalar(6.2735f),
88 SkIntToScalar(10), SK_ColorWHITE, 89 SkIntToScalar(5), SkIntToScalar(10),
89 SkBlurDrawLooper::kIgnoreTransform_BlurFla g | 90 SkBlurDrawLooper::kIgnoreTransform_BlurFla g |
90 SkBlurDrawLooper::kOverrideColor_BlurFlag | 91 SkBlurDrawLooper::kOverrideColor_BlurFlag |
91 SkBlurDrawLooper::kHighQuality_BlurFlag); 92 SkBlurDrawLooper::kHighQuality_BlurFlag);
92 SkAutoUnref aurL0(shadowLooper); 93 SkAutoUnref aurL0(shadowLooper);
93 p.setLooper(shadowLooper); 94 p.setLooper(shadowLooper);
94 fPaints.push_back(p); 95 fPaints.push_back(p);
95 } 96 }
96 97
97 { 98 {
98 // AA with stroke style 99 // AA with stroke style
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 249
249 typedef GM INHERITED; 250 typedef GM INHERITED;
250 }; 251 };
251 252
252 ////////////////////////////////////////////////////////////////////////////// 253 //////////////////////////////////////////////////////////////////////////////
253 254
254 static GM* MyFactory(void*) { return new RectsGM; } 255 static GM* MyFactory(void*) { return new RectsGM; }
255 static GMRegistry reg(MyFactory); 256 static GMRegistry reg(MyFactory);
256 257
257 } 258 }
OLDNEW
« bench/BlurBench.cpp ('K') | « gm/megalooper.cpp ('k') | gm/shadows.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698