summaryrefslogtreecommitdiffstats
path: root/libdimension-python
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-05-30 19:03:33 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-05-30 19:03:33 -0400
commit8807ab192b36acbc94e11790e9261c799ce77892 (patch)
tree7b37684cb5679c132d21f3bd8c2ff47a11e3df55 /libdimension-python
parent4781d3a2a7ec463ee712c8de6362d8b6c872c31b (diff)
downloaddimension-8807ab192b36acbc94e11790e9261c799ce77892.tar.xz
pattern: Use pool.
Diffstat (limited to 'libdimension-python')
-rw-r--r--libdimension-python/dimension.pxd8
-rw-r--r--libdimension-python/dimension.pyx10
2 files changed, 7 insertions, 11 deletions
diff --git a/libdimension-python/dimension.pxd b/libdimension-python/dimension.pxd
index 61b5060..f6333cc 100644
--- a/libdimension-python/dimension.pxd
+++ b/libdimension-python/dimension.pxd
@@ -227,11 +227,11 @@ cdef extern from "../libdimension/dimension.h":
ctypedef struct dmnsn_pattern:
pass
- void dmnsn_delete_pattern(dmnsn_pattern *pattern)
+ void dmnsn_new_pattern(dmnsn_pool *pool)
- dmnsn_pattern *dmnsn_new_checker_pattern()
- dmnsn_pattern *dmnsn_new_gradient_pattern(dmnsn_vector orientation)
- dmnsn_pattern *dmnsn_new_leopard_pattern()
+ dmnsn_pattern *dmnsn_new_checker_pattern(dmnsn_pool *pool)
+ dmnsn_pattern *dmnsn_new_gradient_pattern(dmnsn_pool *pool, dmnsn_vector orientation)
+ dmnsn_pattern *dmnsn_new_leopard_pattern(dmnsn_pool *pool)
########
# Maps #
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index 7466b9e..534781c 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -744,13 +744,10 @@ cdef class Pattern:
def __cinit__(self):
self._pattern = NULL
- def __dealloc__(self):
- dmnsn_delete_pattern(self._pattern)
-
cdef class Checker(Pattern):
"""A checkerboard pattern."""
def __init__(self):
- self._pattern = dmnsn_new_checker_pattern()
+ self._pattern = dmnsn_new_checker_pattern(_get_pool())
Pattern.__init__(self)
cdef class Gradient(Pattern):
@@ -762,13 +759,13 @@ cdef class Gradient(Pattern):
Keyword arguments:
orientation -- The direction of the linear gradient.
"""
- self._pattern = dmnsn_new_gradient_pattern(Vector(orientation)._v)
+ self._pattern = dmnsn_new_gradient_pattern(_get_pool(), Vector(orientation)._v)
Pattern.__init__(self)
cdef class Leopard(Pattern):
"""A leopard pattern."""
def __init__(self):
- self._pattern = dmnsn_new_leopard_pattern()
+ self._pattern = dmnsn_new_leopard_pattern(_get_pool())
Pattern.__init__(self)
############
@@ -875,7 +872,6 @@ cdef class PigmentMap(Pigment):
else:
flags = DMNSN_PIGMENT_MAP_REGULAR
- DMNSN_INCREF(pattern._pattern)
self._pigment = dmnsn_new_pigment_map_pigment(pattern._pattern, pigment_map,
flags)
Pigment.__init__(self, *args, **kwargs)