summaryrefslogtreecommitdiffstats
path: root/libdimension/texture.c
diff options
context:
space:
mode:
Diffstat (limited to 'libdimension/texture.c')
-rw-r--r--libdimension/texture.c29
1 files changed, 27 insertions, 2 deletions
diff --git a/libdimension/texture.c b/libdimension/texture.c
index 3867628..a9d7de1 100644
--- a/libdimension/texture.c
+++ b/libdimension/texture.c
@@ -21,7 +21,7 @@
#include "dimension.h"
#include <stdlib.h> /* For malloc */
-/* Allocate an dummy pigment */
+/* Allocate a dummy pigment */
dmnsn_pigment *
dmnsn_new_pigment()
{
@@ -44,6 +44,29 @@ dmnsn_delete_pigment(dmnsn_pigment *pigment)
}
}
+/* Allocate a dummy finish */
+dmnsn_finish *
+dmnsn_new_finish()
+{
+ dmnsn_finish *finish = malloc(sizeof(dmnsn_finish));
+ if (finish) {
+ finish->free_fn = NULL;
+ }
+ return finish;
+}
+
+/* Free a finish */
+void
+dmnsn_delete_finish(dmnsn_finish *finish)
+{
+ if (finish) {
+ if (finish->free_fn) {
+ (*finish->free_fn)(finish->ptr);
+ }
+ free(finish);
+ }
+}
+
/* Allocate a dummy texture */
dmnsn_texture *
dmnsn_new_texture()
@@ -51,15 +74,17 @@ dmnsn_new_texture()
dmnsn_texture *texture = malloc(sizeof(dmnsn_texture));
if (texture) {
texture->pigment = NULL;
+ texture->finish = NULL;
}
return texture;
}
-/* Free a dummy texture */
+/* Free a texture */
void
dmnsn_delete_texture(dmnsn_texture *texture)
{
if (texture) {
+ dmnsn_delete_finish(texture->finish);
dmnsn_delete_pigment(texture->pigment);
free(texture);
}