OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SK_CONVOLVER_H | 5 #ifndef SK_CONVOLVER_H |
6 #define SK_CONVOLVER_H | 6 #define SK_CONVOLVER_H |
7 | 7 |
8 #include "SkSize.h" | 8 #include "SkSize.h" |
9 #include "SkTypes.h" | 9 #include "SkTypes.h" |
10 #include "SkTArray.h" | 10 #include "SkTArray.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 // filter values are put into the corresponding out arguments (see AddFilter | 84 // filter values are put into the corresponding out arguments (see AddFilter |
85 // above for what these mean), and a pointer to the first scaling factor is | 85 // above for what these mean), and a pointer to the first scaling factor is |
86 // returned. There will be |filterLength| values in this array. | 86 // returned. There will be |filterLength| values in this array. |
87 inline const ConvolutionFixed* FilterForValue(int valueOffset, | 87 inline const ConvolutionFixed* FilterForValue(int valueOffset, |
88 int* filterOffset, | 88 int* filterOffset, |
89 int* filterLength) const { | 89 int* filterLength) const { |
90 const FilterInstance& filter = fFilters[valueOffset]; | 90 const FilterInstance& filter = fFilters[valueOffset]; |
91 *filterOffset = filter.fOffset; | 91 *filterOffset = filter.fOffset; |
92 *filterLength = filter.fTrimmedLength; | 92 *filterLength = filter.fTrimmedLength; |
93 if (filter.fTrimmedLength == 0) { | 93 if (filter.fTrimmedLength == 0) { |
94 return NULL; | 94 return nullptr; |
95 } | 95 } |
96 return &fFilterValues[filter.fDataLocation]; | 96 return &fFilterValues[filter.fDataLocation]; |
97 } | 97 } |
98 | 98 |
99 // Retrieves the filter for the offset 0, presumed to be the one and only. | 99 // Retrieves the filter for the offset 0, presumed to be the one and only. |
100 // The offset and length of the filter values are put into the corresponding | 100 // The offset and length of the filter values are put into the corresponding |
101 // out arguments (see AddFilter). Note that |filterLegth| and | 101 // out arguments (see AddFilter). Note that |filterLegth| and |
102 // |specifiedFilterLength| may be different if leading/trailing zeros of the | 102 // |specifiedFilterLength| may be different if leading/trailing zeros of the |
103 // original floating point form were clipped. | 103 // original floating point form were clipped. |
104 // There will be |filterLength| values in the return array. | 104 // There will be |filterLength| values in the return array. |
105 // Returns NULL if the filter is 0-length (for instance when all floating | 105 // Returns nullptr if the filter is 0-length (for instance when all floating |
106 // point values passed to AddFilter were clipped to 0). | 106 // point values passed to AddFilter were clipped to 0). |
107 SK_API const ConvolutionFixed* GetSingleFilter(int* specifiedFilterLength, | 107 SK_API const ConvolutionFixed* GetSingleFilter(int* specifiedFilterLength, |
108 int* filterOffset, | 108 int* filterOffset, |
109 int* filterLength) const; | 109 int* filterLength) const; |
110 | 110 |
111 // Add another value to the fFilterValues array -- useful for | 111 // Add another value to the fFilterValues array -- useful for |
112 // SIMD padding which happens outside of this class. | 112 // SIMD padding which happens outside of this class. |
113 | 113 |
114 void addFilterValue( ConvolutionFixed val ) { | 114 void addFilterValue( ConvolutionFixed val ) { |
115 fFilterValues.push_back( val ); | 115 fFilterValues.push_back( val ); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 int sourceByteRowStride, | 197 int sourceByteRowStride, |
198 bool sourceHasAlpha, | 198 bool sourceHasAlpha, |
199 const SkConvolutionFilter1D& xfilter, | 199 const SkConvolutionFilter1D& xfilter, |
200 const SkConvolutionFilter1D& yfilter, | 200 const SkConvolutionFilter1D& yfilter, |
201 int outputByteRowStride, | 201 int outputByteRowStride, |
202 unsigned char* output, | 202 unsigned char* output, |
203 const SkConvolutionProcs&, | 203 const SkConvolutionProcs&, |
204 bool useSimdIfPossible); | 204 bool useSimdIfPossible); |
205 | 205 |
206 #endif // SK_CONVOLVER_H | 206 #endif // SK_CONVOLVER_H |
OLD | NEW |