comparison pytouhou/ui/sdl/sprite.pyx @ 616:4ce3ef053a25

Remove every case where an exception could be silently eaten by a cdef function.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Sat, 28 Mar 2015 23:21:15 +0100
parents dacdcca59b66
children
comparison
equal deleted inserted replaced
615:d1f0bb0b7a17 616:4ce3ef053a25
10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of 10 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 ## GNU General Public License for more details. 12 ## GNU General Public License for more details.
13 ## 13 ##
14 14
15 15 cimport cython
16 from libc.stdlib cimport malloc 16 from libc.stdlib cimport malloc
17 from libc.math cimport M_PI as pi 17 from libc.math cimport M_PI as pi
18 18
19 19
20 cdef RenderingData* get_sprite_rendering_data(Sprite sprite) nogil: 20 cdef RenderingData* get_sprite_rendering_data(Sprite sprite) nogil:
21 if sprite.changed: 21 if sprite.changed:
22 render_sprite(sprite) 22 render_sprite(sprite)
23 return <RenderingData*>sprite._rendering_data 23 return <RenderingData*>sprite._rendering_data
24 24
25 25
26 @cython.cdivision(True)
26 cdef void render_sprite(Sprite sprite) nogil: 27 cdef void render_sprite(Sprite sprite) nogil:
27 if sprite._rendering_data == NULL: 28 if sprite._rendering_data == NULL:
28 sprite._rendering_data = malloc(sizeof(RenderingData)) 29 sprite._rendering_data = malloc(sizeof(RenderingData))
29 30
30 data = <RenderingData*>sprite._rendering_data 31 data = <RenderingData*>sprite._rendering_data