summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2020-09-26 19:18:07 -0700
committerVito Caputo <vcaputo@pengaru.com>2020-09-26 19:18:07 -0700
commitc962c3deb21b0faec28fdabb460649b68c250eb6 (patch)
tree25fa1a18657588a9e4d14ce67f07c232926a9c5c /src/modules
parent1f8de9a371a1ca7f208e28c66468d911db6af103 (diff)
modules/compose: set default layers
In case some code path creates module contexts and renders without applying settings, it's important to ensure there are defaults. As-is this would have crashed compose because compose_layers would have been NULL, and compose_create_context() assumed compose_layers always contained something useful. Montage would have been an example of this, though for other reasons montage has had compose disabled so I don't think anything currently would have triggered this.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/compose/compose.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c
index dd85c93..a542b5e 100644
--- a/src/modules/compose/compose.c
+++ b/src/modules/compose/compose.c
@@ -40,6 +40,7 @@ static void compose_destroy_context(void *context);
static void compose_prepare_frame(void *context, unsigned ticks, unsigned n_cpus, fb_fragment_t *fragment, rototiller_fragmenter_t *res_fragmenter);
static int compose_setup(const settings_t *settings, setting_desc_t **next_setting);
+static char *compose_default_layers[] = { "drizzle", "stars", "spiro", NULL };
static char **compose_layers;
@@ -57,10 +58,14 @@ rototiller_module_t compose_module = {
static void * compose_create_context(unsigned ticks, unsigned num_cpus)
{
+ char **layers = compose_default_layers;
compose_context_t *ctxt;
int n;
- for (n = 0; compose_layers[n]; n++);
+ if (compose_layers)
+ layers = compose_layers;
+
+ for (n = 0; layers[n]; n++);
ctxt = calloc(1, sizeof(compose_context_t) + n * sizeof(compose_layer_t));
if (!ctxt)
@@ -71,7 +76,7 @@ static void * compose_create_context(unsigned ticks, unsigned num_cpus)
for (int i = 0; i < n; i++) {
const rototiller_module_t *module;
- module = rototiller_lookup_module(compose_layers[i]);
+ module = rototiller_lookup_module(layers[i]);
ctxt->layers[i].module = module;
if (module->create_context)
@@ -146,7 +151,7 @@ static int compose_setup(const settings_t *settings, setting_desc_t **next_setti
size_t i;
/* other meta-modules like montage and rtv may need to
- * have some consideration here, but for now I'm just
+ * have some consideration here, but for now I'm just
* going to let the user potentially compose with montage
* or rtv as one of the layers.
*/
© All Rights Reserved