Line data Source code
1 : /* This Source Code Form is subject to the terms of the Mozilla Public
2 : * License, v. 2.0. If a copy of the MPL was not distributed with this
3 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 :
5 : #ifndef MOZILLA_GFX_CONVOLUTION_FILTER_H_
6 : #define MOZILLA_GFX_CONVOLUTION_FILTER_H_
7 :
8 : #include "mozilla/UniquePtr.h"
9 :
10 : class SkConvolutionFilter1D;
11 :
12 : namespace mozilla {
13 : namespace gfx {
14 :
15 : class ConvolutionFilter
16 : {
17 : public:
18 : ConvolutionFilter();
19 : ~ConvolutionFilter();
20 :
21 : int32_t MaxFilter() const;
22 : int32_t NumValues() const;
23 :
24 : bool GetFilterOffsetAndLength(int32_t aRowIndex, int32_t* aResultOffset, int32_t* aResultLength);
25 :
26 : void ConvolveHorizontally(const uint8_t* aSrc, uint8_t* aDst, bool aHasAlpha);
27 : void ConvolveVertically(uint8_t* const* aSrc, uint8_t* aDst, int32_t aRowIndex, int32_t aRowSize, bool aHasAlpha);
28 :
29 : enum class ResizeMethod
30 : {
31 : BOX,
32 : TRIANGLE,
33 : LANCZOS3,
34 : HAMMING,
35 : MITCHELL
36 : };
37 :
38 : bool ComputeResizeFilter(ResizeMethod aResizeMethod, int32_t aSrcSize, int32_t aDstSize);
39 :
40 0 : static inline size_t PadBytesForSIMD(size_t aBytes) {
41 0 : return (aBytes + 31) & ~31;
42 : }
43 :
44 : private:
45 : UniquePtr<SkConvolutionFilter1D> mFilter;
46 : };
47 :
48 : } // namespace gfx
49 : } // namespace mozilla
50 :
51 : #endif /* MOZILLA_GFX_CONVOLUTION_FILTER_H_ */
52 :
|