Merge changes from topic "cherrypicker-L31500000961697753:N79800001383851094" into udc-qpr-dev am: 4c440498b9

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23859834

Change-Id: Icd9424b88d5b446ee23349bfe31fb63339f58a78
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-06-29 21:59:01 +00:00
committed by Automerger Merge Worker

View File

@@ -270,21 +270,16 @@ public class MagnificationThumbnail {
mThumbnailView.setScaleX(scaleDown);
mThumbnailView.setScaleY(scaleDown);
}
float thumbnailWidth;
float thumbnailHeight;
if (mThumbnailView.getWidth() == 0 || mThumbnailView.getHeight() == 0) {
// if the thumbnail view size is not updated correctly, we just use the cached values.
thumbnailWidth = mThumbnailWidth;
thumbnailHeight = mThumbnailHeight;
} else {
thumbnailWidth = mThumbnailView.getWidth();
thumbnailHeight = mThumbnailView.getHeight();
}
if (!Float.isNaN(centerX)) {
if (!Float.isNaN(centerX)
&& !Float.isNaN(centerY)
&& mThumbnailWidth > 0
&& mThumbnailHeight > 0
) {
var padding = mThumbnailView.getPaddingTop();
var ratio = 1f / BG_ASPECT_RATIO;
var centerXScaled = centerX * ratio - (thumbnailWidth / 2f + padding);
var centerYScaled = centerY * ratio - (thumbnailHeight / 2f + padding);
var centerXScaled = centerX * ratio - (mThumbnailWidth / 2f + padding);
var centerYScaled = centerY * ratio - (mThumbnailHeight / 2f + padding);
if (DEBUG) {
Log.d(