Mercurial > touhou
comparison pytouhou/ui/opengl/texture.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 | dec43940f092 |
children | 1be60813f7cb |
comparison
equal
deleted
inserted
replaced
524:7f016dfbdfb1 | 525:43ecf0f98f4d |
---|---|
37 | 37 |
38 | 38 |
39 cdef void load(self, dict anms): | 39 cdef void load(self, dict anms): |
40 for anm in sorted(anms.values(), key=is_ascii): | 40 for anm in sorted(anms.values(), key=is_ascii): |
41 for entry in anm: | 41 for entry in anm: |
42 if not hasattr(entry, 'texture'): | 42 if entry.texture is None: |
43 texture = decode_png(self.loader, entry.first_name, entry.secondary_name) | 43 texture = decode_png(self.loader, entry.first_name, entry.secondary_name) |
44 elif not isinstance(entry.texture, self.texture_class): | 44 elif not isinstance(entry.texture, self.texture_class): |
45 texture = entry.texture | 45 texture = entry.texture |
46 entry.texture = self.texture_class(load_texture(texture), self.renderer) | 46 entry.texture = self.texture_class(load_texture(texture), self.renderer) |
47 anms.clear() | 47 anms.clear() |