summaryrefslogtreecommitdiff
path: root/packages/psplash/files/psplash_1bpp.patch
blob: 3fcc0f7947d44e3899676fe9a44b29820ad6ef3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
diff -urN psplash.orig/psplash-fb.c psplash/psplash-fb.c
--- psplash.orig/psplash-fb.c	2007-08-29 20:27:49.000000000 +0200
+++ psplash/psplash-fb.c	2009-01-14 19:14:15.000000000 +0100
@@ -62,7 +62,7 @@
       goto fail;
     }
   
-  if (fb_var.bits_per_pixel < 16)
+  if (fb_var.bits_per_pixel != 1 && fb_var.bits_per_pixel < 16)
     {
       fprintf(stderr,
 	      "Error, no support currently for %i bpp frame buffers\n",
@@ -143,7 +143,7 @@
   return NULL;
 }
 
-#define OFFSET(fb,x,y) (((y) * (fb)->stride) + ((x) * ((fb)->bpp >> 3)))
+#define OFFSET(fb,x,y) (((fb)->bpp == 1) ? (((y) * ((fb)->stride << 3)) + (x)) : (((y) * (fb)->stride) + ((x) * ((fb)->bpp >> 3))))
 
 inline void
 psplash_fb_plot_pixel (PSplashFB    *fb, 
@@ -188,6 +188,12 @@
       *(volatile uint16 *) (fb->data + off) 
 	= ((red >> 3) << 11) | ((green >> 2) << 5) | (blue >> 3);
       break;
+    case 1:
+      if (((11*red + 16*green + 5*blue) >> 5) >= 128)
+        *(fb->data + (off >> 3)) |= (1 << (7 - (off & 0x07)));
+      else
+        *(fb->data + (off >> 3)) &= ~(1 << (7 - (off & 0x07)));
+      break;
     default:
       /* depth not supported yet */
       break;