| 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 "SkBlurImageFilter.h" | 8 #include "SkBlurImageFilter.h" |
| 9 | 9 |
| 10 #include "SkAutoPixmapStorage.h" | 10 #include "SkAutoPixmapStorage.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 static SkVector map_sigma(const SkSize& localSigma, const SkMatrix& ctm) { | 30 static SkVector map_sigma(const SkSize& localSigma, const SkMatrix& ctm) { |
| 31 SkVector sigma = SkVector::Make(localSigma.width(), localSigma.height()); | 31 SkVector sigma = SkVector::Make(localSigma.width(), localSigma.height()); |
| 32 ctm.mapVectors(&sigma, 1); | 32 ctm.mapVectors(&sigma, 1); |
| 33 sigma.fX = SkMinScalar(SkScalarAbs(sigma.fX), MAX_SIGMA); | 33 sigma.fX = SkMinScalar(SkScalarAbs(sigma.fX), MAX_SIGMA); |
| 34 sigma.fY = SkMinScalar(SkScalarAbs(sigma.fY), MAX_SIGMA); | 34 sigma.fY = SkMinScalar(SkScalarAbs(sigma.fY), MAX_SIGMA); |
| 35 return sigma; | 35 return sigma; |
| 36 } | 36 } |
| 37 | 37 |
| 38 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, | 38 SkBlurImageFilter::SkBlurImageFilter(SkScalar sigmaX, |
| 39 SkScalar sigmaY, | 39 SkScalar sigmaY, |
| 40 SkImageFilter* input, | 40 sk_sp<SkImageFilter> input, |
| 41 const CropRect* cropRect) | 41 const CropRect* cropRect) |
| 42 : INHERITED(1, &input, cropRect), fSigma(SkSize::Make(sigmaX, sigmaY)) { | 42 : INHERITED(&input, 1, cropRect) |
| 43 , fSigma(SkSize::Make(sigmaX, sigmaY)) { |
| 43 } | 44 } |
| 44 | 45 |
| 45 sk_sp<SkFlattenable> SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { | 46 sk_sp<SkFlattenable> SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { |
| 46 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 47 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
| 47 SkScalar sigmaX = buffer.readScalar(); | 48 SkScalar sigmaX = buffer.readScalar(); |
| 48 SkScalar sigmaY = buffer.readScalar(); | 49 SkScalar sigmaY = buffer.readScalar(); |
| 49 return sk_sp<SkFlattenable>(Create(sigmaX, sigmaY, common.getInput(0).get(), | 50 return Make(sigmaX, sigmaY, common.getInput(0), &common.cropRect()); |
| 50 &common.cropRect())); | |
| 51 } | 51 } |
| 52 | 52 |
| 53 void SkBlurImageFilter::flatten(SkWriteBuffer& buffer) const { | 53 void SkBlurImageFilter::flatten(SkWriteBuffer& buffer) const { |
| 54 this->INHERITED::flatten(buffer); | 54 this->INHERITED::flatten(buffer); |
| 55 buffer.writeScalar(fSigma.fWidth); | 55 buffer.writeScalar(fSigma.fWidth); |
| 56 buffer.writeScalar(fSigma.fHeight); | 56 buffer.writeScalar(fSigma.fHeight); |
| 57 } | 57 } |
| 58 | 58 |
| 59 static void get_box3_params(SkScalar s, int *kernelSize, int* kernelSize3, int *
lowOffset, | 59 static void get_box3_params(SkScalar s, int *kernelSize, int* kernelSize3, int *
lowOffset, |
| 60 int *highOffset) { | 60 int *highOffset) { |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 str->appendf("SkBlurImageFilter: ("); | 239 str->appendf("SkBlurImageFilter: ("); |
| 240 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); | 240 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); |
| 241 | 241 |
| 242 if (this->getInput(0)) { | 242 if (this->getInput(0)) { |
| 243 this->getInput(0)->toString(str); | 243 this->getInput(0)->toString(str); |
| 244 } | 244 } |
| 245 | 245 |
| 246 str->append("))"); | 246 str->append("))"); |
| 247 } | 247 } |
| 248 #endif | 248 #endif |
| OLD | NEW |