From 90fde2df2d8c59b0b885e6e02b5e89dbe966a5e9 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Fri, 3 Feb 2017 15:43:51 -0800 Subject: 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. --- src/modules/sparkler/rocket.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/modules/sparkler/rocket.c') diff --git a/src/modules/sparkler/rocket.c b/src/modules/sparkler/rocket.c index 2088cc7..ae628d3 100644 --- a/src/modules/sparkler/rocket.c +++ b/src/modules/sparkler/rocket.c @@ -1,7 +1,7 @@ #include -#include "draw.h" #include "fb.h" +#include "helpers.h" #include "particle.h" #include "particles.h" @@ -123,14 +123,11 @@ static void rocket_draw(particles_t *particles, particle_t *p, int x, int y, fb_ { rocket_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)) /* kill off parts that wander off screen */ - ctxt->longevity = 0; - return; - } - draw_pixel(f, x, y, 0xff0000); + fb_fragment_put_pixel_unchecked(f, x, y, 0xff0000); } -- cgit v1.2.3