]> source.dussan.org Git - tigervnc.git/commitdiff
Use compressionLevel in ZRLEEncoder 1645/head
authorAdam Halim <adaab301@student.liu.se>
Mon, 10 Jul 2023 09:15:33 +0000 (11:15 +0200)
committer= <adaab301@student.liu.se>
Mon, 20 Nov 2023 12:02:01 +0000 (13:02 +0100)
This change makes the ZRLEEncoder respect a client's desired
compressionLevel. The ZlibLevel option is marked deprecated and removed
from the manpages.

common/rfb/ZRLEEncoder.cxx
common/rfb/ZRLEEncoder.h
unix/x0vncserver/x0vncserver.man
unix/xserver/hw/vnc/Xvnc.man

index 4e25d49f29b71c8b3aee61e6d965c03244a0ed8a..ad3aec1a8e6c53068c3af676ce449700d3003d6c 100644 (file)
 #include <rfb/SConnection.h>
 #include <rfb/ZRLEEncoder.h>
 #include <rfb/Configuration.h>
+#include <rfb/LogWriter.h>
 
 using namespace rfb;
 
-IntParameter zlibLevel("ZlibLevel","Zlib compression level",-1);
+static LogWriter vlog("ZRLEEncoder");
+
+IntParameter zlibLevel("ZlibLevel","[DEPRECATED] Zlib compression level",-1);
 
 ZRLEEncoder::ZRLEEncoder(SConnection* conn)
   : Encoder(conn, encodingZRLE, EncoderPlain, 127),
-  zos(0,zlibLevel), mos(129*1024)
+  zos(0, 2), mos(129*1024)
 {
+  if (zlibLevel != -1) {
+    vlog.info("Warning: The ZlibLevel option is deprecated and is "
+              "ignored by the server. The compression level can be set "
+              "by the client instead.");
+  }
   zos.setUnderlying(&mos);
 }
 
@@ -50,6 +58,11 @@ bool ZRLEEncoder::isSupported()
   return conn->client.supportsEncoding(encodingZRLE);
 }
 
+void ZRLEEncoder::setCompressLevel(int level)
+{
+  zos.setCompressionLevel(level);
+}
+
 void ZRLEEncoder::writeRect(const PixelBuffer* pb, const Palette& palette)
 {
   int x, y;
index 4cfff75db1d8121f485d6813ba06c13a11c47278..fa89f10f35854961fa56e3891564b0dcca72f369 100644 (file)
@@ -32,6 +32,8 @@ namespace rfb {
 
     virtual bool isSupported();
 
+    virtual void setCompressLevel(int level);
+
     virtual void writeRect(const PixelBuffer* pb, const Palette& palette);
     virtual void writeSolidRect(int width, int height,
                                 const PixelFormat& pf,
index c36ae34e2f4b45573ba8d9c18cdb46f4e57c29de..fda435bcad0fc88a96cb09cbe70b8e2fb6893ab5 100644 (file)
@@ -287,12 +287,6 @@ Use MIT-SHM extension if available.  Using that extension accelerates reading
 the screen.  Default is on.
 .
 .TP
-.B \-ZlibLevel \fIlevel\fP
-Zlib compression level for ZRLE encoding (it does not affect Tight encoding).
-Acceptable values are between 0 and 9.  Default is to use the standard
-compression level provided by the \fBzlib\fP(3) compression library.
-.
-.TP
 .B \-ImprovedHextile
 Use improved compression algorithm for Hextile encoding which achieves better
 compression ratios by the cost of using slightly more CPU time.  Default is
index ea87deaf119d91c0ff14790f871b08e5ef42ea57..4f26b07dd2d4e9877e641f8a36ad24b47068e7d1 100644 (file)
@@ -171,12 +171,6 @@ be either \fB0\fP (off), \fB1\fP (always) or \fB2\fP (auto). Default is
 \fB2\fP.
 .
 .TP
-.B \-ZlibLevel \fIlevel\fP
-Zlib compression level for ZRLE encoding (it does not affect Tight encoding).
-Acceptable values are between 0 and 9.  Default is to use the standard
-compression level provided by the \fBzlib\fP(3) compression library.
-.
-.TP
 .B \-ImprovedHextile
 Use improved compression algorithm for Hextile encoding which achieves better
 compression ratios by the cost of using slightly more CPU time.  Default is