Index: src/gpu/effects/GrMatrixConvolutionEffect.h |
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h |
index 6fdd85b7c74d5de862dc097fdc7b65024f281592..2802a7dace7dc45dcfdd914b8d18d93901c774a0 100644 |
--- a/src/gpu/effects/GrMatrixConvolutionEffect.h |
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.h |
@@ -12,6 +12,7 @@ |
// A little bit less than the minimum # uniforms required by DX9SM2 (32). |
// Allows for a 5x5 kernel (or 25x1, for that matter). |
+// TODO make maximum kernel size a GLCap |
#define MAX_KERNEL_SIZE 25 |
class GrGLMatrixConvolutionEffect; |
@@ -19,6 +20,7 @@ class GrGLMatrixConvolutionEffect; |
class GrMatrixConvolutionEffect : public GrSingleTextureEffect { |
public: |
/*! \enum TileMode */ |
+ //TODO expand texture domain class to add ClampToColor and Repeat and then clean this up |
bsalomon
2014/07/28 15:20:41
It has clamp to black already I believe.
|
enum TileMode { |
kClamp_TileMode = 0, /*!< Clamp to the image's edge pixels. */ |
kRepeat_TileMode, /*!< Wrap around to the image's opposite edge. */ |
@@ -27,6 +29,8 @@ public: |
}; |
typedef GrMatrixConvolutionEffect::TileMode TileMode; |
+ |
+ /// Convolve with arbitrary user specified kernel |
static GrEffect* Create(GrTexture* texture, |
const SkIRect& bounds, |
const SkISize& kernelSize, |
@@ -35,7 +39,8 @@ public: |
SkScalar bias, |
const SkIPoint& kernelOffset, |
TileMode tileMode, |
- bool convolveAlpha) { |
+ bool convolveAlpha, |
+ bool useBounds) { |
return SkNEW_ARGS(GrMatrixConvolutionEffect, (texture, |
bounds, |
kernelSize, |
@@ -44,8 +49,23 @@ public: |
bias, |
kernelOffset, |
tileMode, |
- convolveAlpha)); |
+ convolveAlpha, |
+ useBounds)); |
} |
+ |
+ /// Convolve with a Gaussian kernel |
+ static GrEffect* CreateGaussian(GrTexture* texture, |
+ const SkIRect& bounds, |
+ const SkISize& kernelSize, |
+ SkScalar gain, |
+ SkScalar bias, |
+ const SkIPoint& kernelOffset, |
+ TileMode tileMode, |
+ bool convolveAlpha, |
+ bool useBounds, |
+ SkScalar sigmaX, |
+ SkScalar sigmaY); |
+ |
virtual ~GrMatrixConvolutionEffect(); |
virtual void getConstantColorComponents(GrColor* color, |
@@ -63,6 +83,7 @@ public: |
float bias() const { return fBias; } |
TileMode tileMode() const { return fTileMode; } |
bool convolveAlpha() const { return fConvolveAlpha; } |
+ bool useBounds() const { return fUseBounds; } |
typedef GrGLMatrixConvolutionEffect GLEffect; |
@@ -77,18 +98,20 @@ private: |
SkScalar bias, |
const SkIPoint& kernelOffset, |
TileMode tileMode, |
- bool convolveAlpha); |
+ bool convolveAlpha, |
+ bool useBounds); |
virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; |
SkIRect fBounds; |
SkISize fKernelSize; |
- float *fKernel; |
+ float fKernel[MAX_KERNEL_SIZE]; |
float fGain; |
float fBias; |
float fKernelOffset[2]; |
TileMode fTileMode; |
bool fConvolveAlpha; |
+ bool fUseBounds; |
GR_DECLARE_EFFECT_TEST; |