Merge "WindowState: Correct wallpaper scaling" into sc-dev am: e7fc75760a am: cdf8b3c0ed

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/15006781

Change-Id: I17f16c2e2e98e6e6494df63e1122f781e44b78f8
This commit is contained in:
Rob Carr
2021-06-17 21:36:29 +00:00
committed by Automerger Merge Worker

View File

@@ -5547,7 +5547,19 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
mSurfacePlacementNeeded = false;
transformFrameToSurfacePosition(mWindowFrames.mFrame.left, mWindowFrames.mFrame.top,
mSurfacePosition);
mSurfacePosition.offset(mXOffset, mYOffset);
if (mWallpaperScale != 1f) {
DisplayInfo displayInfo = getDisplayInfo();
Matrix matrix = mTmpMatrix;
matrix.setTranslate(mXOffset, mYOffset);
matrix.postScale(mWallpaperScale, mWallpaperScale, displayInfo.logicalWidth / 2f,
displayInfo.logicalHeight / 2f);
matrix.getValues(mTmpMatrixArray);
mSurfacePosition.offset(Math.round(mTmpMatrixArray[Matrix.MTRANS_X]),
Math.round(mTmpMatrixArray[Matrix.MTRANS_Y]));
} else {
mSurfacePosition.offset(mXOffset, mYOffset);
}
// Freeze position while we're unrotated, so the surface remains at the position it was
// prior to the rotation.