From 61c2c0c84ae560ba616045b62329134975168728 Mon Sep 17 00:00:00 2001 From: Sylvia van Os Date: Sun, 8 Dec 2019 18:15:08 +0100 Subject: [PATCH] Completely removed rectangle cleanup code, 1D codes seem to need this padding --- .../card_locker/BarcodeImageWriterTask.java | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java b/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java index b38f47e18..a03a52994 100644 --- a/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java +++ b/app/src/main/java/protect/card_locker/BarcodeImageWriterTask.java @@ -112,30 +112,13 @@ class BarcodeImageWriterTask extends AsyncTask int bitMatrixWidth = bitMatrix.getWidth(); int bitMatrixHeight = bitMatrix.getHeight(); - // Returns: left,top,width,height enclosing rectangle of all 1 bits, or null if it is all white - int[] enclosingRectangle = bitMatrix.getEnclosingRectangle(); - - // We add 20 pixels on all sides to ensure small intentional padding around the barcodes isn't removed - int left = enclosingRectangle != null ? enclosingRectangle[0] - 20 : 0; - int top = enclosingRectangle != null ? enclosingRectangle[1] - 20 : 0; - int right = enclosingRectangle != null ? (enclosingRectangle[0] + enclosingRectangle[2] + 20) : bitMatrixWidth; - int bottom = enclosingRectangle != null ? (enclosingRectangle[1] + enclosingRectangle[3] + 20) : bitMatrixHeight; - int[] pixels = new int[bitMatrixWidth * bitMatrixHeight]; for (int y = 0; y < bitMatrixHeight; y++) { - if(y < top || y >= bottom) - { - continue; - } int offset = y * bitMatrixWidth; for (int x = 0; x < bitMatrixWidth; x++) { - if(x < left || x >= right) - { - continue; - } int color = bitMatrix.get(x, y) ? BLACK : WHITE; pixels[offset + x] = color; }