Wrap GrEffects in GrEffectPtr.
This is the first step towards automatic recycling of scratch resouces in the cache via ref-cnts.
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/7092061
git-svn-id: http://skia.googlecode.com/svn/trunk@7222 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h
index 3638c0c..ff661b2 100644
--- a/src/gpu/effects/GrConvolutionEffect.h
+++ b/src/gpu/effects/GrConvolutionEffect.h
@@ -22,13 +22,26 @@
public:
/// Convolve with an arbitrary user-specified kernel
- GrConvolutionEffect(GrTexture*, Direction,
- int halfWidth, const float* kernel);
+ static GrEffectRef* Create(GrTexture* tex, Direction dir, int halfWidth, const float* kernel) {
+ SkAutoTUnref<GrEffect> effect(SkNEW_ARGS(GrConvolutionEffect, (tex,
+ dir,
+ halfWidth,
+ kernel)));
+ return CreateEffectPtr(effect);
+ }
/// Convolve with a Gaussian kernel
- GrConvolutionEffect(GrTexture*, Direction,
- int halfWidth,
- float gaussianSigma);
+ static GrEffectRef* Create(GrTexture* tex,
+ Direction dir,
+ int halfWidth,
+ float gaussianSigma) {
+ SkAutoTUnref<GrEffect> effect(SkNEW_ARGS(GrConvolutionEffect, (tex,
+ dir,
+ halfWidth,
+ gaussianSigma)));
+ return CreateEffectPtr(effect);
+ }
+
virtual ~GrConvolutionEffect();
const float* kernel() const { return fKernel; }
@@ -56,6 +69,14 @@
float fKernel[kMaxKernelWidth];
private:
+ GrConvolutionEffect(GrTexture*, Direction,
+ int halfWidth, const float* kernel);
+
+ /// Convolve with a Gaussian kernel
+ GrConvolutionEffect(GrTexture*, Direction,
+ int halfWidth,
+ float gaussianSigma);
+
GR_DECLARE_EFFECT_TEST;
typedef Gr1DKernelEffect INHERITED;