summaryrefslogtreecommitdiffstats
path: root/libdimension/camera.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-05-21 20:27:09 -0600
committerTavian Barnes <tavianator@gmail.com>2011-05-21 20:27:09 -0600
commit0f0b704144bddc045657f7ed852b49d5e349b0bd (patch)
treecefc022b10cc4f5675245ea2e77c24c89a6bc30a /libdimension/camera.c
parent07d784563af19c162945c60562819269e6fc4994 (diff)
downloaddimension-0f0b704144bddc045657f7ed852b49d5e349b0bd.tar.xz
Add refcounts to cameras.
Diffstat (limited to 'libdimension/camera.c')
-rw-r--r--libdimension/camera.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libdimension/camera.c b/libdimension/camera.c
index 67117f9..e76200a 100644
--- a/libdimension/camera.c
+++ b/libdimension/camera.c
@@ -31,8 +31,9 @@ dmnsn_camera *
dmnsn_new_camera(void)
{
dmnsn_camera *camera = dmnsn_malloc(sizeof(dmnsn_camera));
- camera->free_fn = NULL;
- camera->trans = dmnsn_identity_matrix();
+ camera->free_fn = NULL;
+ camera->trans = dmnsn_identity_matrix();
+ camera->refcount = dmnsn_new_refcount();
return camera;
}
@@ -40,7 +41,8 @@ dmnsn_new_camera(void)
void
dmnsn_delete_camera(dmnsn_camera *camera)
{
- if (camera) {
+ if (camera && DMNSN_DECREF(camera)) {
+ dmnsn_delete_refcount(camera->refcount);
if (camera->free_fn) {
camera->free_fn(camera->ptr);
}