[rendering] This simple trick didn't work...
[wikipediardware.git] / jsp / wikireader / gui.c
bloba78620aabb4a6804a8c511ae457ec0f2287454b1
1 #include <wikilib.h>
2 #include <guilib.h>
3 #include <malloc.h>
4 #include <stdlib.h>
5 #include <string.h>
7 /* FIXME: don't use bootloader includes */
8 #include <regs.h>
10 unsigned char *framebuffer;
12 void fb_init(void)
14 framebuffer = (unsigned char *) malloc((guilib_framebuffer_width() * guilib_framebuffer_height()) / 2);
15 REG_LCDC_MADD = (unsigned int) framebuffer;
18 void fb_clear(void)
20 memset(framebuffer, 0, (guilib_framebuffer_width() * guilib_framebuffer_height()) / 2);
23 void fb_refresh(void)
25 /* is there a pragma to omit the frame pointer? */
26 return;
29 /* 1bpp implementation */
31 void fb_set_pixel(int x, int y, int val)
33 char mask = 1 << (x % 8);
34 unsigned int byte = (y * guilib_framebuffer_width() + x) / 8;
36 framebuffer[byte] &= ~mask;
38 if (val)
39 framebuffer[byte] |= mask;