mirror of
https://github.com/zxing/zxing.git
synced 2024-11-12 14:04:06 -08:00
Optimize buffer size (#1013)
This commit is contained in:
parent
a372dfe175
commit
fa0e1d7556
|
@ -339,7 +339,7 @@ public final class BitArray implements Cloneable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuilder result = new StringBuilder(size);
|
StringBuilder result = new StringBuilder(size + (size / 8) + 1);
|
||||||
for (int i = 0; i < size; i++) {
|
for (int i = 0; i < size; i++) {
|
||||||
if ((i & 0x07) == 0) {
|
if ((i & 0x07) == 0) {
|
||||||
result.append(' ');
|
result.append(' ');
|
||||||
|
|
|
@ -200,7 +200,7 @@ public final class BitMatrix implements Cloneable {
|
||||||
|| rowSize != mask.getRowSize()) {
|
|| rowSize != mask.getRowSize()) {
|
||||||
throw new IllegalArgumentException("input matrix dimensions do not match");
|
throw new IllegalArgumentException("input matrix dimensions do not match");
|
||||||
}
|
}
|
||||||
BitArray rowArray = new BitArray(width / 32 + 1);
|
BitArray rowArray = new BitArray(width);
|
||||||
for (int y = 0; y < height; y++) {
|
for (int y = 0; y < height; y++) {
|
||||||
int offset = y * rowSize;
|
int offset = y * rowSize;
|
||||||
int[] row = mask.getRow(y, rowArray).getBitArray();
|
int[] row = mask.getRow(y, rowArray).getBitArray();
|
||||||
|
|
Loading…
Reference in a new issue