summaryrefslogtreecommitdiff
path: root/src/modules/roto/roto.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-06-14 12:34:37 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-06-14 12:34:37 -0700
commitc5b6fb679416544b1c5cd1d4d55eeaa0d11fd405 (patch)
tree94255e3961730ef0d1d1db278b7fb8e648e47155 /src/modules/roto/roto.c
parent082b6b388deb9bf4cab422259594050d12804b0b (diff)
modules/roto: trivial simplification of render loop
Maybe earlier versions used the absolute coordinates in the frame, but the current code doesn't make use of this and simply needs to confine itself into the WxH of the fragment.
Diffstat (limited to 'src/modules/roto/roto.c')
-rw-r--r--src/modules/roto/roto.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/modules/roto/roto.c b/src/modules/roto/roto.c
index 322b967..8564870 100644
--- a/src/modules/roto/roto.c
+++ b/src/modules/roto/roto.c
@@ -213,7 +213,7 @@ static void roto_render_fragment(til_module_context_t *context, til_stream_t *st
roto_context_t *ctxt = (roto_context_t *)context;
til_fb_fragment_t *fragment = *fragment_ptr;
- int x, y, frame_width = fragment->frame_width, frame_height = fragment->frame_height;
+ int frame_width = fragment->frame_width, frame_height = fragment->frame_height;
int y_cos_r, y_sin_r, x_cos_r, x_sin_r, x_cos_r_init, x_sin_r_init, cos_r, sin_r;
uint32_t *buf = fragment->buf;
@@ -230,12 +230,12 @@ static void roto_render_fragment(til_module_context_t *context, til_stream_t *st
y_cos_r = FIXED_MULT(-FIXED_NEW(frame_height / 2) + FIXED_NEW(fragment->y), cos_r);
y_sin_r = FIXED_MULT(-FIXED_NEW(frame_height / 2) + FIXED_NEW(fragment->y), sin_r);
- for (y = fragment->y; y < fragment->y + fragment->height; y++) {
+ for (int y = 0; y < fragment->height; y++) {
x_cos_r = x_cos_r_init;
x_sin_r = x_sin_r_init;
- for (x = fragment->x; x < fragment->x + fragment->width; x++, buf++) {
+ for (int x = 0; x < fragment->width; x++, buf++) {
*buf = bilerp_color(texture, ctxt->palette, x_sin_r - y_cos_r, y_sin_r + x_cos_r);
x_cos_r += cos_r;
© All Rights Reserved