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>
This commit is contained in:
John Stiles 2020-06-15 10:48:49 -04:00 committed by Skia Commit-Bot
parent b48895dca2
commit 3779f448ca
25 changed files with 59 additions and 194 deletions

View File

@ -519,15 +519,8 @@ GrDisplacementMapEffect::GrDisplacementMapEffect(const GrDisplacementMapEffect&
, fXChannelSelector(that.fXChannelSelector)
, fYChannelSelector(that.fYChannelSelector)
, fScale(that.fScale) {
auto displacement = that.childProcessor(0).clone();
if (that.childProcessor(0).isSampledWithExplicitCoords()) {
displacement->setSampledWithExplicitCoords();
}
this->registerChildProcessor(std::move(displacement));
auto color = that.childProcessor(1).clone();
color->setSampledWithExplicitCoords();
this->registerChildProcessor(std::move(color));
this->cloneAndRegisterChildProcessor(that.childProcessor(0)); // Displacement
this->cloneAndRegisterChildProcessor(that.childProcessor(1)); // Color
this->addCoordTransform(&fCoordTransform);
}

View File

@ -141,6 +141,14 @@ int GrFragmentProcessor::registerChildProcessor(std::unique_ptr<GrFragmentProces
return index;
}
int GrFragmentProcessor::cloneAndRegisterChildProcessor(const GrFragmentProcessor& fp) {
std::unique_ptr<GrFragmentProcessor> clone = fp.clone();
if (fp.isSampledWithExplicitCoords()) {
clone->setSampledWithExplicitCoords();
}
return this->registerChildProcessor(std::move(clone));
}
bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) const {
if (this->numCoordTransforms() != that.numCoordTransforms()) {
return false;

View File

@ -411,6 +411,13 @@ protected:
*/
int registerChildProcessor(std::unique_ptr<GrFragmentProcessor> child);
/**
* This method takes an existing fragment processor, clones it, registers it as a child of this
* fragment processor, and returns its child index. It also takes care of any boilerplate in the
* cloning process.
*/
int cloneAndRegisterChildProcessor(const GrFragmentProcessor& fp);
void setTextureSamplerCnt(int cnt) {
SkASSERT(cnt >= 0);
fTextureSamplerCnt = cnt;

View File

@ -51,11 +51,7 @@ bool GrMatrixEffect::onIsEqual(const GrFragmentProcessor& other) const {
GrMatrixEffect::GrMatrixEffect(const GrMatrixEffect& src)
: INHERITED(kGrMatrixEffect_ClassID, src.optimizationFlags())
, fMatrix(src.fMatrix) {
auto child = src.childProcessor(0).clone();
if (src.childProcessor(0).isSampledWithExplicitCoords()) {
child->setSampledWithExplicitCoords();
}
this->registerChildProcessor(std::move(child));
this->cloneAndRegisterChildProcessor(src.childProcessor(0));
}
std::unique_ptr<GrFragmentProcessor> GrMatrixEffect::clone() const {

View File

@ -105,11 +105,7 @@ GrAARectEffect::GrAARectEffect(const GrAARectEffect& src)
, edgeType(src.edgeType)
, rect(src.rect) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrAARectEffect::clone() const {

View File

@ -96,11 +96,7 @@ GrAlphaThresholdFragmentProcessor::GrAlphaThresholdFragmentProcessor(
, innerThreshold(src.innerThreshold)
, outerThreshold(src.outerThreshold) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
this->setTextureSamplerCnt(1);
this->addCoordTransform(&maskCoordTransform);

View File

@ -63,11 +63,7 @@ GrBlurredEdgeFragmentProcessor::GrBlurredEdgeFragmentProcessor(
: INHERITED(kGrBlurredEdgeFragmentProcessor_ClassID, src.optimizationFlags())
, mode(src.mode) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrBlurredEdgeFragmentProcessor::clone() const {

View File

@ -359,11 +359,7 @@ GrCircleBlurFragmentProcessor::GrCircleBlurFragmentProcessor(
, solidRadius(src.solidRadius)
, blurProfileSampler(src.blurProfileSampler) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
this->setTextureSamplerCnt(1);
}

View File

@ -112,11 +112,7 @@ GrCircleEffect::GrCircleEffect(const GrCircleEffect& src)
, center(src.center)
, radius(src.radius) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrCircleEffect::clone() const {

View File

@ -61,11 +61,7 @@ GrClampFragmentProcessor::GrClampFragmentProcessor(const GrClampFragmentProcesso
: INHERITED(kGrClampFragmentProcessor_ClassID, src.optimizationFlags())
, clampToPremul(src.clampToPremul) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrClampFragmentProcessor::clone() const {

View File

@ -110,11 +110,7 @@ GrColorMatrixFragmentProcessor::GrColorMatrixFragmentProcessor(
, clampRGBOutput(src.clampRGBOutput)
, premulOutput(src.premulOutput) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrColorMatrixFragmentProcessor::clone() const {

View File

@ -68,18 +68,10 @@ bool GrComposeLerpEffect::onIsEqual(const GrFragmentProcessor& other) const {
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 {

View File

@ -58,13 +58,7 @@ bool GrDeviceSpaceEffect::onIsEqual(const GrFragmentProcessor& other) const {
}
GrDeviceSpaceEffect::GrDeviceSpaceEffect(const GrDeviceSpaceEffect& src)
: INHERITED(kGrDeviceSpaceEffect_ClassID, src.optimizationFlags()), matrix(src.matrix) {
{
auto fp_clone = src.childProcessor(src.fp_index).clone();
if (src.childProcessor(src.fp_index).isSampledWithExplicitCoords()) {
fp_clone->setSampledWithExplicitCoords();
}
fp_index = this->registerChildProcessor(std::move(fp_clone));
}
{ fp_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.fp_index)); }
}
std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceEffect::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrDeviceSpaceEffect(*this));

View File

@ -136,11 +136,7 @@ GrEllipseEffect::GrEllipseEffect(const GrEllipseEffect& src)
, center(src.center)
, radii(src.radii) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrEllipseEffect::clone() const {

View File

@ -56,11 +56,7 @@ bool GrHSLToRGBFilterEffect::onIsEqual(const GrFragmentProcessor& other) const {
GrHSLToRGBFilterEffect::GrHSLToRGBFilterEffect(const GrHSLToRGBFilterEffect& src)
: INHERITED(kGrHSLToRGBFilterEffect_ClassID, src.optimizationFlags()) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrHSLToRGBFilterEffect::clone() const {

View File

@ -54,11 +54,7 @@ bool GrLumaColorFilterEffect::onIsEqual(const GrFragmentProcessor& other) const
GrLumaColorFilterEffect::GrLumaColorFilterEffect(const GrLumaColorFilterEffect& src)
: INHERITED(kGrLumaColorFilterEffect_ClassID, src.optimizationFlags()) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrLumaColorFilterEffect::clone() const {

View File

@ -65,19 +65,9 @@ bool GrMixerEffect::onIsEqual(const GrFragmentProcessor& other) const {
}
GrMixerEffect::GrMixerEffect(const GrMixerEffect& src)
: INHERITED(kGrMixerEffect_ClassID, src.optimizationFlags()), weight(src.weight) {
{
auto fp0_clone = src.childProcessor(src.fp0_index).clone();
if (src.childProcessor(src.fp0_index).isSampledWithExplicitCoords()) {
fp0_clone->setSampledWithExplicitCoords();
}
fp0_index = this->registerChildProcessor(std::move(fp0_clone));
}
{ fp0_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.fp0_index)); }
if (src.fp1_index >= 0) {
auto fp1_clone = src.childProcessor(src.fp1_index).clone();
if (src.childProcessor(src.fp1_index).isSampledWithExplicitCoords()) {
fp1_clone->setSampledWithExplicitCoords();
}
fp1_index = this->registerChildProcessor(std::move(fp1_clone));
fp1_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.fp1_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrMixerEffect::clone() const {

View File

@ -90,13 +90,7 @@ GrOverrideInputFragmentProcessor::GrOverrideInputFragmentProcessor(
, useUniform(src.useUniform)
, uniformColor(src.uniformColor)
, literalColor(src.literalColor) {
{
auto fp_clone = src.childProcessor(src.fp_index).clone();
if (src.childProcessor(src.fp_index).isSampledWithExplicitCoords()) {
fp_clone->setSampledWithExplicitCoords();
}
fp_index = this->registerChildProcessor(std::move(fp_clone));
}
{ fp_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.fp_index)); }
}
std::unique_ptr<GrFragmentProcessor> GrOverrideInputFragmentProcessor::clone() const {
return std::unique_ptr<GrFragmentProcessor>(new GrOverrideInputFragmentProcessor(*this));

View File

@ -58,11 +58,7 @@ bool GrRGBToHSLFilterEffect::onIsEqual(const GrFragmentProcessor& other) const {
GrRGBToHSLFilterEffect::GrRGBToHSLFilterEffect(const GrRGBToHSLFilterEffect& src)
: INHERITED(kGrRGBToHSLFilterEffect_ClassID, src.optimizationFlags()) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
}
std::unique_ptr<GrFragmentProcessor> GrRGBToHSLFilterEffect::clone() const {

View File

@ -159,11 +159,7 @@ GrRRectBlurEffect::GrRRectBlurEffect(const GrRRectBlurEffect& src)
, cornerRadius(src.cornerRadius)
, ninePatchSampler(src.ninePatchSampler) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
this->setTextureSamplerCnt(1);
}

View File

@ -166,11 +166,7 @@ GrRectBlurEffect::GrRectBlurEffect(const GrRectBlurEffect& src)
, invSixSigma(src.invSixSigma)
, isFast(src.isFast) {
if (src.inputFP_index >= 0) {
auto inputFP_clone = src.childProcessor(src.inputFP_index).clone();
if (src.childProcessor(src.inputFP_index).isSampledWithExplicitCoords()) {
inputFP_clone->setSampledWithExplicitCoords();
}
inputFP_index = this->registerChildProcessor(std::move(inputFP_clone));
inputFP_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.inputFP_index));
}
this->setTextureSamplerCnt(1);
}

View File

@ -100,18 +100,12 @@ GrClampedGradientEffect::GrClampedGradientEffect(const GrClampedGradientEffect&
, 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> GrClampedGradientEffect::clone() const {

View File

@ -76,18 +76,12 @@ GrTiledGradientEffect::GrTiledGradientEffect(const GrTiledGradientEffect& src)
, 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 {

View File

@ -1143,15 +1143,10 @@ void CPPCodeGenerator::writeClone() {
} else {
this->write(" {\n");
}
this->writef(
" auto %s_clone = src.childProcessor(src.%s_index).clone();\n"
" if (src.childProcessor(src.%s_index).isSampledWithExplicitCoords()) {\n"
" %s_clone->setSampledWithExplicitCoords();\n"
" }\n"
" %s_index = this->registerChildProcessor(std::move(%s_clone));\n"
" }\n",
fieldName.c_str(), fieldName.c_str(), fieldName.c_str(),
fieldName.c_str(), fieldName.c_str(), fieldName.c_str());
this->writef(" %s_index = this->cloneAndRegisterChildProcessor("
"src.childProcessor(src.%s_index));\n"
" }\n",
fieldName.c_str(), fieldName.c_str());
}
}
if (samplerCount) {

View File

@ -544,18 +544,10 @@ DEF_TEST(SkSLFPChildProcessors, r) {
"fragBuilder->codeAppendf(\"%s = %s * %s;\\n\", args.fOutputColor, "
"_sample149.c_str(), _sample166.c_str());\n",
"{",
" 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));",
"}",
"{",
" 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));",
"}",
});
}
@ -586,18 +578,10 @@ DEF_TEST(SkSLFPChildProcessorsWithInput, r) {
"SkString _sample258;",
"_sample258 = this->invokeChild(_outer.child2_index, _input258.c_str(), args);",
"{",
" 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));",
"}",
"{",
" 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));",
"}"
});
}
@ -620,11 +604,7 @@ DEF_TEST(SkSLFPChildProcessorWithInputExpression, r) {
"_sample106 = this->invokeChild(_outer.child_index, _input106.c_str(), args);",
"fragBuilder->codeAppendf(\"%s = %s;\\n\", args.fOutputColor, _sample106.c_str());",
"{",
" auto child_clone = src.childProcessor(src.child_index).clone();",
" if (src.childProcessor(src.child_index).isSampledWithExplicitCoords()) {",
" child_clone->setSampledWithExplicitCoords();",
" }",
" child_index = this->registerChildProcessor(std::move(child_clone));",
" child_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.child_index));",
"}",
});
}
@ -652,18 +632,10 @@ DEF_TEST(SkSLFPNestedChildProcessors, r) {
"_sample149 = this->invokeChild(_outer.child2_index, _input149.c_str(), args);",
"fragBuilder->codeAppendf(\"%s = %s;\\n\", args.fOutputColor, _sample149.c_str());",
"{",
" 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));",
"}",
"{",
" 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));",
"}",
});
}
@ -695,11 +667,7 @@ DEF_TEST(SkSLFPChildFPAndGlobal, r) {
"fragBuilder->codeAppendf(\"\\n %s = %s;\\n} else {\\n %s = half4(1.0);\\n}\\n\","
" args.fOutputColor, _sample200.c_str(), args.fOutputColor);",
"{",
" auto child_clone = src.childProcessor(src.child_index).clone();",
" if (src.childProcessor(src.child_index).isSampledWithExplicitCoords()) {",
" child_clone->setSampledWithExplicitCoords();",
" }",
" child_index = this->registerChildProcessor(std::move(child_clone));",
" child_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.child_index));",
"}",
});
}
@ -729,11 +697,7 @@ DEF_TEST(SkSLFPChildProcessorInlineFieldAccess, r) {
"fragBuilder->codeAppendf(\"\\n %s = %s;\\n} else {\\n %s = half4(1.0);\\n}\\n\","
" args.fOutputColor, _sample161.c_str(), args.fOutputColor);",
"{",
" auto child_clone = src.childProcessor(src.child_index).clone();",
" if (src.childProcessor(src.child_index).isSampledWithExplicitCoords()) {",
" child_clone->setSampledWithExplicitCoords();",
" }",
" child_index = this->registerChildProcessor(std::move(child_clone));",
" child_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.child_index));",
"}",
});
}
@ -764,11 +728,7 @@ DEF_TEST(SkSLFPChildProcessorFieldAccess, r) {
"fragBuilder->codeAppendf(\"\\n %s = %s;\\n} else {\\n %s = half4(0.5);\\n}\\n\","
" args.fOutputColor, _sample196.c_str(), args.fOutputColor);",
"{",
" auto child_clone = src.childProcessor(src.child_index).clone();",
" if (src.childProcessor(src.child_index).isSampledWithExplicitCoords()) {",
" child_clone->setSampledWithExplicitCoords();",
" }",
" child_index = this->registerChildProcessor(std::move(child_clone));",
" child_index = this->cloneAndRegisterChildProcessor(src.childProcessor(src.child_index));",
"}",
});
}