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

Commit d5aca836 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add DoF zoom support to SurfaceControl blur" into main

parents 07d67dad 317942d9
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -167,6 +167,8 @@ public final class SurfaceControl implements Parcelable {
            long nativeObject, float clientDrawnCornerRadius);
    private static native void nativeSetBackgroundBlurRadius(long transactionObj, long nativeObject,
            int blurRadius);
    private static native void nativeSetBackgroundBlurScale(long transactionObj, long nativeObject,
            float blurScale);
    private static native void nativeSetLayerStack(long transactionObj, long nativeObject,
            int layerStack);
    private static native void nativeSetBlurRegions(long transactionObj, long nativeObj,
@@ -3811,6 +3813,24 @@ public final class SurfaceControl implements Parcelable {
            return this;
        }

        /**
         * Sets the background blur scaling of the {@link SurfaceControl}.
         *
         * @param sc SurfaceControl.
         * @param scale Zoom level to apply, where 1.0f is 100%.
         * @return itself.
         * @hide
         */
        public Transaction setBackgroundBlurScale(SurfaceControl sc, float scale) {
            checkPreconditions(sc);
            if (SurfaceControlRegistry.sCallStackDebuggingEnabled) {
                SurfaceControlRegistry.getProcessInstance().checkCallStackDebugging(
                        "setBackgroundBlurScale", this, sc, "scale=" + scale);
            }
            nativeSetBackgroundBlurScale(mNativeObject, sc.mNativeObject, scale);
            return this;
        }

        /**
         * Specify what regions should be blurred on the {@link SurfaceControl}.
         *
+10 −0
Original line number Diff line number Diff line
@@ -1131,6 +1131,14 @@ static void nativeSetBackgroundBlurRadius(JNIEnv* env, jclass clazz, jlong trans
    transaction->setBackgroundBlurRadius(ctrl, blurRadius);
}

static void nativeSetBackgroundBlurScale(JNIEnv* env, jclass clazz, jlong transactionObj,
         jlong nativeObject, jfloat blurScale) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);

    SurfaceControl* const ctrl = reinterpret_cast<SurfaceControl *>(nativeObject);
    transaction->setBackgroundBlurScale(ctrl, blurScale);
}

static void nativeSetLayerStack(JNIEnv* env, jclass clazz, jlong transactionObj,
        jlong nativeObject, jint layerStack) {
    auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionObj);
@@ -2606,6 +2614,8 @@ static const JNINativeMethod sSurfaceControlMethods[] = {
            (void*) nativeSetClientDrawnCornerRadius },
    {"nativeSetBackgroundBlurRadius", "(JJI)V",
            (void*)nativeSetBackgroundBlurRadius },
    {"nativeSetBackgroundBlurScale", "(JJF)V",
            (void*)nativeSetBackgroundBlurScale },
    {"nativeSetLayerStack", "(JJI)V",
            (void*)nativeSetLayerStack },
    {"nativeSetBlurRegions", "(JJ[[FI)V",