Remove isOpaque from SkRuntimeEffect::makeShader signature

Bug: skia:12643
Change-Id: Id5eecb3445082e747def8c87f99a16552857af3f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/506462
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
Brian Osman 2022-02-09 14:57:07 -05:00 committed by SkCQ
parent 7caeb1bdb1
commit 40d7426345
4 changed files with 13 additions and 13 deletions

View File

@ -10,6 +10,12 @@ Milestone 100
std::string_view and std::optional.
* Added SkSurface::resolveMSAA api to force Skia to resolve MSAA draws. Useful for when
Skia wraps a client's texture as the resolve target.
* All of the `makeShader` functions associated with `SkRuntimeEffect` no longer take an
`isOpaque` parameter. These functions will now make a best effort to determine if your
shader always produces opaque output, and optimize accordingly. If you definitely want your
shader to produce opaque output, do so in the shader's SkSL code. This can be done by adjusting
any `return` statement in your shader with a swizzle: `return color.rgb1;`.
https://review.skia.org/506462
* * *

View File

@ -198,12 +198,10 @@ public:
sk_sp<SkShader> makeShader(sk_sp<SkData> uniforms,
sk_sp<SkShader> children[],
size_t childCount,
const SkMatrix* localMatrix = nullptr,
bool /*isOpaque [DEPRECATED]*/ = false) const;
const SkMatrix* localMatrix = nullptr) const;
sk_sp<SkShader> makeShader(sk_sp<SkData> uniforms,
SkSpan<ChildPtr> children,
const SkMatrix* localMatrix = nullptr,
bool /*isOpaque [DEPRECATED]*/ = false) const;
const SkMatrix* localMatrix = nullptr) const;
sk_sp<SkImage> makeImage(GrRecordingContext*,
sk_sp<SkData> uniforms,
@ -483,8 +481,7 @@ public:
SkRuntimeShaderBuilder(const SkRuntimeShaderBuilder&) = default;
~SkRuntimeShaderBuilder();
sk_sp<SkShader> makeShader(const SkMatrix* localMatrix = nullptr,
bool /*isOpaque [DEPRECATED]*/ = false);
sk_sp<SkShader> makeShader(const SkMatrix* localMatrix = nullptr);
sk_sp<SkImage> makeImage(GrRecordingContext*,
const SkMatrix* localMatrix,
SkImageInfo resultInfo,

View File

@ -56,7 +56,7 @@ static void ShaderBuilder_SetUniformMatrix(JNIEnv* env, jobject, jlong native_in
static jlong ShaderBuilder_MakeShader(JNIEnv* env, jobject, jlong native_instance) {
if (auto* builder = reinterpret_cast<SkRuntimeShaderBuilder*>(native_instance)) {
auto shader = builder->makeShader(nullptr, false);
auto shader = builder->makeShader();
return reinterpret_cast<jlong>(shader.release());
}

View File

@ -1321,8 +1321,7 @@ sk_sp<SkFlattenable> SkRuntimeBlender::CreateProc(SkReadBuffer& buffer) {
sk_sp<SkShader> SkRuntimeEffect::makeShader(sk_sp<SkData> uniforms,
sk_sp<SkShader> childShaders[],
size_t childCount,
const SkMatrix* localMatrix,
bool /*isOpaque [DEPRECATED]*/) const {
const SkMatrix* localMatrix) const {
SkSTArray<4, ChildPtr> children(childCount);
for (size_t i = 0; i < childCount; ++i) {
children.emplace_back(childShaders[i]);
@ -1332,8 +1331,7 @@ sk_sp<SkShader> SkRuntimeEffect::makeShader(sk_sp<SkData> uniforms,
sk_sp<SkShader> SkRuntimeEffect::makeShader(sk_sp<SkData> uniforms,
SkSpan<ChildPtr> children,
const SkMatrix* localMatrix,
bool /*isOpaque [DEPRECATED]*/) const {
const SkMatrix* localMatrix) const {
if (!this->allowShader()) {
return nullptr;
}
@ -1555,8 +1553,7 @@ sk_sp<SkImage> SkRuntimeShaderBuilder::makeImage(GrRecordingContext* recordingCo
mipmapped);
}
sk_sp<SkShader> SkRuntimeShaderBuilder::makeShader(const SkMatrix* localMatrix,
bool /*isOpaque [DEPRECATED]*/) {
sk_sp<SkShader> SkRuntimeShaderBuilder::makeShader(const SkMatrix* localMatrix) {
return this->effect()->makeShader(
this->uniforms(), SkMakeSpan(this->children(), this->numChildren()), localMatrix);
}