summaryrefslogtreecommitdiff
path: root/src/modules/drizzle
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-05-11 12:51:00 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-05-11 15:19:25 -0700
commit0d9aa593e68f33da8ea71a04b930bb6093dbaccb (patch)
tree679fd3c55385e597176b51a7d4b4c297680ad341 /src/modules/drizzle
parentdede4eca3e2fca76f297b5f5b901434cb99eafb0 (diff)
modules/*: stop storing setup by value in contexts
With setup refcounting and a reference bound to the context, we should just dereference the single instance. The way setups are used it just as a read-only thing to affect context behavior... Note I've left the module-type-specific setup pointer despite it duplicating the setup pointer in the module_context. This is just a convenience thing so the accessors don't have to cast the general til_setup_t* to my_module_setup_t* everywhere.
Diffstat (limited to 'src/modules/drizzle')
-rw-r--r--src/modules/drizzle/drizzle.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules/drizzle/drizzle.c b/src/modules/drizzle/drizzle.c
index 7558ea7..f60aa6e 100644
--- a/src/modules/drizzle/drizzle.c
+++ b/src/modules/drizzle/drizzle.c
@@ -65,7 +65,7 @@ typedef struct drizzle_context_t {
float *viscosity, *rainfall;
til_fb_fragment_t *snapshot;
puddle_t *puddle;
- drizzle_setup_t setup;
+ drizzle_setup_t *setup;
} drizzle_context_t;
@@ -108,7 +108,7 @@ static til_module_context_t * drizzle_create_context(const til_module_t *module,
ctxt->taps.viscosity = til_tap_init_float(ctxt, &ctxt->viscosity, 1, &ctxt->vars.viscosity, "viscosity");
ctxt->taps.rainfall = til_tap_init_float(ctxt, &ctxt->rainfall, 1, &ctxt->vars.rainfall, "rainfall");
- ctxt->setup = *(drizzle_setup_t *)setup;
+ ctxt->setup = (drizzle_setup_t *)setup;
return &ctxt->til_module_context;
}
@@ -128,7 +128,7 @@ static void drizzle_prepare_frame(til_module_context_t *context, til_stream_t *s
drizzle_context_t *ctxt = (drizzle_context_t *)context;
if (!til_stream_tap_context(stream, context, NULL, &ctxt->taps.viscosity))
- *ctxt->viscosity = ctxt->setup.viscosity;
+ *ctxt->viscosity = ctxt->setup->viscosity;
if (!til_stream_tap_context(stream, context, NULL, &ctxt->taps.rainfall))
*ctxt->rainfall = RAINFALL_CNT;
@@ -292,7 +292,7 @@ static void drizzle_render_fragment(til_module_context_t *context, til_stream_t
return;
}
- switch (ctxt->setup.style) {
+ switch (ctxt->setup->style) {
case DRIZZLE_STYLE_MASK:
coord.y = yf * (float)fragment->y;
for (int y = fragment->y; y < fragment->y + fragment->height; y++) {
© All Rights Reserved