changeset 31:55973a3f1222

Some more optimization!
author Thibaut Girka <thib@sitedethib.com>
date Sat, 13 Aug 2011 00:02:11 +0200
parents e3ba2fa966f6
children 47543594ff66
files pytouhou/game/sprite.py pytouhou/utils/matrix.py
diffstat 2 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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.):
--- 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)))