mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-27 12:33:41 +03:00
Flake8 and fix typo
This commit is contained in:
parent
8a73a20af1
commit
9acbaa4aee
|
@ -33,6 +33,7 @@ i32 = _binary.i32le
|
||||||
def _accept(prefix):
|
def _accept(prefix):
|
||||||
return prefix[:4] == b"\0\0\2\0"
|
return prefix[:4] == b"\0\0\2\0"
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
# Image plugin for Windows Cursor files.
|
# Image plugin for Windows Cursor files.
|
||||||
|
|
||||||
|
@ -48,7 +49,7 @@ class CurImageFile(BmpImagePlugin.BmpImageFile):
|
||||||
# check magic
|
# check magic
|
||||||
s = self.fp.read(6)
|
s = self.fp.read(6)
|
||||||
if not _accept(s):
|
if not _accept(s):
|
||||||
raise SyntaxError("not an CUR file")
|
raise SyntaxError("not a CUR file")
|
||||||
|
|
||||||
# pick the largest cursor in the file
|
# pick the largest cursor in the file
|
||||||
m = b""
|
m = b""
|
||||||
|
@ -58,14 +59,14 @@ class CurImageFile(BmpImagePlugin.BmpImageFile):
|
||||||
m = s
|
m = s
|
||||||
elif i8(s[0]) > i8(m[0]) and i8(s[1]) > i8(m[1]):
|
elif i8(s[0]) > i8(m[0]) and i8(s[1]) > i8(m[1]):
|
||||||
m = s
|
m = s
|
||||||
#print "width", i8(s[0])
|
# print "width", i8(s[0])
|
||||||
#print "height", i8(s[1])
|
# print "height", i8(s[1])
|
||||||
#print "colors", i8(s[2])
|
# print "colors", i8(s[2])
|
||||||
#print "reserved", i8(s[3])
|
# print "reserved", i8(s[3])
|
||||||
#print "hotspot x", i16(s[4:])
|
# print "hotspot x", i16(s[4:])
|
||||||
#print "hotspot y", i16(s[6:])
|
# print "hotspot y", i16(s[6:])
|
||||||
#print "bytes", i32(s[8:])
|
# print "bytes", i32(s[8:])
|
||||||
#print "offset", i32(s[12:])
|
# print "offset", i32(s[12:])
|
||||||
|
|
||||||
# load as bitmap
|
# load as bitmap
|
||||||
self._bitmap(i32(m[12:]) + offset)
|
self._bitmap(i32(m[12:]) + offset)
|
||||||
|
@ -73,7 +74,7 @@ class CurImageFile(BmpImagePlugin.BmpImageFile):
|
||||||
# patch up the bitmap height
|
# patch up the bitmap height
|
||||||
self.size = self.size[0], self.size[1]//2
|
self.size = self.size[0], self.size[1]//2
|
||||||
d, e, o, a = self.tile[0]
|
d, e, o, a = self.tile[0]
|
||||||
self.tile[0] = d, (0,0)+self.size, o, a
|
self.tile[0] = d, (0, 0)+self.size, o, a
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user