From ed889f0b2d7d831b5256789f382c2653806b0382 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sun, 24 Jul 2022 03:10:51 -0700 Subject: modules/spiro: fast and dirty frame clipping fixup Sorry but more s/unchecked/checked/ and now this seems to not crash when used as a checkers fill_module. --- src/modules/spiro/spiro.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src/modules') diff --git a/src/modules/spiro/spiro.c b/src/modules/spiro/spiro.c index 9da4686..30e5f06 100644 --- a/src/modules/spiro/spiro.c +++ b/src/modules/spiro/spiro.c @@ -57,7 +57,7 @@ static void spiro_render_fragment(til_module_context_t *context, unsigned ticks, { spiro_context_t *ctxt = (spiro_context_t *)context; - int width = fragment->width, height = fragment->height; + int width = fragment->frame_width, height = fragment->frame_height; int display_R, display_origin_x, display_origin_y; @@ -85,7 +85,7 @@ static void spiro_render_fragment(til_module_context_t *context, unsigned ticks, float my_y=((1.f-k)*sinf(t))-(l*k*sinf(((1.f-k)/k)*t)); int pos_x=display_origin_x+(my_x*display_R); int pos_y=display_origin_y+(my_y*display_R); - til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, pos_x, pos_y, + til_fb_fragment_put_pixel_checked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, pos_x, pos_y, makergb(sinf(M_1_PI*t)*127+128, sinf(M_1_PI*t+(2*M_PI*.333333333333f))*127+128, sinf(M_1_PI*t+(4*M_PI*.333333333333f))*127+128, @@ -94,31 +94,31 @@ static void spiro_render_fragment(til_module_context_t *context, unsigned ticks, #ifdef DEBUG /* plot the origin point */ - til_fb_fragment_put_pixel_unchecked(fragment, 0, display_origin_x, display_origin_y, + til_fb_fragment_put_pixel_checked(fragment, 0, display_origin_x, display_origin_y, makergb(0xFF, 0xFF, 0x00, 1)); /* plot the fixed outer circle C0 */ for(float a=0.f; a<2*M_PI; a+= M_PI_2/display_R) { int pos_x=display_origin_x+(cosf(a)*display_R); int pos_y=display_origin_y+(sinf(a)*display_R); - til_fb_fragment_put_pixel_unchecked(fragment, 0, pos_x, pos_y, + til_fb_fragment_put_pixel_checked(fragment, 0, pos_x, pos_y, makergb(0xFF, 0xFF, 0x00, 1)); } /* plot inner circle Ci */ - til_fb_fragment_put_pixel_unchecked(fragment, 0, display_origin_x+display_R-(ctxt->r*display_R), + til_fb_fragment_put_pixel_checked(fragment, 0, display_origin_x+display_R-(ctxt->r*display_R), display_origin_y, makergb(0xFF, 0xFF, 0x00, 1)); for(float a=0.f; a<2*M_PI; a+= M_PI_2/display_R) { int pos_x=display_origin_x+display_R-(ctxt->r*display_R)+ (cosf(a)*ctxt->r*display_R); int pos_y=display_origin_y+(sinf(a)*ctxt->r*display_R); - til_fb_fragment_put_pixel_unchecked(fragment, 0, pos_x, pos_y, + til_fb_fragment_put_pixel_checked(fragment, 0, pos_x, pos_y, makergb(0xFF, 0xFF, 0x00, 1)); } /* plot p */ - til_fb_fragment_put_pixel_unchecked(fragment, 0, display_origin_x+display_R-(ctxt->r*display_R)+ + til_fb_fragment_put_pixel_checked(fragment, 0, display_origin_x+display_R-(ctxt->r*display_R)+ (ctxt->p*display_R), display_origin_y, makergb(0xFF, 0xFF, 0x00, 1)); #endif -- cgit v1.2.3