summaryrefslogtreecommitdiff
path: root/src/modules/sparkler/simple.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@gnugeneration.com>2017-02-03 15:43:51 -0800
committerVito Caputo <vcaputo@gnugeneration.com>2017-02-03 15:43:51 -0800
commit90fde2df2d8c59b0b885e6e02b5e89dbe966a5e9 (patch)
treef1e5d26650fd34bb47b2d8040d7711996c77f97c /src/modules/sparkler/simple.c
parent1a330772b827364471dbe02b417c14fb42838c2d (diff)
sparkler: use fb.h put_pixel helpers
discards draw_pixel(), introduces helpers.h and a convenience function for bounds checking and oob extermination. Move makergb to helpers.h, draw.h gets removed in a later commit.
Diffstat (limited to 'src/modules/sparkler/simple.c')
-rw-r--r--src/modules/sparkler/simple.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/modules/sparkler/simple.c b/src/modules/sparkler/simple.c
index 74edc24..5524282 100644
--- a/src/modules/sparkler/simple.c
+++ b/src/modules/sparkler/simple.c
@@ -1,7 +1,7 @@
#include <stdlib.h>
-#include "draw.h"
#include "fb.h"
+#include "helpers.h"
#include "particle.h"
#include "particles.h"
@@ -98,14 +98,11 @@ static void simple_draw(particles_t *particles, particle_t *p, int x, int y, fb_
{
simple_ctxt_t *ctxt = p->ctxt;
- if (!fb_fragment_contains(f, x, y)) {
+ if (!should_draw_expire_if_oob(particles, p, x, y, f, &ctxt->longevity))
/* immediately kill off stars that wander off screen */
- ctxt->longevity = 0;
-
return;
- }
- draw_pixel(f, x, y, makergb(0xff, 0xff, 0xff, ((float)ctxt->longevity / ctxt->lifetime)));
+ fb_fragment_put_pixel_unchecked(f, x, y, makergb(0xff, 0xff, 0xff, ((float)ctxt->longevity / ctxt->lifetime)));
}
© All Rights Reserved