[oe-commits] Jeremy Lainé : fbgrab: add support for monochrome framebuffer

GIT User account git at amethyst.openembedded.net
Mon Dec 15 19:25:08 UTC 2008


Module: openembedded.git
Branch: org.openembedded.dev
Commit: bec79ea02035fe7baef993cf1912ec2117d2e1f8
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=bec79ea02035fe7baef993cf1912ec2117d2e1f8

Author: Jeremy Lainé <jeremy.laine at m4x.org>
Date:   Mon Dec 15 20:23:26 2008 +0100

fbgrab: add support for monochrome framebuffer

---

 packages/fbgrab/fbgrab/fbgrab_1bpp.patch |   52 ++++++++++++++++++++++++++++++
 packages/fbgrab/fbgrab_1.0.bb            |    3 +-
 2 files changed, 54 insertions(+), 1 deletions(-)

diff --git a/packages/fbgrab/fbgrab/fbgrab_1bpp.patch b/packages/fbgrab/fbgrab/fbgrab_1bpp.patch
new file mode 100644
index 0000000..8c6dff2
--- /dev/null
+++ b/packages/fbgrab/fbgrab/fbgrab_1bpp.patch
@@ -0,0 +1,52 @@
+--- fbgrab-1.0.orig/fbgrab.c	2002-04-15 22:22:54.000000000 +0200
++++ fbgrab-1.0/fbgrab.c	2008-12-15 20:18:55.000000000 +0100
+@@ -135,6 +135,26 @@
+ 	fatal_error("Error: Not enough memory or data\n");
+ }
+ 
++static void convert1to32(int width, int height, 
++			    unsigned char *inbuffer, 
++			    unsigned char *outbuffer)
++{
++    unsigned int i, j;
++    unsigned char *ptr = outbuffer;
++
++    for (i=0; i < (unsigned int) height*width >> 3; i++)
++    {
++	for(j=0; j < 8; j++)
++	{
++	    /* BLUE = 0, GREEN = 1, RED = 2 */
++	    *ptr = *(ptr+1) = *(ptr+2) = ((inbuffer[i] >> (7-j)) & 1) ? 255 : 0;
++	    /* ALPHA = 3 */
++	    *(ptr+3) = '\0';
++	    ptr += 4;
++	}
++    }
++}
++
+ static void convert1555to32(int width, int height, 
+ 			    unsigned char *inbuffer, 
+ 			    unsigned char *outbuffer)
+@@ -270,6 +290,10 @@
+     
+     switch(bits) 
+     {
++    case 1:
++	convert1to32(width, height, inbuffer, outbuffer);
++	write_PNG(outbuffer, filename, width, height, interlace);
++	break;
+     case 15:
+ 	convert1555to32(width, height, inbuffer, outbuffer);
+ 	write_PNG(outbuffer, filename, width, height, interlace);
+@@ -405,7 +429,10 @@
+ 	strncpy(infile, device, MAX_LEN - 1);
+     }
+     
+-    buf_size = width * height * (((unsigned int) bitdepth + 7) >> 3);
++    if (bitdepth == 1)
++	buf_size = (width * height) >> 3;
++    else
++	buf_size = width * height * (((unsigned int) bitdepth + 7) >> 3);
+ 
+     buf_p = malloc(buf_size);
+     
diff --git a/packages/fbgrab/fbgrab_1.0.bb b/packages/fbgrab/fbgrab_1.0.bb
index 8790fe0..28ac55f 100644
--- a/packages/fbgrab/fbgrab_1.0.bb
+++ b/packages/fbgrab/fbgrab_1.0.bb
@@ -2,13 +2,14 @@ SECTION = "console/network"
 DESCRIPTION = "framebuffer screenshot program"
 LICENSE = "GPL"
 
-PR = "r1"
+PR = "r2"
 
 DEPENDS = " zlib libpng "
 
 SRC_URI = "http://hem.bredband.net/gmogmo/fbgrab/fbgrab-${PV}.tar.gz \
            file://makefile.patch;patch=1 \
 	   http://people.openezx.org/ao2/fbgrab_network_mode.diff;patch=1 \
+	   file://fbgrab_1bpp.patch;patch=1 \
 	   "
 
 do_install() {





More information about the Openembedded-commits mailing list