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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 blurColor = fLooper->fBlurColor; | 113 blurColor = fLooper->fBlurColor; |
114 if (SkColorGetA(blurColor) == 255) { | 114 if (SkColorGetA(blurColor) == 255) { |
115 blurColor = SkColorSetA(blurColor, paint->getAlpha()); | 115 blurColor = SkColorSetA(blurColor, paint->getAlpha()); |
116 } | 116 } |
117 paint->setColor(blurColor); | 117 paint->setColor(blurColor); |
118 #else | 118 #else |
119 paint->setColor(fLooper->fBlurColor); | 119 paint->setColor(fLooper->fBlurColor); |
120 #endif | 120 #endif |
121 paint->setMaskFilter(fLooper->fBlur); | 121 paint->setMaskFilter(fLooper->fBlur); |
122 paint->setColorFilter(fLooper->fColorFilter); | 122 paint->setColorFilter(fLooper->fColorFilter); |
123 canvas->save(SkCanvas::kMatrix_SaveFlag); | 123 canvas->save(); |
124 if (fLooper->fBlurFlags & kIgnoreTransform_BlurFlag) { | 124 if (fLooper->fBlurFlags & kIgnoreTransform_BlurFlag) { |
125 SkMatrix transform(canvas->getTotalMatrix()); | 125 SkMatrix transform(canvas->getTotalMatrix()); |
126 transform.postTranslate(fLooper->fDx, fLooper->fDy); | 126 transform.postTranslate(fLooper->fDx, fLooper->fDy); |
127 canvas->setMatrix(transform); | 127 canvas->setMatrix(transform); |
128 } else { | 128 } else { |
129 canvas->translate(fLooper->fDx, fLooper->fDy); | 129 canvas->translate(fLooper->fDx, fLooper->fDy); |
130 } | 130 } |
131 fState = kAfterEdge; | 131 fState = kAfterEdge; |
132 return true; | 132 return true; |
133 case kAfterEdge: | 133 case kAfterEdge: |
(...skipping 30 matching lines...) Expand all Loading... |
164 &needsSeparator); | 164 &needsSeparator); |
165 SkAddFlagToString(str, SkToBool(kHighQuality_BlurFlag & fBlurFlags), "Hi
ghQuality", | 165 SkAddFlagToString(str, SkToBool(kHighQuality_BlurFlag & fBlurFlags), "Hi
ghQuality", |
166 &needsSeparator); | 166 &needsSeparator); |
167 } | 167 } |
168 str->append(")"); | 168 str->append(")"); |
169 | 169 |
170 // TODO: add optional "fBlurFilter->toString(str);" when SkMaskFilter::toStr
ing is added | 170 // 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 | 171 // alternatively we could cache the radius in SkBlurDrawLooper and just add
it here |
172 } | 172 } |
173 #endif | 173 #endif |
OLD | NEW |