aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-07-28 07:34:05 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-07-28 11:54:47 +0000
commit3f6f965a5a65415c65fe9e64eb41896c66da771d (patch)
tree1de139167492fd077527517356bbf1f3298a9800 /src/effects
parent71603cca8ec779bb3ad5ad18a3dc69e97910fb7c (diff)
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>
Diffstat (limited to 'src/effects')
-rw-r--r--src/effects/SkMagnifierImageFilter.cpp20
-rw-r--r--src/effects/SkMorphologyImageFilter.cpp18
2 files changed, 38 insertions, 0 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);