Remove extra GrSkSLFP constructor

Both Make() factories have a similar pattern now (sharing the simpler
constructor, and appending uniforms in the factory).

Change-Id: I362afd19c9fc0fa45f614df00c232a099ac16b4b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/417597
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: Brian Osman <brianosman@google.com>
Reviewed-by: John Stiles <johnstiles@google.com>
This commit is contained in:
Brian Osman 2021-06-10 14:40:40 -04:00 committed by Skia Commit-Bot
parent ecc8e3bc04
commit 1f5ee0d00c
2 changed files with 3 additions and 18 deletions

View File

@ -190,8 +190,9 @@ std::unique_ptr<GrSkSLFP> GrSkSLFP::Make(sk_sp<SkRuntimeEffect> effect,
return nullptr;
}
size_t uniformSize = uniforms->size();
return std::unique_ptr<GrSkSLFP>(
new (uniformSize) GrSkSLFP(std::move(effect), name, std::move(uniforms)));
std::unique_ptr<GrSkSLFP> fp(new (uniformSize) GrSkSLFP(std::move(effect), name));
sk_careful_memcpy(fp->uniformData(), uniforms->data(), uniformSize);
return fp;
}
GrSkSLFP::GrSkSLFP(sk_sp<SkRuntimeEffect> effect, const char* name)
@ -207,21 +208,6 @@ GrSkSLFP::GrSkSLFP(sk_sp<SkRuntimeEffect> effect, const char* name)
}
}
GrSkSLFP::GrSkSLFP(sk_sp<SkRuntimeEffect> effect, const char* name, sk_sp<SkData> uniforms)
: INHERITED(kGrSkSLFP_ClassID,
effect->getFilterColorProgram()
? kConstantOutputForConstantInput_OptimizationFlag
: kNone_OptimizationFlags)
, fEffect(std::move(effect))
, fName(name)
, fUniformSize(uniforms->size()) {
sk_careful_memcpy(this->uniformData(), uniforms->data(), fUniformSize);
if (fEffect->usesSampleCoords()) {
this->setUsesSampleCoordsDirectly();
}
}
GrSkSLFP::GrSkSLFP(const GrSkSLFP& other)
: INHERITED(kGrSkSLFP_ClassID, other.optimizationFlags())
, fEffect(other.fEffect)

View File

@ -106,7 +106,6 @@ public:
private:
GrSkSLFP(sk_sp<SkRuntimeEffect> effect, const char* name);
GrSkSLFP(sk_sp<SkRuntimeEffect> effect, const char* name, sk_sp<SkData> uniforms);
GrSkSLFP(const GrSkSLFP& other);
std::unique_ptr<GrGLSLFragmentProcessor> onMakeProgramImpl() const override;