| 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 29 matching lines...) Expand all Loading... |
| 40 convolution. This can be used to center the kernel | 40 convolution. This can be used to center the kernel |
| 41 over the image (e.g., a 3x3 kernel should have a | 41 over the image (e.g., a 3x3 kernel should have a |
| 42 target of {1, 1}). | 42 target of {1, 1}). |
| 43 @param tileMode How accesses outside the image are treated. (@see | 43 @param tileMode How accesses outside the image are treated. (@see |
| 44 TileMode). | 44 TileMode). |
| 45 @param convolveAlpha If true, all channels are convolved. If false, | 45 @param convolveAlpha If true, all channels are convolved. If false, |
| 46 only the RGB channels are convolved, and | 46 only the RGB channels are convolved, and |
| 47 alpha is copied from the source image. | 47 alpha is copied from the source image. |
| 48 @param input The input image filter. If NULL, the src bitmap | 48 @param input The input image filter. If NULL, the src bitmap |
| 49 passed to filterImage() is used instead. | 49 passed to filterImage() is used instead. |
| 50 @param cropRect The rectangle to which the output processing will be
limited. |
| 50 */ | 51 */ |
| 51 | 52 |
| 52 SkMatrixConvolutionImageFilter(const SkISize& kernelSize, const SkScalar* ke
rnel, SkScalar gain, SkScalar bias, const SkIPoint& target, TileMode tileMode, b
ool convolveAlpha, SkImageFilter* input = NULL); | 53 SkMatrixConvolutionImageFilter(const SkISize& kernelSize, |
| 54 const SkScalar* kernel, |
| 55 SkScalar gain, |
| 56 SkScalar bias, |
| 57 const SkIPoint& target, |
| 58 TileMode tileMode, |
| 59 bool convolveAlpha, |
| 60 SkImageFilter* input = NULL, |
| 61 const CropRect* cropRect = NULL); |
| 53 virtual ~SkMatrixConvolutionImageFilter(); | 62 virtual ~SkMatrixConvolutionImageFilter(); |
| 54 | 63 |
| 55 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixConvolutionImage
Filter) | 64 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMatrixConvolutionImage
Filter) |
| 56 | 65 |
| 57 protected: | 66 protected: |
| 58 SkMatrixConvolutionImageFilter(SkFlattenableReadBuffer& buffer); | 67 SkMatrixConvolutionImageFilter(SkFlattenableReadBuffer& buffer); |
| 59 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; | 68 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; |
| 60 | 69 |
| 61 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, | 70 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, |
| 62 SkBitmap* result, SkIPoint* loc) SK_OVERRIDE; | 71 SkBitmap* result, SkIPoint* loc) SK_OVERRIDE; |
| 63 | 72 |
| 64 #if SK_SUPPORT_GPU | 73 #if SK_SUPPORT_GPU |
| 65 virtual bool asNewEffect(GrEffectRef** effect, GrTexture*, const SkMatrix& m
atrix) const SK_OVERRIDE; | 74 virtual bool asNewEffect(GrEffectRef** effect, |
| 75 GrTexture*, |
| 76 const SkMatrix& matrix, |
| 77 const SkIRect& bounds) const SK_OVERRIDE; |
| 66 #endif | 78 #endif |
| 67 | 79 |
| 68 private: | 80 private: |
| 69 SkISize fKernelSize; | 81 SkISize fKernelSize; |
| 70 SkScalar* fKernel; | 82 SkScalar* fKernel; |
| 71 SkScalar fGain; | 83 SkScalar fGain; |
| 72 SkScalar fBias; | 84 SkScalar fBias; |
| 73 SkIPoint fTarget; | 85 SkIPoint fTarget; |
| 74 TileMode fTileMode; | 86 TileMode fTileMode; |
| 75 bool fConvolveAlpha; | 87 bool fConvolveAlpha; |
| 76 typedef SkImageFilter INHERITED; | 88 typedef SkImageFilter INHERITED; |
| 77 | 89 |
| 78 template <class PixelFetcher, bool convolveAlpha> | 90 template <class PixelFetcher, bool convolveAlpha> |
| 79 void filterPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect
); | 91 void filterPixels(const SkBitmap& src, |
| 92 SkBitmap* result, |
| 93 const SkIRect& rect, |
| 94 const SkIRect& bounds); |
| 80 template <class PixelFetcher> | 95 template <class PixelFetcher> |
| 81 void filterPixels(const SkBitmap& src, SkBitmap* result, const SkIRect& rect
); | 96 void filterPixels(const SkBitmap& src, |
| 82 void filterInteriorPixels(const SkBitmap& src, SkBitmap* result, const SkIRe
ct& rect); | 97 SkBitmap* result, |
| 83 void filterBorderPixels(const SkBitmap& src, SkBitmap* result, const SkIRect
& rect); | 98 const SkIRect& rect, |
| 99 const SkIRect& bounds); |
| 100 void filterInteriorPixels(const SkBitmap& src, |
| 101 SkBitmap* result, |
| 102 const SkIRect& rect, |
| 103 const SkIRect& bounds); |
| 104 void filterBorderPixels(const SkBitmap& src, |
| 105 SkBitmap* result, |
| 106 const SkIRect& rect, |
| 107 const SkIRect& bounds); |
| 84 }; | 108 }; |
| 85 | 109 |
| 86 #endif | 110 #endif |
| OLD | NEW |