From 36f340dab3725f21d173425e9d87fa317178d2b0 Mon Sep 17 00:00:00 2001 From: Matthias Agethle Date: Mon, 3 Feb 2025 14:30:29 +0100 Subject: [PATCH] Revert "Add hint to correct wrong dimension" This reverts commit 16723b3434a78ab49894f611cfb57c3e712b9b97. --- .../java/com/google/zxing/DecodeHintType.java | 13 ------------- .../multi/qrcode/detector/MultiDetector.java | 2 +- .../google/zxing/qrcode/detector/Detector.java | 16 +++++----------- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/core/src/main/java/com/google/zxing/DecodeHintType.java b/core/src/main/java/com/google/zxing/DecodeHintType.java index 880df8639..a53275003 100644 --- a/core/src/main/java/com/google/zxing/DecodeHintType.java +++ b/core/src/main/java/com/google/zxing/DecodeHintType.java @@ -104,19 +104,6 @@ public enum DecodeHintType { */ ALSO_INVERTED(Void.class), - - /** - * If true, it will round down wrong dimension to next possible value. - * Doesn't matter what it maps to; use {@link Boolean#TRUE}. - */ - CORRECT_DIMENSION_TO_LOWER_VALUE(Void.class), - - /** - * If true, it will round up wrong dimension to next possible value. - * Doesn't matter what it maps to; use {@link Boolean#TRUE}. - */ - CORRECT_DIMENSION_TO_UPPER_VALUE(Void.class), - // End of enumeration values. ; diff --git a/core/src/main/java/com/google/zxing/multi/qrcode/detector/MultiDetector.java b/core/src/main/java/com/google/zxing/multi/qrcode/detector/MultiDetector.java index 897d9c559..512b452c8 100644 --- a/core/src/main/java/com/google/zxing/multi/qrcode/detector/MultiDetector.java +++ b/core/src/main/java/com/google/zxing/multi/qrcode/detector/MultiDetector.java @@ -58,7 +58,7 @@ public final class MultiDetector extends Detector { List result = new ArrayList<>(); for (FinderPatternInfo info : infos) { try { - result.add(processFinderPatternInfo(info, hints)); + result.add(processFinderPatternInfo(info)); } catch (ReaderException e) { // ignore } diff --git a/core/src/main/java/com/google/zxing/qrcode/detector/Detector.java b/core/src/main/java/com/google/zxing/qrcode/detector/Detector.java index 9aa396167..9648883bb 100644 --- a/core/src/main/java/com/google/zxing/qrcode/detector/Detector.java +++ b/core/src/main/java/com/google/zxing/qrcode/detector/Detector.java @@ -80,10 +80,10 @@ public class Detector { FinderPatternFinder finder = new FinderPatternFinder(image, resultPointCallback); FinderPatternInfo info = finder.find(hints); - return processFinderPatternInfo(info, hints); + return processFinderPatternInfo(info); } - protected final DetectorResult processFinderPatternInfo(FinderPatternInfo info, Map hints) + protected final DetectorResult processFinderPatternInfo(FinderPatternInfo info) throws NotFoundException, FormatException { FinderPattern topLeft = info.getTopLeft(); @@ -94,7 +94,7 @@ public class Detector { if (moduleSize < 1.0f) { throw NotFoundException.getNotFoundInstance(); } - int dimension = computeDimension(topLeft, topRight, bottomLeft, moduleSize, hints); + int dimension = computeDimension(topLeft, topRight, bottomLeft, moduleSize); Version provisionalVersion = Version.getProvisionalVersionForDimension(dimension); int modulesBetweenFPCenters = provisionalVersion.getDimensionForVersion() - 7; @@ -198,8 +198,7 @@ public class Detector { private static int computeDimension(ResultPoint topLeft, ResultPoint topRight, ResultPoint bottomLeft, - float moduleSize, - Map hints) throws NotFoundException { + float moduleSize) throws NotFoundException { int tltrCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, topRight) / moduleSize); int tlblCentersDimension = MathUtils.round(ResultPoint.distance(topLeft, bottomLeft) / moduleSize); int dimension = ((tltrCentersDimension + tlblCentersDimension) / 2) + 7; @@ -212,12 +211,7 @@ public class Detector { dimension--; break; case 3: - if (hints != null && hints.get(DecodeHintType.CORRECT_DIMENSION_TO_LOWER_VALUE)!=null) - dimension = dimension - 2; - else if (hints != null && hints.get(DecodeHintType.CORRECT_DIMENSION_TO_UPPER_VALUE)!=null) - dimension = dimension + 2; - else - throw NotFoundException.getNotFoundInstance(); + throw NotFoundException.getNotFoundInstance(); } return dimension; }