Skip to content
Snippets Groups Projects
Commit d7f88601 authored by Ikram Gabiyev's avatar Ikram Gabiyev
Browse files

Cap scale when swiping to PiP

If the source rect hint is off by a couple pixels
from the app bounds we run a different scale-crop
animation than to when it perfectly fits the screen
along one axis.

We need to make sure that in cases such as this one,
we do not go over scale=1.0 in any case. Since this
path is only triggered when source-rect-hint is valid
and larger than the destination bounds, such assumption
should be safe.

Recordings:
Folded:   http://recall/-/BSXDRqFG6tqOB9EtbTyBy/NPnVIYg77S7d7Fjlm9zol
Unfolded: http://recall/-/BSXDRqFG6tqOB9EtbTyBy/ekZHmCyApxeHf7X9RNOpXI

Flag: N/A
Bug: 340024197
Test: repro the steps in the bug report
Change-Id: I2a9012511b7567ef4d08aa60de8b1a9992f99c58
(cherry picked from commit d2e8dfa3)
parent 256196a1
No related branches found
No related tags found
No related merge requests found
......@@ -99,7 +99,7 @@ public class PipSurfaceTransactionHelper {
final float startScale = sourceRectHint.width() <= sourceRectHint.height()
? (float) destinationBounds.width() / sourceBounds.width()
: (float) destinationBounds.height() / sourceBounds.height();
scale = (1 - progress) * startScale + progress * endScale;
scale = Math.min((1 - progress) * startScale + progress * endScale, 1.0f);
}
final float left = destinationBounds.left - (insets.left + sourceBounds.left) * scale;
final float top = destinationBounds.top - (insets.top + sourceBounds.top) * scale;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment