[GlyphCoordinates] Speed up __imul__()
Like the recent change to __isub__/__iadd__(). This, as well as the other, change do not handle overflows. Going to fix that now.
This commit is contained in:
parent
96690de9a9
commit
8be2f49b84
@ -1705,12 +1705,18 @@ class GlyphCoordinates(object):
|
|||||||
>>> g
|
>>> g
|
||||||
GlyphCoordinates([(2, 4)])
|
GlyphCoordinates([(2, 4)])
|
||||||
"""
|
"""
|
||||||
if isinstance(other, Number):
|
|
||||||
other = (other, other)
|
|
||||||
if isinstance(other, tuple):
|
if isinstance(other, tuple):
|
||||||
assert len(other) == 2
|
assert len(other) == 2
|
||||||
self.scale(other)
|
self.scale(other)
|
||||||
return self
|
return self
|
||||||
|
if isinstance(other, Number):
|
||||||
|
if other == 1.0: return self
|
||||||
|
if other == int(other): other = int(other)
|
||||||
|
if isinstance(other, float): self._ensureFloat()
|
||||||
|
a = self._a
|
||||||
|
for i in range(len(a)):
|
||||||
|
a[i] *= other
|
||||||
|
return self
|
||||||
return NotImplemented
|
return NotImplemented
|
||||||
|
|
||||||
def __itruediv__(self, other):
|
def __itruediv__(self, other):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user