#include #include #include "fb.h" static FB fb; static int init = 0; int pb_fb_init(void) { if (fbopen(&fb) == 0) { fbviewportpane(&fb); init = 1; return 0; } return -1; } void pb_fb_close(void) { if (init) { fbclose(&fb); init = 0; } } /* * blit an ARGB8888-backed libnsfb buffer (sgp = pointer, gkw stride) * onto the Linux framebuffer, fit to the current viewport. */ int pb_fb_display(const unsigned char *buf, int sw, int sh, int stride) { if (init == 0 || buf == NULL) return -1; /* viewport is our clip window */ fbviewportpane(&fb); fbblit(&fb, buf, sw, sh, 0, 0, fb.vw, fb.vh); return 0; }