Add helper method to clone and register a child FP.
This will remove common boilerplate from our gen-code, and gives us a
place to put common child-cloning boilerplate.
Change-Id: I6101655af89d4c5844ec908b81ce4f6e5d59f834
Bug: skia:10217
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/296177
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
diff --git a/src/gpu/effects/generated/GrComposeLerpEffect.cpp b/src/gpu/effects/generated/GrComposeLerpEffect.cpp
index 7c06231..cacabf7 100644
--- a/src/gpu/effects/generated/GrComposeLerpEffect.cpp
+++ b/src/gpu/effects/generated/GrComposeLerpEffect.cpp
@@ -68,18 +68,10 @@
GrComposeLerpEffect::GrComposeLerpEffect(const GrComposeLerpEffect& src)
: INHERITED(kGrComposeLerpEffect_ClassID, src.optimizationFlags()), weight(src.weight) {
if (src.child1_index >= 0) {
- auto child1_clone = src.childProcessor(src.child1_index).clone();
- if (src.childProcessor(src.child1_index).isSampledWithExplicitCoords()) {
- child1_clone->setSampledWithExplicitCoords();
- }
- child1_index = this->registerChildProcessor(std::move(child1_clone));
+ child1_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.child1_index));
}
if (src.child2_index >= 0) {
- auto child2_clone = src.childProcessor(src.child2_index).clone();
- if (src.childProcessor(src.child2_index).isSampledWithExplicitCoords()) {
- child2_clone->setSampledWithExplicitCoords();
- }
- child2_index = this->registerChildProcessor(std::move(child2_clone));
+ child2_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.child2_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrComposeLerpEffect::clone() const {