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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 } | 79 } |
80 fGain = buffer.readScalar(); | 80 fGain = buffer.readScalar(); |
81 fBias = buffer.readScalar(); | 81 fBias = buffer.readScalar(); |
82 fKernelOffset.fX = buffer.readInt(); | 82 fKernelOffset.fX = buffer.readInt(); |
83 fKernelOffset.fY = buffer.readInt(); | 83 fKernelOffset.fY = buffer.readInt(); |
84 fTileMode = (TileMode) buffer.readInt(); | 84 fTileMode = (TileMode) buffer.readInt(); |
85 fConvolveAlpha = buffer.readBool(); | 85 fConvolveAlpha = buffer.readBool(); |
86 buffer.validate((fKernel != 0) && | 86 buffer.validate((fKernel != 0) && |
87 SkScalarIsFinite(fGain) && | 87 SkScalarIsFinite(fGain) && |
88 SkScalarIsFinite(fBias) && | 88 SkScalarIsFinite(fBias) && |
89 tile_mode_is_valid(fTileMode)); | 89 tile_mode_is_valid(fTileMode) && |
| 90 (fKernelOffset.fX >= 0) && (fKernelOffset.fX < fKernelSize.f
Width) && |
| 91 (fKernelOffset.fY >= 0) && (fKernelOffset.fY < fKernelSize.f
Height)); |
90 } | 92 } |
91 | 93 |
92 void SkMatrixConvolutionImageFilter::flatten(SkWriteBuffer& buffer) const { | 94 void SkMatrixConvolutionImageFilter::flatten(SkWriteBuffer& buffer) const { |
93 this->INHERITED::flatten(buffer); | 95 this->INHERITED::flatten(buffer); |
94 buffer.writeInt(fKernelSize.fWidth); | 96 buffer.writeInt(fKernelSize.fWidth); |
95 buffer.writeInt(fKernelSize.fHeight); | 97 buffer.writeInt(fKernelSize.fHeight); |
96 buffer.writeScalarArray(fKernel, fKernelSize.fWidth * fKernelSize.fHeight); | 98 buffer.writeScalarArray(fKernel, fKernelSize.fWidth * fKernelSize.fHeight); |
97 buffer.writeScalar(fGain); | 99 buffer.writeScalar(fGain); |
98 buffer.writeScalar(fBias); | 100 buffer.writeScalar(fBias); |
99 buffer.writeInt(fKernelOffset.fX); | 101 buffer.writeInt(fKernelOffset.fX); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 fBias, | 679 fBias, |
678 fKernelOffset, | 680 fKernelOffset, |
679 fTileMode, | 681 fTileMode, |
680 fConvolveAlpha); | 682 fConvolveAlpha); |
681 return true; | 683 return true; |
682 } | 684 } |
683 | 685 |
684 /////////////////////////////////////////////////////////////////////////////// | 686 /////////////////////////////////////////////////////////////////////////////// |
685 | 687 |
686 #endif | 688 #endif |
OLD | NEW |