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

Commit 5a2f3fd5 authored by Steve Kondik's avatar Steve Kondik
Browse files

BlurLayer: Remove unnecessary surface transactions

 * As with the previous commit, do the same for the blur layer.

Change-Id: If56210f2d07091f24872a1be6d6e3eaa8fdcebe9
parent 4a6db046
Loading
Loading
Loading
Loading
+19 −20
Original line number Diff line number Diff line
@@ -142,7 +142,7 @@ public class BlurLayer {
        }
    }

    void adjustSurface(int layer, boolean inTransaction) {
    void adjustBounds() {
        final int dw, dh;
        final float xPos, yPos;
        if (!mStack.isFullscreen()) {
@@ -159,28 +159,26 @@ public class BlurLayer {
            yPos = 0;
        }

        mBlurSurface.setPosition(xPos, yPos);
        mBlurSurface.setSize(dw, dh);
        mLastBounds.set(mBounds);
    }

    void setBounds(Rect bounds, boolean inTransaction) {
        mBounds.set(bounds);
        if (isBlurring() && !mLastBounds.equals(bounds)) {
            try {
                if (!inTransaction) {
                    SurfaceControl.openTransaction();
                }
            mBlurSurface.setPosition(xPos, yPos);
            mBlurSurface.setSize(dw, dh);
            mBlurSurface.setLayer(layer);
                adjustBounds();
            } catch (RuntimeException e) {
            Slog.w(TAG, "Failure setting size or layer", e);
                Slog.w(TAG, "Failure setting size", e);
            } finally {
                if (!inTransaction) {
                    SurfaceControl.closeTransaction();
                }
            }
        mLastBounds.set(mBounds);
        mLayer = layer;
    }

    void setBounds(Rect bounds) {
        mBounds.set(bounds);
        if (isBlurring() && !mLastBounds.equals(bounds)) {
            adjustSurface(mLayer, false);
        }
    }

@@ -219,9 +217,10 @@ public class BlurLayer {
            return;
        }

        if (!mLastBounds.equals(mBounds) || mLayer != layer) {
            adjustSurface(layer, true);
        if (!mLastBounds.equals(mBounds)) {
            adjustBounds();
        }
        setLayer(layer);

        long curTime = SystemClock.uptimeMillis();
        final boolean animating = isAnimating();
+1 −1
Original line number Diff line number Diff line
@@ -134,7 +134,7 @@ public class TaskStack {

        mDimLayer.setBounds(bounds, false);
        mAnimationBackgroundSurface.setBounds(bounds, false);
        mBlurLayer.setBounds(bounds);
        mBlurLayer.setBounds(bounds, false);
        mBounds.set(bounds);

        return true;