From 74934cba48910e366d96e4e596e8676d8434fe24 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 18 Mar 2009 17:29:19 +0100 Subject: Adding 2bpp support to qvfb --- tools/qvfb/config.ui | 1655 ++++++++++++++++++++++------------------------- tools/qvfb/qvfb.cpp | 3 + tools/qvfb/qvfbview.cpp | 61 ++ 3 files changed, 855 insertions(+), 864 deletions(-) (limited to 'tools/qvfb') diff --git a/tools/qvfb/config.ui b/tools/qvfb/config.ui index 7a45bfe0a4..ac91d3e4bf 100644 --- a/tools/qvfb/config.ui +++ b/tools/qvfb/config.ui @@ -1,4 +1,5 @@ - + + ********************************************************************* ** ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). @@ -40,181 +41,145 @@ ** ********************************************************************* Config - - + + 0 0 600 - 650 + 665 - + Configure - + true - - + + 6 - - 8 - - - 8 - - - 8 - - + 8 - - + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - - + + + 0 0 - + Size - - + + 6 - - 11 - - - 11 - - - 11 - - + 11 - - - 176x220 "SmartPhone" + + + 176x220 "SmartPhone" - - - 240x320 "PDA" + + + 240x320 "PDA" - - - 320x240 "TV" / "QVGA" + + + 320x240 "TV" / "QVGA" - - - 640x480 "VGA" + + + 640x480 "VGA" - - + + 800x600 - - + + 1024x768 - - + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - - + + + 0 0 - + Custom - - + + 1 - + 1280 - + 16 - + 400 - - + + 1 - + 1024 - + 16 - + 300 @@ -225,92 +190,84 @@ - - + + Depth - - - 6 - - - 11 - - - 11 - - - 11 - - - 11 - + - - + + 1 bit monochrome - - + + + 2 bit grayscale + + + + + + 4 bit grayscale - - + + 8 bit - - + + 12 (16) bit - - + + 15 bit - - + + 16 bit - - + + 18 bit - - + + 24 bit - - + + 32 bit - - + + 32 bit ARGB @@ -321,39 +278,30 @@ - - + + 6 - - 0 - - - 0 - - - 0 - - + 0 - - + + Skin - - - + + + 0 0 - + None @@ -362,25 +310,25 @@ - - + + Emulate touch screen (no mouse move) - - + + Emulate LCD screen (Only with fixed zoom of 3.0 times magnification) - + Qt::Vertical - + 20 10 @@ -389,204 +337,192 @@ - - - + + + 0 0 - - <p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>. + + <p>Note that any applications using the virtual framebuffer will be terminated if you change the Size or Depth <i>above</i>. You may freely modify the Gamma <i>below</i>. - + true - - + + Gamma - - + + 11 - - 11 - - - 11 - - - 11 - - - 6 - - + 6 - - - + + + Blue - - - + + + - - - + + + 128 128 128 - - - + + + 0 0 255 - - - + + + 127 127 255 - - - + + + 38 38 255 - - - + + + 0 0 127 - - - + + + 0 0 170 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -595,153 +531,153 @@ - - - + + + 128 128 128 - - - + + + 0 0 255 - - - + + + 127 127 255 - - - + + + 38 38 255 - - - + + + 0 0 127 - - - + + + 0 0 170 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -750,153 +686,153 @@ - - - + + + 128 128 128 - - - + + + 0 0 255 - - - + + + 127 127 255 - - - + + + 38 38 255 - - - + + + 0 0 127 - - - + + + 0 0 170 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -906,183 +842,183 @@ - + 400 - + 100 - + Qt::Horizontal - - - + + + 1.0 - - - + + + Green - - - + + + - - - + + + 128 128 128 - - - + + + 0 255 0 - - - + + + 127 255 127 - - - + + + 38 255 38 - - - + + + 0 127 0 - - - + + + 0 170 0 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -1091,153 +1027,153 @@ - - - + + + 128 128 128 - - - + + + 0 255 0 - - - + + + 127 255 127 - - - + + + 38 255 38 - - - + + + 0 127 0 - - - + + + 0 170 0 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -1246,153 +1182,153 @@ - - - + + + 128 128 128 - - - + + + 0 255 0 - - - + + + 127 255 127 - - - + + + 38 255 38 - - - + + + 0 127 0 - - - + + + 0 170 0 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -1402,190 +1338,190 @@ - + 400 - + 100 - + Qt::Horizontal - - - + + + 1.0 - - - + + + All - - - + + + 1.0 - - - + + + - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 127 127 127 - - - + + + 170 170 170 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -1594,153 +1530,153 @@ - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 127 127 127 - - - + + + 170 170 170 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -1749,153 +1685,153 @@ - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 255 255 255 - - - + + + 127 127 127 - - - + + + 170 170 170 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -1905,183 +1841,183 @@ - + 400 - + 100 - + Qt::Horizontal - - - + + + Red - - - + + + 1.0 - - - + + + - - - + + + 128 128 128 - - - + + + 255 0 0 - - - + + + 255 127 127 - - - + + + 255 38 38 - - - + + + 127 0 0 - - - + + + 170 0 0 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -2090,153 +2026,153 @@ - - - + + + 128 128 128 - - - + + + 255 0 0 - - - + + + 255 127 127 - - - + + + 255 38 38 - - - + + + 127 0 0 - - - + + + 170 0 0 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -2245,153 +2181,153 @@ - - - + + + 128 128 128 - - - + + + 255 0 0 - - - + + + 255 127 127 - - - + + + 255 38 38 - - - + + + 127 0 0 - - - + + + 170 0 0 - - - + + + 0 0 0 - - - + + + 255 255 255 - - - + + + 128 128 128 - - - + + + 255 255 255 - - - + + + 220 220 220 - - - + + + 0 0 0 - - - + + + 10 95 137 - - - + + + 255 255 255 - - - + + + 0 0 0 - - - + + + 0 0 0 - - - + + + 232 232 232 @@ -2401,53 +2337,44 @@ - + 400 - + 100 - + Qt::Horizontal - - - + + + Set all to 1.0 - - + + - - + + 6 - - 0 - - - 0 - - - 0 - - + 0 - + Qt::Horizontal - + 40 20 @@ -2456,24 +2383,24 @@ - - + + &OK - + true - + true - - + + &Cancel - + true @@ -2482,7 +2409,7 @@ - + GammaView @@ -2498,11 +2425,11 @@ size_custom click() - + 152 193 - + 94 199 @@ -2514,11 +2441,11 @@ size_custom click() - + 259 196 - + 64 188 diff --git a/tools/qvfb/qvfb.cpp b/tools/qvfb/qvfb.cpp index 62149a1952..0fb35770cf 100644 --- a/tools/qvfb/qvfb.cpp +++ b/tools/qvfb/qvfb.cpp @@ -678,6 +678,8 @@ void QVFb::configure() int d; if ( config->depth_1->isChecked() ) d=1; + else if ( config->depth_2gray->isChecked() ) + d=2; else if ( config->depth_4gray->isChecked() ) d=4; else if ( config->depth_8->isChecked() ) @@ -741,6 +743,7 @@ void QVFb::chooseSize(const QSize& sz) void QVFb::chooseDepth(int depth, QVFbView::PixelFormat displayFormat) { config->depth_1->setChecked(depth==1); + config->depth_2gray->setChecked(depth==2); config->depth_4gray->setChecked(depth==4); config->depth_8->setChecked(depth==8); config->depth_12->setChecked(depth==12); diff --git a/tools/qvfb/qvfbview.cpp b/tools/qvfb/qvfbview.cpp index 53a5360e52..c2df8fd7ed 100644 --- a/tools/qvfb/qvfbview.cpp +++ b/tools/qvfb/qvfbview.cpp @@ -457,6 +457,67 @@ QImage QVFbView::getBuffer(const QRect &r, int &leading) const } break; } + + case 2: { + if (requiredSize > buffer.size()) + buffer.resize(requiredSize); + + // XXX: hw: replace by drawhelper functionality + + const int pixelsPerByte = 4; + quint8 *src = reinterpret_cast(mView->data()) + + r.y() * mView->linestep() + r.x() / pixelsPerByte; + const int align = qMin(r.width(), (4 - (r.x() & 3)) & 3); + const int doAlign = (align > 0 ? 1 : 0); + const int tail = qMin(r.width(), (r.width() - align) & 3); + const int doTail = (tail > 0 ? 1 : 0); + const int width8 = (r.width() - align) / pixelsPerByte; + const int stride = mView->linestep() - (width8 + doAlign); + + uchar *b = reinterpret_cast(buffer.data()); + img = QImage(b, r.width(), r.height(), QImage::Format_RGB32); + for (int y = 0; y < r.height(); ++y) { + quint32 *dest = reinterpret_cast(img.scanLine(y)); + quint8 c; + + if (doAlign) { + switch (align) { + case 3: c = ((*src & 0x30) >> 4) * 0x55; + *dest++ = qRgb(c, c, c); + case 2: c = ((*src & 0x0c) >> 2) * 0x55; + *dest++ = qRgb(c, c, c); + case 1: c = ((*src & 0x03)) * 0x55; + *dest++ = qRgb(c, c, c); + } + ++src; + } + for (int i = 0; i < width8; ++i) { + c = ((*src & 0xc0) >> 6) * 0x55; + *dest++ = qRgb(c, c, c); + c = ((*src & 0x30) >> 4) * 0x55; + *dest++ = qRgb(c, c, c); + c = ((*src & 0x0c) >> 2) * 0x55; + *dest++ = qRgb(c, c, c); + c = ((*src & 0x03)) * 0x55; + *dest++ = qRgb(c, c, c); + + ++src; + } + if (doTail) { + switch (tail) { + case 3: c = ((*src & 0x0c) >> 2) * 0x55; + dest[2] = qRgb(c, c, c); + case 2: c = ((*src & 0x30) >> 4) * 0x55; + dest[1] = qRgb(c, c, c); + case 1: c = ((*src & 0xc0) >> 6) * 0x55; + dest[0] = qRgb(c, c, c); + } + } + src += stride; + } + break; + } + case 4: { if (requiredSize > buffer.size()) buffer.resize(requiredSize); -- cgit v1.2.1