Speed up painting of qr codes.

Probably speeds it up by about a factor of two.
Unfortunately it needs to be another 5x faster
for sluggishness to disappear in the GUI when
typing a description in the receive tab.

Note the old code was off-by-one.
This commit is contained in:
Neil Booth 2015-05-26 15:24:35 +09:00
parent 7becb28ec8
commit 85952a2dea
1 changed files with 3 additions and 6 deletions

View File

@ -72,16 +72,13 @@ class QRCodeWidget(QWidget):
qp.setBrush(white)
qp.setPen(white)
qp.drawRect(left-margin, top-margin, size+(margin*2), size+(margin*2))
qp.setBrush(black)
qp.setPen(black)
for r in range(k):
for c in range(k):
if matrix[r][c]:
qp.setBrush(black)
qp.setPen(black)
else:
qp.setBrush(white)
qp.setPen(white)
qp.drawRect(left+c*boxsize, top+r*boxsize, boxsize, boxsize)
qp.drawRect(left+c*boxsize, top+r*boxsize, boxsize - 1, boxsize - 1)
qp.end()