alexandroid/decompiled/jadx/sources/androidx/camera/view/PreviewViewMeteringPointFactory.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

80 lines
2.5 KiB
Java

package androidx.camera.view;
import android.graphics.Matrix;
import android.graphics.PointF;
import android.graphics.Rect;
import android.util.Rational;
import android.util.Size;
import androidx.annotation.AnyThread;
import androidx.annotation.GuardedBy;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RestrictTo;
import androidx.annotation.UiThread;
import androidx.camera.core.MeteringPointFactory;
import androidx.camera.core.impl.utils.Threads;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
@RestrictTo({RestrictTo.Scope.LIBRARY_GROUP})
/* loaded from: classes.dex */
class PreviewViewMeteringPointFactory extends MeteringPointFactory {
static final PointF INVALID_POINT = new PointF(2.0f, 2.0f);
@Nullable
@GuardedBy("this")
private Matrix mMatrix;
@NonNull
private final PreviewTransformation mPreviewTransformation;
@Nullable
@GuardedBy("this")
private Rect mSensorRect = null;
public PreviewViewMeteringPointFactory(@NonNull PreviewTransformation previewTransformation) {
this.mPreviewTransformation = previewTransformation;
}
@Override // androidx.camera.core.MeteringPointFactory
@NonNull
@AnyThread
public PointF convertPoint(float f, float f2) {
float[] fArr = {f, f2};
synchronized (this) {
try {
Matrix matrix = this.mMatrix;
if (matrix == null) {
return INVALID_POINT;
}
matrix.mapPoints(fArr);
return new PointF(fArr[0], fArr[1]);
} catch (Throwable th) {
throw th;
}
}
}
@UiThread
public void recalculate(@NonNull Size size, int i) {
Rect rect;
Threads.checkMainThread();
synchronized (this) {
try {
if (size.getWidth() != 0 && size.getHeight() != 0 && (rect = this.mSensorRect) != null) {
this.mMatrix = this.mPreviewTransformation.getPreviewViewToNormalizedSensorMatrix(size, i, rect);
return;
}
this.mMatrix = null;
} catch (Throwable th) {
throw th;
}
}
}
public void setSensorRect(Rect rect) {
setSurfaceAspectRatio(new Rational(rect.width(), rect.height()));
synchronized (this) {
this.mSensorRect = rect;
}
}
}