diff options
author | Brian Salomon <bsalomon@google.com> | 2017-07-31 16:27:23 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-07-31 20:51:42 +0000 |
commit | 96271cd1805d55b1a985652eebd0399ebe415283 (patch) | |
tree | 951bef0f222b0eb3c087901cd810f805593e5965 /src/shaders/SkLightingShader.cpp | |
parent | f3ce7e3c673fd4ace2ca56effe4cfd2908919b9d (diff) |
Require clone() be implemented by GrFragmentProcessor subclasses
Change-Id: I66ba0978e5748806d563ff4f26000e4e0095ed24
Reviewed-on: https://skia-review.googlesource.com/29042
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/shaders/SkLightingShader.cpp')
-rw-r--r-- | src/shaders/SkLightingShader.cpp | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/src/shaders/SkLightingShader.cpp b/src/shaders/SkLightingShader.cpp index 88610a073c..97c5ac6ce4 100644 --- a/src/shaders/SkLightingShader.cpp +++ b/src/shaders/SkLightingShader.cpp @@ -122,14 +122,7 @@ public: const char* name() const override { return "LightingFP"; } sk_sp<GrFragmentProcessor> clone() const override { - // Currently we make the child clone here and pass it to the "copy" constructor. This is - // because clone() may fail for processor classes that haven't yet implemented it. Once all - // processors have an implementation the child can be cloned in a true copy constructor. - auto normalFPClone = this->childProcessor(0).clone(); - if (!normalFPClone) { - return nullptr; - } - return sk_sp<GrFragmentProcessor>(new LightingFP(*this, std::move(normalFPClone))); + return sk_sp<GrFragmentProcessor>(new LightingFP(*this)); } const SkTArray<SkLights::Light>& directionalLights() const { return fDirectionalLights; } @@ -263,11 +256,11 @@ private: this->initClassID<LightingFP>(); } - LightingFP(const LightingFP& that, sk_sp<GrFragmentProcessor> normalFPClone) + LightingFP(const LightingFP& that) : INHERITED(kPreservesOpaqueInput_OptimizationFlag) , fDirectionalLights(that.fDirectionalLights) , fAmbientColor(that.fAmbientColor) { - this->registerChildProcessor(std::move(normalFPClone)); + this->registerChildProcessor(that.childProcessor(0).clone()); this->initClassID<LightingFP>(); } |