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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 sk_sp<SkFlattenable> SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { | 55 sk_sp<SkFlattenable> SkBlurImageFilter::CreateProc(SkReadBuffer& buffer) { |
56 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); | 56 SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
57 SkScalar sigmaX = buffer.readScalar(); | 57 SkScalar sigmaX = buffer.readScalar(); |
58 SkScalar sigmaY = buffer.readScalar(); | 58 SkScalar sigmaY = buffer.readScalar(); |
59 return Make(sigmaX, sigmaY, common.getInput(0), &common.cropRect()); | 59 return Make(sigmaX, sigmaY, common.getInput(0), &common.cropRect()); |
60 } | 60 } |
61 | 61 |
62 void SkBlurImageFilter::flatten(SkWriteBuffer& buffer) const { | 62 void SkBlurImageFilter::flatten(SkWriteBuffer& buffer) const { |
63 this->INHERITED::flatten(buffer); | 63 this->INHERITED::flatten(buffer); |
64 buffer.writeScalar(fSigma.fWidth); | 64 buffer.writeScalar("fSigmaWidth", fSigma.fWidth); |
65 buffer.writeScalar(fSigma.fHeight); | 65 buffer.writeScalar("fSigmaHeight", fSigma.fHeight); |
66 } | 66 } |
67 | 67 |
68 static void get_box3_params(SkScalar s, int *kernelSize, int* kernelSize3, int *
lowOffset, | 68 static void get_box3_params(SkScalar s, int *kernelSize, int* kernelSize3, int *
lowOffset, |
69 int *highOffset) { | 69 int *highOffset) { |
70 float pi = SkScalarToFloat(SK_ScalarPI); | 70 float pi = SkScalarToFloat(SK_ScalarPI); |
71 int d = static_cast<int>(floorf(SkScalarToFloat(s) * 3.0f * sqrtf(2.0f * pi)
/ 4.0f + 0.5f)); | 71 int d = static_cast<int>(floorf(SkScalarToFloat(s) * 3.0f * sqrtf(2.0f * pi)
/ 4.0f + 0.5f)); |
72 *kernelSize = d; | 72 *kernelSize = d; |
73 if (d % 2 == 1) { | 73 if (d % 2 == 1) { |
74 *lowOffset = *highOffset = (d - 1) / 2; | 74 *lowOffset = *highOffset = (d - 1) / 2; |
75 *kernelSize3 = d; | 75 *kernelSize3 = d; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 str->appendf("SkBlurImageFilter: ("); | 249 str->appendf("SkBlurImageFilter: ("); |
250 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); | 250 str->appendf("sigma: (%f, %f) input (", fSigma.fWidth, fSigma.fHeight); |
251 | 251 |
252 if (this->getInput(0)) { | 252 if (this->getInput(0)) { |
253 this->getInput(0)->toString(str); | 253 this->getInput(0)->toString(str); |
254 } | 254 } |
255 | 255 |
256 str->append("))"); | 256 str->append("))"); |
257 } | 257 } |
258 #endif | 258 #endif |
OLD | NEW |