summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2022-05-24 23:45:30 -0700
committerVito Caputo <vcaputo@pengaru.com>2022-05-24 23:45:30 -0700
commitd6892b6a0b0fb45a7250415918b2ce3852f00489 (patch)
tree40f8095d727fc95ffdfa50f8ffab894d5b3739f1
parent4e3dd029be7fa23be0276f029241e402b487b81e (diff)
modules/shapes: fixup indentation of star+pinwheel
woops
-rw-r--r--src/modules/shapes/shapes.c64
1 files changed, 32 insertions, 32 deletions
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;
}
}
© All Rights Reserved