OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 info.fPaintBits = SkLayerDrawLooper::kStyle_Bit | SkLayerDrawLooper::kMa
skFilter_Bit; | 75 info.fPaintBits = SkLayerDrawLooper::kStyle_Bit | SkLayerDrawLooper::kMa
skFilter_Bit; |
76 info.fColorMode = SkXfermode::kSrc_Mode; | 76 info.fColorMode = SkXfermode::kSrc_Mode; |
77 | 77 |
78 for (size_t i = 0; i < SK_ARRAY_COUNT(gParams); i++) { | 78 for (size_t i = 0; i < SK_ARRAY_COUNT(gParams); i++) { |
79 info.fOffset.set(gParams[i].fOffset, gParams[i].fOffset); | 79 info.fOffset.set(gParams[i].fOffset, gParams[i].fOffset); |
80 SkPaint* paint = looperBuilder.addLayer(info); | 80 SkPaint* paint = looperBuilder.addLayer(info); |
81 paint->setColor(gParams[i].fColor); | 81 paint->setColor(gParams[i].fColor); |
82 paint->setStyle(gParams[i].fStyle); | 82 paint->setStyle(gParams[i].fStyle); |
83 paint->setStrokeWidth(gParams[i].fWidth); | 83 paint->setStrokeWidth(gParams[i].fWidth); |
84 if (gParams[i].fBlur > 0) { | 84 if (gParams[i].fBlur > 0) { |
85 SkMaskFilter* mf = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, | 85 paint->setMaskFilter(SkBlurMaskFilter::Make(kNormal_SkBlurStyle, |
86 SkBlurMask::ConvertRadiusToSigma(gParam
s[i].fBlur)); | 86 SkBlurMask::ConvertRadiusToSigma(gParam
s[i].fBlur))); |
87 paint->setMaskFilter(mf)->unref(); | |
88 } | 87 } |
89 } | 88 } |
90 fLooper = looperBuilder.detach(); | 89 fLooper = looperBuilder.detach(); |
91 } | 90 } |
92 | 91 |
93 typedef GM INHERITED; | 92 typedef GM INHERITED; |
94 }; | 93 }; |
95 | 94 |
96 ////////////////////////////////////////////////////////////////////////////// | 95 ////////////////////////////////////////////////////////////////////////////// |
97 | 96 |
98 DEF_GM( return new DrawLooperGM; ) | 97 DEF_GM( return new DrawLooperGM; ) |
OLD | NEW |