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 | |
46 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, | 34 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, |
47 SkScalar sigmaY, | 35 SkScalar sigmaY, |
48 SkImageFilter* input, | 36 SkImageFilter* input, |
49 const CropRect* cropRect, | 37 const CropRect* cropRect, |
50 uint32_t uniqueID) | 38 uint32_t uniqueID) |
51 : INHERITED(1, &input, cropRect, uniqueID), fSigma(SkSize::Make(sigmaX, sigm
aY)) { | 39 : INHERITED(1, &input, cropRect, uniqueID), fSigma(SkSize::Make(sigmaX, sigm
aY)) { |
52 } | 40 } |
53 | 41 |
54 SkFlattenable* SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { | 42 SkFlattenable* SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { |
55 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 43 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 true, | 280 true, |
293 sigma.x(), | 281 sigma.x(), |
294 sigma.y())); | 282 sigma.y())); |
295 WrapTexture(tex, rect.width(), rect.height(), result); | 283 WrapTexture(tex, rect.width(), rect.height(), result); |
296 return true; | 284 return true; |
297 #else | 285 #else |
298 SkDEBUGFAIL("Should not call in GPU-less build"); | 286 SkDEBUGFAIL("Should not call in GPU-less build"); |
299 return false; | 287 return false; |
300 #endif | 288 #endif |
301 } | 289 } |
OLD | NEW |