| Index: src/gpu/effects/GrMatrixConvolutionEffect.h
|
| diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h
|
| index 6fdd85b7c74d5de862dc097fdc7b65024f281592..111fceb05706502bb8c47c22669dfe1fee460e2c 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
|
| 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,35 @@ 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) {
|
| + return SkNEW_ARGS(GrMatrixConvolutionEffect, (texture,
|
| + bounds,
|
| + kernelSize,
|
| + gain,
|
| + bias,
|
| + kernelOffset,
|
| + tileMode,
|
| + convolveAlpha,
|
| + useBounds,
|
| + sigmaX,
|
| + sigmaY));
|
| }
|
| +
|
| virtual ~GrMatrixConvolutionEffect();
|
|
|
| virtual void getConstantColorComponents(GrColor* color,
|
| @@ -63,6 +95,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 +110,32 @@ private:
|
| SkScalar bias,
|
| const SkIPoint& kernelOffset,
|
| TileMode tileMode,
|
| - bool convolveAlpha);
|
| + bool convolveAlpha,
|
| + bool useBounds);
|
| +
|
| + GrMatrixConvolutionEffect(GrTexture*,
|
| + const SkIRect& bounds,
|
| + const SkISize& kernelSize,
|
| + SkScalar gain,
|
| + SkScalar bias,
|
| + const SkIPoint& kernelOffset,
|
| + TileMode tileMode,
|
| + bool convolveAlpha,
|
| + bool useBounds,
|
| + SkScalar sigmaX,
|
| + SkScalar sigmaY);
|
|
|
| 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;
|
|
|
|
|