OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 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 "SkMatrixConvolutionImageFilter.h" | 8 #include "SkMatrixConvolutionImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 return nullptr; | 90 return nullptr; |
91 } | 91 } |
92 SkScalar gain = buffer.readScalar(); | 92 SkScalar gain = buffer.readScalar(); |
93 SkScalar bias = buffer.readScalar(); | 93 SkScalar bias = buffer.readScalar(); |
94 SkIPoint kernelOffset; | 94 SkIPoint kernelOffset; |
95 kernelOffset.fX = buffer.readInt(); | 95 kernelOffset.fX = buffer.readInt(); |
96 kernelOffset.fY = buffer.readInt(); | 96 kernelOffset.fY = buffer.readInt(); |
97 TileMode tileMode = (TileMode)buffer.readInt(); | 97 TileMode tileMode = (TileMode)buffer.readInt(); |
98 bool convolveAlpha = buffer.readBool(); | 98 bool convolveAlpha = buffer.readBool(); |
99 return Create(kernelSize, kernel.get(), gain, bias, kernelOffset, tileMode,
convolveAlpha, | 99 return Create(kernelSize, kernel.get(), gain, bias, kernelOffset, tileMode,
convolveAlpha, |
100 common.getInput(0), &common.cropRect()); | 100 common.getInput(0).get(), &common.cropRect()); |
101 } | 101 } |
102 | 102 |
103 void SkMatrixConvolutionImageFilter::flatten(SkWriteBuffer& buffer) const { | 103 void SkMatrixConvolutionImageFilter::flatten(SkWriteBuffer& buffer) const { |
104 this->INHERITED::flatten(buffer); | 104 this->INHERITED::flatten(buffer); |
105 buffer.writeInt(fKernelSize.fWidth); | 105 buffer.writeInt(fKernelSize.fWidth); |
106 buffer.writeInt(fKernelSize.fHeight); | 106 buffer.writeInt(fKernelSize.fHeight); |
107 buffer.writeScalarArray(fKernel, fKernelSize.fWidth * fKernelSize.fHeight); | 107 buffer.writeScalarArray(fKernel, fKernelSize.fWidth * fKernelSize.fHeight); |
108 buffer.writeScalar(fGain); | 108 buffer.writeScalar(fGain); |
109 buffer.writeScalar(fBias); | 109 buffer.writeScalar(fBias); |
110 buffer.writeInt(fKernelOffset.fX); | 110 buffer.writeInt(fKernelOffset.fX); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); | 390 str->appendf("%f ", fKernel[y * fKernelSize.width() + x]); |
391 } | 391 } |
392 } | 392 } |
393 str->appendf(")"); | 393 str->appendf(")"); |
394 str->appendf("gain: %f bias: %f ", fGain, fBias); | 394 str->appendf("gain: %f bias: %f ", fGain, fBias); |
395 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); | 395 str->appendf("offset: (%d, %d) ", fKernelOffset.fX, fKernelOffset.fY); |
396 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); | 396 str->appendf("convolveAlpha: %s", fConvolveAlpha ? "true" : "false"); |
397 str->append(")"); | 397 str->append(")"); |
398 } | 398 } |
399 #endif | 399 #endif |
OLD | NEW |