# HG changeset patch # User Thibaut Girka # Date 1313186531 -7200 # Node ID 55973a3f1222a60fcea867ff4c0c62a47a7f17a3 # Parent e3ba2fa966f65760f597e0bb375924a9d244edf1 Some more optimization! diff --git a/pytouhou/game/sprite.py b/pytouhou/game/sprite.py --- a/pytouhou/game/sprite.py +++ b/pytouhou/game/sprite.py @@ -41,7 +41,7 @@ class Sprite(object): width = override_width or (tw * sx) height = override_height or (th * sy) - vertmat.scale(width, height, 1.) + vertmat.scale2d(width, height) if self.mirrored: vertmat.flip() if self.rotations_3d != (0., 0., 0.): diff --git a/pytouhou/utils/matrix.py b/pytouhou/utils/matrix.py --- a/pytouhou/utils/matrix.py +++ b/pytouhou/utils/matrix.py @@ -24,6 +24,12 @@ class Matrix(object): d1[2][:] = (a * z for a in d1[2]) + def scale2d(self, x, y): + d1 = self.data + d1[0][:] = (a * x for a in d1[0]) + d1[1][:] = (a * y for a in d1[1]) + + def translate(self, x, y, z): d1 = self.data a, b, c = (v * m for v, m in zip(d1[3][:3], (x, y, z)))