summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-07-11 12:50:05 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-07-11 12:50:05 -0700
commit853f67297bafe344ba5b857270103eaa16685c91 (patch)
tree9b87d7e4b12345fd0eed55ba6de37fb3675e1637 /src/modules
parentb6362c546a41d58650859a82b91581edc5e7fe1e (diff)
modules/blinds: update taps at context create too
Especially since taps are established on first use, it's desirable to get them online immediately so they show in things like --print-pipes and modules::rkt/RocketEditor and not spuriously once the context becomes actively rendered... This kind of thing will be done for all modules eventually
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/blinds/blinds.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/modules/blinds/blinds.c b/src/modules/blinds/blinds.c
index 529cdaa..8acfae8 100644
--- a/src/modules/blinds/blinds.c
+++ b/src/modules/blinds/blinds.c
@@ -42,6 +42,19 @@ typedef struct blinds_context_t {
} blinds_context_t;
+static void blinds_update_taps(blinds_context_t *ctxt, til_stream_t *stream, unsigned ticks)
+{
+ if (!til_stream_tap_context(stream, &ctxt->til_module_context, NULL, &ctxt->taps.t))
+ *ctxt->t = til_ticks_to_rads(ticks);
+
+ if (!til_stream_tap_context(stream, &ctxt->til_module_context, NULL, &ctxt->taps.step))
+ *ctxt->step = .1f;
+
+ if (!til_stream_tap_context(stream, &ctxt->til_module_context, NULL, &ctxt->taps.count))
+ *ctxt->count = ctxt->setup->count;
+}
+
+
static til_module_context_t * blinds_create_context(const til_module_t *module, til_stream_t *stream, unsigned seed, unsigned ticks, unsigned n_cpus, til_setup_t *setup)
{
blinds_context_t *ctxt;
@@ -56,6 +69,8 @@ static til_module_context_t * blinds_create_context(const til_module_t *module,
ctxt->setup = (blinds_setup_t *)setup;
+ blinds_update_taps(ctxt, stream, ticks);
+
return &ctxt->til_module_context;
}
@@ -97,14 +112,7 @@ static void blinds_render_fragment(til_module_context_t *context, til_stream_t *
unsigned blind;
float t;
- if (!til_stream_tap_context(stream, context, NULL, &ctxt->taps.t))
- *ctxt->t = til_ticks_to_rads(ticks);
-
- if (!til_stream_tap_context(stream, context, NULL, &ctxt->taps.step))
- *ctxt->step = .1f;
-
- if (!til_stream_tap_context(stream, context, NULL, &ctxt->taps.count))
- *ctxt->count = ctxt->setup->count;
+ blinds_update_taps(ctxt, stream, ticks);
til_fb_fragment_clear(fragment);
© All Rights Reserved