1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
4 # T2 SDE: package/.../fbgrab/565-fixup.patch
5 # Copyright (C) 2004 - 2005 The T2 SDE Project
7 # More information can be found in the files COPYING and README.
9 # This patch file is dual-licensed. It is available under the license the
10 # patched project is licensed under, as long as it is an OpenSource license
11 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
12 # of the GNU General Public License as published by the Free Software
13 # Foundation; either version 2 of the License, or (at your option) any later
15 # --- T2-COPYRIGHT-NOTE-END ---
17 Fixed fbgrab for big-endian systems, including a code cleanup on the way.
21 --- fbgrab-1.0/fbgrab.c 2002-04-15 22:22:54.000000000 +0200
22 +++ fbgrab-1.0-fixed/fbgrab.c 2004-09-05 16:12:42.874276472 +0200
25 for (i=0; i < (unsigned int) height*width*2; i+=2)
28 - outbuffer[(i<<1)+0] = (inbuffer[i] & 0x1f) << 3;
30 - outbuffer[(i<<1)+1] = (((inbuffer[i+1] & 0x7) << 3) |
31 - (inbuffer[i] & 0xE0) >> 5) << 2;
33 - outbuffer[(i<<1)+2] = (inbuffer[i+1] & 0xF8);
35 - outbuffer[(i<<1)+3] = '\0';
37 +#ifdef __BIG_ENDIAN__
38 + (inbuffer[i] << 8) + inbuffer[i+1];
40 + (inbuffer[i+1] << 8) + inbuffer[i];
43 + outbuffer[(i<<1)+0] = (v << 3) & 0xf8; /* B */
44 + outbuffer[(i<<1)+1] = (v >> 3) & 0xfc; /* G */
45 + outbuffer[(i<<1)+2] = (v >> 8) & 0xf8; /* R */
46 + outbuffer[(i<<1)+3] = 0; /* A */