OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Intel Inc. | 3 * Copyright 2012 Intel Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkTArray.h" | 9 #include "SkBlurDrawLooper.h" |
10 #include "SkRandom.h" | 10 #include "SkBlurMask.h" |
11 #include "SkMatrix.h" | |
12 #include "SkBlurMaskFilter.h" | 11 #include "SkBlurMaskFilter.h" |
13 #include "SkGradientShader.h" | 12 #include "SkGradientShader.h" |
14 #include "SkBlurDrawLooper.h" | 13 #include "SkMatrix.h" |
| 14 #include "SkRandom.h" |
| 15 #include "SkTArray.h" |
15 | 16 |
16 namespace skiagm { | 17 namespace skiagm { |
17 | 18 |
18 class CircleGM : public GM { | 19 class CircleGM : public GM { |
19 public: | 20 public: |
20 CircleGM() { | 21 CircleGM() { |
21 this->setBGColor(0xFF000000); | 22 this->setBGColor(0xFF000000); |
22 this->makePaints(); | 23 this->makePaints(); |
23 this->makeMatrices(); | 24 this->makeMatrices(); |
24 } | 25 } |
(...skipping 18 matching lines...) Expand all Loading... |
43 // AA | 44 // AA |
44 SkPaint p; | 45 SkPaint p; |
45 p.setAntiAlias(true); | 46 p.setAntiAlias(true); |
46 fPaints.push_back(p); | 47 fPaints.push_back(p); |
47 } | 48 } |
48 | 49 |
49 { | 50 { |
50 // AA with mask filter | 51 // AA with mask filter |
51 SkPaint p; | 52 SkPaint p; |
52 p.setAntiAlias(true); | 53 p.setAntiAlias(true); |
53 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkIntToScalar(5), | 54 SkMaskFilter* mf = SkBlurMaskFilter::Create( |
54 SkBlurMaskFilter::kNormal_BlurStyle, | 55 SkBlurMaskFilter::kNormal_BlurStyle, |
| 56 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar(5)
), |
55 SkBlurMaskFilter::kHighQuality_BlurFlag); | 57 SkBlurMaskFilter::kHighQuality_BlurFlag); |
56 p.setMaskFilter(mf)->unref(); | 58 p.setMaskFilter(mf)->unref(); |
57 fPaints.push_back(p); | 59 fPaints.push_back(p); |
58 } | 60 } |
59 | 61 |
60 { | 62 { |
61 // AA with radial shader | 63 // AA with radial shader |
62 SkPaint p; | 64 SkPaint p; |
63 p.setAntiAlias(true); | 65 p.setAntiAlias(true); |
64 SkPoint center = SkPoint::Make(SkIntToScalar(40), SkIntToScalar(40)); | 66 SkPoint center = SkPoint::Make(SkIntToScalar(40), SkIntToScalar(40)); |
65 SkColor colors[] = { SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN }; | 67 SkColor colors[] = { SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN }; |
66 SkScalar pos[] = { 0, SK_ScalarHalf, SK_Scalar1 }; | 68 SkScalar pos[] = { 0, SK_ScalarHalf, SK_Scalar1 }; |
67 SkShader* s = SkGradientShader::CreateRadial(center, | 69 SkShader* s = SkGradientShader::CreateRadial(center, |
68 SkIntToScalar(20), | 70 SkIntToScalar(20), |
69 colors, | 71 colors, |
70 pos, | 72 pos, |
71 SK_ARRAY_COUNT(colors), | 73 SK_ARRAY_COUNT(colors), |
72 SkShader::kClamp_TileMode); | 74 SkShader::kClamp_TileMode); |
73 p.setShader(s)->unref(); | 75 p.setShader(s)->unref(); |
74 fPaints.push_back(p); | 76 fPaints.push_back(p); |
75 } | 77 } |
76 | 78 |
77 { | 79 { |
78 // AA with blur | 80 // AA with blur |
79 SkPaint p; | 81 SkPaint p; |
80 p.setAntiAlias(true); | 82 p.setAntiAlias(true); |
81 SkBlurDrawLooper* shadowLooper = | 83 SkBlurDrawLooper* shadowLooper = |
82 new SkBlurDrawLooper (SkIntToScalar(10), SkIntToScalar(5), | 84 new SkBlurDrawLooper (SK_ColorBLUE, |
83 SkIntToScalar(10), 0xFF0000FF, | 85 SkBlurMask::ConvertRadiusToSigma(SkIntToScalar
(10)), |
| 86 SkIntToScalar(5), SkIntToScalar(10), |
84 SkBlurDrawLooper::kIgnoreTransform_BlurFlag | | 87 SkBlurDrawLooper::kIgnoreTransform_BlurFlag | |
85 SkBlurDrawLooper::kOverrideColor_BlurFlag | | 88 SkBlurDrawLooper::kOverrideColor_BlurFlag | |
86 SkBlurDrawLooper::kHighQuality_BlurFlag); | 89 SkBlurDrawLooper::kHighQuality_BlurFlag); |
87 SkAutoUnref aurL0(shadowLooper); | 90 SkAutoUnref aurL0(shadowLooper); |
88 p.setLooper(shadowLooper); | 91 p.setLooper(shadowLooper); |
89 fPaints.push_back(p); | 92 fPaints.push_back(p); |
90 } | 93 } |
91 | 94 |
92 { | 95 { |
93 // AA with stroke style | 96 // AA with stroke style |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 SkTArray<SkPaint> fPaints; | 199 SkTArray<SkPaint> fPaints; |
197 SkTArray<SkMatrix> fMatrices; | 200 SkTArray<SkMatrix> fMatrices; |
198 }; | 201 }; |
199 | 202 |
200 ////////////////////////////////////////////////////////////////////////////// | 203 ////////////////////////////////////////////////////////////////////////////// |
201 | 204 |
202 static GM* MyFactory(void*) { return new CircleGM; } | 205 static GM* MyFactory(void*) { return new CircleGM; } |
203 static GMRegistry reg(MyFactory); | 206 static GMRegistry reg(MyFactory); |
204 | 207 |
205 } | 208 } |
OLD | NEW |