From 97fc995af0e578d8f87ee6fb6bea3ea91a9a81c6 Mon Sep 17 00:00:00 2001 From: srowen Date: Tue, 19 Feb 2008 21:49:26 +0000 Subject: [PATCH] Little bug fix affecting QR Codes that run all the way to the left/top edge of an image git-svn-id: http://zxing.googlecode.com/svn/trunk@215 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../com/google/zxing/qrcode/detector/Detector.java | 6 ++++-- core/test/data/blackbox/qrcode-2/11.txt | 12 ++++++++++++ core/test/data/blackbox/qrcode-2/11.url | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 core/test/data/blackbox/qrcode-2/11.txt create mode 100644 core/test/data/blackbox/qrcode-2/11.url diff --git a/core/src/com/google/zxing/qrcode/detector/Detector.java b/core/src/com/google/zxing/qrcode/detector/Detector.java index 356defa9..87a08fba 100644 --- a/core/src/com/google/zxing/qrcode/detector/Detector.java +++ b/core/src/com/google/zxing/qrcode/detector/Detector.java @@ -178,13 +178,15 @@ public final class Detector { // Now count other way -- don't run off image though of course int otherToX = fromX - (toX - fromX); if (otherToX < 0) { - otherToX = 0; + // "to" should the be the first value not included, so, the first value off + // the edge is -1 + otherToX = -1; } else if (otherToX >= image.getWidth()) { otherToX = image.getWidth(); } int otherToY = fromY - (toY - fromY); if (otherToY < 0) { - otherToY = 0; + otherToY = -1; } else if (otherToY >= image.getHeight()) { otherToY = image.getHeight(); } diff --git a/core/test/data/blackbox/qrcode-2/11.txt b/core/test/data/blackbox/qrcode-2/11.txt new file mode 100644 index 00000000..2b574b76 --- /dev/null +++ b/core/test/data/blackbox/qrcode-2/11.txt @@ -0,0 +1,12 @@ +BEGIN:VCARD +N:Kennedy;Steve +TEL:+44 (0)7775 755503 +ADR;HOME:;;Flat 2, 43 Howitt Road, Belsize Park;London;;NW34LU;UK +ORG:NetTek Ltd; +TITLE:Consultant +EMAIL:steve@nettek.co.uk +URL:www.nettek.co.uk +EMAIL;IM:MSN:steve@gbnet.net +NOTE:Testing 1 2 3 +BDAY:19611105 +END:VCARD \ No newline at end of file diff --git a/core/test/data/blackbox/qrcode-2/11.url b/core/test/data/blackbox/qrcode-2/11.url new file mode 100644 index 00000000..5ea88854 --- /dev/null +++ b/core/test/data/blackbox/qrcode-2/11.url @@ -0,0 +1 @@ +http://www.d-co.de/images/qrcode_eg1.gif \ No newline at end of file -- 2.20.1