Fix scanline stride issue
authorsrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 20 Oct 2009 17:41:23 +0000 (17:41 +0000)
committersrowen <srowen@59b500cc-1b3d-0410-9834-0bbf25fbcc57>
Tue, 20 Oct 2009 17:41:23 +0000 (17:41 +0000)
git-svn-id: http://zxing.googlecode.com/svn/trunk@1079 59b500cc-1b3d-0410-9834-0bbf25fbcc57

javase/src/com/google/zxing/client/j2se/BufferedImageLuminanceSource.java

index e5d45b5..d9e61a3 100644 (file)
@@ -70,7 +70,7 @@ public final class BufferedImageLuminanceSource extends LuminanceSource {
     if (rgbData == null || rgbData.length < width) {
       rgbData = new int[width];
     }
-    image.getRGB(left, top + y, width, 1, rgbData, 0, image.getWidth());
+    image.getRGB(left, top + y, width, 1, rgbData, 0, width);
     for (int x = 0; x < width; x++) {
       int pixel = rgbData[x];
       int luminance = (306 * ((pixel >> 16) & 0xFF) +
@@ -89,7 +89,7 @@ public final class BufferedImageLuminanceSource extends LuminanceSource {
     byte[] matrix = new byte[area];
 
     int[] rgb = new int[area];
-    image.getRGB(left, top, width, height, rgb, 0, image.getWidth());
+    image.getRGB(left, top, width, height, rgb, 0, width);
     for (int y = 0; y < height; y++) {
       int offset = y * width;
       for (int x = 0; x < width; x++) {