OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The Android Open Source Project | 2 * Copyright 2011 The Android Open Source Project |
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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #define MAX_SIGMA SkIntToScalar(532) | 24 #define MAX_SIGMA SkIntToScalar(532) |
25 | 25 |
26 static SkVector mapSigma(const SkSize& localSigma, const SkMatrix& ctm) { | 26 static SkVector mapSigma(const SkSize& localSigma, const SkMatrix& ctm) { |
27 SkVector sigma = SkVector::Make(localSigma.width(), localSigma.height()); | 27 SkVector sigma = SkVector::Make(localSigma.width(), localSigma.height()); |
28 ctm.mapVectors(&sigma, 1); | 28 ctm.mapVectors(&sigma, 1); |
29 sigma.fX = SkMinScalar(SkScalarAbs(sigma.fX), MAX_SIGMA); | 29 sigma.fX = SkMinScalar(SkScalarAbs(sigma.fX), MAX_SIGMA); |
30 sigma.fY = SkMinScalar(SkScalarAbs(sigma.fY), MAX_SIGMA); | 30 sigma.fY = SkMinScalar(SkScalarAbs(sigma.fY), MAX_SIGMA); |
31 return sigma; | 31 return sigma; |
32 } | 32 } |
33 | 33 |
| 34 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
| 35 SkBlurImageFilter::SkBlurImageFilter(SkReadBuffer& buffer) |
| 36 : INHERITED(1, buffer) { |
| 37 fSigma.fWidth = buffer.readScalar(); |
| 38 fSigma.fHeight = buffer.readScalar(); |
| 39 buffer.validate(SkScalarIsFinite(fSigma.fWidth) && |
| 40 SkScalarIsFinite(fSigma.fHeight) && |
| 41 (fSigma.fWidth >= 0) && |
| 42 (fSigma.fHeight >= 0)); |
| 43 } |
| 44 #endif |
| 45 |
34 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, | 46 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, |
35 SkScalar sigmaY, | 47 SkScalar sigmaY, |
36 SkImageFilter* input, | 48 SkImageFilter* input, |
37 const CropRect* cropRect, | 49 const CropRect* cropRect, |
38 uint32_t uniqueID) | 50 uint32_t uniqueID) |
39 : INHERITED(1, &input, cropRect, uniqueID), fSigma(SkSize::Make(sigmaX, sigm
aY)) { | 51 : INHERITED(1, &input, cropRect, uniqueID), fSigma(SkSize::Make(sigmaX, sigm
aY)) { |
40 } | 52 } |
41 | 53 |
42 SkFlattenable* SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { | 54 SkFlattenable* SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { |
43 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 55 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 true, | 292 true, |
281 sigma.x(), | 293 sigma.x(), |
282 sigma.y())); | 294 sigma.y())); |
283 WrapTexture(tex, rect.width(), rect.height(), result); | 295 WrapTexture(tex, rect.width(), rect.height(), result); |
284 return true; | 296 return true; |
285 #else | 297 #else |
286 SkDEBUGFAIL("Should not call in GPU-less build"); | 298 SkDEBUGFAIL("Should not call in GPU-less build"); |
287 return false; | 299 return false; |
288 #endif | 300 #endif |
289 } | 301 } |
OLD | NEW |