| 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 #ifndef SkMatrixConvolutionImageFilter_DEFINED | 8 #ifndef SkMatrixConvolutionImageFilter_DEFINED |
| 9 #define SkMatrixConvolutionImageFilter_DEFINED | 9 #define SkMatrixConvolutionImageFilter_DEFINED |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class SK_API SkMatrixConvolutionImageFilter : public SkImageFilter { | 22 class SK_API SkMatrixConvolutionImageFilter : public SkImageFilter { |
| 23 public: | 23 public: |
| 24 /*! \enum TileMode */ | 24 /*! \enum TileMode */ |
| 25 enum TileMode { | 25 enum TileMode { |
| 26 kClamp_TileMode = 0, /*!< Clamp to the image's edge pixels. */ | 26 kClamp_TileMode = 0, /*!< Clamp to the image's edge pixels. */ |
| 27 kRepeat_TileMode, /*!< Wrap around to the image's opposite edge. */ | 27 kRepeat_TileMode, /*!< Wrap around to the image's opposite edge. */ |
| 28 kClampToBlack_TileMode, /*!< Fill with transparent black. */ | 28 kClampToBlack_TileMode, /*!< Fill with transparent black. */ |
| 29 kMax_TileMode = kClampToBlack_TileMode | 29 kMax_TileMode = kClampToBlack_TileMode |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 virtual ~SkMatrixConvolutionImageFilter(); | 32 ~SkMatrixConvolutionImageFilter() override; |
| 33 | 33 |
| 34 /** Construct a matrix convolution image filter. | 34 /** Construct a matrix convolution image filter. |
| 35 @param kernelSize The kernel size in pixels, in each dimension (N by
M). | 35 @param kernelSize The kernel size in pixels, in each dimension (N by
M). |
| 36 @param kernel The image processing kernel. Must contain N * M | 36 @param kernel The image processing kernel. Must contain N * M |
| 37 elements, in row order. | 37 elements, in row order. |
| 38 @param gain A scale factor applied to each pixel after | 38 @param gain A scale factor applied to each pixel after |
| 39 convolution. This can be used to normalize the | 39 convolution. This can be used to normalize the |
| 40 kernel, if it does not sum to 1. | 40 kernel, if it does not sum to 1. |
| 41 @param bias A bias factor added to each pixel after convolutio
n. | 41 @param bias A bias factor added to each pixel after convolutio
n. |
| 42 @param kernelOffset An offset applied to each pixel coordinate before | 42 @param kernelOffset An offset applied to each pixel coordinate before |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 const SkScalar* kernel, | 85 const SkScalar* kernel, |
| 86 SkScalar gain, | 86 SkScalar gain, |
| 87 SkScalar bias, | 87 SkScalar bias, |
| 88 const SkIPoint& kernelOffset, | 88 const SkIPoint& kernelOffset, |
| 89 TileMode tileMode, | 89 TileMode tileMode, |
| 90 bool convolveAlpha, | 90 bool convolveAlpha, |
| 91 sk_sp<SkImageFilter> input, | 91 sk_sp<SkImageFilter> input, |
| 92 const CropRect* cropRect); | 92 const CropRect* cropRect); |
| 93 void flatten(SkWriteBuffer&) const override; | 93 void flatten(SkWriteBuffer&) const override; |
| 94 | 94 |
| 95 bool onFilterImageDeprecated(Proxy*, const SkBitmap& src, const Context&, | 95 sk_sp<SkSpecialImage> onFilterImage(SkSpecialImage* source, const Context&, |
| 96 SkBitmap* result, SkIPoint* loc) const override
; | 96 SkIPoint* offset) const override; |
| 97 SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) co
nst override; | 97 SkIRect onFilterNodeBounds(const SkIRect&, const SkMatrix&, MapDirection) co
nst override; |
| 98 bool affectsTransparentBlack() const override; | 98 bool affectsTransparentBlack() const override; |
| 99 | 99 |
| 100 #if SK_SUPPORT_GPU | |
| 101 bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&, | |
| 102 const SkIRect& bounds) const override; | |
| 103 #endif | |
| 104 | |
| 105 private: | 100 private: |
| 106 SkISize fKernelSize; | 101 SkISize fKernelSize; |
| 107 SkScalar* fKernel; | 102 SkScalar* fKernel; |
| 108 SkScalar fGain; | 103 SkScalar fGain; |
| 109 SkScalar fBias; | 104 SkScalar fBias; |
| 110 SkIPoint fKernelOffset; | 105 SkIPoint fKernelOffset; |
| 111 TileMode fTileMode; | 106 TileMode fTileMode; |
| 112 bool fConvolveAlpha; | 107 bool fConvolveAlpha; |
| 113 | 108 |
| 114 template <class PixelFetcher, bool convolveAlpha> | 109 template <class PixelFetcher, bool convolveAlpha> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 127 const SkIRect& bounds) const; | 122 const SkIRect& bounds) const; |
| 128 void filterBorderPixels(const SkBitmap& src, | 123 void filterBorderPixels(const SkBitmap& src, |
| 129 SkBitmap* result, | 124 SkBitmap* result, |
| 130 const SkIRect& rect, | 125 const SkIRect& rect, |
| 131 const SkIRect& bounds) const; | 126 const SkIRect& bounds) const; |
| 132 | 127 |
| 133 typedef SkImageFilter INHERITED; | 128 typedef SkImageFilter INHERITED; |
| 134 }; | 129 }; |
| 135 | 130 |
| 136 #endif | 131 #endif |
| OLD | NEW |