From 63815bbe5afa2d472444ee3a3ac4b179c888ec06 Mon Sep 17 00:00:00 2001
From: Vito Caputo <vcaputo@pengaru.com>
Date: Fri, 2 Jun 2023 17:55:48 -0700
Subject: modules/compose: drop redundant til_module_t*

Once til_module_context_t.module was introduced, this vestigial
module member @ compose_layer_t.module became redundant.

So here it's dropped in the obvious manner, but the
compose_layer_t struct is retained despite only having
til_module_context_t* now.  This is in anticipation of future
additions where compose settings may set per-layer/texture
rendering behaviors (think alpha, colors, texturing toggles, etc)
---
 src/modules/compose/compose.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

(limited to 'src')

diff --git a/src/modules/compose/compose.c b/src/modules/compose/compose.c
index f41b838..4a93557 100644
--- a/src/modules/compose/compose.c
+++ b/src/modules/compose/compose.c
@@ -26,8 +26,8 @@
  */
 
 typedef struct compose_layer_t {
-	const til_module_t	*module;
 	til_module_context_t	*module_ctxt;
+	/* XXX: it's expected that layers will get more settable attributes to stick in here */
 } compose_layer_t;
 
 typedef struct compose_context_t {
@@ -82,15 +82,16 @@ static til_module_context_t * compose_create_context(const til_module_t *module,
 		const til_module_t	*layer_module;
 
 		layer_module = til_lookup_module(((compose_setup_t *)setup)->layers[i].module);
-		ctxt->layers[i].module = layer_module;
 		(void) til_module_create_context(layer_module, stream, rand_r(&seed), ticks, n_cpus, s->layers[i].setup, &ctxt->layers[i].module_ctxt); /* TODO: errors */
 
 		ctxt->n_layers++;
 	}
 
 	if (((compose_setup_t *)setup)->texture.module) {
-		ctxt->texture.module = til_lookup_module(((compose_setup_t *)setup)->texture.module);
-		(void) til_module_create_context(ctxt->texture.module, stream, rand_r(&seed), ticks, n_cpus, s->texture.setup, &ctxt->texture.module_ctxt); /* TODO: errors */
+		const til_module_t	*texture_module;
+
+		texture_module = til_lookup_module(((compose_setup_t *)setup)->texture.module);
+		(void) til_module_create_context(texture_module, stream, rand_r(&seed), ticks, n_cpus, s->texture.setup, &ctxt->texture.module_ctxt); /* TODO: errors */
 	}
 
 	return &ctxt->til_module_context;
@@ -104,11 +105,8 @@ static void compose_destroy_context(til_module_context_t *context)
 	for (size_t i = 0; i < ctxt->n_layers; i++)
 		til_module_context_free(ctxt->layers[i].module_ctxt);
 
-	if (ctxt->texture.module)
-		til_module_context_free(ctxt->texture.module_ctxt);
-
+	til_module_context_free(ctxt->texture.module_ctxt);
 	free(ctxt->texture_fb.buf);
-
 	free(context);
 }
 
@@ -119,7 +117,7 @@ static void compose_render_fragment(til_module_context_t *context, til_stream_t
 	til_fb_fragment_t	*fragment = *fragment_ptr, *texture = &ctxt->texture_fb;
 	til_fb_fragment_t	*old_texture = fragment->texture;
 
-	if (ctxt->texture.module) {
+	if (ctxt->texture.module_ctxt) {
 		if (!ctxt->texture_fb.buf ||
 		    ctxt->texture_fb.frame_width != fragment->frame_width ||
 		    ctxt->texture_fb.frame_height != fragment->frame_height) {
-- 
cgit v1.2.3