deploy-ng: fix some Python 3 issues in icon generation code

See #718
This commit is contained in:
rdb 2019-08-28 22:41:38 +02:00
parent 61a276f49a
commit 00376c9d0a

View File

@ -367,7 +367,7 @@ class Icon:
# XOR mask # XOR mask
if bpp == 24: if bpp == 24:
# Align rows to 4-byte boundary # Align rows to 4-byte boundary
rowalign = '\0' * (-(size * 3) & 3) rowalign = b'\0' * (-(size * 3) & 3)
for y in xrange(size): for y in xrange(size):
for x in xrange(size): for x in xrange(size):
r, g, b = image.getXel(x, size - y - 1) r, g, b = image.getXel(x, size - y - 1)
@ -503,7 +503,7 @@ class Icon:
if size > 256: if size > 256:
continue continue
elif size == 256: elif size == 256:
ico.write('\0\0') ico.write(b'\0\0')
else: else:
ico.write(struct.pack('<BB', size, size)) ico.write(struct.pack('<BB', size, size))