Mercurial > touhou
diff pytouhou/ui/sdl/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 | 3d4410de78e1 |
children | db28538cd399 |
line wrap: on
line diff
--- a/pytouhou/ui/sdl/sprite.pyx +++ b/pytouhou/ui/sdl/sprite.pyx @@ -43,9 +43,8 @@ cpdef tuple get_sprite_rendering_data(Sp x -= width / 2 y -= 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,