From 74323fa54010d29737281579e4f3b4038da94989 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Sat, 31 May 2014 15:06:09 -0400 Subject: texture: Use pool. --- libdimension-python/dimension.pxd | 6 ++---- libdimension-python/dimension.pyx | 10 +--------- 2 files changed, 3 insertions(+), 13 deletions(-) (limited to 'libdimension-python') diff --git a/libdimension-python/dimension.pxd b/libdimension-python/dimension.pxd index b822827..33f2300 100644 --- a/libdimension-python/dimension.pxd +++ b/libdimension-python/dimension.pxd @@ -295,11 +295,9 @@ cdef extern from "../libdimension/dimension.h": dmnsn_finish finish dmnsn_matrix trans - dmnsn_texture *dmnsn_new_texture() - void dmnsn_delete_texture(dmnsn_texture *texture) + dmnsn_texture *dmnsn_new_texture(dmnsn_pool *pool) - void dmnsn_texture_cascade(dmnsn_texture *default_texture, - dmnsn_texture **texture) + void dmnsn_texture_cascade(dmnsn_texture *default_texture, dmnsn_texture **texture) ############# # Interiors # diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx index 7c951d6..2ab683d 100644 --- a/libdimension-python/dimension.pyx +++ b/libdimension-python/dimension.pyx @@ -963,7 +963,7 @@ cdef class Texture(_Transformable): pigment -- the Pigment for the texture, or a color (default: None) finish -- the Finish for the texture (default: None) """ - self._texture = dmnsn_new_texture() + self._texture = dmnsn_new_texture(_get_pool()) if pigment is not None: self.pigment = Pigment(pigment) @@ -971,9 +971,6 @@ cdef class Texture(_Transformable): if finish is not None: self.finish = finish - def __dealloc__(self): - dmnsn_delete_texture(self._texture) - property pigment: """The texture's pigment.""" def __get__(self): @@ -1005,7 +1002,6 @@ cdef Texture _Texture(dmnsn_texture *texture): """Wrap a Texture object around a dmnsn_texture *.""" cdef Texture self = Texture.__new__(Texture) self._texture = texture - DMNSN_INCREF(self._texture) return self ############# @@ -1095,12 +1091,10 @@ cdef class Object(_Transformable): else: return _Texture(self._object.texture) def __set__(self, Texture texture): - dmnsn_delete_texture(self._object.texture) if texture is None: self._object.texture = NULL else: self._object.texture = texture._texture - DMNSN_INCREF(self._object.texture) property interior: """The object's Interior.""" @@ -1526,9 +1520,7 @@ cdef class Scene: def __get__(self): return _Texture(self._scene.default_texture) def __set__(self, Texture texture not None): - dmnsn_delete_texture(self._scene.default_texture) self._scene.default_texture = texture._texture - DMNSN_INCREF(self._scene.default_texture) property default_interior: """The default Interior for objects.""" def __get__(self): -- cgit v1.2.3