Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed1f745e authored by John Reck's avatar John Reck Committed by Android (Google) Code Review
Browse files

Merge "Fix RuntimeShader example bug"

parents 3dd1ea06 c784d9ac
Loading
Loading
Loading
Loading
+6 −3
Original line number Original line Diff line number Diff line
@@ -228,9 +228,12 @@ static jlong RuntimeShader_create(JNIEnv* env, jobject, jlong shaderFactory, jlo


static jlong RuntimeShader_createShaderFactory(JNIEnv* env, jobject, jstring sksl) {
static jlong RuntimeShader_createShaderFactory(JNIEnv* env, jobject, jstring sksl) {
    ScopedUtfChars strSksl(env, sksl);
    ScopedUtfChars strSksl(env, sksl);
    sk_sp<SkRuntimeEffect> effect = std::get<0>(SkRuntimeEffect::Make(SkString(strSksl.c_str())));
    auto result = SkRuntimeEffect::Make(SkString(strSksl.c_str()));
    ThrowIAE_IfNull(env, effect);
    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());
    return reinterpret_cast<jlong>(effect.release());
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -60,7 +60,7 @@ public class ColorFiltersMutateActivity extends Activity {


        static final String sSkSL =
        static final String sSkSL =
                "uniform float param1;\n"
                "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"
                + "color = half4(color.r, half(param1), color.b, 1.0);\n"
                + "}\n";
                + "}\n";