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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // size will be xfilter.numValues() * yfilter.numValues() pixels. It will be | 186 // size will be xfilter.numValues() * yfilter.numValues() pixels. It will be |
187 // in rows of exactly xfilter.numValues() * 4 bytes. | 187 // in rows of exactly xfilter.numValues() * 4 bytes. |
188 // | 188 // |
189 // |sourceHasAlpha| is a hint that allows us to avoid doing computations on | 189 // |sourceHasAlpha| is a hint that allows us to avoid doing computations on |
190 // the alpha channel if the image is opaque. If you don't know, set this to | 190 // the alpha channel if the image is opaque. If you don't know, set this to |
191 // true and it will work properly, but setting this to false will be a few | 191 // true and it will work properly, but setting this to false will be a few |
192 // percent faster if you know the image is opaque. | 192 // percent faster if you know the image is opaque. |
193 // | 193 // |
194 // The layout in memory is assumed to be 4-bytes per pixel in B-G-R-A order | 194 // The layout in memory is assumed to be 4-bytes per pixel in B-G-R-A order |
195 // (this is ARGB when loaded into 32-bit words on a little-endian machine). | 195 // (this is ARGB when loaded into 32-bit words on a little-endian machine). |
196 SK_API void BGRAConvolve2D(const unsigned char* sourceData, | 196 /** |
| 197 * Returns false if it was unable to perform the convolution/rescale. in which
case the output |
| 198 * buffer is assumed to be undefined. |
| 199 */ |
| 200 SK_API bool BGRAConvolve2D(const unsigned char* sourceData, |
197 int sourceByteRowStride, | 201 int sourceByteRowStride, |
198 bool sourceHasAlpha, | 202 bool sourceHasAlpha, |
199 const SkConvolutionFilter1D& xfilter, | 203 const SkConvolutionFilter1D& xfilter, |
200 const SkConvolutionFilter1D& yfilter, | 204 const SkConvolutionFilter1D& yfilter, |
201 int outputByteRowStride, | 205 int outputByteRowStride, |
202 unsigned char* output, | 206 unsigned char* output, |
203 const SkConvolutionProcs&, | 207 const SkConvolutionProcs&, |
204 bool useSimdIfPossible); | 208 bool useSimdIfPossible); |
205 | 209 |
206 #endif // SK_CONVOLVER_H | 210 #endif // SK_CONVOLVER_H |
OLD | NEW |