]> source.dussan.org Git - tigervnc.git/commitdiff
Remove magic JPEG variables from ConnParams
authorPierre Ossman <ossman@cendio.se>
Mon, 17 Mar 2014 13:42:10 +0000 (14:42 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 7 Jul 2014 11:27:09 +0000 (13:27 +0200)
Custom compression level and JPEG on/off are not inherent parts of
the protocol negotiation so they do not belong in ConnParams. Let the
UI frontend handle such things instead.

common/rfb/CMsgWriter.cxx
common/rfb/ConnParams.cxx
common/rfb/ConnParams.h
vncviewer/CConn.cxx

index 0ebd33e7b375e412d057eaa36a5502b2fb3a521f..9ee7a02f1dc3f47694422bc27e3f72da391da1fd 100644 (file)
@@ -114,9 +114,9 @@ void CMsgWriter::writeSetEncodings(int preferredEncoding, bool useCopyRect)
     }
   }
 
-  if (cp->customCompressLevel && cp->compressLevel >= 0 && cp->compressLevel <= 9)
+  if (cp->compressLevel >= 0 && cp->compressLevel <= 9)
       encodings[nEncodings++] = pseudoEncodingCompressLevel0 + cp->compressLevel;
-  if (!cp->noJpeg && cp->qualityLevel >= 0 && cp->qualityLevel <= 9)
+  if (cp->qualityLevel >= 0 && cp->qualityLevel <= 9)
       encodings[nEncodings++] = pseudoEncodingQualityLevel0 + cp->qualityLevel;
 
   writeSetEncodings(nEncodings, encodings);
index be9d48c07d0083975dc9546fd7e2562499cc8830..6fd6668ead16d50029d789b3962b064f8504d31a 100644 (file)
@@ -36,8 +36,7 @@ ConnParams::ConnParams()
     supportsDesktopRename(false), supportsLastRect(false),
     supportsSetDesktopSize(false), supportsFence(false),
     supportsContinuousUpdates(false),
-    customCompressLevel(false), compressLevel(2),
-    noJpeg(false), qualityLevel(-1), fineQualityLevel(-1),
+    compressLevel(2), qualityLevel(-1), fineQualityLevel(-1),
     subsampling(subsampleUndefined), name_(0),
     currentEncoding_(encodingRaw), verStrPos(0)
 {
@@ -95,9 +94,7 @@ void ConnParams::setEncodings(int nEncodings, const rdr::S32* encodings)
   supportsExtendedDesktopSize = false;
   supportsLocalXCursor = false;
   supportsLastRect = false;
-  customCompressLevel = false;
   compressLevel = -1;
-  noJpeg = true;
   qualityLevel = -1;
   fineQualityLevel = -1;
   subsampling = subsampleUndefined;
@@ -167,10 +164,4 @@ void ConnParams::setEncodings(int nEncodings, const rdr::S32* encodings)
     if (Encoder::supported(encodings[i]))
       currentEncoding_ = encodings[i];
   }
-
-  if (compressLevel != -1)
-    customCompressLevel = true;
-  if ((qualityLevel != -1) || (fineQualityLevel != -1) ||
-      (subsampling != subsampleUndefined))
-    noJpeg = false;
 }
index 68e20754c4279bd6500c21314b92b71f5d964743..43267ffdfb18022b6194dc93cb0997fe28d37083 100644 (file)
@@ -91,9 +91,7 @@ namespace rfb {
     bool supportsFence;
     bool supportsContinuousUpdates;
 
-    bool customCompressLevel;
     int compressLevel;
-    bool noJpeg;
     int qualityLevel;
     int fineQualityLevel;
     int subsampling;
index c5cd4a45467f4daf73ffac68d96fd17d75199016..789cf09e037c0105b76115885a9a8d582c43d0c5 100644 (file)
@@ -89,11 +89,15 @@ CConn::CConn(const char* vncServerName, network::Socket* socket=NULL)
   cp.supportsExtendedDesktopSize = true;
   cp.supportsDesktopRename = true;
 
-  cp.customCompressLevel = customCompressLevel;
-  cp.compressLevel = compressLevel;
+  if (customCompressLevel)
+    cp.compressLevel = compressLevel;
+  else
+    cp.compressLevel = -1;
 
-  cp.noJpeg = noJpeg;
-  cp.qualityLevel = qualityLevel;
+  if (!noJpeg)
+    cp.qualityLevel = qualityLevel;
+  else
+    cp.qualityLevel = -1;
 
   if(sock == NULL) {
     try {
@@ -619,16 +623,19 @@ void CConn::handleOptions(void *data)
 
     if (encNum != -1)
       self->currentEncoding = encNum;
-
-    self->cp.qualityLevel = qualityLevel;
   }
 
   self->cp.supportsLocalCursor = true;
 
-  self->cp.customCompressLevel = customCompressLevel;
-  self->cp.compressLevel = compressLevel;
+  if (customCompressLevel)
+    self->cp.compressLevel = compressLevel;
+  else
+    self->cp.compressLevel = -1;
 
-  self->cp.noJpeg = noJpeg;
+  if (!noJpeg && !autoSelect)
+    self->cp.qualityLevel = qualityLevel;
+  else
+    self->cp.qualityLevel = -1;
 
   self->encodingChange = true;