Browse Source

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.
master
Neil Booth 11 years ago
parent
commit
85952a2dea
  1. 9
      gui/qt/qrcodewidget.py

9
gui/qt/qrcodewidget.py

@ -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()

Loading…
Cancel
Save