Merge "Polish YT auto enter PiP transition" into sc-dev am: 9630069410
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14941602 Change-Id: I93115eb347d68cc7e7bbc605e0564fe5478df4d4
This commit is contained in:
@@ -85,9 +85,7 @@ public class PipSurfaceTransactionHelper {
|
|||||||
final float left = destinationBounds.left - insets.left * scale;
|
final float left = destinationBounds.left - insets.left * scale;
|
||||||
final float top = destinationBounds.top - insets.top * scale;
|
final float top = destinationBounds.top - insets.top * scale;
|
||||||
mTmpTransform.setScale(scale, scale);
|
mTmpTransform.setScale(scale, scale);
|
||||||
final Rect cornerRadiusRect = new Rect(destinationBounds);
|
final float cornerRadius = getScaledCornerRadius(mTmpDestinationRect, destinationBounds);
|
||||||
cornerRadiusRect.inset(insets);
|
|
||||||
final float cornerRadius = getScaledCornerRadius(sourceBounds, cornerRadiusRect);
|
|
||||||
tx.setMatrix(leash, mTmpTransform, mTmpFloat9)
|
tx.setMatrix(leash, mTmpTransform, mTmpFloat9)
|
||||||
.setWindowCrop(leash, mTmpDestinationRect)
|
.setWindowCrop(leash, mTmpDestinationRect)
|
||||||
.setPosition(leash, left, top)
|
.setPosition(leash, left, top)
|
||||||
@@ -110,15 +108,23 @@ public class PipSurfaceTransactionHelper {
|
|||||||
: (float) destinationBounds.height() / sourceBounds.height();
|
: (float) destinationBounds.height() / sourceBounds.height();
|
||||||
mTmpTransform.setRotate(degree, 0, 0);
|
mTmpTransform.setRotate(degree, 0, 0);
|
||||||
mTmpTransform.postScale(scale, scale);
|
mTmpTransform.postScale(scale, scale);
|
||||||
final Rect cornerRadiusRect = new Rect(destinationBounds);
|
final float cornerRadius = getScaledCornerRadius(mTmpDestinationRect, destinationBounds);
|
||||||
cornerRadiusRect.inset(insets);
|
// adjust the positions, take account also the insets
|
||||||
final float cornerRadius = getScaledCornerRadius(sourceBounds, cornerRadiusRect);
|
final float adjustedPositionX, adjustedPositionY;
|
||||||
|
if (degree < 0) {
|
||||||
|
adjustedPositionX = positionX + insets.top * scale;
|
||||||
|
adjustedPositionY = positionY + insets.left * scale;
|
||||||
|
} else {
|
||||||
|
adjustedPositionX = positionX - insets.top * scale;
|
||||||
|
adjustedPositionY = positionY - insets.left * scale;
|
||||||
|
}
|
||||||
tx.setMatrix(leash, mTmpTransform, mTmpFloat9)
|
tx.setMatrix(leash, mTmpTransform, mTmpFloat9)
|
||||||
.setWindowCrop(leash, mTmpDestinationRect)
|
.setWindowCrop(leash, mTmpDestinationRect)
|
||||||
.setPosition(leash, positionX, positionY)
|
.setPosition(leash, adjustedPositionX, adjustedPositionY)
|
||||||
.setCornerRadius(leash, cornerRadius);
|
.setCornerRadius(leash, cornerRadius);
|
||||||
return new PictureInPictureSurfaceTransaction(
|
return new PictureInPictureSurfaceTransaction(
|
||||||
positionX, positionY, mTmpFloat9, degree, cornerRadius, mTmpDestinationRect);
|
adjustedPositionX, adjustedPositionY,
|
||||||
|
mTmpFloat9, degree, cornerRadius, mTmpDestinationRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return the round corner radius scaled by given from and to bounds */
|
/** @return the round corner radius scaled by given from and to bounds */
|
||||||
|
|||||||
Reference in New Issue
Block a user