From: Pierre Ossman Date: Thu, 12 Mar 2009 10:16:07 +0000 (+0000) Subject: Make sure we list fallback encodings in a preferable order. X-Git-Tag: v0.0.90~128 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=090e7d6fb3846ba68f0af46a453d7143d349de0a;p=tigervnc.git 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 --- 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;