From 3d82bfc698165bb20f3c38d42f2b77ab855c1edf Mon Sep 17 00:00:00 2001 From: Christian Klinger Date: Thu, 29 Sep 2016 15:40:18 +0200 Subject: astyle. --- src/client/vnc/vncthread.cpp | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) (limited to 'src/client/vnc/vncthread.cpp') diff --git a/src/client/vnc/vncthread.cpp b/src/client/vnc/vncthread.cpp index dfa35af..b710a2c 100644 --- a/src/client/vnc/vncthread.cpp +++ b/src/client/vnc/vncthread.cpp @@ -62,8 +62,7 @@ VncThread::~VncThread() Q_ASSERT(_run == false); if (_frameBuffer) delete[] _frameBuffer; - if (_client != NULL) - { + if (_client != NULL) { if (_client->sock != -1) ::close(_client->sock); _client->sock = -1; @@ -134,7 +133,7 @@ void VncThread::run() { qDebug("[%s] VNC client started.", metaObject()->className()); qDebug("[%s] Host: '%s' Port: %i Passwd: '%s' Quality: %i", metaObject()->className(), qPrintable(_host), _port, - qPrintable(_passwd), _quality); + qPrintable(_passwd), _quality); // setup network for (int retry = 0; retry < 5 && _run; ++retry) { @@ -156,8 +155,7 @@ void VncThread::run() rfbClientSetClientData(_client, 0, this); // start client - if (rfbInitClient(_client, NULL, NULL)) - { + if (rfbInitClient(_client, NULL, NULL)) { break; // Success! } // Connection failed @@ -167,8 +165,7 @@ void VncThread::run() // error, let's try again this->msleep(10 + qrand() % 50); } - if(_client != NULL) - { + if (_client != NULL) { qDebug("[%s] Connection successful!", metaObject()->className()); int one = 1; setsockopt(_client->sock, SOL_TCP, TCP_NODELAY, &one, sizeof(one)); @@ -180,16 +177,14 @@ void VncThread::run() _connected = true; emit projectionStarted(); } - while (_run) - { + while (_run) { const int i = WaitForMessage(_client, 100 * 1000); // wait 100ms for message. returns -1 on error/disconnect, 0 if nothing happened, 1 if new data arrived if (i < 0) break; if (i > 0 && !HandleRFBServerMessage(_client)) break; - if (_hasNewLocalSize) - { + if (_hasNewLocalSize) { QMutexLocker lock(&_mutex); _hasNewLocalSize = false; _localSize = _newLocalSize; @@ -235,8 +230,7 @@ const QString VncThread::getDesktopName() const */ void VncThread::processImageUpdate(const int x, const int y, const int w, const int h) { - if (_srcStepX > 1 || _srcStepY > 1) - { + if (_srcStepX > 1 || _srcStepY > 1) { // Scaling is required as vnc server and client are using different resolutions // Calc section offsets first const int startX = x / _srcStepX; @@ -256,17 +250,14 @@ void VncThread::processImageUpdate(const int x, const int y, const int w, const // Rescale { QMutexLocker lock(&_mutex); - if (_painter != NULL) - { + if (_painter != NULL) { QImage scaled( - _img.copy(srcX, srcY, srcW, srcH).scaled(dstW, dstH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); + _img.copy(srcX, srcY, srcW, srcH).scaled(dstW, dstH, Qt::IgnoreAspectRatio, Qt::SmoothTransformation)); _painter->drawImage(dstX, dstY, scaled, 0, 0, dstW, dstH); } } emit imageUpdated(dstX, dstY, dstW, dstH); - } - else - { + } else { // Same resolution, nothing to do emit imageUpdated(x, y, w, h); } @@ -318,8 +309,7 @@ rfbBool VncThread::frameBufferHandler(rfbClient *client) client->format.blueMax = 0xff; const int quality = t->_quality; - switch (quality) - { + switch (quality) { case VncThread::HIGH: client->appData.useBGR233 = 0; client->appData.encodingsString = "copyrect zlib hextile raw"; -- cgit v1.2.3-55-g7522