diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2014-05-31 13:54:56 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2014-05-31 13:55:26 -0400 |
commit | c10255ab3da17507d63bdc7e1fdfc809ffd32f7f (patch) | |
tree | de65eefb9152ebb049c2adbb8e2cf00abe09063e /libdimension/canvas_pigment.c | |
parent | 70373204b341fc91694c0293796230e447c51067 (diff) | |
download | dimension-c10255ab3da17507d63bdc7e1fdfc809ffd32f7f.tar.xz |
pigment: Use pool.
Diffstat (limited to 'libdimension/canvas_pigment.c')
-rw-r--r-- | libdimension/canvas_pigment.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/libdimension/canvas_pigment.c b/libdimension/canvas_pigment.c index bc5653e..d4812cf 100644 --- a/libdimension/canvas_pigment.c +++ b/libdimension/canvas_pigment.c @@ -35,8 +35,7 @@ typedef struct dmnsn_canvas_pigment { static dmnsn_tcolor dmnsn_canvas_pigment_fn(const dmnsn_pigment *pigment, dmnsn_vector v) { - const dmnsn_canvas_pigment *canvas_pigment = - (const dmnsn_canvas_pigment *)pigment; + const dmnsn_canvas_pigment *canvas_pigment = (const dmnsn_canvas_pigment *)pigment; dmnsn_canvas *canvas = canvas_pigment->canvas; size_t x = llround((fmod(v.x, 1.0) + 1.0)*(canvas->width - 1)); @@ -44,24 +43,15 @@ dmnsn_canvas_pigment_fn(const dmnsn_pigment *pigment, dmnsn_vector v) return dmnsn_canvas_get_pixel(canvas, x%canvas->width, y%canvas->height); } -/** Canvas pigment destructor. */ -static void -dmnsn_canvas_pigment_free_fn(dmnsn_pigment *pigment) -{ - dmnsn_canvas_pigment *canvas_pigment = (dmnsn_canvas_pigment *)pigment; - dmnsn_free(canvas_pigment); -} - /* Create a canvas color */ dmnsn_pigment * -dmnsn_new_canvas_pigment(dmnsn_canvas *canvas) +dmnsn_new_canvas_pigment(dmnsn_pool *pool, dmnsn_canvas *canvas) { - dmnsn_canvas_pigment *canvas_pigment = DMNSN_MALLOC(dmnsn_canvas_pigment); + dmnsn_canvas_pigment *canvas_pigment = DMNSN_PALLOC(pool, dmnsn_canvas_pigment); canvas_pigment->canvas = canvas; dmnsn_pigment *pigment = &canvas_pigment->pigment; dmnsn_init_pigment(pigment); pigment->pigment_fn = dmnsn_canvas_pigment_fn; - pigment->free_fn = dmnsn_canvas_pigment_free_fn; return pigment; } |