Merge "Fix RuntimeShader example bug"

This commit is contained in:
John Reck
2020-08-04 22:38:58 +00:00
committed by Android (Google) Code Review
2 changed files with 7 additions and 4 deletions

View File

@@ -228,9 +228,12 @@ static jlong RuntimeShader_create(JNIEnv* env, jobject, jlong shaderFactory, jlo
static jlong RuntimeShader_createShaderFactory(JNIEnv* env, jobject, jstring sksl) {
ScopedUtfChars strSksl(env, sksl);
sk_sp<SkRuntimeEffect> effect = std::get<0>(SkRuntimeEffect::Make(SkString(strSksl.c_str())));
ThrowIAE_IfNull(env, effect);
auto result = SkRuntimeEffect::Make(SkString(strSksl.c_str()));
sk_sp<SkRuntimeEffect> effect = std::get<0>(result);
if (!effect) {
const auto& err = std::get<1>(result);
doThrowIAE(env, err.c_str());
}
return reinterpret_cast<jlong>(effect.release());
}

View File

@@ -60,7 +60,7 @@ public class ColorFiltersMutateActivity extends Activity {
static final String sSkSL =
"uniform float param1;\n"
+ "void main(float x, float y, inout half4 color) {\n"
+ "void main(float2 xy, inout half4 color) {\n"
+ "color = half4(color.r, half(param1), color.b, 1.0);\n"
+ "}\n";