Fix VNC format conversion
Pass the right from depth to the conversion function, and set the right format before creating the compositor image for RGB16 support. Fixes: QTBUG-85621 Change-Id: I76f46a3c2d8f1d2b040b790035dbdb0a960ff1a7 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io> (cherry picked from commit 47c6b5b91e0d1271075d98ded5aa7a25296b5ee3) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
e15d63baa3
commit
3b1cb25eb0
@ -514,8 +514,9 @@ void QRfbRawEncoder::write()
|
|||||||
// convert pixels
|
// convert pixels
|
||||||
char *b = buffer.data();
|
char *b = buffer.data();
|
||||||
const int bstep = rect.w * bytesPerPixel;
|
const int bstep = rect.w * bytesPerPixel;
|
||||||
|
const int depth = screenImage.depth();
|
||||||
for (int i = 0; i < rect.h; ++i) {
|
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;
|
screendata += linestep;
|
||||||
b += bstep;
|
b += bstep;
|
||||||
}
|
}
|
||||||
@ -568,9 +569,10 @@ void QVncClientCursor::write(QVncClient *client) const
|
|||||||
Q_ASSERT(cursor.hasAlphaChannel());
|
Q_ASSERT(cursor.hasAlphaChannel());
|
||||||
const QImage img = cursor.convertToFormat(client->server()->screen()->format());
|
const QImage img = cursor.convertToFormat(client->server()->screen()->format());
|
||||||
const int n = client->clientBytesPerPixel() * img.width();
|
const int n = client->clientBytesPerPixel() * img.width();
|
||||||
|
const int depth = img.depth();
|
||||||
char *buffer = new char[n];
|
char *buffer = new char[n];
|
||||||
for (int i = 0; i < img.height(); ++i) {
|
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);
|
socket->write(buffer, n);
|
||||||
}
|
}
|
||||||
delete[] buffer;
|
delete[] buffer;
|
||||||
|
@ -97,10 +97,8 @@ void QVncClient::setDirty(const QRegion ®ion)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QVncClient::convertPixels(char *dst, const char *src, int count) const
|
void QVncClient::convertPixels(char *dst, const char *src, int count, int screendepth) const
|
||||||
{
|
{
|
||||||
const int screendepth = m_server->screen()->depth();
|
|
||||||
|
|
||||||
// cutoffs
|
// cutoffs
|
||||||
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
#if Q_BYTE_ORDER == Q_BIG_ENDIAN
|
||||||
if (!m_swapBytes)
|
if (!m_swapBytes)
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
return m_pixelFormat.bitsPerPixel / 8;
|
return m_pixelFormat.bitsPerPixel / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
void convertPixels(char *dst, const char *src, int count) const;
|
void convertPixels(char *dst, const char *src, int count, int depth) const;
|
||||||
inline bool doPixelConversion() const { return m_needConversion; }
|
inline bool doPixelConversion() const { return m_needConversion; }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -86,14 +86,13 @@ bool QVncScreen::initialize()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QFbScreen::initializeCompositor();
|
|
||||||
|
|
||||||
switch (depth()) {
|
switch (depth()) {
|
||||||
case 32:
|
case 32:
|
||||||
dirty = new QVncDirtyMapOptimized<quint32>(this);
|
dirty = new QVncDirtyMapOptimized<quint32>(this);
|
||||||
break;
|
break;
|
||||||
case 16:
|
case 16:
|
||||||
dirty = new QVncDirtyMapOptimized<quint16>(this);
|
dirty = new QVncDirtyMapOptimized<quint16>(this);
|
||||||
|
mFormat = QImage::Format_RGB16;
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
dirty = new QVncDirtyMapOptimized<quint8>(this);
|
dirty = new QVncDirtyMapOptimized<quint8>(this);
|
||||||
@ -105,6 +104,8 @@ bool QVncScreen::initialize()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QFbScreen::initializeCompositor();
|
||||||
|
|
||||||
setPowerState(PowerStateOff);
|
setPowerState(PowerStateOff);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user