diff options
| author | 2023-09-06 20:53:04 +0000 | |
|---|---|---|
| committer | 2023-09-06 20:53:04 +0000 | |
| commit | 48e4cb6ac5e47459f2a6feec14f7b56e3673565a (patch) | |
| tree | 16c84e3e5cc0f664dea4c81a777110c1015b1e9d | |
| parent | 1f5b85230ab1d9ac886d29ccff8dc440242bf986 (diff) | |
| parent | c084015e237058c7f3b1550820f7a73ff1fb371a (diff) | |
Merge "Reland: Crop surface to the content size during drag-resizing" into main
| -rw-r--r-- | core/java/android/view/ViewRootImpl.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 60d964e32f6f..d191ccdf95a3 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -8413,10 +8413,20 @@ public final class ViewRootImpl implements ViewParent, } } - if (mSurfaceControl.isValid() && !HardwareRenderer.isDrawingEnabled()) { - // When drawing is disabled the window layer won't have a valid buffer. - // Set a window crop so input can get delivered to the window. - mTransaction.setWindowCrop(mSurfaceControl, mSurfaceSize.x, mSurfaceSize.y).apply(); + if (mSurfaceControl.isValid()) { + if (mPendingDragResizing && !mSurfaceSize.equals( + mWinFrameInScreen.width(), mWinFrameInScreen.height())) { + // During drag-resize, a single fullscreen-sized surface is reused for optimization. + // Crop to the content size instead of the surface size to avoid exposing garbage + // content that is still on the surface from previous re-layouts (e.g. when + // resizing to a larger size). + mTransaction.setWindowCrop(mSurfaceControl, + mWinFrameInScreen.width(), mWinFrameInScreen.height()); + } else if (!HardwareRenderer.isDrawingEnabled()) { + // When drawing is disabled the window layer won't have a valid buffer. + // Set a window crop so input can get delivered to the window. + mTransaction.setWindowCrop(mSurfaceControl, mSurfaceSize.x, mSurfaceSize.y).apply(); + } } mLastTransformHint = transformHint; |