Implement clone for 6 additional GrFragmentProcessor subclasses.
GrMagnifierEffect
GrMorphologyEffect
GrBicubicEffect
GrGaussianConvolutionFragmentProcessor
GrMatrixConvolutionEffect
GrTextureDomainEffect
Bug: skia:
Change-Id: I69721b9b95346b365723e5ee21dff2dee8884466
Reviewed-on: https://skia-review.googlesource.com/27900
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index cb453fc..46dc2d8 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -178,6 +178,26 @@
fKernelOffset[1] = static_cast<float>(kernelOffset.y());
}
+GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(const GrMatrixConvolutionEffect& that)
+ : INHERITED(kNone_OptimizationFlags)
+ , fCoordTransform(that.fCoordTransform)
+ , fDomain(that.fDomain)
+ , fTextureSampler(that.fTextureSampler)
+ , fKernelSize(that.fKernelSize)
+ , fGain(that.fGain)
+ , fBias(that.fBias)
+ , fConvolveAlpha(that.fConvolveAlpha) {
+ this->initClassID<GrMatrixConvolutionEffect>();
+ this->addCoordTransform(&fCoordTransform);
+ this->addTextureSampler(&fTextureSampler);
+ memcpy(fKernel, that.fKernel, sizeof(float) * fKernelSize.width() * fKernelSize.height());
+ memcpy(fKernelOffset, that.fKernelOffset, sizeof(fKernelOffset));
+}
+
+sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::clone() const {
+ return sk_sp<GrFragmentProcessor>(new GrMatrixConvolutionEffect(*this));
+}
+
void GrMatrixConvolutionEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLMatrixConvolutionEffect::GenKey(*this, caps, b);
@@ -227,7 +247,6 @@
}
}
-
// Static function to create a 2D convolution
sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::MakeGaussian(
sk_sp<GrTextureProxy> proxy,