mirror of
https://git.planet-casio.com/Lephenixnoir/fxsdk.git
synced 2024-12-28 20:43:37 +01:00
fxconv: replace _encode_{word,long} with u16, u32
This commit is contained in:
parent
53ea134c62
commit
47504ff179
1 changed files with 2 additions and 11 deletions
|
@ -304,15 +304,6 @@ class Grid:
|
||||||
y = b + r * (H + b) + p
|
y = b + r * (H + b) + p
|
||||||
yield (x, y, x + w, y + h)
|
yield (x, y, x + w, y + h)
|
||||||
|
|
||||||
#
|
|
||||||
# Helpers
|
|
||||||
#
|
|
||||||
|
|
||||||
def _encode_word(x):
|
|
||||||
return bytes([ (x >> 8) & 255, x & 255 ])
|
|
||||||
def _encode_long(x):
|
|
||||||
return bytes([ (x >> 24) & 255, (x >> 16) & 255, (x >> 8) & 255, x & 255 ])
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Binary conversion
|
# Binary conversion
|
||||||
#
|
#
|
||||||
|
@ -585,7 +576,7 @@ def convert_topti(input, output, params, target):
|
||||||
|
|
||||||
def encode_block(b):
|
def encode_block(b):
|
||||||
start, length = b
|
start, length = b
|
||||||
return _encode_long((start << 12) | length)
|
return u32((start << 12) | length)
|
||||||
|
|
||||||
data_blocks = b''.join(encode_block(b) for b in blocks)
|
data_blocks = b''.join(encode_block(b) for b in blocks)
|
||||||
|
|
||||||
|
@ -603,7 +594,7 @@ def convert_topti(input, output, params, target):
|
||||||
# Upate index
|
# Upate index
|
||||||
if not (number % 8):
|
if not (number % 8):
|
||||||
idx = total_glyphs // 4
|
idx = total_glyphs // 4
|
||||||
data_index += _encode_word(idx)
|
data_index += u16(idx)
|
||||||
|
|
||||||
# Get glyph area
|
# Get glyph area
|
||||||
glyph = img.crop(region)
|
glyph = img.crop(region)
|
||||||
|
|
Loading…
Reference in a new issue