Remove deprecated form of SkRuntimeEffect::Make.
Chromium has migrated to the new API at https://crrev.com/c/2675855.
Change-Id: Id4af77db2c462348e8031d28f56e543ad619c19c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/367060
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt
index 0d9af45..b370254 100644
--- a/RELEASE_NOTES.txt
+++ b/RELEASE_NOTES.txt
@@ -30,6 +30,7 @@
* Updated SkRuntimeEffect::Make() to take an Options struct. It also now returns a Results struct
instead of a tuple.
https://review.skia.org/363785
+ https://review.skia.org/367060
* Changed SkRuntimeEffect::Varying to have lower-case member names, with no 'f' prefix.
https://review.skia.org/365656
diff --git a/bench/ColorFilterBench.cpp b/bench/ColorFilterBench.cpp
index b94ab5e..d92331b 100644
--- a/bench/ColorFilterBench.cpp
+++ b/bench/ColorFilterBench.cpp
@@ -204,14 +204,14 @@
#if SK_SUPPORT_GPU
DEF_BENCH( return new ColorFilterBench("src_runtime", []() {
- static sk_sp<SkRuntimeEffect> gEffect = std::get<0>(
- SkRuntimeEffect::Make(SkString(RuntimeNone_GPU_SRC)));
+ static sk_sp<SkRuntimeEffect> gEffect =
+ SkRuntimeEffect::Make(SkString(RuntimeNone_GPU_SRC)).effect;
sk_sp<SkColorFilter> input = nullptr;
return gEffect->makeColorFilter(SkData::MakeEmpty(), &input, 1);
});)
DEF_BENCH( return new ColorFilterBench("matrix_runtime", []() {
- static sk_sp<SkRuntimeEffect> gEffect = std::get<0>(
- SkRuntimeEffect::Make(SkString(RuntimeColorMatrix_GPU_SRC)));
+ static sk_sp<SkRuntimeEffect> gEffect =
+ SkRuntimeEffect::Make(SkString(RuntimeColorMatrix_GPU_SRC)).effect;
sk_sp<SkColorFilter> input = nullptr;
return gEffect->makeColorFilter(SkData::MakeWithCopy(gColorMatrix, sizeof(gColorMatrix)),
&input, 1);
diff --git a/gm/fp_sample_chaining.cpp b/gm/fp_sample_chaining.cpp
index 5af0606..689aec9 100644
--- a/gm/fp_sample_chaining.cpp
+++ b/gm/fp_sample_chaining.cpp
@@ -316,10 +316,10 @@
SkBitmap bmp = make_test_bitmap();
sk_sp<SkRuntimeEffect> effects[4] = {
- std::get<0>(SkRuntimeEffect::Make(SkString(gConstantMatrixSkSL))),
- std::get<0>(SkRuntimeEffect::Make(SkString(gUniformMatrixSkSL))),
- std::get<0>(SkRuntimeEffect::Make(SkString(gVariableMatrixSkSL))),
- std::get<0>(SkRuntimeEffect::Make(SkString(gExplicitCoordSkSL))),
+ SkRuntimeEffect::Make(SkString(gConstantMatrixSkSL)).effect,
+ SkRuntimeEffect::Make(SkString(gUniformMatrixSkSL)).effect,
+ SkRuntimeEffect::Make(SkString(gVariableMatrixSkSL)).effect,
+ SkRuntimeEffect::Make(SkString(gExplicitCoordSkSL)).effect,
};
canvas->translate(10, 10);
diff --git a/gm/mixercolorfilter.cpp b/gm/mixercolorfilter.cpp
index 5d73024..f76b164 100644
--- a/gm/mixercolorfilter.cpp
+++ b/gm/mixercolorfilter.cpp
@@ -117,7 +117,7 @@
return mix(sample(cf0), sample(cf1), t);
}
)";
- effect = std::get<0>(SkRuntimeEffect::Make(SkString(sksl)));
+ effect = SkRuntimeEffect::Make(SkString(sksl)).effect;
SkASSERT(effect);
}
diff --git a/gm/runtimefunctions.cpp b/gm/runtimefunctions.cpp
index f8b7450..d4fbf16 100644
--- a/gm/runtimefunctions.cpp
+++ b/gm/runtimefunctions.cpp
@@ -39,7 +39,7 @@
void onDraw(SkCanvas* canvas) override {
sk_sp<SkRuntimeEffect> gEffect =
- std::get<0>(SkRuntimeEffect::Make(SkString(RUNTIME_FUNCTIONS_SRC)));
+ SkRuntimeEffect::Make(SkString(RUNTIME_FUNCTIONS_SRC)).effect;
SkASSERT(gEffect);
SkMatrix localM;
diff --git a/gm/runtimeshader.cpp b/gm/runtimeshader.cpp
index 719fbac..ac09a0a 100644
--- a/gm/runtimeshader.cpp
+++ b/gm/runtimeshader.cpp
@@ -356,7 +356,7 @@
surf->getCanvas()->drawLine(0, 0, 100, 100, p);
auto shader = surf->makeImageSnapshot()->makeShader(SkSamplingOptions(SkFilterMode::kLinear));
- SkRuntimeShaderBuilder builder(std::get<0>(SkRuntimeEffect::Make(SkString(scale))));
+ SkRuntimeShaderBuilder builder(SkRuntimeEffect::Make(SkString(scale)).effect);
builder.child("child") = shader;
p.setShader(builder.makeShader(nullptr, false));
diff --git a/gm/vertices.cpp b/gm/vertices.cpp
index 9aaf51a..d8d3a80 100644
--- a/gm/vertices.cpp
+++ b/gm/vertices.cpp
@@ -305,7 +305,7 @@
return vtx_color;
}
)";
- auto[effect, errorText] = SkRuntimeEffect::Make(SkString(gProg));
+ auto [effect, errorText] = SkRuntimeEffect::Make(SkString(gProg));
if (!effect) {
SK_ABORT("RuntimeEffect error: %s\n", errorText.c_str());
}
diff --git a/include/effects/SkRuntimeEffect.h b/include/effects/SkRuntimeEffect.h
index 08b3289..8093588 100644
--- a/include/effects/SkRuntimeEffect.h
+++ b/include/effects/SkRuntimeEffect.h
@@ -87,12 +87,9 @@
static Result Make(SkString sksl, const Options& options);
- // Older/deprecated version of the Make() API:
- using EffectResult = std::tuple<sk_sp<SkRuntimeEffect>, SkString>;
- static EffectResult Make(SkString sksl) {
- Result result = Make(sksl, Options{});
- return EffectResult{std::move(result.effect), std::move(result.errorText)};
- }
+ // We can't use a default argument for `options` due to a bug in Clang.
+ // https://bugs.llvm.org/show_bug.cgi?id=36684
+ static Result Make(SkString sksl) { return Make(std::move(sksl), Options{}); }
sk_sp<SkShader> makeShader(sk_sp<SkData> uniforms,
sk_sp<SkShader> children[],
diff --git a/modules/skottie/src/effects/BlackAndWhiteEffect.cpp b/modules/skottie/src/effects/BlackAndWhiteEffect.cpp
index b84232c..dd1f59e 100644
--- a/modules/skottie/src/effects/BlackAndWhiteEffect.cpp
+++ b/modules/skottie/src/effects/BlackAndWhiteEffect.cpp
@@ -64,7 +64,7 @@
)";
static const SkRuntimeEffect* effect =
- std::get<0>(SkRuntimeEffect::Make(SkString(BLACK_AND_WHITE_EFFECT))).release();
+ SkRuntimeEffect::Make(SkString(BLACK_AND_WHITE_EFFECT)).effect.release();
SkASSERT(effect);
return sk_ref_sp(effect);
diff --git a/modules/skottie/src/effects/BrightnessContrastEffect.cpp b/modules/skottie/src/effects/BrightnessContrastEffect.cpp
index 5acdb33..f0f870d 100644
--- a/modules/skottie/src/effects/BrightnessContrastEffect.cpp
+++ b/modules/skottie/src/effects/BrightnessContrastEffect.cpp
@@ -140,8 +140,8 @@
const AnimationBuilder& abuilder,
sk_sp<sksg::RenderNode> layer)
: INHERITED(sksg::ExternalColorFilter::Make(std::move(layer)))
- , fBrightnessEffect(std::get<0>(SkRuntimeEffect::Make(SkString(BRIGHTNESS_EFFECT))))
- , fContrastEffect(std::get<0>(SkRuntimeEffect::Make(SkString(CONTRAST_EFFECT)))) {
+ , fBrightnessEffect(SkRuntimeEffect::Make(SkString(BRIGHTNESS_EFFECT)).effect)
+ , fContrastEffect(SkRuntimeEffect::Make(SkString(CONTRAST_EFFECT)).effect) {
SkASSERT(fBrightnessEffect);
SkASSERT(fContrastEffect);
diff --git a/modules/skottie/src/effects/DisplacementMapEffect.cpp b/modules/skottie/src/effects/DisplacementMapEffect.cpp
index 94091d1..a3a244b 100644
--- a/modules/skottie/src/effects/DisplacementMapEffect.cpp
+++ b/modules/skottie/src/effects/DisplacementMapEffect.cpp
@@ -55,9 +55,9 @@
static sk_sp<SkRuntimeEffect> displacement_effect_singleton() {
static const SkRuntimeEffect* effect =
- std::get<0>(SkRuntimeEffect::Make(SkString(gDisplacementSkSL))).release();
+ SkRuntimeEffect::Make(SkString(gDisplacementSkSL)).effect.release();
if (0 && !effect) {
- auto err = std::get<1>(SkRuntimeEffect::Make(SkString(gDisplacementSkSL)));
+ auto err = SkRuntimeEffect::Make(SkString(gDisplacementSkSL)).errorText;
printf("!!! %s\n", err.c_str());
}
SkASSERT(effect);
diff --git a/modules/skottie/src/effects/SphereEffect.cpp b/modules/skottie/src/effects/SphereEffect.cpp
index 3c4a9ff..7614c83 100644
--- a/modules/skottie/src/effects/SphereEffect.cpp
+++ b/modules/skottie/src/effects/SphereEffect.cpp
@@ -78,10 +78,9 @@
static sk_sp<SkRuntimeEffect> sphere_effect_singleton() {
static const SkRuntimeEffect* effect =
- SkRuntimeEffect::Make(SkString(gSphereSkSL), /*options=*/{}).effect.release();
+ SkRuntimeEffect::Make(SkString(gSphereSkSL)).effect.release();
if (0 && !effect) {
- printf("!!! %s\n",
- SkRuntimeEffect::Make(SkString(gSphereSkSL), /*options=*/{}).errorText.c_str());
+ printf("!!! %s\n", SkRuntimeEffect::Make(SkString(gSphereSkSL)).errorText.c_str());
}
SkASSERT(effect);
diff --git a/src/core/SkRuntimeEffect.cpp b/src/core/SkRuntimeEffect.cpp
index 7badaca..8c9eed5 100644
--- a/src/core/SkRuntimeEffect.cpp
+++ b/src/core/SkRuntimeEffect.cpp
@@ -488,7 +488,7 @@
buffer.readString(&sksl);
sk_sp<SkData> uniforms = buffer.readByteArrayAsData();
- auto effect = std::get<0>(SkRuntimeEffect::Make(std::move(sksl)));
+ auto effect = SkRuntimeEffect::Make(std::move(sksl)).effect;
if (!buffer.validate(effect != nullptr)) {
return nullptr;
}
@@ -647,7 +647,7 @@
localMPtr = &localM;
}
- auto effect = std::get<0>(SkRuntimeEffect::Make(std::move(sksl)));
+ auto effect = SkRuntimeEffect::Make(std::move(sksl)).effect;
if (!buffer.validate(effect != nullptr)) {
return nullptr;
}
diff --git a/tests/SkRuntimeEffectTest.cpp b/tests/SkRuntimeEffectTest.cpp
index a36f03f..2f5ae52 100644
--- a/tests/SkRuntimeEffectTest.cpp
+++ b/tests/SkRuntimeEffectTest.cpp
@@ -131,7 +131,7 @@
: fReporter(r), fSurface(std::move(surface)) {}
void build(const char* src) {
- auto[effect, errorText] = SkRuntimeEffect::Make(SkString(src));
+ auto [effect, errorText] = SkRuntimeEffect::Make(SkString(src));
if (!effect) {
REPORT_FAILURE(fReporter, "effect",
SkStringPrintf("Effect didn't compile: %s", errorText.c_str()));
@@ -322,7 +322,7 @@
half4 main() { return half4(x); }
)";
- sk_sp<SkRuntimeEffect> effect = std::get<0>(SkRuntimeEffect::Make(SkString(kSource)));
+ sk_sp<SkRuntimeEffect> effect = SkRuntimeEffect::Make(SkString(kSource)).effect;
REPORTER_ASSERT(r, effect);
// Test passes if this sequence doesn't assert. skbug.com/10667
@@ -341,7 +341,7 @@
half4 main() { return half4(x); }
)";
- sk_sp<SkRuntimeEffect> effect = std::get<0>(SkRuntimeEffect::Make(SkString(kSource)));
+ sk_sp<SkRuntimeEffect> effect = SkRuntimeEffect::Make(SkString(kSource)).effect;
REPORTER_ASSERT(r, effect);
SkRuntimeShaderBuilder b(std::move(effect));