From 85952a2dea24dcfa323bc5b60a18db61dac82507 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Tue, 26 May 2015 15:24:35 +0900 Subject: [PATCH] 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. --- gui/qt/qrcodewidget.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/gui/qt/qrcodewidget.py b/gui/qt/qrcodewidget.py index 0095baa63..ab1008de4 100644 --- a/gui/qt/qrcodewidget.py +++ b/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()