summaryrefslogtreecommitdiffstats
path: root/common/rfb
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2009-03-12 10:16:07 +0000
committerPierre Ossman <ossman@cendio.se>2009-03-12 10:16:07 +0000
commit090e7d6fb3846ba68f0af46a453d7143d349de0a (patch)
tree7a32cbb7dd4b30d7d024a2b27ac02e6bf20f30c3 /common/rfb
parentc6a445f2ae95c96608705b40a7c15f95d56e1ebf (diff)
downloadtigervnc-090e7d6fb3846ba68f0af46a453d7143d349de0a.tar.gz
tigervnc-090e7d6fb3846ba68f0af46a453d7143d349de0a.zip
Make sure we list fallback encodings in a preferable order.
git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3661 3789f03b-4d11-0410-bbf8-ca57d06f2519
Diffstat (limited to 'common/rfb')
-rw-r--r--common/rfb/CMsgWriter.cxx31
1 files changed, 29 insertions, 2 deletions
diff --git a/common/rfb/CMsgWriter.cxx b/common/rfb/CMsgWriter.cxx
index 094ba368..82f7189d 100644
--- a/common/rfb/CMsgWriter.cxx
+++ b/common/rfb/CMsgWriter.cxx
@@ -72,11 +72,38 @@ void CMsgWriter::writeSetEncodings(int preferredEncoding, bool useCopyRect)
if (useCopyRect) {
encodings[nEncodings++] = encodingCopyRect;
}
+
+ /*
+ * Prefer encodings in this order:
+ *
+ * Tight, ZRLE, Hextile, *
+ */
+
+ if ((preferredEncoding != encodingTight) &&
+ Decoder::supported(encodingTight))
+ encodings[nEncodings++] = encodingTight;
+
+ if ((preferredEncoding != encodingZRLE) &&
+ Decoder::supported(encodingZRLE))
+ encodings[nEncodings++] = encodingZRLE;
+
+ if ((preferredEncoding != encodingHextile) &&
+ Decoder::supported(encodingHextile))
+ encodings[nEncodings++] = encodingHextile;
+
+ // Remaining encodings
for (int i = encodingMax; i >= 0; i--) {
- if (i != preferredEncoding && Decoder::supported(i)) {
- encodings[nEncodings++] = i;
+ switch (i) {
+ case encodingTight:
+ case encodingZRLE:
+ case encodingHextile:
+ break;
+ default:
+ if ((i != preferredEncoding) && Decoder::supported(i))
+ encodings[nEncodings++] = i;
}
}
+
encodings[nEncodings++] = pseudoEncodingLastRect;
if (cp->customCompressLevel && cp->compressLevel >= 0 && cp->compressLevel <= 9)
encodings[nEncodings++] = pseudoEncodingCompressLevel0 + cp->compressLevel;