From d6892b6a0b0fb45a7250415918b2ce3852f00489 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Tue, 24 May 2022 23:45:30 -0700 Subject: modules/shapes: fixup indentation of star+pinwheel woops --- src/modules/shapes/shapes.c | 64 ++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 32 deletions(-) (limited to 'src/modules/shapes') diff --git a/src/modules/shapes/shapes.c b/src/modules/shapes/shapes.c index fd8dd40..f601feb 100644 --- a/src/modules/shapes/shapes.c +++ b/src/modules/shapes/shapes.c @@ -170,23 +170,23 @@ static void shapes_render_fragment(void *context, unsigned ticks, unsigned cpu, } case SHAPES_TYPE_PINWHEEL: { - float s = 2.f / (float)size; - float X, Y; - - Y = -1.f; - for (unsigned y = yoff; y < yoff + size; y++, Y += s) { - X = -1.f; - for (unsigned x = xoff; x < xoff + size; x++, X += s) { - float rad = atan2f(Y, X) + (float)ticks * ctxt->setup.spin * .01f; - float r = cosf((float)ctxt->setup.n_points * rad) * .5f + .5f; - - if (X * X + Y * Y < r * r) - til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, fragment->x + x, fragment->y + y, 0xffffffff); - else if (!fragment->cleared) - til_fb_fragment_put_pixel_unchecked(fragment, 0, fragment->x + x, fragment->y + y, 0x0); - - } + float s = 2.f / (float)size; + float X, Y; + + Y = -1.f; + for (unsigned y = yoff; y < yoff + size; y++, Y += s) { + X = -1.f; + for (unsigned x = xoff; x < xoff + size; x++, X += s) { + float rad = atan2f(Y, X) + (float)ticks * ctxt->setup.spin * .01f; + float r = cosf((float)ctxt->setup.n_points * rad) * .5f + .5f; + + if (X * X + Y * Y < r * r) + til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, fragment->x + x, fragment->y + y, 0xffffffff); + else if (!fragment->cleared) + til_fb_fragment_put_pixel_unchecked(fragment, 0, fragment->x + x, fragment->y + y, 0x0); + } + } break; } @@ -209,23 +209,23 @@ static void shapes_render_fragment(void *context, unsigned ticks, unsigned cpu, } case SHAPES_TYPE_STAR: { - float s = 2.f / (float)size; - float X, Y; - - Y = -1.f; - for (unsigned y = yoff; y < yoff + size; y++, Y += s) { - X = -1.f; - for (unsigned x = xoff; x < xoff + size; x++, X += s) { - float rad = atan2f(Y, X) + (float)ticks * ctxt->setup.spin * .01f; - float r = (M_2_PI * asinf(sinf((float)ctxt->setup.n_points * rad) * .5f + .5f)) * .5f + .5f; - /* ^^^^^^^^^^^^^^^^^^^ approximates a triangle wave */ - - if (X * X + Y * Y < r * r) - til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, fragment->x + x, fragment->y + y, 0xffffffff); - else if (!fragment->cleared) - til_fb_fragment_put_pixel_unchecked(fragment, 0, fragment->x + x, fragment->y + y, 0x0); - } + float s = 2.f / (float)size; + float X, Y; + + Y = -1.f; + for (unsigned y = yoff; y < yoff + size; y++, Y += s) { + X = -1.f; + for (unsigned x = xoff; x < xoff + size; x++, X += s) { + float rad = atan2f(Y, X) + (float)ticks * ctxt->setup.spin * .01f; + float r = (M_2_PI * asinf(sinf((float)ctxt->setup.n_points * rad) * .5f + .5f)) * .5f + .5f; + /* ^^^^^^^^^^^^^^^^^^^ approximates a triangle wave */ + + if (X * X + Y * Y < r * r) + til_fb_fragment_put_pixel_unchecked(fragment, TIL_FB_DRAW_FLAG_TEXTURABLE, fragment->x + x, fragment->y + y, 0xffffffff); + else if (!fragment->cleared) + til_fb_fragment_put_pixel_unchecked(fragment, 0, fragment->x + x, fragment->y + y, 0x0); } + } break; } } -- cgit v1.2.1