diff options
author | Vito Caputo <vcaputo@gnugeneration.com> | 2017-02-08 20:03:38 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-08 20:03:38 -0800 |
commit | 8563edd058bb5e564b5e6c2bafde6636b3fce6ee (patch) | |
tree | d3232ac628eee1517e258d9b512b0f9a838e9f02 /src/modules/sparkler/draw.h | |
parent | 9d032314e9db794dc88889bc24bf50bbafc3ec8d (diff) | |
parent | b35ba71b6de341f7b87beb3bc078600f3d191612 (diff) |
Consolidate fb_fragment_t interactions
sparkler and stars both cleared fragments and drew individual pixels into fragments, add that functionality to fb.h and cleanup sparkler and stars accordingly.
Diffstat (limited to 'src/modules/sparkler/draw.h')
-rw-r--r-- | src/modules/sparkler/draw.h | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/src/modules/sparkler/draw.h b/src/modules/sparkler/draw.h deleted file mode 100644 index 5010374..0000000 --- a/src/modules/sparkler/draw.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _DRAW_H -#define _DRAW_H - -#include <stdint.h> - -#include "fb.h" - -/* helper for scaling rgb colors and packing them into an pixel */ -static inline uint32_t makergb(uint32_t r, uint32_t g, uint32_t b, float intensity) -{ - r = (((float)intensity) * r); - g = (((float)intensity) * g); - b = (((float)intensity) * b); - - return (((r & 0xff) << 16) | ((g & 0xff) << 8) | (b & 0xff)); -} - -static inline int draw_pixel(fb_fragment_t *f, int x, int y, uint32_t pixel) -{ - uint32_t *pixels = f->buf; - - if (y < 0 || y >= f->height || x < 0 || x >= f->width) { - return 0; - } - - /* FIXME this assumes stride is aligned to 4 */ - pixels[(y * (f->width + (f->stride >> 2))) + x] = pixel; - - return 1; -} - -#endif |