summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/vnc/qvnc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/vnc/qvnc.cpp')
-rw-r--r--src/plugins/platforms/vnc/qvnc.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/platforms/vnc/qvnc.cpp b/src/plugins/platforms/vnc/qvnc.cpp
index 28c45af714..5ae548bed7 100644
--- a/src/plugins/platforms/vnc/qvnc.cpp
+++ b/src/plugins/platforms/vnc/qvnc.cpp
@@ -477,6 +477,9 @@ void QRfbRawEncoder::write()
// server->screen()->geometry().height());
// }
+ const QImage screenImage = client->server()->screenImage();
+ rgn &= screenImage.rect();
+
const auto rectsInRegion = rgn.rectCount();
{
@@ -492,8 +495,6 @@ void QRfbRawEncoder::write()
if (rectsInRegion <= 0)
return;
- const QImage screenImage = client->server()->screenImage();
-
for (const QRect &tileRect: rgn) {
const QRfbRect rect(tileRect.x(), tileRect.y(),
tileRect.width(), tileRect.height());
@@ -514,8 +515,9 @@ void QRfbRawEncoder::write()
// convert pixels
char *b = buffer.data();
const int bstep = rect.w * bytesPerPixel;
+ const int depth = screenImage.depth();
for (int i = 0; i < rect.h; ++i) {
- client->convertPixels(b, (const char*)screendata, rect.w);
+ client->convertPixels(b, (const char*)screendata, rect.w, depth);
screendata += linestep;
b += bstep;
}
@@ -568,9 +570,10 @@ void QVncClientCursor::write(QVncClient *client) const
Q_ASSERT(cursor.hasAlphaChannel());
const QImage img = cursor.convertToFormat(client->server()->screen()->format());
const int n = client->clientBytesPerPixel() * img.width();
+ const int depth = img.depth();
char *buffer = new char[n];
for (int i = 0; i < img.height(); ++i) {
- client->convertPixels(buffer, (const char*)img.scanLine(i), img.width());
+ client->convertPixels(buffer, (const char*)img.scanLine(i), img.width(), depth);
socket->write(buffer, n);
}
delete[] buffer;
@@ -668,11 +671,10 @@ void QVncServer::newConnection()
void QVncServer::discardClient(QVncClient *client)
{
clients.removeOne(client);
+ qvnc_screen->disableClientCursor(client);
client->deleteLater();
- if (clients.isEmpty()) {
- qvnc_screen->disableClientCursor(client);
+ if (clients.isEmpty())
qvnc_screen->setPowerState(QPlatformScreen::PowerStateOff);
- }
}
inline QImage QVncServer::screenImage() const
@@ -681,3 +683,5 @@ inline QImage QVncServer::screenImage() const
}
QT_END_NAMESPACE
+
+#include "moc_qvnc_p.cpp"