summaryrefslogtreecommitdiffstats
path: root/meta/recipes-qt/qt4/files/0009-support-2bpp.patch
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:14:24 +0100
committerRichard Purdie <rpurdie@linux.intel.com>2010-08-27 15:29:45 +0100
commit29d6678fd546377459ef75cf54abeef5b969b5cf (patch)
tree8edd65790e37a00d01c3f203f773fe4b5012db18 /meta/recipes-qt/qt4/files/0009-support-2bpp.patch
parentda49de6885ee1bc424e70bc02f21f6ab920efb55 (diff)
downloadpoky-29d6678fd546377459ef75cf54abeef5b969b5cf.tar.gz
Major layout change to the packages directory
Having one monolithic packages directory makes it hard to find things and is generally overwhelming. This commit splits it into several logical sections roughly based on function, recipes.txt gives more information about the classifications used. The opportunity is also used to switch from "packages" to "recipes" as used in OpenEmbedded as the term "packages" can be confusing to people and has many different meanings. Not all recipes have been classified yet, this is just a first pass at separating things out. Some packages are moved to meta-extras as they're no longer actively used or maintained. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'meta/recipes-qt/qt4/files/0009-support-2bpp.patch')
-rw-r--r--meta/recipes-qt/qt4/files/0009-support-2bpp.patch299
1 files changed, 299 insertions, 0 deletions
diff --git a/meta/recipes-qt/qt4/files/0009-support-2bpp.patch b/meta/recipes-qt/qt4/files/0009-support-2bpp.patch
new file mode 100644
index 0000000000..cf44ea8214
--- /dev/null
+++ b/meta/recipes-qt/qt4/files/0009-support-2bpp.patch
@@ -0,0 +1,299 @@
1Add 2bpp support
2
3Ported from OE by: Yu Ke <ke.yu@intel.com>
4
5diff -urN qt-embedded-linux-opensource-src-4.4.3.orig/configure qt-embedded-linux-opensource-src-4.4.3/configure
6--- qt-embedded-linux-opensource-src-4.4.3.orig/configure 2008-09-27 11:01:23.000000000 +0200
7+++ qt-embedded-linux-opensource-src-4.4.3/configure 2009-01-14 14:30:53.000000000 +0100
8@@ -5045,6 +5045,7 @@
9 echo "Choose pixel-depths to support:"
10 echo
11 echo " 1. 1bpp, black/white"
12+ echo " 2. 2bpp, grayscale"
13 echo " 4. 4bpp, grayscale"
14 echo " 8. 8bpp, paletted"
15 echo " 12. 12bpp, rgb 4-4-4"
16@@ -5063,11 +5064,11 @@
17 fi
18 if [ -n "$CFG_QWS_DEPTHS" -a "$PLATFORM_QWS" = "yes" ]; then
19 if [ "$CFG_QWS_DEPTHS" = "all" ]; then
20- CFG_QWS_DEPTHS="1 4 8 12 15 16 18 24 32 generic"
21+ CFG_QWS_DEPTHS="1 2 4 8 12 15 16 18 24 32 generic"
22 fi
23 for D in `echo "$CFG_QWS_DEPTHS" | sed -e 's/,/ /g'`; do
24 case $D in
25- 1|4|8|12|15|16|18|24|32) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_$D";;
26+ 1|2|4|8|12|15|16|18|24|32) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_$D";;
27 generic) QCONFIG_FLAGS="$QCONFIG_FLAGS QT_QWS_DEPTH_GENERIC";;
28 esac
29 done
30diff -urN qt-embedded-linux-opensource-src-4.4.3.orig/src/gui/embedded/qscreenlinuxfb_qws.cpp qt-embedded-linux-opensource-src-4.4.3/src/gui/embedded/qscreenlinuxfb_qws.cpp
31--- qt-embedded-linux-opensource-src-4.4.3.orig/src/gui/embedded/qscreenlinuxfb_qws.cpp 2008-09-27 11:01:28.000000000 +0200
32+++ qt-embedded-linux-opensource-src-4.4.3/src/gui/embedded/qscreenlinuxfb_qws.cpp 2009-01-14 17:22:34.000000000 +0100
33@@ -404,8 +404,8 @@
34 setupOffScreen();
35
36 // Now read in palette
37- if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4)) {
38- screencols= (vinfo.bits_per_pixel==8) ? 256 : 16;
39+ if((vinfo.bits_per_pixel==8) || (vinfo.bits_per_pixel==4) || (vinfo.bits_per_pixel==2)) {
40+ screencols= 1 << vinfo.bits_per_pixel;
41 int loopc;
42 fb_cmap startcmap;
43 startcmap.start=0;
44diff -urN qt-embedded-linux-opensource-src-4.4.3.orig/src/gui/embedded/qscreen_qws.cpp qt-embedded-linux-opensource-src-4.4.3/src/gui/embedded/qscreen_qws.cpp
45--- qt-embedded-linux-opensource-src-4.4.3.orig/src/gui/embedded/qscreen_qws.cpp 2008-09-27 11:01:28.000000000 +0200
46+++ qt-embedded-linux-opensource-src-4.4.3/src/gui/embedded/qscreen_qws.cpp 2009-01-14 17:22:44.000000000 +0100
47@@ -444,6 +444,58 @@
48 }
49 #endif // QT_QWS_DEPTH_4
50
51+#ifdef QT_QWS_DEPTH_2
52+static inline void qt_rectfill_gray2(quint8 *dest, quint8 value,
53+ int x, int y, int width, int height,
54+ int stride)
55+{
56+ const int pixelsPerByte = 4;
57+ const int alignWidth = qMin(width, (4 - (x & 3)) & 3);
58+ const int doAlign = (alignWidth > 0 ? 1 : 0);
59+ const int alignStart = pixelsPerByte - 1 - (x & 3);
60+ const int alignStop = alignStart - (alignWidth - 1);
61+ const quint8 alignMask = ((1 << (2 * alignWidth)) - 1) << (2 * alignStop);
62+ const int tailWidth = (width - alignWidth) & 3;
63+ const int doTail = (tailWidth > 0 ? 1 : 0);
64+ const quint8 tailMask = (1 << (2 * (pixelsPerByte - tailWidth))) - 1;
65+ const int width8 = (width - alignWidth) / pixelsPerByte;
66+
67+ dest += y * stride + x / pixelsPerByte;
68+ stride -= (doAlign + width8);
69+
70+ for (int j = 0; j < height; ++j) {
71+ if (doAlign) {
72+ *dest = (*dest & ~alignMask) | (value & alignMask);
73+ ++dest;
74+ }
75+ if (width8) {
76+ qt_memfill<quint8>(dest, value, width8);
77+ dest += width8;
78+ }
79+ if (doTail)
80+ *dest = (*dest & tailMask) | (value & ~tailMask);
81+ dest += stride;
82+ }
83+}
84+
85+static void solidFill_gray2(QScreen *screen, const QColor &color,
86+ const QRegion &region)
87+{
88+ quint8 *dest = reinterpret_cast<quint8*>(screen->base());
89+ const quint8 c = qGray(color.rgba()) >> 6;
90+ const quint8 c8 = (c << 6) | (c << 4) | (c << 2) | c;
91+
92+ const int stride = screen->linestep();
93+ const QVector<QRect> rects = region.rects();
94+
95+ for (int i = 0; i < rects.size(); ++i) {
96+ const QRect r = rects.at(i);
97+ qt_rectfill_gray2(dest, c8, r.x(), r.y(), r.width(), r.height(),
98+ stride);
99+ }
100+}
101+#endif // QT_QWS_DEPTH_2
102+
103 #ifdef QT_QWS_DEPTH_1
104 static inline void qt_rectfill_mono(quint8 *dest, quint8 value,
105 int x, int y, int width, int height,
106@@ -551,6 +603,11 @@
107 screen->d_ptr->solidFill = solidFill_gray4;
108 break;
109 #endif
110+#ifdef QT_QWS_DEPTH_2
111+ case 2:
112+ screen->d_ptr->solidFill = solidFill_gray2;
113+ break;
114+#endif
115 #ifdef QT_QWS_DEPTH_1
116 case 1:
117 screen->d_ptr->solidFill = solidFill_mono;
118@@ -958,6 +1015,149 @@
119 }
120 #endif // QT_QWS_DEPTH_4
121
122+#ifdef QT_QWS_DEPTH_2
123+
124+struct qgray2 { quint8 dummy; } Q_PACKED;
125+
126+template <typename SRC>
127+static inline quint8 qt_convertToGray2(SRC color);
128+
129+template <>
130+inline quint8 qt_convertToGray2(quint32 color)
131+{
132+ return qGray(color) >> 6;
133+}
134+
135+template <>
136+inline quint8 qt_convertToGray2(quint16 color)
137+{
138+ const int r = (color & 0xf800) >> 11;
139+ const int g = (color & 0x07e0) >> 6; // only keep 5 bit
140+ const int b = (color & 0x001f);
141+ return (r * 11 + g * 16 + b * 5) >> 8;
142+}
143+
144+template <>
145+inline quint8 qt_convertToGray2(qrgb444 color)
146+{
147+ return qt_convertToGray2(quint32(color));
148+}
149+
150+template <>
151+inline quint8 qt_convertToGray2(qargb4444 color)
152+{
153+ return qt_convertToGray2(quint32(color));
154+}
155+
156+template <typename SRC>
157+static inline void qt_rectconvert_gray2(qgray2 *dest2, const SRC *src,
158+ int x, int y, int width, int height,
159+ int dstStride, int srcStride)
160+{
161+ const int pixelsPerByte = 4;
162+ quint8 *dest8 = reinterpret_cast<quint8*>(dest2)
163+ + y * dstStride + x / pixelsPerByte;
164+ const int alignWidth = qMin(width, (4 - (x & 3)) & 3);
165+ const int doAlign = (alignWidth > 0 ? 1 : 0);
166+ const int alignStart = pixelsPerByte - 1 - (x & 3);
167+ const int alignStop = alignStart - (alignWidth - 1);
168+ const quint8 alignMask = ((1 << (2 * alignWidth)) - 1) << (2 * alignStop);
169+ const int tailWidth = (width - alignWidth) & 3;
170+ const int doTail = (tailWidth > 0 ? 1 : 0);
171+ const quint8 tailMask = (1 << (2 * (pixelsPerByte - tailWidth))) - 1;
172+ const int width8 = (width - alignWidth) / pixelsPerByte;
173+
174+ srcStride = srcStride / sizeof(SRC) - (width8 * pixelsPerByte + alignWidth);
175+ dstStride -= (width8 + doAlign);
176+
177+ for (int j = 0; j < height; ++j) {
178+ if (doAlign) {
179+ quint8 d = *dest8 & ~alignMask;
180+ for (int i = alignStart; i >= alignStop; --i)
181+ d |= qt_convertToGray2<SRC>(*src++) << (2 * i);
182+ *dest8++ = d;
183+ }
184+ for (int i = 0; i < width8; ++i) {
185+ *dest8 = (qt_convertToGray2<SRC>(src[0]) << 6)
186+ | (qt_convertToGray2<SRC>(src[1]) << 4)
187+ | (qt_convertToGray2<SRC>(src[2]) << 2)
188+ | (qt_convertToGray2<SRC>(src[3]));
189+ src += 4;
190+ ++dest8;
191+ }
192+ if (doTail) {
193+ quint8 d = *dest8 & tailMask;
194+ switch (tailWidth) {
195+ case 3: d |= qt_convertToGray2<SRC>(src[2]) << 2;
196+ case 2: d |= qt_convertToGray2<SRC>(src[1]) << 4;
197+ case 1: d |= qt_convertToGray2<SRC>(src[0]) << 6;
198+ }
199+ *dest8 = d;
200+ }
201+
202+ dest8 += dstStride;
203+ src += srcStride;
204+ }
205+}
206+
207+template <>
208+void qt_rectconvert(qgray2 *dest, const quint32 *src,
209+ int x, int y, int width, int height,
210+ int dstStride, int srcStride)
211+{
212+ qt_rectconvert_gray2<quint32>(dest, src, x, y, width, height,
213+ dstStride, srcStride);
214+}
215+
216+template <>
217+void qt_rectconvert(qgray2 *dest, const quint16 *src,
218+ int x, int y, int width, int height,
219+ int dstStride, int srcStride)
220+{
221+ qt_rectconvert_gray2<quint16>(dest, src, x, y, width, height,
222+ dstStride, srcStride);
223+}
224+
225+template <>
226+void qt_rectconvert(qgray2 *dest, const qrgb444 *src,
227+ int x, int y, int width, int height,
228+ int dstStride, int srcStride)
229+{
230+ qt_rectconvert_gray2<qrgb444>(dest, src, x, y, width, height,
231+ dstStride, srcStride);
232+}
233+
234+template <>
235+void qt_rectconvert(qgray2 *dest, const qargb4444 *src,
236+ int x, int y, int width, int height,
237+ int dstStride, int srcStride)
238+{
239+ qt_rectconvert_gray2<qargb4444>(dest, src, x, y, width, height,
240+ dstStride, srcStride);
241+}
242+
243+static void blit_2(QScreen *screen, const QImage &image,
244+ const QPoint &topLeft, const QRegion &region)
245+{
246+ switch (image.format()) {
247+ case QImage::Format_ARGB32_Premultiplied:
248+ blit_template<qgray2, quint32>(screen, image, topLeft, region);
249+ return;
250+ case QImage::Format_RGB16:
251+ blit_template<qgray2, quint16>(screen, image, topLeft, region);
252+ return;
253+ case QImage::Format_RGB444:
254+ blit_template<qgray2, qrgb444>(screen, image, topLeft, region);
255+ return;
256+ case QImage::Format_ARGB4444_Premultiplied:
257+ blit_template<qgray2, qargb4444>(screen, image, topLeft, region);
258+ return;
259+ default:
260+ qCritical("blit_2(): Image format %d not supported!", image.format());
261+ }
262+}
263+#endif // QT_QWS_DEPTH_2
264+
265 #ifdef QT_QWS_DEPTH_1
266
267 struct qmono { quint8 dummy; } Q_PACKED;
268@@ -1206,6 +1406,11 @@
269 screen->d_ptr->blit = blit_4;
270 break;
271 #endif
272+#ifdef QT_QWS_DEPTH_2
273+ case 2:
274+ screen->d_ptr->blit = blit_2;
275+ break;
276+#endif
277 #ifdef QT_QWS_DEPTH_1
278 case 1:
279 screen->d_ptr->blit = blit_1;
280@@ -2056,6 +2261,8 @@
281 }
282 } else if (d == 4) {
283 ret = qGray(r, g, b) >> 4;
284+ } else if (d == 2) {
285+ ret = qGray(r, g, b) >> 6;
286 } else if (d == 1) {
287 ret = qGray(r, g, b) >= 128;
288 } else {
289@@ -2126,6 +2333,10 @@
290 } else if(d==1) {
291 return true;
292 #endif
293+#ifdef QT_QWS_DEPTH_2
294+ } else if(d==2) {
295+ return true;
296+#endif
297 #ifdef QT_QWS_DEPTH_4
298 } else if(d==4) {
299 return true;