OLD | NEW |
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 "SkBlurDrawLooper.h" |
10 #include "SkMatrix.h" | 10 #include "SkBlurMask.h" |
11 #include "SkBlurMaskFilter.h" | 11 #include "SkBlurMaskFilter.h" |
12 #include "SkGradientShader.h" | 12 #include "SkGradientShader.h" |
13 #include "SkBlurDrawLooper.h" | 13 #include "SkMatrix.h" |
| 14 #include "SkTArray.h" |
14 | 15 |
15 namespace skiagm { | 16 namespace skiagm { |
16 | 17 |
17 class RectsGM : public GM { | 18 class RectsGM : public GM { |
18 public: | 19 public: |
19 RectsGM() { | 20 RectsGM() { |
20 this->setBGColor(0xFF000000); | 21 this->setBGColor(0xFF000000); |
21 this->makePaints(); | 22 this->makePaints(); |
22 this->makeMatrices(); | 23 this->makeMatrices(); |
23 this->makeRects(); | 24 this->makeRects(); |
(...skipping 22 matching lines...) Expand all Loading... |
46 p.setColor(SK_ColorWHITE); | 47 p.setColor(SK_ColorWHITE); |
47 p.setAntiAlias(true); | 48 p.setAntiAlias(true); |
48 fPaints.push_back(p); | 49 fPaints.push_back(p); |
49 } | 50 } |
50 | 51 |
51 { | 52 { |
52 // AA with mask filter | 53 // AA with mask filter |
53 SkPaint p; | 54 SkPaint p; |
54 p.setColor(SK_ColorWHITE); | 55 p.setColor(SK_ColorWHITE); |
55 p.setAntiAlias(true); | 56 p.setAntiAlias(true); |
56 SkMaskFilter* mf = SkBlurMaskFilter::Create(SkIntToScalar(5), | 57 SkMaskFilter* mf = SkBlurMaskFilter::Create( |
57 SkBlurMaskFilter::kNormal_BlurStyle, | 58 SkBlurMaskFilter::kNormal_BlurStyle, |
| 59 SkBlurMask::ConvertRadiusToSigma(SkIntToScala
r(5)), |
58 SkBlurMaskFilter::kHighQuality_BlurFlag); | 60 SkBlurMaskFilter::kHighQuality_BlurFlag); |
59 p.setMaskFilter(mf)->unref(); | 61 p.setMaskFilter(mf)->unref(); |
60 fPaints.push_back(p); | 62 fPaints.push_back(p); |
61 } | 63 } |
62 | 64 |
63 { | 65 { |
64 // AA with radial shader | 66 // AA with radial shader |
65 SkPaint p; | 67 SkPaint p; |
66 p.setColor(SK_ColorWHITE); | 68 p.setColor(SK_ColorWHITE); |
67 p.setAntiAlias(true); | 69 p.setAntiAlias(true); |
68 SkPoint center = SkPoint::Make(SkIntToScalar(-5), SkIntToScalar(30))
; | 70 SkPoint center = SkPoint::Make(SkIntToScalar(-5), SkIntToScalar(30))
; |
69 SkColor colors[] = { SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN }; | 71 SkColor colors[] = { SK_ColorBLUE, SK_ColorRED, SK_ColorGREEN }; |
70 SkScalar pos[] = { 0, SK_ScalarHalf, SK_Scalar1 }; | 72 SkScalar pos[] = { 0, SK_ScalarHalf, SK_Scalar1 }; |
71 SkShader* s = SkGradientShader::CreateRadial(center, | 73 SkShader* s = SkGradientShader::CreateRadial(center, |
72 SkIntToScalar(20), | 74 SkIntToScalar(20), |
73 colors, | 75 colors, |
74 pos, | 76 pos, |
75 SK_ARRAY_COUNT(colors), | 77 SK_ARRAY_COUNT(colors), |
76 SkShader::kClamp_TileMo
de); | 78 SkShader::kClamp_TileMo
de); |
77 p.setShader(s)->unref(); | 79 p.setShader(s)->unref(); |
78 fPaints.push_back(p); | 80 fPaints.push_back(p); |
79 } | 81 } |
80 | 82 |
81 { | 83 { |
82 // AA with blur | 84 // AA with blur |
83 SkPaint p; | 85 SkPaint p; |
84 p.setColor(SK_ColorWHITE); | 86 p.setColor(SK_ColorWHITE); |
85 p.setAntiAlias(true); | 87 p.setAntiAlias(true); |
86 SkBlurDrawLooper* shadowLooper = | 88 SkBlurDrawLooper* shadowLooper = |
87 new SkBlurDrawLooper (SkIntToScalar(10), SkIntToScalar(5), | 89 new SkBlurDrawLooper (SK_ColorWHITE, |
88 SkIntToScalar(10), SK_ColorWHITE, | 90 SkBlurMask::ConvertRadiusToSigma(SkIntToSc
alar(10)), |
| 91 SkIntToScalar(5), SkIntToScalar(10), |
89 SkBlurDrawLooper::kIgnoreTransform_BlurFla
g | | 92 SkBlurDrawLooper::kIgnoreTransform_BlurFla
g | |
90 SkBlurDrawLooper::kOverrideColor_BlurFlag
| | 93 SkBlurDrawLooper::kOverrideColor_BlurFlag
| |
91 SkBlurDrawLooper::kHighQuality_BlurFlag); | 94 SkBlurDrawLooper::kHighQuality_BlurFlag); |
92 SkAutoUnref aurL0(shadowLooper); | 95 SkAutoUnref aurL0(shadowLooper); |
93 p.setLooper(shadowLooper); | 96 p.setLooper(shadowLooper); |
94 fPaints.push_back(p); | 97 fPaints.push_back(p); |
95 } | 98 } |
96 | 99 |
97 { | 100 { |
98 // AA with stroke style | 101 // AA with stroke style |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 251 |
249 typedef GM INHERITED; | 252 typedef GM INHERITED; |
250 }; | 253 }; |
251 | 254 |
252 ////////////////////////////////////////////////////////////////////////////// | 255 ////////////////////////////////////////////////////////////////////////////// |
253 | 256 |
254 static GM* MyFactory(void*) { return new RectsGM; } | 257 static GM* MyFactory(void*) { return new RectsGM; } |
255 static GMRegistry reg(MyFactory); | 258 static GMRegistry reg(MyFactory); |
256 | 259 |
257 } | 260 } |
OLD | NEW |