1.1 --- a/lib/display.c Sat Oct 27 23:44:14 2018 +0200
1.2 +++ b/lib/display.c Sat Oct 27 23:45:09 2018 +0200
1.3 @@ -54,3 +54,22 @@
1.4 linedata += cfg->line_length;
1.5 }
1.6 }
1.7 +
1.8 +/* Copy to framebuffer. */
1.9 +
1.10 +void copy_to_framebuffer(display_config_t *cfg, uint8_t *image, int width, int height)
1.11 +{
1.12 + int sx, sy, tx, ty;
1.13 + uint8_t *targetline = cfg->framebuffer, *sourceline = image;
1.14 +
1.15 + for (sy = 0, ty = 0; (sy < height) && (ty < cfg->line_count); sy++, ty++)
1.16 + {
1.17 + for (sx = 0, tx = 0; (tx < cfg->line_length); sx++, tx++)
1.18 + {
1.19 + targetline[get_position(cfg, tx)] = (sx < width) ? sourceline[sx] : 0;
1.20 + }
1.21 +
1.22 + sourceline += width;
1.23 + targetline += cfg->line_length;
1.24 + }
1.25 +}