Further optimize

Signed-off-by: Hollow Man <hollowman186@vip.qq.com>
master
Hollow Man 6 years ago
parent 22eacbd10c
commit cad87ea77b
No known key found for this signature in database
GPG Key ID: 6CA2A0660F48F7A
  1. 17
      app/pdf-viewer/buffer.py

@ -389,14 +389,15 @@ class PdfViewerWidget(QWidget):
if time%2 == 1 and time//2 > 0: if time%2 == 1 and time//2 > 0:
imagebboxlist.extend(newly_added_overlapbboxlist) imagebboxlist.extend(newly_added_overlapbboxlist)
# remove duplicate to make it run faster if len(imagebboxlist) != len(set(imagebboxlist)):
for item in set(imagebboxlist): # remove duplicate to make it run faster
if imagebboxlist.count(item) % 2 == 0: for item in set(imagebboxlist):
while item in imagebboxlist: if imagebboxlist.count(item) % 2 == 0:
imagebboxlist.remove(item) while item in imagebboxlist:
else: imagebboxlist.remove(item)
while imagebboxlist.count(item) > 1: else:
imagebboxlist.remove(item) while imagebboxlist.count(item) > 1:
imagebboxlist.remove(item)
for bbox in imagebboxlist: for bbox in imagebboxlist:
pixmap.invertIRect(bbox * self.scale) pixmap.invertIRect(bbox * self.scale)

Loading…
Cancel
Save