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:
@@ -72,16 +72,13 @@ class QRCodeWidget(QWidget):
|
|||||||
qp.setBrush(white)
|
qp.setBrush(white)
|
||||||
qp.setPen(white)
|
qp.setPen(white)
|
||||||
qp.drawRect(left-margin, top-margin, size+(margin*2), size+(margin*2))
|
qp.drawRect(left-margin, top-margin, size+(margin*2), size+(margin*2))
|
||||||
|
qp.setBrush(black)
|
||||||
|
qp.setPen(black)
|
||||||
|
|
||||||
for r in range(k):
|
for r in range(k):
|
||||||
for c in range(k):
|
for c in range(k):
|
||||||
if matrix[r][c]:
|
if matrix[r][c]:
|
||||||
qp.setBrush(black)
|
qp.drawRect(left+c*boxsize, top+r*boxsize, boxsize - 1, boxsize - 1)
|
||||||
qp.setPen(black)
|
|
||||||
else:
|
|
||||||
qp.setBrush(white)
|
|
||||||
qp.setPen(white)
|
|
||||||
qp.drawRect(left+c*boxsize, top+r*boxsize, boxsize, boxsize)
|
|
||||||
qp.end()
|
qp.end()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user