Update CameraConfigurationUtils.java

This commit is contained in:
MarlonHerrera01 2024-09-04 09:16:04 -05:00 committed by GitHub
parent 8944e60778
commit 970fbfaae4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -299,7 +299,9 @@ public final class CameraConfigurationUtils {
int realWidth = size.width;
int realHeight = size.height;
int resolution = realWidth * realHeight;
if (resolution < MIN_PREVIEW_PIXELS) {
double distortion = Math.abs(aspectRatio - screenAspectRatio);
//Aplicamos refactor de simplificacion de condicionales
if (resolution < MIN_PREVIEW_PIXELS && distortion > MAX_ASPECT_DISTORTION) {
continue;
}
@ -307,10 +309,7 @@ public final class CameraConfigurationUtils {
int maybeFlippedWidth = isCandidatePortrait ? realHeight : realWidth;
int maybeFlippedHeight = isCandidatePortrait ? realWidth : realHeight;
double aspectRatio = maybeFlippedWidth / (double) maybeFlippedHeight;
double distortion = Math.abs(aspectRatio - screenAspectRatio);
if (distortion > MAX_ASPECT_DISTORTION) {
continue;
}
if (maybeFlippedWidth == screenResolution.x && maybeFlippedHeight == screenResolution.y) {
Point exactPoint = new Point(realWidth, realHeight);