aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/effects/SkMagnifierImageFilter.cpp20
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp18
-rw-r--r--src/gpu/effects/GrBicubicEffect.cpp10
-rw-r--r--src/gpu/effects/GrBicubicEffect.h6
-rw-r--r--src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp15
-rw-r--r--src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h8
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.cpp21
-rw-r--r--src/gpu/effects/GrMatrixConvolutionEffect.h4
-rw-r--r--src/gpu/effects/GrTextureDomain.cpp11
-rw-r--r--src/gpu/effects/GrTextureDomain.h6
10 files changed, 113 insertions, 6 deletions
diff --git a/src/effects/SkMagnifierImageFilter.cpp b/src/effects/SkMagnifierImageFilter.cpp
index 7c7c12590b..e640697610 100644
--- a/src/effects/SkMagnifierImageFilter.cpp
+++ b/src/effects/SkMagnifierImageFilter.cpp
@@ -68,6 +68,10 @@ public:
const char* name() const override { return "Magnifier"; }
+ sk_sp<GrFragmentProcessor> clone() const override {
+ return sk_sp<GrFragmentProcessor>(new GrMagnifierEffect(*this));
+ }
+
SkString dumpInfo() const override {
SkString str;
str.appendf("Texture: %d", fTextureSampler.proxy()->uniqueID().asUInt());
@@ -112,6 +116,22 @@ private:
this->addTextureSampler(&fTextureSampler);
}
+ explicit GrMagnifierEffect(const GrMagnifierEffect& that)
+ : INHERITED(that.optimizationFlags())
+ , fCoordTransform(that.fCoordTransform)
+ , fTextureSampler(that.fTextureSampler)
+ , fColorSpaceXform(that.fColorSpaceXform)
+ , fBounds(that.fBounds)
+ , fSrcRect(that.fSrcRect)
+ , fXInvZoom(that.fXInvZoom)
+ , fYInvZoom(that.fYInvZoom)
+ , fXInvInset(that.fXInvInset)
+ , fYInvInset(that.fYInvInset) {
+ this->initClassID<GrMagnifierEffect>();
+ this->addCoordTransform(&fCoordTransform);
+ this->addTextureSampler(&fTextureSampler);
+ }
+
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp
index 9bc1d7660f..c0ac576e6e 100644
--- a/src/effects/SkMorphologyImageFilter.cpp
+++ b/src/effects/SkMorphologyImageFilter.cpp
@@ -179,6 +179,7 @@ private:
bool onIsEqual(const GrFragmentProcessor&) const override;
GrMorphologyEffect(sk_sp<GrTextureProxy>, Direction, int radius, Type, const float range[2]);
+ explicit GrMorphologyEffect(const GrMorphologyEffect&);
GR_DECLARE_FRAGMENT_PROCESSOR_TEST
@@ -339,6 +340,23 @@ GrMorphologyEffect::GrMorphologyEffect(sk_sp<GrTextureProxy> proxy,
}
}
+GrMorphologyEffect::GrMorphologyEffect(const GrMorphologyEffect& that)
+ : INHERITED(that.optimizationFlags())
+ , fCoordTransform(that.fCoordTransform)
+ , fTextureSampler(that.fTextureSampler)
+ , fDirection(that.fDirection)
+ , fRadius(that.fRadius)
+ , fType(that.fType)
+ , fUseRange(that.fUseRange) {
+ this->initClassID<GrMorphologyEffect>();
+ this->addCoordTransform(&fCoordTransform);
+ this->addTextureSampler(&fTextureSampler);
+ if (that.fUseRange) {
+ fRange[0] = that.fRange[0];
+ fRange[1] = that.fRange[1];
+ }
+}
+
void GrMorphologyEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const {
GrGLMorphologyEffect::GenKey(*this, caps, b);
diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp
index dc608c5c9f..4095f93e7a 100644
--- a/src/gpu/effects/GrBicubicEffect.cpp
+++ b/src/gpu/effects/GrBicubicEffect.cpp
@@ -160,7 +160,15 @@ GrBicubicEffect::GrBicubicEffect(sk_sp<GrTextureProxy> proxy,
this->addTextureSampler(&fTextureSampler);
}
-GrBicubicEffect::~GrBicubicEffect() {
+GrBicubicEffect::GrBicubicEffect(const GrBicubicEffect& that)
+ : INHERITED(that.optimizationFlags())
+ , fCoordTransform(that.fCoordTransform)
+ , fDomain(that.fDomain)
+ , fTextureSampler(that.fTextureSampler)
+ , fColorSpaceXform(that.fColorSpaceXform) {
+ this->initClassID<GrBicubicEffect>();
+ this->addCoordTransform(&fCoordTransform);
+ this->addTextureSampler(&fTextureSampler);
}
void GrBicubicEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index 0d4c7c5dd9..65e2c3dbba 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -19,10 +19,13 @@ public:
kFilterTexelPad = 2, // Given a src rect in texels to be filtered, this number of
// surrounding texels are needed by the kernel in x and y.
};
- ~GrBicubicEffect() override;
const char* name() const override { return "Bicubic"; }
+ sk_sp<GrFragmentProcessor> clone() const override {
+ return sk_sp<GrFragmentProcessor>(new GrBicubicEffect(*this));
+ }
+
const GrTextureDomain& domain() const { return fDomain; }
const GrColorSpaceXform* colorSpaceXform() const { return fColorSpaceXform.get(); }
@@ -66,6 +69,7 @@ private:
const SkMatrix &matrix, const SkShader::TileMode tileModes[2]);
GrBicubicEffect(sk_sp<GrTextureProxy>, sk_sp<GrColorSpaceXform>,
const SkMatrix &matrix, const SkRect& domain);
+ explicit GrBicubicEffect(const GrBicubicEffect&);
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index 6d51cf9ed1..ebe86dd8f7 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -217,7 +217,20 @@ GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor(
memcpy(fBounds, bounds, sizeof(fBounds));
}
-GrGaussianConvolutionFragmentProcessor::~GrGaussianConvolutionFragmentProcessor() {}
+GrGaussianConvolutionFragmentProcessor::GrGaussianConvolutionFragmentProcessor(
+ const GrGaussianConvolutionFragmentProcessor& that)
+ : INHERITED(that.optimizationFlags())
+ , fCoordTransform(that.fCoordTransform)
+ , fTextureSampler(that.fTextureSampler)
+ , fRadius(that.fRadius)
+ , fDirection(that.fDirection)
+ , fMode(that.fMode) {
+ this->initClassID<GrGaussianConvolutionFragmentProcessor>();
+ this->addCoordTransform(&fCoordTransform);
+ this->addTextureSampler(&fTextureSampler);
+ memcpy(fKernel, that.fKernel, that.width() * sizeof(float));
+ memcpy(fBounds, that.fBounds, sizeof(fBounds));
+}
void GrGaussianConvolutionFragmentProcessor::onGetGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const {
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h
index bdc4384a2c..74e9a94c2d 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.h
@@ -32,8 +32,6 @@ public:
std::move(proxy), dir, halfWidth, gaussianSigma, mode, bounds));
}
- ~GrGaussianConvolutionFragmentProcessor() override;
-
const float* kernel() const { return fKernel; }
const int* bounds() const { return fBounds; }
@@ -46,6 +44,10 @@ public:
const char* name() const override { return "GaussianConvolution"; }
+ sk_sp<GrFragmentProcessor> clone() const override {
+ return sk_sp<GrFragmentProcessor>(new GrGaussianConvolutionFragmentProcessor(*this));
+ }
+
// This was decided based on the min allowed value for the max texture
// samples per fragment program run in DX9SM2 (32). A sigma param of 4.0
// on a blur filter gives a kernel width of 25 while a sigma of 5.0
@@ -61,6 +63,8 @@ private:
int halfWidth, float gaussianSigma,
GrTextureDomain::Mode mode, int bounds[2]);
+ explicit GrGaussianConvolutionFragmentProcessor(const GrGaussianConvolutionFragmentProcessor&);
+
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index cb453fc941..46dc2d8cb9 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -178,6 +178,26 @@ GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrTextureProxy> proxy
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 void fill_in_2D_gaussian_kernel(float* kernel, int width, int height,
}
}
-
// Static function to create a 2D convolution
sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::MakeGaussian(
sk_sp<GrTextureProxy> proxy,
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.h b/src/gpu/effects/GrMatrixConvolutionEffect.h
index a89d640b52..9ece00ee5d 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.h
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.h
@@ -52,6 +52,8 @@ public:
const char* name() const override { return "MatrixConvolution"; }
+ sk_sp<GrFragmentProcessor> clone() const override;
+
private:
GrMatrixConvolutionEffect(sk_sp<GrTextureProxy> proxy,
const SkIRect& bounds,
@@ -63,6 +65,8 @@ private:
GrTextureDomain::Mode tileMode,
bool convolveAlpha);
+ GrMatrixConvolutionEffect(const GrMatrixConvolutionEffect&);
+
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index e26ea67462..fa560580e4 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -242,6 +242,17 @@ GrTextureDomainEffect::GrTextureDomainEffect(sk_sp<GrTextureProxy> proxy,
this->addTextureSampler(&fTextureSampler);
}
+GrTextureDomainEffect::GrTextureDomainEffect(const GrTextureDomainEffect& that)
+ : INHERITED(that.optimizationFlags())
+ , fCoordTransform(that.fCoordTransform)
+ , fTextureDomain(that.fTextureDomain)
+ , fTextureSampler(that.fTextureSampler)
+ , fColorSpaceXform(that.fColorSpaceXform) {
+ this->initClassID<GrTextureDomainEffect>();
+ this->addCoordTransform(&fCoordTransform);
+ this->addTextureSampler(&fTextureSampler);
+}
+
void GrTextureDomainEffect::onGetGLSLProcessorKey(const GrShaderCaps& caps,
GrProcessorKeyBuilder* b) const {
b->add32(GrTextureDomain::GLDomain::DomainKey(fTextureDomain));
diff --git a/src/gpu/effects/GrTextureDomain.h b/src/gpu/effects/GrTextureDomain.h
index f134d8deb5..96bbc235c3 100644
--- a/src/gpu/effects/GrTextureDomain.h
+++ b/src/gpu/effects/GrTextureDomain.h
@@ -162,6 +162,10 @@ public:
const char* name() const override { return "TextureDomain"; }
+ sk_sp<GrFragmentProcessor> clone() const override {
+ return sk_sp<GrFragmentProcessor>(new GrTextureDomainEffect(*this));
+ }
+
SkString dumpInfo() const override {
SkString str;
str.appendf("Domain: [L: %.2f, T: %.2f, R: %.2f, B: %.2f]",
@@ -184,6 +188,8 @@ private:
GrTextureDomain::Mode,
GrSamplerParams::FilterMode);
+ explicit GrTextureDomainEffect(const GrTextureDomainEffect&);
+
static OptimizationFlags OptFlags(GrPixelConfig config, GrTextureDomain::Mode mode);
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;