Replace addRuntimeEffectDictionary with constructor argument.

Change-Id: I695a76d5b0aad2ffcf8c1e074c465ed3f60016e4
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/557058
Commit-Queue: John Stiles <johnstiles@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
John Stiles 2022-07-09 10:31:55 -04:00 committed by SkCQ
parent 34e9334877
commit a43654ec7e
2 changed files with 9 additions and 5 deletions

View File

@ -96,15 +96,20 @@ struct SkShaderSnippet {
// for program creation and its invocation.
class SkShaderInfo {
public:
SkShaderInfo(SkRuntimeEffectDictionary* rteDict = nullptr)
: fRuntimeEffectDictionary(rteDict) {}
~SkShaderInfo() = default;
SkShaderInfo(SkShaderInfo&&) = default;
SkShaderInfo& operator=(SkShaderInfo&&) = default;
SkShaderInfo(const SkShaderInfo&) = delete;
SkShaderInfo& operator=(const SkShaderInfo&) = delete;
void add(const SkPaintParamsKey::BlockReader& reader) {
fBlockReaders.push_back(reader);
}
void addFlags(SnippetRequirementFlags flags) {
fSnippetRequirementFlags |= flags;
}
void addRuntimeEffectDictionary(SkRuntimeEffectDictionary* dict) {
fRuntimeEffectDictionary = dict;
}
bool needsLocalCoords() const {
return fSnippetRequirementFlags & SnippetRequirementFlags::kLocalCoords;
}

View File

@ -164,11 +164,10 @@ std::string get_sksl_fs(SkShaderCodeDictionary* dict,
return {};
}
SkShaderInfo shaderInfo;
SkShaderInfo shaderInfo(rteDict);
dict->getShaderInfo(desc.paintParamsID(), &shaderInfo);
*blendInfo = shaderInfo.blendInfo();
shaderInfo.addRuntimeEffectDictionary(rteDict);
return shaderInfo.toSkSL();
}