Skip to content

Commit 9fc0735

Browse files
author
BoboTiG
committed
MSSWindows: huge optimization of get_pixels()
1 parent 843e903 commit 9fc0735

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

doc/CHANGELOG

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ devel 201y/mm/dd
1111
- MSSLinux: fix object has no attribute 'display' into __del__
1212
- MSSLinux: use of XDestroyImage() instead of XFree()
1313
- MSSLinux: few optimizations into get_pixels()
14-
- MSSWindows: optimization of get_pixels()
14+
- MSSWindows: huge optimization of get_pixels()
1515

1616
0.1.1 2015/04/10
1717
- little code review

mss.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,8 @@ def get_pixels(self, monitor):
667667
windll.gdi32.DeleteObject(bmp)
668668

669669
# Replace pixels values: BGR to RGB
670-
# @TODO: this part takes most of the time. Need a better solution.
671-
for idx in range(0, buffer_len - 2, 3):
672-
self.image[idx + 2], self.image[idx] = \
673-
self.image[idx], self.image[idx + 2]
670+
self.image[2:buffer_len:3], self.image[0:buffer_len:3] = \
671+
self.image[0:buffer_len:3], self.image[2:buffer_len:3]
674672
return self.image
675673

676674

0 commit comments

Comments
 (0)