diff options
| author | 2024-07-16 18:04:16 +0000 | |
|---|---|---|
| committer | 2024-07-16 18:04:16 +0000 | |
| commit | bd95b591ed38b1c286cb75d93e1cf216a19f76b8 (patch) | |
| tree | e5c1dc5c426ec3db12a4465bfc2b66a681f639c8 | |
| parent | f5d25988621bb04b6cb156daa9e98058cd918dea (diff) | |
| parent | 252b4d996a03b8c631badf5e508f766e0bee89f2 (diff) | |
Merge "Fix scale/translation for fixed rotation PiP enter" into main
| -rw-r--r-- | packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java | 11 | 
1 files changed, 6 insertions, 5 deletions
diff --git a/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java b/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java index c225cbcc6e81..f2899889a3a0 100644 --- a/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java +++ b/packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java @@ -128,19 +128,20 @@ public class PipSurfaceTransactionHelper {          mTmpDestinationRect.inset(insets);          // Scale by the shortest edge and offset such that the top/left of the scaled inset          // source rect aligns with the top/left of the destination bounds -        final float scale = sourceBounds.width() <= sourceBounds.height() -                ? (float) destinationBounds.width() / sourceBounds.width() -                : (float) destinationBounds.height() / sourceBounds.height(); +        final float scale = Math.max((float) destinationBounds.width() / sourceBounds.width(), +                (float) destinationBounds.height() / sourceBounds.height());          mTmpTransform.setRotate(degree, 0, 0);          mTmpTransform.postScale(scale, scale);          final float cornerRadius = getScaledCornerRadius(mTmpDestinationRect, destinationBounds);          // adjust the positions, take account also the insets          final float adjustedPositionX, adjustedPositionY;          if (degree < 0) { -            adjustedPositionX = positionX + insets.top * scale; +            // Counter-clockwise rotation. +            adjustedPositionX = positionX - insets.top * scale;              adjustedPositionY = positionY + insets.left * scale;          } else { -            adjustedPositionX = positionX - insets.top * scale; +            // Clockwise rotation. +            adjustedPositionX = positionX + insets.top * scale;              adjustedPositionY = positionY - insets.left * scale;          }          tx.setMatrix(leash, mTmpTransform, mTmpFloat9)  |