49 lines
1.6 KiB
49 lines
1.6 KiB
# --- T2-COPYRIGHT-NOTE-BEGIN --- |
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch. |
|
# |
|
# T2 SDE: package/.../fbgrab/565-fixup.patch |
|
# Copyright (C) 2004 - 2006 The T2 SDE Project |
|
# |
|
# More information can be found in the files COPYING and README. |
|
# |
|
# This patch file is dual-licensed. It is available under the license the |
|
# patched project is licensed under, as long as it is an OpenSource license |
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms |
|
# of the GNU General Public License as published by the Free Software |
|
# Foundation; either version 2 of the License, or (at your option) any later |
|
# version. |
|
# --- T2-COPYRIGHT-NOTE-END --- |
|
|
|
Fixed fbgrab for big-endian systems, including a code cleanup on the way. |
|
|
|
- Rene Rebe |
|
|
|
--- fbgrab-1.0/fbgrab.c 2002-04-15 22:22:54.000000000 +0200 |
|
+++ fbgrab-1.0-fixed/fbgrab.c 2004-09-05 16:12:42.874276472 +0200 |
|
@@ -166,15 +166,17 @@ |
|
|
|
for (i=0; i < (unsigned int) height*width*2; i+=2) |
|
{ |
|
- /* BLUE = 0 */ |
|
- outbuffer[(i<<1)+0] = (inbuffer[i] & 0x1f) << 3; |
|
- /* GREEN = 1 */ |
|
- outbuffer[(i<<1)+1] = (((inbuffer[i+1] & 0x7) << 3) | |
|
- (inbuffer[i] & 0xE0) >> 5) << 2; |
|
- /* RED = 2 */ |
|
- outbuffer[(i<<1)+2] = (inbuffer[i+1] & 0xF8); |
|
- /* ALPHA = 3 */ |
|
- outbuffer[(i<<1)+3] = '\0'; |
|
+ int16_t v = |
|
+#ifdef __BIG_ENDIAN__ |
|
+ (inbuffer[i] << 8) + inbuffer[i+1]; |
|
+#else |
|
+ (inbuffer[i+1] << 8) + inbuffer[i]; |
|
+#endif |
|
+ |
|
+ outbuffer[(i<<1)+0] = (v << 3) & 0xf8; /* B */ |
|
+ outbuffer[(i<<1)+1] = (v >> 3) & 0xfc; /* G */ |
|
+ outbuffer[(i<<1)+2] = (v >> 8) & 0xf8; /* R */ |
|
+ outbuffer[(i<<1)+3] = 0; /* A */ |
|
} |
|
} |
|
|
|
|