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 16 matching lines...) Expand all Loading... |
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 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, | 34 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, |
35 SkScalar sigmaY, | 35 SkScalar sigmaY, |
36 SkImageFilter* input, | 36 SkImageFilter* input, |
37 const CropRect* cropRect, | 37 const CropRect* cropRect) |
38 uint32_t uniqueID) | 38 : INHERITED(1, &input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) { |
39 : INHERITED(1, &input, cropRect, uniqueID), fSigma(SkSize::Make(sigmaX, sigm
aY)) { | |
40 } | 39 } |
41 | 40 |
42 SkFlattenable* SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { | 41 SkFlattenable* SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { |
43 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 42 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
44 SkScalar sigmaX = buffer.readScalar(); | 43 SkScalar sigmaX = buffer.readScalar(); |
45 SkScalar sigmaY = buffer.readScalar(); | 44 SkScalar sigmaY = buffer.readScalar(); |
46 return Create(sigmaX, sigmaY, common.getInput(0), &common.cropRect(), common
.uniqueID()); | 45 return Create(sigmaX, sigmaY, common.getInput(0), &common.cropRect()); |
47 } | 46 } |
48 | 47 |
49 void SkBlurImageFilter::flatten(SkWriteBuffer& buffer) const { | 48 void SkBlurImageFilter::flatten(SkWriteBuffer& buffer) const { |
50 this->INHERITED::flatten(buffer); | 49 this->INHERITED::flatten(buffer); |
51 buffer.writeScalar(fSigma.fWidth); | 50 buffer.writeScalar(fSigma.fWidth); |
52 buffer.writeScalar(fSigma.fHeight); | 51 buffer.writeScalar(fSigma.fHeight); |
53 } | 52 } |
54 | 53 |
55 enum BlurDirection { | 54 enum BlurDirection { |
56 kX, kY | 55 kX, kY |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 str->appendf("SkBlurImageFilter: ("); | 295 str->appendf("SkBlurImageFilter: ("); |
297 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); | 296 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); |
298 | 297 |
299 if (this->getInput(0)) { | 298 if (this->getInput(0)) { |
300 this->getInput(0)->toString(str); | 299 this->getInput(0)->toString(str); |
301 } | 300 } |
302 | 301 |
303 str->append("))"); | 302 str->append("))"); |
304 } | 303 } |
305 #endif | 304 #endif |
OLD | NEW |