| 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" |
| 11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
| 12 #include "SkColorFilter.h" | 12 #include "SkColorFilter.h" |
| 13 #include "SkReadBuffer.h" | 13 #include "SkReadBuffer.h" |
| 14 #include "SkWriteBuffer.h" | 14 #include "SkWriteBuffer.h" |
| 15 #include "SkMaskFilter.h" | 15 #include "SkMaskFilter.h" |
| 16 #include "SkPaint.h" | 16 #include "SkPaint.h" |
| 17 #include "SkString.h" | 17 #include "SkString.h" |
| 18 #include "SkStringUtils.h" | 18 #include "SkStringUtils.h" |
| 19 | 19 |
| 20 #ifdef SK_SUPPORT_LEGACY_BLURDRAWLOOPERCONSTRUCTORS | |
| 21 SkBlurDrawLooper::SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, | |
| 22 SkColor color, uint32_t flags) { | |
| 23 this->init(SkBlurMask::ConvertRadiusToSigma(radius), dx, dy, color, flags); | |
| 24 } | |
| 25 #endif | |
| 26 | |
| 27 SkBlurDrawLooper::SkBlurDrawLooper(SkColor color, SkScalar sigma, | 20 SkBlurDrawLooper::SkBlurDrawLooper(SkColor color, SkScalar sigma, |
| 28 SkScalar dx, SkScalar dy, uint32_t flags) { | 21 SkScalar dx, SkScalar dy, uint32_t flags) { |
| 29 this->init(sigma, dx, dy, color, flags); | 22 this->init(sigma, dx, dy, color, flags); |
| 30 } | 23 } |
| 31 | 24 |
| 32 // only call from constructor | 25 // only call from constructor |
| 33 void SkBlurDrawLooper::initEffects() { | 26 void SkBlurDrawLooper::initEffects() { |
| 34 SkASSERT(fBlurFlags <= kAll_BlurFlag); | 27 SkASSERT(fBlurFlags <= kAll_BlurFlag); |
| 35 if (fSigma > 0) { | 28 if (fSigma > 0) { |
| 36 uint32_t flags = fBlurFlags & kIgnoreTransform_BlurFlag ? | 29 uint32_t flags = fBlurFlags & kIgnoreTransform_BlurFlag ? |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 &needsSeparator); | 178 &needsSeparator); |
| 186 SkAddFlagToString(str, SkToBool(kHighQuality_BlurFlag & fBlurFlags), "Hi
ghQuality", | 179 SkAddFlagToString(str, SkToBool(kHighQuality_BlurFlag & fBlurFlags), "Hi
ghQuality", |
| 187 &needsSeparator); | 180 &needsSeparator); |
| 188 } | 181 } |
| 189 str->append(")"); | 182 str->append(")"); |
| 190 | 183 |
| 191 // TODO: add optional "fBlurFilter->toString(str);" when SkMaskFilter::toStr
ing is added | 184 // TODO: add optional "fBlurFilter->toString(str);" when SkMaskFilter::toStr
ing is added |
| 192 // alternatively we could cache the radius in SkBlurDrawLooper and just add
it here | 185 // alternatively we could cache the radius in SkBlurDrawLooper and just add
it here |
| 193 } | 186 } |
| 194 #endif | 187 #endif |
| OLD | NEW |