summaryrefslogtreecommitdiffstats
path: root/libdimension/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-05-31 13:54:56 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-05-31 13:55:26 -0400
commitc10255ab3da17507d63bdc7e1fdfc809ffd32f7f (patch)
treede65eefb9152ebb049c2adbb8e2cf00abe09063e /libdimension/dimension
parent70373204b341fc91694c0293796230e447c51067 (diff)
downloaddimension-c10255ab3da17507d63bdc7e1fdfc809ffd32f7f.tar.xz
pigment: Use pool.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r--libdimension/dimension/map.h6
-rw-r--r--libdimension/dimension/pigment.h17
-rw-r--r--libdimension/dimension/pigments.h17
3 files changed, 12 insertions, 28 deletions
diff --git a/libdimension/dimension/map.h b/libdimension/dimension/map.h
index 77b1fe9..7229a24 100644
--- a/libdimension/dimension/map.h
+++ b/libdimension/dimension/map.h
@@ -24,11 +24,7 @@
*/
/** A map. */
-typedef struct dmnsn_map {
- dmnsn_free_fn *free_fn; /**< Destructor callback. */
- size_t obj_size; /**< @internal The size of the mapped objects. */
- dmnsn_array *array; /**< @internal The map entries. */
-} dmnsn_map;
+typedef struct dmnsn_map dmnsn_map;
/**
* Create an empty map.
diff --git a/libdimension/dimension/pigment.h b/libdimension/dimension/pigment.h
index 455ee72..14d8bae 100644
--- a/libdimension/dimension/pigment.h
+++ b/libdimension/dimension/pigment.h
@@ -41,17 +41,10 @@ typedef dmnsn_tcolor dmnsn_pigment_fn(const dmnsn_pigment *pigment,
*/
typedef void dmnsn_pigment_initialize_fn(dmnsn_pigment *pigment);
-/**
- * Pigment destructor callback.
- * @param[in,out] pigment The pigment to destroy.
- */
-typedef void dmnsn_pigment_free_fn(dmnsn_pigment *pigment);
-
/** A pigment. */
struct dmnsn_pigment {
dmnsn_pigment_fn *pigment_fn; /**< The pigment callback. */
dmnsn_pigment_initialize_fn *initialize_fn; /**< The initializer callback. */
- dmnsn_pigment_free_fn *free_fn; /**< The destructor callback. */
dmnsn_matrix trans; /**< Transformation matrix. */
dmnsn_matrix trans_inv; /**< The inverse of the transformation matrix. */
@@ -59,15 +52,15 @@ struct dmnsn_pigment {
/** Quick color -- used for low-quality renders. */
dmnsn_tcolor quick_color;
- DMNSN_REFCOUNT; /** Reference count. */
bool initialized; /** @internal Whether the pigment is initialized. */
};
/**
* Allocate a new dummy pigment.
+ * @param[in] pool The memory pool to allocate from.
* @return The allocated pigment.
*/
-dmnsn_pigment *dmnsn_new_pigment(void);
+dmnsn_pigment *dmnsn_new_pigment(dmnsn_pool *pool);
/**
* Initialize a dmnsn_pigment field.
@@ -76,12 +69,6 @@ dmnsn_pigment *dmnsn_new_pigment(void);
void dmnsn_init_pigment(dmnsn_pigment *pigment);
/**
- * Delete a pigment.
- * @param[in,out] pigment The pigment to delete.
- */
-void dmnsn_delete_pigment(dmnsn_pigment *pigment);
-
-/**
* Initialize a pigment. Pigments should not be used before being initialized,
* but should not be modified after being initialized. Pigments are generally
* initialized for you.
diff --git a/libdimension/dimension/pigments.h b/libdimension/dimension/pigments.h
index e2ea274..100016d 100644
--- a/libdimension/dimension/pigments.h
+++ b/libdimension/dimension/pigments.h
@@ -25,25 +25,27 @@
/**
* A solid color.
+ * @param[in] pool The memory pool to allocate from.
* @param[in] color The color of the pigment.
* @return A pigment with the color \p color everywhere.
*/
-dmnsn_pigment *dmnsn_new_solid_pigment(dmnsn_tcolor color);
+dmnsn_pigment *dmnsn_new_solid_pigment(dmnsn_pool *pool, dmnsn_tcolor color);
/**
* An image map. The image (regardless of its real dimensions) is projected
* on the x-y plane in tesselating unit squares.
+ * @param[in] pool The memory pool to allocate from.
* @param[in] canvas The canvas holding the image.
* @return An image-mapped pigment.
*/
-dmnsn_pigment *dmnsn_new_canvas_pigment(dmnsn_canvas *canvas);
+dmnsn_pigment *dmnsn_new_canvas_pigment(dmnsn_pool *pool, dmnsn_canvas *canvas);
/**
* Pigment map flags.
*/
typedef enum dmnsn_pigment_map_flags {
DMNSN_PIGMENT_MAP_REGULAR, /**< Calculate linear color gradients. */
- DMNSN_PIGMENT_MAP_SRGB /**< Calculate sRGB color gradients. */
+ DMNSN_PIGMENT_MAP_SRGB /**< Calculate sRGB color gradients. */
} dmnsn_pigment_map_flags;
/**
@@ -55,11 +57,10 @@ dmnsn_map *dmnsn_new_pigment_map(dmnsn_pool *pool);
/**
* A pigment-mapped pigment.
+ * @param[in] pool The memory pool to allocate from.
* @param[in,out] pattern The pattern of the pigment.
- * @param[in,out] map The pigment map to apply to the pattern.
- * @param[in] flags Gradient flags
+ * @param[in,out] map The pigment map to apply to the pattern.
+ * @param[in] flags Gradient flags
* @return A pigment mapping the pattern to other pigments.
*/
-dmnsn_pigment *dmnsn_new_pigment_map_pigment(dmnsn_pattern *pattern,
- dmnsn_map *map,
- dmnsn_pigment_map_flags flags);
+dmnsn_pigment *dmnsn_new_pigment_map_pigment(dmnsn_pool *pool, dmnsn_pattern *pattern, dmnsn_map *map, dmnsn_pigment_map_flags flags);