From 5a0776f1fdc6b7780cd21d568150e804347a6f8a Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 14 Jun 2022 02:28:36 -0700 Subject: til: til_fb_fragment_t **fragment_ptr all the things Preparatory commit for enabling cloneable/swappable fragments There's an outstanding issue with the til_fb_page_t submission, see comments. Doesn't matter for now since cloning doesn't happen yet, but will need to be addressed before they do. --- src/modules/plasma/plasma.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/modules/plasma') diff --git a/src/modules/plasma/plasma.c b/src/modules/plasma/plasma.c index 8cc4fda..b58e34f 100644 --- a/src/modules/plasma/plasma.c +++ b/src/modules/plasma/plasma.c @@ -75,7 +75,7 @@ static til_module_context_t * plasma_create_context(unsigned seed, unsigned tick /* Prepare a frame for concurrent drawing of fragment using multiple fragments */ -static void plasma_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t *fragment, til_frame_plan_t *res_frame_plan) +static void plasma_prepare_frame(til_module_context_t *context, unsigned ticks, til_fb_fragment_t **fragment_ptr, til_frame_plan_t *res_frame_plan) { plasma_context_t *ctxt = (plasma_context_t *)context; @@ -85,17 +85,19 @@ static void plasma_prepare_frame(til_module_context_t *context, unsigned ticks, /* Draw a plasma effect */ -static void plasma_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t *fragment) +static void plasma_render_fragment(til_module_context_t *context, unsigned ticks, unsigned cpu, til_fb_fragment_t **fragment_ptr) { plasma_context_t *ctxt = (plasma_context_t *)context; - int xstep = PLASMA_WIDTH / fragment->frame_width; - int ystep = PLASMA_HEIGHT / fragment->frame_height; - unsigned width = fragment->width * xstep, height = fragment->height * ystep; - int fw2 = FIXED_NEW(width / 2), fh2 = FIXED_NEW(height / 2); - int x, y, cx, cy, dx2, dy2; - uint32_t *buf = fragment->buf; - color_t c = { .r = 0, .g = 0, .b = 0 }, cscale; - unsigned rr2, rr6, rr8, rr16, rr20, rr12; + til_fb_fragment_t *fragment = *fragment_ptr; + + int xstep = PLASMA_WIDTH / fragment->frame_width; + int ystep = PLASMA_HEIGHT / fragment->frame_height; + unsigned width = fragment->width * xstep, height = fragment->height * ystep; + int fw2 = FIXED_NEW(width / 2), fh2 = FIXED_NEW(height / 2); + int x, y, cx, cy, dx2, dy2; + uint32_t *buf = fragment->buf; + color_t c = { .r = 0, .g = 0, .b = 0 }, cscale; + unsigned rr2, rr6, rr8, rr16, rr20, rr12; rr2 = ctxt->rr * 2; rr6 = ctxt->rr * 6; -- cgit v1.2.1