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