* updated korganizer (21.12.1 -> 21.12.2), untested
[t2-trunk.git] / package / graphic / fbv / bigendian.patch
blob9d0d2e7bae1f9e92b16f0fa3fdf5a3245b233451
1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
3 #
4 # T2 SDE: package/.../fbv/bigendian.patch
5 # Copyright (C) 2007 The T2 SDE Project
6 #
7 # More information can be found in the files COPYING and README.
8 #
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
14 # version.
15 # --- T2-COPYRIGHT-NOTE-END ---
17 This is a bit hacky as the endianess of the frame-buffer is
18 not tied to the CPU. But the fbv code sucks anyway ... Let's
19 see this as basic fixup and use miniescreen for the same task,
20 otherwise ...
22 - Rene Rebe <rene@exactcode.de>
24 --- fbv-1.0b/fb_display.c 2004-09-07 12:09:43.000000000 +0000
25 +++ fbv-1.0b-fixed/fb_display.c 2007-03-07 16:50:59.243785153 +0000
26 @@ -293,17 +293,29 @@
27 inline static unsigned short make15color(unsigned char r, unsigned char g, unsigned char b)
29 return (
30 +#if __BYTE_ORDER != __BIG_ENDIAN
31 (((r >> 3) & 31) << 10) |
32 (((g >> 3) & 31) << 5) |
33 ((b >> 3) & 31) );
34 +#else
35 + ((r >> 3) & 31) |
36 + (((g >> 3) & 31) << 5) |
37 + (((b >> 3) & 31) << 10) );
38 +#endif
41 inline static unsigned short make16color(unsigned char r, unsigned char g, unsigned char b)
43 return (
44 +#if __BYTE_ORDER != __BIG_ENDIAN
45 (((r >> 3) & 31) << 11) |
46 (((g >> 2) & 63) << 5) |
47 ((b >> 3) & 31) );
48 +#else
49 + ((r >> 3) & 31) |
50 + (((g >> 3) & 31) << 5) |
51 + (((b >> 3) & 31) << 10) );
52 +#endif
55 void* convertRGB2FB(int fh, unsigned char *rgbbuff, unsigned long count, int bpp, int *cpp)
56 @@ -312,7 +324,6 @@
57 void *fbbuff = NULL;
58 u_int8_t *c_fbbuff;
59 u_int16_t *s_fbbuff;
60 - u_int32_t *i_fbbuff;
62 switch(bpp)
64 @@ -339,13 +350,25 @@
65 break;
66 case 24:
67 case 32:
68 - *cpp = 4;
69 - i_fbbuff = (unsigned int *) malloc(count * sizeof(unsigned int));
70 - for(i = 0; i < count ; i++)
71 - i_fbbuff[i] = ((rgbbuff[i*3] << 16) & 0xFF0000) |
72 - ((rgbbuff[i*3+1] << 8) & 0xFF00) |
73 - (rgbbuff[i*3+2] & 0xFF);
74 - fbbuff = (void *) i_fbbuff;
75 + *cpp = bpp/8;
76 + c_fbbuff = (unsigned char *) malloc(count * *cpp);
77 + fbbuff = (void *) c_fbbuff;
78 + for(i = 0; i < count ; i++) {
79 +#if __BYTE_ORDER != __BIG_ENDIAN
80 + c_fbbuff[0] = rgbbuff[i*3];
81 + c_fbbuff[1] = rgbbuff[i*3+1];
82 + c_fbbuff[2] = rgbbuff[i*3+2];
83 + if (*cpp == 4) c_fbbuff[3] = 0;
84 + c_fbbuff += *cpp;
85 +#else
86 + c_fbbuff += *cpp;
87 + c_fbbuff[-1] = rgbbuff[i*3];
88 + c_fbbuff[-2] = rgbbuff[i*3+1];
89 + c_fbbuff[-3] = rgbbuff[i*3+2];
90 + if (*cpp == 4) c_fbbuff[-4] = 0;
92 +#endif
93 + }
94 break;
95 default:
96 fprintf(stderr, "Unsupported video mode! You've got: %dbpp\n", bpp);