39 lines
1.4 KiB
Java
39 lines
1.4 KiB
Java
package com.kofax.kmc.ken.engines;
|
|
|
|
import android.graphics.Rect;
|
|
import com.kofax.kmc.ken.engines.data.BoundingTetragon;
|
|
import com.kofax.kmc.ken.engines.data.OrientationGuidance;
|
|
|
|
/* JADX INFO: Access modifiers changed from: package-private */
|
|
/* loaded from: classes3.dex */
|
|
public class l implements IOrientationGuidanceCalculator {
|
|
private static final double bO = 1.1d;
|
|
private static final double bP = 0.9090909090909091d;
|
|
private final IBoundingRectCalculator T;
|
|
|
|
private static boolean a(double d) {
|
|
return bP < d && d < bO;
|
|
}
|
|
|
|
public l(IBoundingRectCalculator iBoundingRectCalculator) {
|
|
this.T = iBoundingRectCalculator;
|
|
}
|
|
|
|
@Override // com.kofax.kmc.ken.engines.IOrientationGuidanceCalculator
|
|
public OrientationGuidance calculate(Rect rect, BoundingTetragon boundingTetragon) {
|
|
Rect calculate = this.T.calculate(boundingTetragon);
|
|
double width = calculate.width() / calculate.height();
|
|
if (a(width)) {
|
|
return OrientationGuidance.ORIENTATION_OK;
|
|
}
|
|
double width2 = rect.width() / rect.height();
|
|
if (a(width2)) {
|
|
return OrientationGuidance.ORIENTATION_OK;
|
|
}
|
|
if ((width < 1.0d && width2 > 1.0d) || (width > 1.0d && width2 < 1.0d)) {
|
|
return OrientationGuidance.ORIENTATION_CHANGE;
|
|
}
|
|
return OrientationGuidance.ORIENTATION_OK;
|
|
}
|
|
}
|