OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google 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 "SkBlurDrawLooper.h" | 8 #include "SkBlurDrawLooper.h" |
9 #include "SkBlurMask.h" // just for SkBlurMask::ConvertRadiusToSigma | 9 #include "SkBlurMask.h" // just for SkBlurMask::ConvertRadiusToSigma |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 SkASSERT(flags <= kAll_BlurFlag); | 39 SkASSERT(flags <= kAll_BlurFlag); |
40 if (sigma > 0) { | 40 if (sigma > 0) { |
41 uint32_t blurFlags = flags & kIgnoreTransform_BlurFlag ? | 41 uint32_t blurFlags = flags & kIgnoreTransform_BlurFlag ? |
42 SkBlurMaskFilter::kIgnoreTransform_BlurFlag : | 42 SkBlurMaskFilter::kIgnoreTransform_BlurFlag : |
43 SkBlurMaskFilter::kNone_BlurFlag; | 43 SkBlurMaskFilter::kNone_BlurFlag; |
44 | 44 |
45 blurFlags |= flags & kHighQuality_BlurFlag ? | 45 blurFlags |= flags & kHighQuality_BlurFlag ? |
46 SkBlurMaskFilter::kHighQuality_BlurFlag : | 46 SkBlurMaskFilter::kHighQuality_BlurFlag : |
47 SkBlurMaskFilter::kNone_BlurFlag; | 47 SkBlurMaskFilter::kNone_BlurFlag; |
48 | 48 |
49 fBlur = SkBlurMaskFilter::Create(SkBlurMaskFilter::kNormal_BlurStyle, | 49 fBlur = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, sigma, blurFlags); |
50 sigma, | |
51 blurFlags); | |
52 } else { | 50 } else { |
53 fBlur = NULL; | 51 fBlur = NULL; |
54 } | 52 } |
55 | 53 |
56 if (flags & kOverrideColor_BlurFlag) { | 54 if (flags & kOverrideColor_BlurFlag) { |
57 // Set alpha to 1 for the override since transparency will already | 55 // Set alpha to 1 for the override since transparency will already |
58 // be baked into the blurred mask. | 56 // be baked into the blurred mask. |
59 SkColor opaqueColor = SkColorSetA(color, 255); | 57 SkColor opaqueColor = SkColorSetA(color, 255); |
60 //The SrcIn xfer mode will multiply 'color' by the incoming alpha | 58 //The SrcIn xfer mode will multiply 'color' by the incoming alpha |
61 fColorFilter = SkColorFilter::CreateModeFilter(opaqueColor, | 59 fColorFilter = SkColorFilter::CreateModeFilter(opaqueColor, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 &needsSeparator); | 162 &needsSeparator); |
165 SkAddFlagToString(str, SkToBool(kHighQuality_BlurFlag & fBlurFlags), "Hi
ghQuality", | 163 SkAddFlagToString(str, SkToBool(kHighQuality_BlurFlag & fBlurFlags), "Hi
ghQuality", |
166 &needsSeparator); | 164 &needsSeparator); |
167 } | 165 } |
168 str->append(")"); | 166 str->append(")"); |
169 | 167 |
170 // TODO: add optional "fBlurFilter->toString(str);" when SkMaskFilter::toStr
ing is added | 168 // TODO: add optional "fBlurFilter->toString(str);" when SkMaskFilter::toStr
ing is added |
171 // alternatively we could cache the radius in SkBlurDrawLooper and just add
it here | 169 // alternatively we could cache the radius in SkBlurDrawLooper and just add
it here |
172 } | 170 } |
173 #endif | 171 #endif |
OLD | NEW |