From 671741c937e615483c2a5cae735272f4f6cbabac Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 1 Dec 2023 15:01:19 -0800 Subject: modules/pan: fmod the snapshot's dimensions This assumption broke with the introduction of a default tile for non-overlay mode. --- src/modules/pan/pan.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/modules/pan/pan.c b/src/modules/pan/pan.c index ede0dff..d080366 100644 --- a/src/modules/pan/pan.c +++ b/src/modules/pan/pan.c @@ -76,16 +76,21 @@ static void pan_prepare_frame(til_module_context_t *context, til_stream_t *strea pan_setup_t *s = (pan_setup_t *)context->setup; til_fb_fragment_t *fragment = *fragment_ptr; float dt = (ticks - context->last_ticks) * .1f; + til_fb_fragment_t *snapshot = &ctxt->tile; + + if (fragment->cleared) + ctxt->snapshot = til_fb_fragment_snapshot(fragment_ptr, 0); + + if (ctxt->snapshot) + snapshot = ctxt->snapshot; ctxt->xoffset += dt * s->x; - ctxt->xoffset = fmodf(ctxt->xoffset, fragment->frame_width); + ctxt->xoffset = fmodf(ctxt->xoffset, snapshot->frame_width); ctxt->yoffset += dt * s->y; - ctxt->yoffset = fmodf(ctxt->yoffset, fragment->frame_height); + ctxt->yoffset = fmodf(ctxt->yoffset, snapshot->frame_height); *res_frame_plan = (til_frame_plan_t){ .fragmenter = til_fragmenter_slice_per_cpu_x16 }; - if (fragment->cleared) - ctxt->snapshot = til_fb_fragment_snapshot(fragment_ptr, 0); } -- cgit v1.2.1