Bug 1890689 accumulate input in LargerReceiverBlockSizeThanDesiredBuffering GTest...
[gecko.git] / gfx / 2d / ConvolutionFilter.h
blob282222b8d6b4ae6816034d3f9c62c12313cf04c3
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef MOZILLA_GFX_CONVOLUTION_FILTER_H_
8 #define MOZILLA_GFX_CONVOLUTION_FILTER_H_
10 #include "mozilla/UniquePtr.h"
12 namespace skia {
13 class SkConvolutionFilter1D;
16 namespace mozilla {
17 namespace gfx {
19 class ConvolutionFilter final {
20 public:
21 ConvolutionFilter();
22 ~ConvolutionFilter();
24 int32_t MaxFilter() const;
25 int32_t NumValues() const;
27 bool GetFilterOffsetAndLength(int32_t aRowIndex, int32_t* aResultOffset,
28 int32_t* aResultLength);
30 void ConvolveHorizontally(const uint8_t* aSrc, uint8_t* aDst, bool aHasAlpha);
31 void ConvolveVertically(uint8_t* const* aSrc, uint8_t* aDst,
32 int32_t aRowIndex, int32_t aRowSize, bool aHasAlpha);
34 enum class ResizeMethod { BOX, LANCZOS3 };
36 bool ComputeResizeFilter(ResizeMethod aResizeMethod, int32_t aSrcSize,
37 int32_t aDstSize);
39 static inline size_t PadBytesForSIMD(size_t aBytes) {
40 return (aBytes + 31) & ~31;
43 const skia::SkConvolutionFilter1D& GetSkiaFilter() const {
44 return *mFilter.get();
47 private:
48 UniquePtr<skia::SkConvolutionFilter1D> mFilter;
51 } // namespace gfx
52 } // namespace mozilla
54 #endif /* MOZILLA_GFX_CONVOLUTION_FILTER_H_ */