From 337440d4a0f141c036e057ecc4fe4f4b808ff9c0 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 15 Sep 2017 19:52:49 -0700 Subject: modules/*: cease dividing stride by 4 Just cast buf to (void *) for the pointer arithmetic, stride is in units of bytes and no assumptions should be made about its value such as divisability by 4. --- src/modules/roto/roto.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modules/roto') diff --git a/src/modules/roto/roto.c b/src/modules/roto/roto.c index e859d94..e21b971 100644 --- a/src/modules/roto/roto.c +++ b/src/modules/roto/roto.c @@ -203,7 +203,7 @@ static void roto32_render_fragment(void *context, fb_fragment_t *fragment) { roto_context_t *ctxt = context; 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; - int x, y, stride = fragment->stride / 4, frame_width = fragment->frame_width, frame_height = fragment->frame_height; + int x, y, frame_width = fragment->frame_width, frame_height = fragment->frame_height; uint32_t *buf = fragment->buf; /* This is all done using fixed-point in the hopes of being faster, and yes assumptions @@ -240,7 +240,7 @@ static void roto32_render_fragment(void *context, fb_fragment_t *fragment) x_sin_r += sin_r; } - buf += stride; + buf = ((void *)buf) + fragment->stride; y_cos_r += cos_r; y_sin_r += sin_r; } @@ -253,7 +253,7 @@ static void roto64_render_fragment(void *context, fb_fragment_t *fragment) { roto_context_t *ctxt = context; 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; - int x, y, stride = fragment->stride / 8, frame_width = fragment->frame_width, frame_height = fragment->frame_height, width = fragment->width; + int x, y, frame_width = fragment->frame_width, frame_height = fragment->frame_height, width = fragment->width; uint64_t *buf = (uint64_t *)fragment->buf; /* This is all done using fixed-point in the hopes of being faster, and yes assumptions @@ -301,7 +301,7 @@ static void roto64_render_fragment(void *context, fb_fragment_t *fragment) x_sin_r += sin_r; } - buf += stride; + buf = ((void *)buf) + fragment->stride; y_cos_r += cos_r; y_sin_r += sin_r; } -- cgit v1.2.3