summaryrefslogtreecommitdiffstats
path: root/libdimension-python
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-05-30 15:48:29 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-05-30 15:48:29 -0400
commit45e219eac23ea4a8181f68300fed693d9ac361a0 (patch)
tree06b72b3ca9a97b1352537836a2a42af7033ae6b1 /libdimension-python
parentf61c7c75c3c7ff4a329315700d3efa1d77bafa6d (diff)
downloaddimension-45e219eac23ea4a8181f68300fed693d9ac361a0.tar.xz
canvas: Use pool.
Diffstat (limited to 'libdimension-python')
-rw-r--r--libdimension-python/dimension.pxd6
-rw-r--r--libdimension-python/dimension.pyx8
2 files changed, 5 insertions, 9 deletions
diff --git a/libdimension-python/dimension.pxd b/libdimension-python/dimension.pxd
index d3c0c9e..6b5c77f 100644
--- a/libdimension-python/dimension.pxd
+++ b/libdimension-python/dimension.pxd
@@ -203,7 +203,7 @@ cdef extern from "../libdimension/dimension.h":
size_t width
size_t height
- dmnsn_canvas *dmnsn_new_canvas(size_t width, size_t height)
+ dmnsn_canvas *dmnsn_new_canvas(dmnsn_pool *pool, size_t width, size_t height)
void dmnsn_delete_canvas(dmnsn_canvas *canvas)
dmnsn_tcolor dmnsn_canvas_get_pixel(dmnsn_canvas *canvas, size_t x, size_t y)
@@ -215,8 +215,8 @@ cdef extern from "../libdimension/dimension.h":
int dmnsn_png_optimize_canvas(dmnsn_canvas *canvas)
int dmnsn_png_write_canvas(dmnsn_canvas *canvas, FILE *file)
dmnsn_future *dmnsn_png_write_canvas_async(dmnsn_canvas *canvas, FILE *file)
- dmnsn_canvas *dmnsn_png_read_canvas(FILE *file)
- dmnsn_future *dmnsn_png_read_canvas_async(dmnsn_canvas **canvas, FILE *file)
+ dmnsn_canvas *dmnsn_png_read_canvas(dmnsn_pool *pool, FILE *file)
+ dmnsn_future *dmnsn_png_read_canvas_async(dmnsn_canvas **canvas, dmnsn_pool *pool, FILE *file)
int dmnsn_gl_optimize_canvas(dmnsn_canvas *canvas)
int dmnsn_gl_write_canvas(dmnsn_canvas *canvas)
diff --git a/libdimension-python/dimension.pyx b/libdimension-python/dimension.pyx
index c84d21a..79e4014 100644
--- a/libdimension-python/dimension.pyx
+++ b/libdimension-python/dimension.pyx
@@ -643,12 +643,9 @@ cdef class Canvas:
width -- the width of the canvas
height -- the height of the canvas
"""
- self._canvas = dmnsn_new_canvas(width, height)
+ self._canvas = dmnsn_new_canvas(_get_pool(), width, height)
self.clear(Black)
- def __dealloc__(self):
- dmnsn_delete_canvas(self._canvas)
-
property width:
"""The width of the canvas."""
def __get__(self):
@@ -834,7 +831,7 @@ cdef class ImageMap(Pigment):
cdef FILE *file = fopen(cpath, "rb")
if file == NULL:
_raise_OSError(path)
- cdef dmnsn_canvas *canvas = dmnsn_png_read_canvas(file)
+ cdef dmnsn_canvas *canvas = dmnsn_png_read_canvas(_get_pool(), file)
if canvas == NULL:
_raise_OSError(path)
if fclose(file) != 0:
@@ -1514,7 +1511,6 @@ cdef class Scene:
self._scene = dmnsn_new_scene(_get_pool())
self._scene.canvas = canvas._canvas
- DMNSN_INCREF(self._scene.canvas)
self.outer_width = self._scene.canvas.width
self.outer_height = self._scene.canvas.height
self.background = Black