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

Commit a0a082b8 authored by Robert Carr's avatar Robert Carr Committed by Rob Carr
Browse files

WinodowStateAnimator: Remove mD(s|t)d(x|y)

They are always either 1 or 0 and so there is no use. We also fix a bug
in WindowState#getTransformationMatrix where the value should be equal
to mGlobalScale (or at least it was in previous releases).

Bug: 161937501
Test: Existing tests pass
Change-Id: I8ecc88b6be6b4d9b87bc43a1e0319f33b589b46e
parent 194d95b1
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -5175,10 +5175,10 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
     * @param outMatrix Matrix to fill in the transformation.
     * @param outMatrix Matrix to fill in the transformation.
     */
     */
    void getTransformationMatrix(float[] float9, Matrix outMatrix) {
    void getTransformationMatrix(float[] float9, Matrix outMatrix) {
        float9[Matrix.MSCALE_X] = mWinAnimator.mDsDx;
        float9[Matrix.MSCALE_X] = mGlobalScale;
        float9[Matrix.MSKEW_Y] = mWinAnimator.mDtDx;
        float9[Matrix.MSKEW_Y] = 0;
        float9[Matrix.MSKEW_X] = mWinAnimator.mDtDy;
        float9[Matrix.MSKEW_X] = 0;
        float9[Matrix.MSCALE_Y] = mWinAnimator.mDsDy;
        float9[Matrix.MSCALE_Y] = mGlobalScale;
        transformSurfaceInsetsPosition(mTmpPoint, mAttrs.surfaceInsets);
        transformSurfaceInsetsPosition(mTmpPoint, mAttrs.surfaceInsets);
        int x = mSurfacePosition.x + mTmpPoint.x;
        int x = mSurfacePosition.x + mTmpPoint.x;
        int y = mSurfacePosition.y + mTmpPoint.y;
        int y = mSurfacePosition.y + mTmpPoint.y;
+15 −37
Original line number Original line Diff line number Diff line
@@ -125,11 +125,6 @@ class WindowStateAnimator {
     */
     */
    private final Rect mSystemDecorRect = new Rect();
    private final Rect mSystemDecorRect = new Rect();


    float mDsDx=1, mDtDx=0, mDsDy=0, mDtDy=1;
    private float mLastDsDx=1, mLastDtDx=0, mLastDsDy=0, mLastDtDy=1;

    boolean mHaveMatrix;

    // Set to true if, when the window gets displayed, it should perform
    // Set to true if, when the window gets displayed, it should perform
    // an enter animation.
    // an enter animation.
    boolean mEnterAnimationPending;
    boolean mEnterAnimationPending;
@@ -478,11 +473,6 @@ class WindowStateAnimator {
        }
        }


        mShownAlpha = mAlpha;
        mShownAlpha = mAlpha;
        mHaveMatrix = false;
        mDsDx = 1;
        mDtDx = 0;
        mDtDy = 0;
        mDsDy = 1;
    }
    }


    private boolean isInBlastSync() {
    private boolean isInBlastSync() {
@@ -522,10 +512,10 @@ class WindowStateAnimator {
                // Wallpaper is already updated above when calling setWallpaperPositionAndScale so
                // Wallpaper is already updated above when calling setWallpaperPositionAndScale so
                // we only need to consider the non-wallpaper case here.
                // we only need to consider the non-wallpaper case here.
                mSurfaceController.setMatrix(t,
                mSurfaceController.setMatrix(t,
                        mDsDx * w.mHScale,
                        w.mHScale,
                        mDtDx * w.mVScale,
                        w.mVScale,
                        mDtDy * w.mHScale,
                        w.mHScale,
                        mDsDy * w.mVScale);
                        w.mVScale);
            } else {
            } else {
                setWallpaperPositionAndScale(t, xOffset, yOffset, mWallpaperScale);
                setWallpaperPositionAndScale(t, xOffset, yOffset, mWallpaperScale);
            }
            }
@@ -585,25 +575,17 @@ class WindowStateAnimator {
                        "Orientation change skips hidden %s", w);
                        "Orientation change skips hidden %s", w);
            }
            }
        } else if (mLastAlpha != mShownAlpha
        } else if (mLastAlpha != mShownAlpha
                || mLastDsDx != mDsDx
                || mLastDtDx != mDtDx
                || mLastDsDy != mDsDy
                || mLastDtDy != mDtDy
                || w.mLastHScale != w.mHScale
                || w.mLastHScale != w.mHScale
                || w.mLastVScale != w.mVScale
                || w.mLastVScale != w.mVScale
                || mLastHidden) {
                || mLastHidden) {
            displayed = true;
            displayed = true;
            mLastAlpha = mShownAlpha;
            mLastAlpha = mShownAlpha;
            mLastDsDx = mDsDx;
            mLastDtDx = mDtDx;
            mLastDsDy = mDsDy;
            mLastDtDy = mDtDy;
            w.mLastHScale = w.mHScale;
            w.mLastHScale = w.mHScale;
            w.mLastVScale = w.mVScale;
            w.mLastVScale = w.mVScale;
            ProtoLog.i(WM_SHOW_TRANSACTIONS,
            ProtoLog.i(WM_SHOW_TRANSACTIONS,
                    "SURFACE controller=%s alpha=%f matrix=[%f*%f,%f*%f][%f*%f,%f*%f]: %s",
                    "SURFACE controller=%s alpha=%f matrix=[%f*%f,%f*%f][%f*%f,%f*%f]: %s",
                            mSurfaceController, mShownAlpha, mDsDx, w.mHScale, mDtDx, w.mVScale,
                            mSurfaceController, mShownAlpha, w.mHScale, w.mVScale,
                            mDtDy, w.mHScale, mDsDy, w.mVScale, w);
                            w.mHScale, w.mVScale, w);


            boolean prepared = true;
            boolean prepared = true;


@@ -612,10 +594,10 @@ class WindowStateAnimator {
            } else {
            } else {
                prepared =
                prepared =
                    mSurfaceController.prepareToShowInTransaction(t, mShownAlpha,
                    mSurfaceController.prepareToShowInTransaction(t, mShownAlpha,
                        mDsDx * w.mHScale,
                        w.mHScale,
                        mDtDx * w.mVScale,
                        w.mVScale,
                        mDtDy * w.mHScale,
                        w.mHScale,
                        mDsDy * w.mVScale
                        w.mVScale
                    );
                    );
            }
            }


@@ -712,10 +694,10 @@ class WindowStateAnimator {
        mSurfaceController.setPosition(t,mWin.mTmpMatrixArray[MTRANS_X],
        mSurfaceController.setPosition(t,mWin.mTmpMatrixArray[MTRANS_X],
                mWin.mTmpMatrixArray[MTRANS_Y]);
                mWin.mTmpMatrixArray[MTRANS_Y]);
        mSurfaceController.setMatrix(t,
        mSurfaceController.setMatrix(t,
                mDsDx * mWin.mTmpMatrixArray[MSCALE_X] * mWin.mHScale,
                mWin.mTmpMatrixArray[MSCALE_X] * mWin.mHScale,
                mDtDx * mWin.mTmpMatrixArray[MSKEW_Y] * mWin.mVScale,
                mWin.mTmpMatrixArray[MSKEW_Y] * mWin.mVScale,
                mDtDy * mWin.mTmpMatrixArray[MSKEW_X] * mWin.mHScale,
                mWin.mTmpMatrixArray[MSKEW_X] * mWin.mHScale,
                mDsDy * mWin.mTmpMatrixArray[MSCALE_Y] * mWin.mVScale);
                mWin.mTmpMatrixArray[MSCALE_Y] * mWin.mVScale);
    }
    }


    /**
    /**
@@ -917,12 +899,8 @@ class WindowStateAnimator {
                    pw.print(" mAlpha="); pw.print(mAlpha);
                    pw.print(" mAlpha="); pw.print(mAlpha);
                    pw.print(" mLastAlpha="); pw.println(mLastAlpha);
                    pw.print(" mLastAlpha="); pw.println(mLastAlpha);
        }
        }
        if (mHaveMatrix || mWin.mGlobalScale != 1) {
        if (mWin.mGlobalScale != 1) {
            pw.print(prefix); pw.print("mGlobalScale="); pw.print(mWin.mGlobalScale);
            pw.print(prefix); pw.print("mGlobalScale="); pw.print(mWin.mGlobalScale);
                    pw.print(" mDsDx="); pw.print(mDsDx);
                    pw.print(" mDtDx="); pw.print(mDtDx);
                    pw.print(" mDtDy="); pw.print(mDtDy);
                    pw.print(" mDsDy="); pw.println(mDsDy);
        }
        }
    }
    }