diff options
author | 2020-08-04 22:38:58 +0000 | |
---|---|---|
committer | 2020-08-04 22:38:58 +0000 | |
commit | ed1f745ec45922f599faece93f0a19edc945f16b (patch) | |
tree | 29f793ee49d81aabc004e672399b7c081bacaa92 | |
parent | 3dd1ea063bf2ce09328632e11a36ee6b86c8a70a (diff) | |
parent | c784d9acf7c18f5458f33a87cde37a056e6c7143 (diff) |
Merge "Fix RuntimeShader example bug"
-rw-r--r-- | libs/hwui/jni/Shader.cpp | 9 | ||||
-rw-r--r-- | tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/libs/hwui/jni/Shader.cpp b/libs/hwui/jni/Shader.cpp index 0f6837640524..e76aace601be 100644 --- a/libs/hwui/jni/Shader.cpp +++ b/libs/hwui/jni/Shader.cpp @@ -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()); } diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java index 51bae3af3e9c..08144c845555 100644 --- a/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java +++ b/tests/HwAccelerationTest/src/com/android/test/hwui/ColorFiltersMutateActivity.java @@ -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"; |