summaryrefslogtreecommitdiffstats
path: root/libdimension/dimension
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2014-04-26 19:07:45 -0400
committerTavian Barnes <tavianator@tavianator.com>2014-04-26 19:07:45 -0400
commit3f949f8a9705972a4b61532602814b5b47d1a328 (patch)
tree1abe46ba981dbe2f0a4863afb20b32ead6646721 /libdimension/dimension
parent48d08d21106545d1f27a9fd5a787a12c9dcf7d7c (diff)
downloaddimension-3f949f8a9705972a4b61532602814b5b47d1a328.tar.xz
canvas: Avoid copying entire dmnsn_canvas_optimizer structs.
Diffstat (limited to 'libdimension/dimension')
-rw-r--r--libdimension/dimension/canvas.h20
1 files changed, 8 insertions, 12 deletions
diff --git a/libdimension/dimension/canvas.h b/libdimension/dimension/canvas.h
index 6c6ff86..2000141 100644
--- a/libdimension/dimension/canvas.h
+++ b/libdimension/dimension/canvas.h
@@ -43,27 +43,23 @@ typedef struct dmnsn_canvas {
DMNSN_REFCOUNT; /**< Reference count. */
} dmnsn_canvas;
-/* Forward-declare dmnsn_canvas_optimizer */
-typedef struct dmnsn_canvas_optimizer dmnsn_canvas_optimizer;
-
/**
* Canvas optimizer callback type.
- * @param[in] canvas The canvas that was just updated.
- * @param[in] optimizer The canvas optimizer itself.
- * @param[in] x The x-coordinate that was just updated.
- * @param[in] y The y-coordinate that was just updated.
+ * @param[in] canvas The canvas that was just updated.
+ * @param[in] ptr The canvas optimizer's data pointer.
+ * @param[in] x The x-coordinate that was just updated.
+ * @param[in] y The y-coordinate that was just updated.
*/
-typedef void dmnsn_canvas_optimizer_fn(const dmnsn_canvas *canvas,
- dmnsn_canvas_optimizer optimizer,
+typedef void dmnsn_canvas_optimizer_fn(const dmnsn_canvas *canvas, void *ptr,
size_t x, size_t y);
/** Canvas optimizer. */
-struct dmnsn_canvas_optimizer {
+typedef struct dmnsn_canvas_optimizer {
dmnsn_canvas_optimizer_fn *optimizer_fn; /**< Optimizer callback. */
dmnsn_free_fn *free_fn; /**< Destructor callback. */
void *ptr; /**< Generic pointer. */
-};
+} dmnsn_canvas_optimizer;
/**
* Allocate a new canvas.
@@ -85,7 +81,7 @@ void dmnsn_delete_canvas(dmnsn_canvas *canvas);
* @param[in] optimizer The optimizer to use.
*/
void dmnsn_canvas_optimize(dmnsn_canvas *canvas,
- dmnsn_canvas_optimizer optimizer);
+ const dmnsn_canvas_optimizer *optimizer);
/* Pixel accessors */