summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@theqtcompany.com>2015-12-17 09:45:44 +0100
committerAndy Nichols <andy.nichols@qt.io>2016-06-28 10:18:23 +0000
commitef4db5a347c6ad1ddb75027c8449ade64b731d08 (patch)
tree3c6583ff7e666ff51c777bd34fff6a6e2a371dd8
parenta1dbf346e6f1dc6c539d43bfa40b1aa78772ecdd (diff)
cleanups in the VNC plugin
Change-Id: Iac930d3c7036b285ff5003691bfecf6071795d54 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp128
-rw-r--r--src/plugins/platforms/vnc/qvnc_p.h3
-rw-r--r--src/plugins/platforms/vnc/qvncscreen.cpp42
3 files changed, 10 insertions, 163 deletions
diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp
index d01d53b2f8..da03d889a6 100644
--- a/src/plugins/platforms/vnc/qvnc.cpp
+++ b/src/plugins/platforms/vnc/qvnc.cpp
@@ -450,6 +450,7 @@ void QRfbRawEncoder::write()
const int bytesPerPixel = server->clientBytesPerPixel();
// create a region from the dirty rects and send the region's merged rects.
+ // ### use the tile map again
QRegion rgn = server->screen()->dirtyRegion;
server->screen()->clearDirty();
QT_VNC_DEBUG() << "QRfbRawEncoder::write()" << rgn;
@@ -496,25 +497,6 @@ void QRfbRawEncoder::write()
const uchar *screendata = screenImage.scanLine(rect.y)
+ rect.x * screenImage.depth() / 8;
-#if 0 //ndef QT_NO_QWS_CURSOR
- // hardware cursors must be blended with the screen memory
- const bool doBlendCursor = qt_screencursor
- && !server->hasClientCursor()
- && qt_screencursor->isAccelerated();
- QImage tileImage;
- if (doBlendCursor) {
- const QRect cursorRect = qt_screencursor->boundingRect()
- .translated(-server->screen()->offset());
- if (tileRect.intersects(cursorRect)) {
- tileImage = screenImage.copy(tileRect);
- blendCursor(tileImage,
- tileRect.translated(server->screen()->offset()));
- screendata = tileImage.bits();
- linestep = tileImage.bytesPerLine();
- }
- }
-#endif // QT_NO_QWS_CURSOR
-
if (server->doPixelConversion()) {
const int bufferSize = rect.w * rect.h * bytesPerPixel;
if (bufferSize > buffer.size())
@@ -541,7 +523,6 @@ void QRfbRawEncoder::write()
socket->flush();
}
-
QVncClientCursor::QVncClientCursor(QVncServer *s)
: server(s)
{
@@ -703,9 +684,7 @@ void QVncServer::newConnection()
QT_VNC_DEBUG() << "new Connection" << thread();
- // ####
-// if (!qvnc_screen->screen() && !qvnc_screen->noDisablePainting)
-// QWSServer::instance()->enablePainting(true);
+ qvnc_screen->setPowerState(QPlatformScreen::PowerStateOn);
}
void QVncServer::readClient()
@@ -976,46 +955,22 @@ void QVncServer::setEncodings()
supportHextile = true;
if (encoder)
break;
+#if 0
switch (qvnc_screen->depth()) {
-#ifdef QT_QWS_DEPTH_8
case 8:
encoder = new QRfbHextileEncoder<quint8>(this);
break;
-#endif
-#ifdef QT_QWS_DEPTH_12
- case 12:
- encoder = new QRfbHextileEncoder<qrgb444>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_15
- case 15:
- encoder = new QRfbHextileEncoder<qrgb555>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_16
case 16:
encoder = new QRfbHextileEncoder<quint16>(this);
break;
-#endif
-#ifdef QT_QWS_DEPTH_18
- case 18:
- encoder = new QRfbHextileEncoder<qrgb666>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_24
- case 24:
- encoder = new QRfbHextileEncoder<qrgb888>(this);
- break;
-#endif
-#ifdef QT_QWS_DEPTH_32
case 32:
encoder = new QRfbHextileEncoder<quint32>(this);
break;
-#endif
default:
break;
}
QT_VNC_DEBUG("QVncServer::setEncodings: using hextile");
+#endif
break;
case ZRLE:
supportZRLE = true;
@@ -1129,22 +1084,10 @@ bool QVncServer::pixelConversionNeeded() const
case 32:
case 24:
return false;
- case 18:
- return (pixelFormat.redBits == 6
- && pixelFormat.greenBits == 6
- && pixelFormat.blueBits == 6);
case 16:
return (pixelFormat.redBits == 5
&& pixelFormat.greenBits == 6
&& pixelFormat.blueBits == 5);
- case 15:
- return (pixelFormat.redBits == 5
- && pixelFormat.greenBits == 5
- && pixelFormat.blueBits == 5);
- case 12:
- return (pixelFormat.redBits == 4
- && pixelFormat.greenBits == 4
- && pixelFormat.blueBits == 4);
}
return true;
}
@@ -1210,25 +1153,10 @@ void QVncServer::convertPixels(char *dst, const char *src, int count) const
const int bytesPerPixel = (pixelFormat.bitsPerPixel + 7) / 8;
-// nibble = 0;
-
for (int i = 0; i < count; ++i) {
int r, g, b;
switch (screendepth) {
-#if 0
- case 4: {
- if (!nibble) {
- r = ((*src) & 0x0f) << 4;
- } else {
- r = (*src) & 0xf0;
- src++;
- }
- nibble = !nibble;
- g = b = r;
- break;
- }
-#endif
case 8: {
QRgb rgb = qvnc_screen->image()->colorTable()[int(*src)];
r = qRed(rgb);
@@ -1237,26 +1165,6 @@ void QVncServer::convertPixels(char *dst, const char *src, int count) const
src++;
break;
}
-#ifdef QT_QWS_DEPTH_12
- case 12: {
- quint32 p = quint32(*reinterpret_cast<const qrgb444*>(src));
- r = qRed(p);
- g = qGreen(p);
- b = qBlue(p);
- src += sizeof(qrgb444);
- break;
- }
-#endif
-#ifdef QT_QWS_DEPTH_15
- case 15: {
- quint32 p = quint32(*reinterpret_cast<const qrgb555*>(src));
- r = qRed(p);
- g = qGreen(p);
- b = qBlue(p);
- src += sizeof(qrgb555);
- break;
- }
-#endif
case 16: {
quint16 p = *reinterpret_cast<const quint16*>(src);
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
@@ -1272,26 +1180,6 @@ void QVncServer::convertPixels(char *dst, const char *src, int count) const
src += sizeof(quint16);
break;
}
-#ifdef QT_QWS_DEPTH_18
- case 18: {
- quint32 p = quint32(*reinterpret_cast<const qrgb666*>(src));
- r = qRed(p);
- g = qGreen(p);
- b = qBlue(p);
- src += sizeof(qrgb666);
- break;
- }
-#endif
-#ifdef QT_QWS_DEPTH_24
- case 24: {
- quint32 p = quint32(*reinterpret_cast<const qrgb888*>(src));
- r = qRed(p);
- g = qGreen(p);
- b = qBlue(p);
- src += sizeof(qrgb888);
- break;
- }
-#endif
case 32: {
quint32 p = *reinterpret_cast<const quint32*>(src);
r = (p >> 16) & 0xff;
@@ -1321,7 +1209,7 @@ void QVncServer::convertPixels(char *dst, const char *src, int count) const
(b << pixelFormat.blueShift);
if (sameEndian || pixelFormat.bitsPerPixel == 8) {
- memcpy(dst, &pixel, bytesPerPixel); // XXX: do a simple for-loop instead?
+ memcpy(dst, &pixel, bytesPerPixel);
dst += bytesPerPixel;
continue;
}
@@ -1385,6 +1273,7 @@ void QVncServer::checkUpdate()
encoder->write();
wantUpdate = false;
}
+ // ### re-enable map support
// if (dirtyMap()->numDirty > 0) {
// if (encoder)
// encoder->write();
@@ -1402,9 +1291,8 @@ void QVncServer::discardClient()
delete qvnc_cursor;
qvnc_cursor = 0;
#endif
- // ###
-// if (!qvnc_screen->screen() && !qvnc_screen->noDisablePainting && QWSServer::instance())
-// QWSServer::instance()->enablePainting(false);
+
+ qvnc_screen->setPowerState(QPlatformScreen::PowerStateOff);
}
inline QImage QVncServer::screenImage() const
diff --git a/src/plugins/platforms/vnc/qvnc_p.h b/src/plugins/platforms/vnc/qvnc_p.h
index 01884523d4..f9364656b7 100644
--- a/src/plugins/platforms/vnc/qvnc_p.h
+++ b/src/plugins/platforms/vnc/qvnc_p.h
@@ -60,9 +60,8 @@ class QVncScreen;
class QVncServer;
class QVncClientCursor;
+// This fits with the VNC hextile messages
#define MAP_TILE_SIZE 16
-#define MAP_WIDTH 1280 / MAP_TILE_SIZE
-#define MAP_HEIGHT 1024 / MAP_TILE_SIZE
class QVncDirtyMap
{
diff --git a/src/plugins/platforms/vnc/qvncscreen.cpp b/src/plugins/platforms/vnc/qvncscreen.cpp
index b8bf08259a..29b5dda77d 100644
--- a/src/plugins/platforms/vnc/qvncscreen.cpp
+++ b/src/plugins/platforms/vnc/qvncscreen.cpp
@@ -70,41 +70,15 @@ bool QVncScreen::initialize()
mCursor = new QFbCursor(this);
switch (depth()) {
-#if 1//def QT_QWS_DEPTH_32
case 32:
dirty = new QVncDirtyMapOptimized<quint32>(this);
break;
-#endif
-//#if 1//def QT_QWS_DEPTH_24
-// case 24:
-// dirty = new QVncDirtyMapOptimized<qrgb888>(this);
-// break;
-//#endif
-//#if 1//def QT_QWS_DEPTH_24
-// case 18:
-// dirty = new QVncDirtyMapOptimized<qrgb666>(this);
-// break;
-//#endif
-#if 1//def QT_QWS_DEPTH_24
case 16:
dirty = new QVncDirtyMapOptimized<quint16>(this);
break;
-#endif
-//#if 1//def QT_QWS_DEPTH_24
-// case 15:
-// dirty = new QVncDirtyMapOptimized<qrgb555>(this);
-// break;
-//#endif
-//#if 1//def QT_QWS_DEPTH_24
-// case 12:
-// dirty = new QVncDirtyMapOptimized<qrgb444>(this);
-// break;
-//#endif
-#if 1//def QT_QWS_DEPTH_24
case 8:
dirty = new QVncDirtyMapOptimized<quint8>(this);
break;
-#endif
default:
qWarning("QVNCScreen::initDevice: No support for screen depth %d",
depth());
@@ -112,17 +86,7 @@ bool QVncScreen::initialize()
return false;
}
-
-// const bool ok = QProxyScreen::initDevice();
-//#ifndef QT_NO_QWS_CURSOR
-// qt_screencursor = new QVNCCursor(this);
-//#endif
-// if (QProxyScreen::screen())
-// return ok;
-
-// // Disable painting if there is only 1 display and nothing is attached to the VNC server
-// if (!d_ptr->noDisablePainting)
-// QWSServer::instance()->enablePainting(false);
+ setPowerState(PowerStateOff);
return true;
}
@@ -136,10 +100,6 @@ QRegion QVncScreen::doRedraw()
return touched;
dirtyRegion += touched;
- QVector<QRect> rects = touched.rects();
- for (int i = 0; i < rects.size(); i++) {
- // ### send to client
- }
vncServer->setDirty();
return touched;
}