X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=javame%2Fsrc%2Fcom%2Fgoogle%2Fzxing%2Fclient%2Fj2me%2FLCDUIImageMonochromeBitmapSource.java;h=3ee5fe0634fcab67a36299aed945c6d122b1853f;hb=6ed938ceb681243e6fbc7d331e96bddc25a88abb;hp=04d0ca39be78db5818386ae1026e318add273ac2;hpb=04a9820548080f89444f758af0e4d838c9d49716;p=zxing.git diff --git a/javame/src/com/google/zxing/client/j2me/LCDUIImageMonochromeBitmapSource.java b/javame/src/com/google/zxing/client/j2me/LCDUIImageMonochromeBitmapSource.java index 04d0ca39..3ee5fe06 100644 --- a/javame/src/com/google/zxing/client/j2me/LCDUIImageMonochromeBitmapSource.java +++ b/javame/src/com/google/zxing/client/j2me/LCDUIImageMonochromeBitmapSource.java @@ -32,16 +32,20 @@ public final class LCDUIImageMonochromeBitmapSource extends BaseMonochromeBitmap private final int width; // For why this isn't final, see below private int[] rgbRow; + private int[] rgbColumn; private final int[] pixelHolder; private int cachedRow; + private int cachedColumn; public LCDUIImageMonochromeBitmapSource(Image image) { this.image = image; height = image.getHeight(); width = image.getWidth(); rgbRow = new int[width]; + rgbColumn = new int[height]; pixelHolder = new int[1]; cachedRow = -1; + cachedColumn = -1; } public int getHeight() { @@ -61,6 +65,8 @@ public final class LCDUIImageMonochromeBitmapSource extends BaseMonochromeBitmap int pixel; if (cachedRow == y && rgbRow.length == width) { pixel = rgbRow[x]; + } else if (cachedColumn == x && rgbColumn.length == height) { + pixel = rgbColumn[y]; } else { image.getRGB(pixelHolder, 0, width, x, y, 1, 1); pixel = pixelHolder[0]; @@ -94,4 +100,14 @@ public final class LCDUIImageMonochromeBitmapSource extends BaseMonochromeBitmap } } + public void cacheColumnForLuminance(int x) { + if (x != cachedColumn) { + if (rgbColumn.length != height) { + rgbColumn = new int[height]; + } + image.getRGB(rgbColumn, 0, 1, x, 0, 1, height); + cachedColumn = x; + } + } + } \ No newline at end of file