]> git.ozlabs.org Git - yaboot.git/blob - second/gui/pcx.c
Commit yaboot 1.3.3
[yaboot.git] / second / gui / pcx.c
1 /* Crude PCX file loading and display for 640x480 image at boot */
2
3 unsigned char *pcxColormap(unsigned char *gfx_file, int gfx_len)
4 {
5   return(gfx_file + gfx_len - 768);
6 }
7
8 extern void scrPutPixel( int x, int y, unsigned char c );
9
10 static void inline do_putpixel(int offset, unsigned char c)
11 {
12    scrPutPixel(offset % 640, offset / 640, c);
13 }
14
15 void pcxDisplay(unsigned char *gfx_file, unsigned gfx_len)
16 {
17   int offset, file_offset, i, c, f;
18
19   for(offset = 0, file_offset = 128; offset < 640 * 480 && file_offset < gfx_len - 769; file_offset++)
20   {
21      if(((c = gfx_file[file_offset]) & 0xc0) == 0xc0)
22      {
23         f = gfx_file[++file_offset];
24         c &= 0x3f;
25         for(i = 0; i < c; ++i)
26            do_putpixel(offset++, f);
27      }
28      else
29         do_putpixel(offset++, c);
30   }
31 }