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

Commit 28fd1926 authored by Brian Osman's avatar Brian Osman Committed by Android (Google) Code Review
Browse files

Merge "Update frameworks/base to use newer SkRuntimeEffect::MakeForShader" into sc-dev

parents 2c87b91f 64ee324b
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -115,7 +115,7 @@ final class RippleShader extends RuntimeShader {
            + "    float fade = min(fadeIn, 1. - fadeOutRipple);\n"
            + "    float fade = min(fadeIn, 1. - fadeOutRipple);\n"
            + "    vec4 circle = in_color * (softCircle(p, center, in_maxRadius "
            + "    vec4 circle = in_color * (softCircle(p, center, in_maxRadius "
            + "      * scaleIn, 0.2) * fade);\n"
            + "      * scaleIn, 0.2) * fade);\n"
            + "    float mask = in_hasMask == 1. ? sample(in_shader).a > 0. ? 1. : 0. : 1.;\n"
            + "    float mask = in_hasMask == 1. ? sample(in_shader, p).a > 0. ? 1. : 0. : 1.;\n"
            + "    return mix(circle, in_sparkleColor, sparkle) * mask;\n"
            + "    return mix(circle, in_sparkleColor, sparkle) * mask;\n"
            + "}";
            + "}";
    private static final String SHADER = SHADER_UNIFORMS + SHADER_LIB + SHADER_MAIN;
    private static final String SHADER = SHADER_UNIFORMS + SHADER_LIB + SHADER_MAIN;
+1 −1
Original line number Original line Diff line number Diff line
@@ -237,7 +237,7 @@ sk_sp<SkShader> StretchEffect::getShader(const sk_sp<SkImage>& snapshotImage) co
}
}


sk_sp<SkRuntimeEffect> StretchEffect::getStretchEffect() {
sk_sp<SkRuntimeEffect> StretchEffect::getStretchEffect() {
    const static SkRuntimeEffect::Result instance = SkRuntimeEffect::Make(stretchShader);
    const static SkRuntimeEffect::Result instance = SkRuntimeEffect::MakeForShader(stretchShader);
    return instance.effect;
    return instance.effect;
}
}


+2 −1
Original line number Original line Diff line number Diff line
@@ -239,7 +239,8 @@ static jlong ComposeShader_create(JNIEnv* env, jobject o, jlong matrixPtr,


static jlong RuntimeShader_createShaderBuilder(JNIEnv* env, jobject, jstring sksl) {
static jlong RuntimeShader_createShaderBuilder(JNIEnv* env, jobject, jstring sksl) {
    ScopedUtfChars strSksl(env, sksl);
    ScopedUtfChars strSksl(env, sksl);
    auto result = SkRuntimeEffect::Make(SkString(strSksl.c_str()), SkRuntimeEffect::Options{});
    auto result = SkRuntimeEffect::MakeForShader(SkString(strSksl.c_str()),
                                                 SkRuntimeEffect::Options{});
    if (result.effect.get() == nullptr) {
    if (result.effect.get() == nullptr) {
        doThrowIAE(env, result.errorText.c_str());
        doThrowIAE(env, result.errorText.c_str());
        return 0;
        return 0;
+1 −1
Original line number Original line Diff line number Diff line
@@ -60,7 +60,7 @@ public class ColorFiltersMutateActivity extends Activity {
        private float mShaderParam1 = 0.0f;
        private float mShaderParam1 = 0.0f;


        static final String sSkSL =
        static final String sSkSL =
                "in shader bitmapShader;\n"
                "uniform shader bitmapShader;\n"
                + "uniform float param1;\n"
                + "uniform float param1;\n"
                + "half4 main(float2 xy) {\n"
                + "half4 main(float2 xy) {\n"
                + "  return half4(sample(bitmapShader, xy).rgb, param1);\n"
                + "  return half4(sample(bitmapShader, xy).rgb, param1);\n"
+1 −1
Original line number Original line Diff line number Diff line
@@ -89,7 +89,7 @@ public class RippleActivity extends Activity {
                + "    d = rand(float2(x, y)) > density ? d : d * .2;\n"
                + "    d = rand(float2(x, y)) > density ? d : d * .2;\n"
                + "    d = d * rand(float2(fraction, x * y));\n"
                + "    d = d * rand(float2(fraction, x * y));\n"
                + "    float alpha = 1. - pow(fraction, 3.);\n"
                + "    float alpha = 1. - pow(fraction, 3.);\n"
                + "    return float4(sample(in_paintColor).rgb, d * alpha);\n"
                + "    return float4(sample(in_paintColor, p).rgb, d * alpha);\n"
                + "}";
                + "}";


        RippleView(Context c) {
        RippleView(Context c) {
Loading