fixed bug with reminder bits in some qr versions

This commit is contained in:
Florian Sundermann 2013-12-12 09:08:33 +01:00
parent e9d2d310c8
commit 4c758a440a
1 changed files with 9 additions and 5 deletions

View File

@ -109,13 +109,17 @@ func render(data []byte, vi *versionInfo) *qrcode {
var curBitNo int = 0
for pos := range itterateModules(occupied) {
var curBit bool
if curBitNo < len(data)*8 {
curBit := ((data[curBitNo/8] >> uint(7-(curBitNo%8))) & 1) == 1
for i := 0; i < 8; i++ {
setMasked(pos.X, pos.Y, curBit, i, results[i].Set)
}
curBitNo += 1
curBit = ((data[curBitNo/8] >> uint(7-(curBitNo%8))) & 1) == 1
} else {
curBit = false
}
for i := 0; i < 8; i++ {
setMasked(pos.X, pos.Y, curBit, i, results[i].Set)
}
curBitNo += 1
}
lowestPenalty := ^uint(0)