Merge "Fix the scale for entering PiP animation" into tm-qpr-dev
This commit is contained in:
@@ -115,8 +115,8 @@ public class PipSurfaceTransactionHelper {
|
|||||||
// coordinates so offset the bounds to 0,0
|
// coordinates so offset the bounds to 0,0
|
||||||
mTmpDestinationRect.offsetTo(0, 0);
|
mTmpDestinationRect.offsetTo(0, 0);
|
||||||
mTmpDestinationRect.inset(insets);
|
mTmpDestinationRect.inset(insets);
|
||||||
// Scale by the shortest edge and offset such that the top/left of the scaled inset source
|
// Scale to the bounds no smaller than the destination and offset such that the top/left
|
||||||
// rect aligns with the top/left of the destination bounds
|
// of the scaled inset source rect aligns with the top/left of the destination bounds
|
||||||
final float scale;
|
final float scale;
|
||||||
if (isInPipDirection
|
if (isInPipDirection
|
||||||
&& sourceRectHint != null && sourceRectHint.width() < sourceBounds.width()) {
|
&& sourceRectHint != null && sourceRectHint.width() < sourceBounds.width()) {
|
||||||
@@ -129,9 +129,8 @@ public class PipSurfaceTransactionHelper {
|
|||||||
: (float) destinationBounds.height() / sourceBounds.height();
|
: (float) destinationBounds.height() / sourceBounds.height();
|
||||||
scale = (1 - fraction) * startScale + fraction * endScale;
|
scale = (1 - fraction) * startScale + fraction * endScale;
|
||||||
} else {
|
} else {
|
||||||
scale = sourceBounds.width() <= sourceBounds.height()
|
scale = Math.max((float) destinationBounds.width() / sourceBounds.width(),
|
||||||
? (float) destinationBounds.width() / sourceBounds.width()
|
(float) destinationBounds.height() / sourceBounds.height());
|
||||||
: (float) destinationBounds.height() / sourceBounds.height();
|
|
||||||
}
|
}
|
||||||
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;
|
||||||
|
|||||||
@@ -85,13 +85,12 @@ public class PipSurfaceTransactionHelper {
|
|||||||
mTmpSourceRectF.set(sourceBounds);
|
mTmpSourceRectF.set(sourceBounds);
|
||||||
mTmpDestinationRect.set(sourceBounds);
|
mTmpDestinationRect.set(sourceBounds);
|
||||||
mTmpDestinationRect.inset(insets);
|
mTmpDestinationRect.inset(insets);
|
||||||
// Scale by the shortest edge and offset such that the top/left of the scaled inset
|
// Scale to the bounds no smaller than the destination and offset such that the top/left
|
||||||
// source rect aligns with the top/left of the destination bounds
|
// of the scaled inset source rect aligns with the top/left of the destination bounds
|
||||||
final float scale;
|
final float scale;
|
||||||
if (sourceRectHint.isEmpty() || sourceRectHint.width() == sourceBounds.width()) {
|
if (sourceRectHint.isEmpty() || sourceRectHint.width() == sourceBounds.width()) {
|
||||||
scale = sourceBounds.width() <= sourceBounds.height()
|
scale = Math.max((float) destinationBounds.width() / sourceBounds.width(),
|
||||||
? (float) destinationBounds.width() / sourceBounds.width()
|
(float) destinationBounds.height() / sourceBounds.height());
|
||||||
: (float) destinationBounds.height() / sourceBounds.height();
|
|
||||||
} else {
|
} else {
|
||||||
// scale by sourceRectHint if it's not edge-to-edge
|
// scale by sourceRectHint if it's not edge-to-edge
|
||||||
final float endScale = sourceRectHint.width() <= sourceRectHint.height()
|
final float endScale = sourceRectHint.width() <= sourceRectHint.height()
|
||||||
|
|||||||
Reference in New Issue
Block a user