Fix bytes to integers conversion in png2c script.
Use really correct coefficients for all the bytes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66861 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
21b5902b81
commit
8de6a0270d
@ -56,9 +56,14 @@ for path in sys.argv[1:]:
|
|||||||
|
|
||||||
# Try to naively get its size if necessary
|
# Try to naively get its size if necessary
|
||||||
if with_size:
|
if with_size:
|
||||||
width = bytes[19] + 16*bytes[18] + 256*bytes[17] + 65536*bytes[16]
|
def getInt(start):
|
||||||
height = bytes[23] + 16*bytes[22] + 256*bytes[21] + 65536*bytes[20]
|
""" Convert 4 bytes in network byte order to an integer. """
|
||||||
size_suffix = "_%dx%d" % (width, height)
|
return 16777216*bytes[start] + \
|
||||||
|
65536*bytes[start+1] + \
|
||||||
|
256*bytes[start+2] + \
|
||||||
|
bytes[start+3];
|
||||||
|
|
||||||
|
size_suffix = "_%dx%d" % (getInt(16), getInt(20))
|
||||||
|
|
||||||
# Create the C header
|
# Create the C header
|
||||||
text = "/* %s - %d bytes */\n" \
|
text = "/* %s - %d bytes */\n" \
|
||||||
|
Loading…
Reference in New Issue
Block a user