Mercurial > touhou
changeset 514:3d4410de78e1
Remove some useless optimisations now that cython does them for us.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 05 Dec 2013 20:40:11 +0100 |
parents | 5e3e0b09a531 |
children | b3193b43a86c |
files | pytouhou/ui/opengl/sprite.pxd pytouhou/ui/opengl/sprite.pyx pytouhou/ui/sdl/sprite.pxd pytouhou/ui/sdl/sprite.pyx |
diffstat | 4 files changed, 9 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/pytouhou/ui/opengl/sprite.pxd +++ b/pytouhou/ui/opengl/sprite.pxd @@ -1,3 +1,3 @@ from pytouhou.game.sprite cimport Sprite -cpdef object get_sprite_rendering_data(Sprite sprite) +cpdef tuple get_sprite_rendering_data(Sprite sprite)
--- a/pytouhou/ui/opengl/sprite.pyx +++ b/pytouhou/ui/opengl/sprite.pyx @@ -19,17 +19,14 @@ from pytouhou.utils.matrix cimport Matri from .renderer cimport Texture #XXX -cpdef object get_sprite_rendering_data(Sprite sprite): +cpdef tuple get_sprite_rendering_data(Sprite sprite): cdef double tx, ty, tw, th, sx, sy, rx, ry, rz, tox, toy - cdef object tmp1, tmp2 if not sprite.changed: return sprite._rendering_data - tmp1 = .5 - tmp2 = -.5 - vertmat = Matrix([tmp2, tmp1, tmp1, tmp2, - tmp2, tmp2, tmp1, tmp1, + vertmat = Matrix([-.5, .5, .5, -.5, + -.5, -.5, .5, .5, 0, 0, 0, 0, 1, 1, 1, 1]) @@ -59,8 +56,9 @@ cpdef object get_sprite_rendering_data(S if sprite.corner_relative_placement: # Reposition vertmat.translate(width / 2, height / 2, 0) - x_1 = 1 / <double>sprite.anm.size[0] - y_1 = 1 / <double>sprite.anm.size[1] + size = sprite.anm.size + x_1 = 1 / <double>size[0] + y_1 = 1 / <double>size[1] tox, toy = sprite.texoffsets uvs = (tx * x_1 + tox, (tx + tw) * x_1 + tox,
--- a/pytouhou/ui/sdl/sprite.pxd +++ b/pytouhou/ui/sdl/sprite.pxd @@ -1,3 +1,3 @@ from pytouhou.game.sprite cimport Sprite -cpdef object get_sprite_rendering_data(Sprite sprite) +cpdef tuple get_sprite_rendering_data(Sprite sprite)
--- a/pytouhou/ui/sdl/sprite.pyx +++ b/pytouhou/ui/sdl/sprite.pyx @@ -16,7 +16,7 @@ from libc.math cimport M_PI as pi -cpdef object get_sprite_rendering_data(Sprite sprite): +cpdef tuple get_sprite_rendering_data(Sprite sprite): cdef double x, y, tx, ty, tw, th, sx, sy, rz, tox, toy if not sprite.changed: