summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-01-25 15:02:40 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2018-01-25 15:02:40 +0100
commite61d5fd9474d0a266d18a9e9e3a7f9b5ed2fd5df (patch)
tree90b8c73f8eaa96b07bf05eca7fdd5f95f79db0bc
parent8076c1d0945f2233f773690a29d14e9db84607cb (diff)
downloadpoezio-e61d5fd9474d0a266d18a9e9e3a7f9b5ed2fd5df.tar.gz
poezio-e61d5fd9474d0a266d18a9e9e3a7f9b5ed2fd5df.tar.bz2
poezio-e61d5fd9474d0a266d18a9e9e3a7f9b5ed2fd5df.tar.xz
poezio-e61d5fd9474d0a266d18a9e9e3a7f9b5ed2fd5df.zip
Optimise the half-block codepath slightly.
-rw-r--r--poezio/windows/image.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/poezio/windows/image.py b/poezio/windows/image.py
index 6077ef46..8404ec48 100644
--- a/poezio/windows/image.py
+++ b/poezio/windows/image.py
@@ -88,10 +88,10 @@ class ImageWin(Win):
line1 = two_lines[:width * 3]
line2 = two_lines[width * 3:]
self.move(start_y + y, start_x)
- for x in range(width):
- r, g, b = line1[x * 3:(x + 1) * 3]
+ for x in range(0, width * 3, 3):
+ r, g, b = line1[x:x + 3]
top_color = _parse_css_color('#%02x%02x%02x' % (r, g, b))
- r, g, b = line2[x * 3:(x + 1) * 3]
+ r, g, b = line2[x:x + 3]
bot_color = _parse_css_color('#%02x%02x%02x' % (r, g, b))
self.addstr('▄', to_curses_attr((bot_color, top_color)))