Merge "Makes sure the magnifier source bounds doesn't beyond the surface." into rvc-dev am: 2c591e8c6b am: 4dcc22b7a2

Change-Id: I57c30c6728e124386c91c0d13d9c2fa45af70826
This commit is contained in:
Automerger Merge Worker
2020-02-27 12:14:50 +00:00

View File

@@ -353,8 +353,9 @@ public final class Magnifier {
// Gets the startX for new style, which should be bounded by the horizontal bounds.
// Also calculates the left/right cut width for pixel copy.
leftBound += mViewCoordinatesInSurface[0];
rightBound += mViewCoordinatesInSurface[0];
leftBound = Math.max(leftBound + mViewCoordinatesInSurface[0], 0);
rightBound = Math.min(
rightBound + mViewCoordinatesInSurface[0], mContentCopySurface.mWidth);
mLeftCutWidth = Math.max(0, leftBound - startX);
mRightCutWidth = Math.max(0, startX + mSourceWidth - rightBound);
startX = Math.max(startX, leftBound);