diff pytouhou/ui/opengl/sprite.pyx @ 525:43ecf0f98f4d

Precalculate the inverse of the texture size at ANM load, to not recalculate at every sprite change.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Wed, 18 Dec 2013 18:15:45 +0100
parents 6e3b3d5d4691
children db28538cd399
line wrap: on
line diff
--- a/pytouhou/ui/opengl/sprite.pyx
+++ b/pytouhou/ui/opengl/sprite.pyx
@@ -57,9 +57,8 @@ cpdef tuple get_sprite_rendering_data(Sp
     if sprite.corner_relative_placement: # Reposition
         translate2d(&vertmat, width / 2, height / 2)
 
-    size = sprite.anm.size
-    x_1 = 1 / <double>size[0]
-    y_1 = 1 / <double>size[1]
+    x_1 = sprite.anm.size_inv[0]
+    y_1 = sprite.anm.size_inv[1]
     tox, toy = sprite.texoffsets
     uvs = (tx * x_1 + tox,
            (tx + tw) * x_1 + tox,