| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 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 GrConvolutionEffect_DEFINED | 8 #ifndef GrConvolutionEffect_DEFINED |
| 9 #define GrConvolutionEffect_DEFINED | 9 #define GrConvolutionEffect_DEFINED |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 public: | 22 public: |
| 23 | 23 |
| 24 /// Convolve with an arbitrary user-specified kernel | 24 /// Convolve with an arbitrary user-specified kernel |
| 25 static GrEffectRef* Create(GrTexture* tex, | 25 static GrEffectRef* Create(GrTexture* tex, |
| 26 Direction dir, | 26 Direction dir, |
| 27 int halfWidth, | 27 int halfWidth, |
| 28 const float* kernel, | 28 const float* kernel, |
| 29 bool useBounds, | 29 bool useBounds, |
| 30 float bounds[2]) { | 30 float bounds[2]) { |
| 31 AutoEffectUnref effect(SkNEW_ARGS(GrConvolutionEffect, (tex, | 31 return SkNEW_ARGS(GrConvolutionEffect, (tex, |
| 32 dir, | 32 dir, |
| 33 halfWidth, | 33 halfWidth, |
| 34 kernel, | 34 kernel, |
| 35 useBounds, | 35 useBounds, |
| 36 bounds))); | 36 bounds)); |
| 37 return CreateEffectRef(effect); | |
| 38 } | 37 } |
| 39 | 38 |
| 40 /// Convolve with a Gaussian kernel | 39 /// Convolve with a Gaussian kernel |
| 41 static GrEffectRef* CreateGaussian(GrTexture* tex, | 40 static GrEffectRef* CreateGaussian(GrTexture* tex, |
| 42 Direction dir, | 41 Direction dir, |
| 43 int halfWidth, | 42 int halfWidth, |
| 44 float gaussianSigma, | 43 float gaussianSigma, |
| 45 bool useBounds, | 44 bool useBounds, |
| 46 float bounds[2]) { | 45 float bounds[2]) { |
| 47 AutoEffectUnref effect(SkNEW_ARGS(GrConvolutionEffect, (tex, | 46 return SkNEW_ARGS(GrConvolutionEffect, (tex, |
| 48 dir, | 47 dir, |
| 49 halfWidth, | 48 halfWidth, |
| 50 gaussianSigma, | 49 gaussianSigma, |
| 51 useBounds, | 50 useBounds, |
| 52 bounds))); | 51 bounds)); |
| 53 return CreateEffectRef(effect); | |
| 54 } | 52 } |
| 55 | 53 |
| 56 virtual ~GrConvolutionEffect(); | 54 virtual ~GrConvolutionEffect(); |
| 57 | 55 |
| 58 const float* kernel() const { return fKernel; } | 56 const float* kernel() const { return fKernel; } |
| 59 | 57 |
| 60 const float* bounds() const { return fBounds; } | 58 const float* bounds() const { return fBounds; } |
| 61 bool useBounds() const { return fUseBounds; } | 59 bool useBounds() const { return fUseBounds; } |
| 62 | 60 |
| 63 static const char* Name() { return "Convolution"; } | 61 static const char* Name() { return "Convolution"; } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 float bounds[2]); | 102 float bounds[2]); |
| 105 | 103 |
| 106 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; | 104 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; |
| 107 | 105 |
| 108 GR_DECLARE_EFFECT_TEST; | 106 GR_DECLARE_EFFECT_TEST; |
| 109 | 107 |
| 110 typedef Gr1DKernelEffect INHERITED; | 108 typedef Gr1DKernelEffect INHERITED; |
| 111 }; | 109 }; |
| 112 | 110 |
| 113 #endif | 111 #endif |
| OLD | NEW |