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 "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 18 matching lines...) Expand all Loading... |
29 uint32_t flags = fBlurFlags & kIgnoreTransform_BlurFlag ? | 29 uint32_t flags = fBlurFlags & kIgnoreTransform_BlurFlag ? |
30 SkBlurMaskFilter::kIgnoreTransform_BlurFlag : | 30 SkBlurMaskFilter::kIgnoreTransform_BlurFlag : |
31 SkBlurMaskFilter::kNone_BlurFlag; | 31 SkBlurMaskFilter::kNone_BlurFlag; |
32 | 32 |
33 flags |= fBlurFlags & kHighQuality_BlurFlag ? | 33 flags |= fBlurFlags & kHighQuality_BlurFlag ? |
34 SkBlurMaskFilter::kHighQuality_BlurFlag : | 34 SkBlurMaskFilter::kHighQuality_BlurFlag : |
35 SkBlurMaskFilter::kNone_BlurFlag; | 35 SkBlurMaskFilter::kNone_BlurFlag; |
36 | 36 |
37 fBlur = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, fSigma, flags); | 37 fBlur = SkBlurMaskFilter::Create(kNormal_SkBlurStyle, fSigma, flags); |
38 } else { | 38 } else { |
39 fBlur = NULL; | 39 fBlur = nullptr; |
40 } | 40 } |
41 | 41 |
42 if (fBlurFlags & kOverrideColor_BlurFlag) { | 42 if (fBlurFlags & kOverrideColor_BlurFlag) { |
43 // Set alpha to 1 for the override since transparency will already | 43 // Set alpha to 1 for the override since transparency will already |
44 // be baked into the blurred mask. | 44 // be baked into the blurred mask. |
45 SkColor opaqueColor = SkColorSetA(fBlurColor, 255); | 45 SkColor opaqueColor = SkColorSetA(fBlurColor, 255); |
46 //The SrcIn xfer mode will multiply 'color' by the incoming alpha | 46 //The SrcIn xfer mode will multiply 'color' by the incoming alpha |
47 fColorFilter = SkColorFilter::CreateModeFilter(opaqueColor, | 47 fColorFilter = SkColorFilter::CreateModeFilter(opaqueColor, |
48 SkXfermode::kSrcIn_Mode); | 48 SkXfermode::kSrcIn_Mode); |
49 } else { | 49 } else { |
50 fColorFilter = NULL; | 50 fColorFilter = nullptr; |
51 } | 51 } |
52 } | 52 } |
53 | 53 |
54 void SkBlurDrawLooper::init(SkScalar sigma, SkScalar dx, SkScalar dy, | 54 void SkBlurDrawLooper::init(SkScalar sigma, SkScalar dx, SkScalar dy, |
55 SkColor color, uint32_t flags) { | 55 SkColor color, uint32_t flags) { |
56 fSigma = sigma; | 56 fSigma = sigma; |
57 fDx = dx; | 57 fDx = dx; |
58 fDy = dy; | 58 fDy = dy; |
59 fBlurColor = color; | 59 fBlurColor = color; |
60 fBlurFlags = flags; | 60 fBlurFlags = flags; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 &needsSeparator); | 175 &needsSeparator); |
176 SkAddFlagToString(str, SkToBool(kHighQuality_BlurFlag & fBlurFlags), "Hi
ghQuality", | 176 SkAddFlagToString(str, SkToBool(kHighQuality_BlurFlag & fBlurFlags), "Hi
ghQuality", |
177 &needsSeparator); | 177 &needsSeparator); |
178 } | 178 } |
179 str->append(")"); | 179 str->append(")"); |
180 | 180 |
181 // TODO: add optional "fBlurFilter->toString(str);" when SkMaskFilter::toStr
ing is added | 181 // TODO: add optional "fBlurFilter->toString(str);" when SkMaskFilter::toStr
ing is added |
182 // alternatively we could cache the radius in SkBlurDrawLooper and just add
it here | 182 // alternatively we could cache the radius in SkBlurDrawLooper and just add
it here |
183 } | 183 } |
184 #endif | 184 #endif |
OLD | NEW |