summaryrefslogtreecommitdiffstats
path: root/libdimension/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@gmail.com>2011-07-28 21:34:45 -0600
committerTavian Barnes <tavianator@gmail.com>2011-07-28 21:34:45 -0600
commit250c28ccdef5f238677b34f21ec7fab06588a127 (patch)
tree7aa115cf5d7c4119bedafc31703cd4a0a11d9d64 /libdimension/dimension
parent275c2542c4e414ffe01558cfca2445dcad6bbd29 (diff)
downloaddimension-250c28ccdef5f238677b34f21ec7fab06588a127.tar.xz
Make the checker pattern a singleton.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r--libdimension/dimension/pattern.h12
-rw-r--r--libdimension/dimension/refcount.h9
2 files changed, 8 insertions, 13 deletions
diff --git a/libdimension/dimension/pattern.h b/libdimension/dimension/pattern.h
index de37286..596ed35 100644
--- a/libdimension/dimension/pattern.h
+++ b/libdimension/dimension/pattern.h
@@ -40,9 +40,6 @@ struct dmnsn_pattern {
dmnsn_pattern_fn *pattern_fn; /**< The pattern callback. */
dmnsn_free_fn *free_fn; /**< The destructor callback. */
- dmnsn_matrix trans; /**< The transformation matrix of the pattern. */
- dmnsn_matrix trans_inv; /**< The inverse of the transformation matrix. */
-
void *ptr; /**< Generic pointer. */
dmnsn_refcount refcount; /**< @internal Reference count. */
@@ -61,15 +58,6 @@ dmnsn_pattern *dmnsn_new_pattern(void);
void dmnsn_delete_pattern(dmnsn_pattern *pattern);
/**
- * Initialize a pattern. This precomputes some values that are used during
- * ray-tracing; the pattern will not work until it has been initialized, but
- * should not be modified after it has been initialized. Patterns are generally
- * initialized for you.
- * @param[in,out] pattern The pattern to initialize.
- */
-void dmnsn_initialize_pattern(dmnsn_pattern *pattern);
-
-/**
* Invoke the pattern callback with the right transformation.
* @param[in] pattern The pattern to evaluate.
* @param[in] v The point to get the pattern value for.
diff --git a/libdimension/dimension/refcount.h b/libdimension/dimension/refcount.h
index 5ffde4c..a0f5b6e 100644
--- a/libdimension/dimension/refcount.h
+++ b/libdimension/dimension/refcount.h
@@ -32,7 +32,14 @@ typedef unsigned int dmnsn_refcount;
* Increment a reference count.
* @param[in,out] object The reference-counted object to acquire.
*/
-#define DMNSN_INCREF(object) ((void)((object) && ++(object)->refcount))
+#define DMNSN_INCREF(object) \
+ do { \
+ /* Suppress "address will always evaluate to true" warning */ \
+ void *testptr = (object); \
+ if (testptr) { \
+ ++(object)->refcount; \
+ } \
+ } while (0)
/**
* @internal