summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/pixmap.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/common/pixmap.py b/common/pixmap.py
index 3e52486..fcf9312 100644
--- a/common/pixmap.py
+++ b/common/pixmap.py
@@ -1,5 +1,5 @@
-import io
+import io, sys
def decodepixmap(data):
f = io.BytesIO(data)
@@ -70,9 +70,10 @@ def makebkgnd(w, h, data):
for position in range(0, scanline*h, scanline):
line = []
for p in range(position, position+scanline, 3):
- line.append(2 * (chr(ord(data[p ]) >> 3) +
- chr(ord(data[p+1]) >> 3) +
- chr(ord(data[p+2]) >> 3)))
+ print(f"data[p]={data[p+1]} type={type(data[p+1])}", file=sys.stderr)
+ line.append(2 * ( (data[p ] >> 3).to_bytes(1,byteorder='little') +
+ (data[p+1] >> 3).to_bytes(1,byteorder='little') +
+ (data[p+2] >> 3).to_bytes(1,byteorder='little') ))
line = b''.join(line)
result.append(line)
result.append(line)