summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-12-01 15:01:19 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-12-01 15:01:19 -0800
commit671741c937e615483c2a5cae735272f4f6cbabac (patch)
tree289926a1346541859d43358f2b2b45cfda6de32a /src
parentdc59f812eedc39c0e764a19519aeb88856992d12 (diff)
modules/pan: fmod the snapshot's dimensions
This assumption broke with the introduction of a default tile for non-overlay mode.
Diffstat (limited to 'src')
-rw-r--r--src/modules/pan/pan.c13
1 files 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);
}
© All Rights Reserved