aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/qte/qte-2.3.10/support_18bpp.diff
blob: 138c4ce0bc8b4bee1b843d6341447486906e413e (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
diff -urN qt-2.3.10/configure qt-2.3.10_mod/configure
--- qt-2.3.10/configure	2005-01-23 08:00:36.000000000 -0600
+++ qt-2.3.10_mod/configure	2006-10-21 23:13:29.000000000 -0500
@@ -805,7 +805,8 @@
     echo "   4. 4bpp grayscale - also enables 8bpp"
     echo "   8. 8bpp"
     echo "  16. 16bpp"
-    echo "  24. 24bpp - also enables 32bpp"
+    echo "  18. 18bpp - packed into 24bpp, cannot be enabled with 24bpp"
+    echo "  24. 24bpp - also enables 32bpp, cannot be enabled with 18bpp"
     echo "  32. 32bpp"
     echo
     echo "Each depth adds around 100Kb on 80386."
@@ -830,7 +831,7 @@
 
 if [ -n "$DEPTHS" ]
 then
-    DV=;D4=;D8=;D16=;D24=;D32=
+    DV=;D4=;D8=;D16=;D18=;D24=;D32=
     for D in `echo "$DEPTHS" | sed -e 's/,/ /g'`
     do
 	case "$D" in
@@ -838,10 +839,20 @@
 	;;  4) D4=y; D8=y
 	;;  8) D8=y
 	;; 16) D16=y
+            ;; 18) D18=y
 	;; 24) D24=y; D32=y
 	;; 32) D32=y
 	esac
     done
+
+    if [ ! -z "$D18" -a ! -z "$D24" ]
+    then
+        echo
+        echo "WARNING: You have configured with depth 18 and 24."
+        echo "         These depths are not compatible. Depth 24"
+        echo "         will be disabled."
+    fi
+
     if [ -z "$DV" ]
     then
 	QT_CXX="$QT_CXX -DQT_NO_QWS_VGA_16"
@@ -858,9 +869,19 @@
     then
 	QT_CXX="$QT_CXX -DQT_NO_QWS_DEPTH_16"
     fi
+    if [ -z "$D18" ]
+    then
+        QT_CXX="$QT_CXX -DQT_NO_QWS_DEPTH_18"
+    fi
     if [ -z "$D24" ]
     then
 	QT_CXX="$QT_CXX -DQT_NO_QWS_DEPTH_24"
+    else
+        # Disable depth 24 if depth 18 enabled
+        if [ ! -z "$D18" ]
+        then
+            QT_CXX="$QT_CXX -DQT_NO_QWS_DEPTH_24"
+        fi
     fi
     if [ -z "$D32" ]
     then
@@ -1326,7 +1347,7 @@
 			 default ($QCONFIG).
 
     -depths list ....... Comma-separated list of supported bit-per-pixel
-			 depths, from:  v, 4, 8, 16, 24, and 32.  'v' is VGA16.
+			 depths, from:  v, 4, 8, 16, 18, 24, and 32.  'v' is VGA16.
 
     -accel-snap ........ Enable SciTech SNAP Graphics acceleration.
     -accel-voodoo3 ..... Enable Voodoo3 acceleration.
diff -urN qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp qt-2.3.10_mod/src/kernel/qgfxlinuxfb_qws.cpp
--- qt-2.3.10/src/kernel/qgfxlinuxfb_qws.cpp	2011-04-09 18:48:17.000000000 +0100
+++ qt-2.3.10_mod/src/kernel/qgfxlinuxfb_qws.cpp	2011-04-09 18:54:45.000000000 +0100
@@ -134,6 +134,10 @@
     }
 
     d=vinfo.bits_per_pixel;
+    // 18-bpp-support
+    if ((d == 18) || (d == 19))
+       d = 24;
+    // End of 18-bpp-support
     lstep=finfo.line_length;
     int xoff = vinfo.xoffset;
     int yoff = vinfo.yoffset;
@@ -427,6 +431,15 @@
 		gbits=6;
 		bbits=5;
 		break;
+	  // 18-bpp-support
+	  case 18: case 19:
+		rbits=6;
+		gbits=6;
+		bbits=6;
+		vinfo.bits_per_pixel=24;
+		startupd=24;
+		break;
+	  // End of 18-bpp-support
 	  case 24: case 32:
 		rbits=gbits=bbits=8;
 		break;
@@ -819,6 +832,10 @@
     w=vinfo.xres;
     h=vinfo.yres;
     d=vinfo.bits_per_pixel;
+    // 18-bpp-support
+    if ((d == 18) || (d == 19))
+       d = 24;
+    // End of 18-bpp-support
     lstep=finfo.line_length;
     size=h*lstep;
 }
diff -urN qt-2.3.10/src/kernel/qgfxraster_qws.cpp qt-2.3.10_mod/src/kernel/qgfxraster_qws.cpp
--- qt-2.3.10/src/kernel/qgfxraster_qws.cpp	2005-01-23 08:00:47.000000000 -0600
+++ qt-2.3.10_mod/src/kernel/qgfxraster_qws.cpp	2006-10-22 08:38:38.000000000 -0500
@@ -161,25 +161,51 @@
 #endif
 
 #define MASK4BPP(x) (0xf0 >> (x))
-
+// 18-bpp-support
 inline void gfxSetRgb24( unsigned char *d, unsigned int p )
 {
-    *d = p & 0x0000ff;
+#ifdef QT_NO_QWS_DEPTH_18 
+    *d = p & 0x000ff;
     *(d+1) = (p & 0x00ff00 ) >> 8;
     *(d+2) = (p & 0xff0000 ) >> 16;
+#else
+    uint b = (p & 0x0000ff) >>  0;
+    uint g = (p & 0x00ff00) >>  8;
+    uint r = (p & 0xff0000) >> 16;
+    uint data = (b>>2) | ((g>>2) << 6) | ((r>>2) << 12);
+    *d = data & 0xff;
+    *(d+1) = (data >> 8) & 0xff;
+    *(d+2) = (data >> 16) & 0xff;
+#endif
 }
 
 inline void gfxSetRgb24( unsigned char *d, int r, int g, int b )
 {
+#ifdef QT_NO_QWS_DEPTH_18 
     *d = b;
     *(d+1) = g;
     *(d+2) = r;
+#else
+    uint data = (b>>2) | ((g>>2) << 6) | ((r>>2) << 12);
+    *d = data & 0xff;
+    *(d+1) = (data >> 8) & 0xff;
+    *(d+2) = (data >> 16) & 0xff;
+#endif
 }
 
 inline unsigned int gfxGetRgb24( unsigned char *d )
 {
+#ifdef QT_NO_QWS_DEPTH_18 
     return *d | (*(d+1)<<8) | (*(d+2)<<16);
+#else
+    uint data = *d | (*(d+1)<<8) | (*(d+2)<<16);
+    uint r = ((data >> 10) & 0xfc);
+    uint g = ((data >>  4) & 0xfc);
+    uint b = ((data <<  2) & 0xfc);
+    return b | (g << 8) | (r << 16);
+#endif
 }
+// End of 18-bpp-support
 
 static bool simple_8bpp_alloc=FALSE;
 
@@ -1767,11 +1793,12 @@
 	} else {
 	    (*srcdata)+=4;
 	}
-#if !defined( QT_NO_QWS_DEPTH_24 )
+// 18-bpp hack (mlk)
+//#if !defined( QT_NO_QWS_DEPTH_24 )
     } else if(sdepth==24) {
 	ret = gfxGetRgb24( *srcdata );
 	(*srcdata) += 3;
-#endif
+//#endif
 #if !defined( QT_NO_IMAGE_16_BIT ) || !defined( QT_NO_QWS_DEPTH_16 )
     } else if(sdepth==16) {
 	unsigned short int hold=*((unsigned short int *)(*srcdata));
@@ -3963,9 +3990,22 @@
 	unsigned char *alphaptr = (unsigned char *)alphabuf;
 	unsigned char *avp = alphas;
 	int loopc;
-
+// 18-bpp-support 
+#ifdef QT_NO_QWS_DEPTH_18
 	memcpy( alphabuf, myptr+x1*3, w*3 );
-
+#else
+	{ uchar *srcptr24 = myptr+x1*3;
+	uchar *dstptr24 = (uchar*)alphabuf;
+	for ( int i = 0; i < w; i++ ) {
+	    uint pix = gfxGetRgb24(srcptr24);
+	    dstptr24[2] = (pix >> 16) & 0xff;
+	    dstptr24[1] = (pix >>  8) & 0xff;
+	    dstptr24[0] = (pix >>  0) & 0xff;
+	    srcptr24 += 3;
+	    dstptr24 += 3;
+	} }
+#endif
+// End of 18-bpp-support
 	// Now blend with source data
 	unsigned char * srcptr=srcdata;
 	unsigned int srcval;
@@ -5808,10 +5848,10 @@
     } else if(d==8) {
 	ret = new QGfxRaster<8,0>(bytes,w,h);
 #endif
-#ifndef QT_NO_QWS_DEPTH_24
+//#ifndef QT_NO_QWS_DEPTH_24
     } else if(d==24) {
 	ret = new QGfxRaster<24,0>(bytes,w,h);
-#endif
+//#endif
 #ifndef QT_NO_QWS_DEPTH_32
     } else if(d==32) {
 	ret = new QGfxRaster<32,0>(bytes,w,h);
diff -urN qt-2.3.10/src/kernel/qgfxtransformed_qws.cpp qt-2.3.10_mod/src/kernel/qgfxtransformed_qws.cpp
--- qt-2.3.10/src/kernel/qgfxtransformed_qws.cpp	2005-01-23 08:00:46.000000000 -0600
+++ qt-2.3.10_mod/src/kernel/qgfxtransformed_qws.cpp	2006-10-22 00:57:27.000000000 -0500
@@ -1020,10 +1020,10 @@
     } else if (d==8) {
 	ret = new QGfxTransformedRaster<8,0>(bytes,w,h);
 #endif
-#ifndef QT_NO_QWS_DEPTH_24
+//#ifndef QT_NO_QWS_DEPTH_24
     } else if (d==24) {
 	ret = new QGfxTransformedRaster<24,0>(bytes,w,h);
-#endif
+//#endif
 #ifndef QT_NO_QWS_DEPTH_32
     } else if (d==32) {
 	ret = new QGfxTransformedRaster<32,0>(bytes,w,h);
diff -urN qt-2.3.10/src/kernel/qgfxvfb_qws.cpp qt-2.3.10_mod/src/kernel/qgfxvfb_qws.cpp
--- qt-2.3.10/src/kernel/qgfxvfb_qws.cpp	2005-01-23 08:00:47.000000000 -0600
+++ qt-2.3.10_mod/src/kernel/qgfxvfb_qws.cpp	2006-10-22 00:19:30.000000000 -0500
@@ -288,10 +288,14 @@
     d = hdr->depth;
     lstep = hdr->linestep;
 
-#ifdef DEBUG
+//#ifdef DEBUG
     qDebug( "Connected to VFB server: %d x %d x %d", w, h, d );
-#endif
+//#endif
 
+// 18-bpp-support
+    if ( (d == 18) || (d == 19) )
+	d = 24;
+// End of 18-bpp-support
     size = lstep * h;
     mapsize = size;
     screencols = hdr->numcols;
@@ -434,6 +438,15 @@
 	else
 	    ret = new QGfxRaster<32,0>(bytes,w,h);
 #endif
+// 18-bpp-support
+//#ifndef QT_NO_QWS_DEPTH_24
+    } else if (d==24) {
+	if ( bytes == qt_screen->base() )
+	    ret = new QGfxVFb<24,0>(bytes,w,h);
+	else
+	    ret = new QGfxRaster<24,0>(bytes,w,h);
+//#endif
+// 18-bpp-support
     } else {
 	qFatal("Can't drive depth %d",d);
     }