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/gradients/generated/GrTiledGradientEffect.cpp b/src/gpu/gradients/generated/GrTiledGradientEffect.cpp
index db612f2..761c4e6 100644
--- a/src/gpu/gradients/generated/GrTiledGradientEffect.cpp
+++ b/src/gpu/gradients/generated/GrTiledGradientEffect.cpp
@@ -76,18 +76,12 @@
, makePremul(src.makePremul)
, colorsAreOpaque(src.colorsAreOpaque) {
{
- auto colorizer_clone = src.childProcessor(src.colorizer_index).clone();
- if (src.childProcessor(src.colorizer_index).isSampledWithExplicitCoords()) {
- colorizer_clone->setSampledWithExplicitCoords();
- }
- colorizer_index = this->registerChildProcessor(std::move(colorizer_clone));
+ colorizer_index =
+ this->cloneAndRegisterChildProcessor(src.childProcessor(src.colorizer_index));
}
{
- auto gradLayout_clone = src.childProcessor(src.gradLayout_index).clone();
- if (src.childProcessor(src.gradLayout_index).isSampledWithExplicitCoords()) {
- gradLayout_clone->setSampledWithExplicitCoords();
- }
- gradLayout_index = this->registerChildProcessor(std::move(gradLayout_clone));
+ gradLayout_index =
+ this->cloneAndRegisterChildProcessor(src.childProcessor(src.gradLayout_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrTiledGradientEffect::clone() const {