|
|
@ -161,8 +161,11 @@ public final class QrCode {
|
|
|
|
* @return the module's color, which is either false (white) or true (black)
|
|
|
|
* @return the module's color, which is either false (white) or true (black)
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public boolean getModule(int x, int y) {
|
|
|
|
public boolean getModule(int x, int y) {
|
|
|
|
return 0 <= x && x < size && 0 <= y && y < size
|
|
|
|
if (0 <= x && x < size && 0 <= y && y < size) {
|
|
|
|
&& getModuleUnchecked(x, y) != 0;
|
|
|
|
int i = y * size + x;
|
|
|
|
|
|
|
|
return ((modules[i >>> 5] >>> i) & 1) != 0;
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -273,12 +276,6 @@ public final class QrCode {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int getModuleUnchecked(int x, int y) {
|
|
|
|
|
|
|
|
int i = y * size + x;
|
|
|
|
|
|
|
|
return (modules[i >>> 5] >>> i) & 1;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*---- Private helper methods for constructor: Codewords and masking ----*/
|
|
|
|
/*---- Private helper methods for constructor: Codewords and masking ----*/
|
|
|
|
|
|
|
|
|
|
|
|
// Returns a new byte string representing the given data with the appropriate error correction
|
|
|
|
// Returns a new byte string representing the given data with the appropriate error correction
|
|
|
|