]> source.dussan.org Git - tigervnc.git/commitdiff
Avoid reader/writer duplication in every encoder/decoder
authorPierre Ossman <ossman@cendio.se>
Wed, 29 Jan 2014 15:42:48 +0000 (16:42 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 7 Jul 2014 12:42:08 +0000 (14:42 +0200)
24 files changed:
common/rfb/Decoder.cxx
common/rfb/Decoder.h
common/rfb/Encoder.cxx
common/rfb/Encoder.h
common/rfb/HextileDecoder.cxx
common/rfb/HextileDecoder.h
common/rfb/HextileEncoder.cxx
common/rfb/HextileEncoder.h
common/rfb/RREDecoder.cxx
common/rfb/RREDecoder.h
common/rfb/RREEncoder.cxx
common/rfb/RREEncoder.h
common/rfb/RawDecoder.cxx
common/rfb/RawDecoder.h
common/rfb/RawEncoder.cxx
common/rfb/RawEncoder.h
common/rfb/TightDecoder.cxx
common/rfb/TightDecoder.h
common/rfb/TightEncoder.cxx
common/rfb/TightEncoder.h
common/rfb/ZRLEDecoder.cxx
common/rfb/ZRLEDecoder.h
common/rfb/ZRLEEncoder.cxx
common/rfb/ZRLEEncoder.h

index e201821fcf456753a0207a5f71793034eaf996bf..9982c93205a966a2f2a3df373bf8478d25e9d72b 100644 (file)
 
 using namespace rfb;
 
+Decoder::Decoder(CMsgReader* reader_) : reader(reader_)
+{
+}
+
 Decoder::~Decoder()
 {
 }
index 025d63f56a8dd292f30d83a04d69482d43874057..842491fb2b6bfdc9632681ea9d0894424c8f9f71 100644 (file)
@@ -27,11 +27,14 @@ namespace rfb {
 
   class Decoder {
   public:
+    Decoder(CMsgReader* reader);
     virtual ~Decoder();
     virtual void readRect(const Rect& r, CMsgHandler* handler)=0;
 
     static bool supported(int encoding);
     static Decoder* createDecoder(int encoding, CMsgReader* reader);
+  protected:
+    CMsgReader* reader;
   };
 }
 
index 1733c8ec8172ffbb44de008ddf711f93854f04fc..6b2321c45003855291e8ef71fd7997761985f519 100644 (file)
 #include <rfb/HextileEncoder.h>
 #include <rfb/ZRLEEncoder.h>
 #include <rfb/TightEncoder.h>
+#include <rfb/SMsgWriter.h>
 
 using namespace rfb;
 
+Encoder::Encoder(SMsgWriter* writer_) : writer(writer_)
+{
+}
+
 Encoder::~Encoder()
 {
 }
index 8712c09ade2a2122a500de2c195e7c5d121ef768..485b850c502316895d2f6af92c261909a6c6c526 100644 (file)
@@ -29,6 +29,7 @@ namespace rfb {
 
   class Encoder {
   public:
+    Encoder(SMsgWriter* writer);
     virtual ~Encoder();
 
     virtual void setCompressLevel(int level) {};
@@ -43,6 +44,9 @@ namespace rfb {
 
     static bool supported(int encoding);
     static Encoder* createEncoder(int encoding, SMsgWriter* writer);
+
+  protected:
+    SMsgWriter* writer;
   };
 }
 
index ae612676224cd867979cd5c6b786f85ed38ed9b9..04ef956bd6701f5a04cdb9d55d11f5e78aa25bf9 100644 (file)
@@ -34,7 +34,7 @@ using namespace rfb;
 #include <rfb/hextileDecode.h>
 #undef BPP
 
-HextileDecoder::HextileDecoder(CMsgReader* reader_) : reader(reader_)
+HextileDecoder::HextileDecoder(CMsgReader* reader) : Decoder(reader)
 {
 }
 
index 95a7f8a4a205f8d08cfddabeb01b28fec638cf9a..287b49d57b151eba1314f81d04aee4c0f0901b37 100644 (file)
@@ -27,8 +27,6 @@ namespace rfb {
     HextileDecoder(CMsgReader* reader);
     virtual ~HextileDecoder();
     virtual void readRect(const Rect& r, CMsgHandler* handler);
-  private:
-    CMsgReader* reader;
   };
 }
 #endif
index 19fb1a3effb6fa5f79e3a38a9b16272683788120..c31e608c363444aa356e339740468f4a5371a556 100644 (file)
@@ -45,7 +45,7 @@ BoolParameter improvedHextile("ImprovedHextile",
 #include <rfb/hextileEncodeBetter.h>
 #undef BPP
 
-HextileEncoder::HextileEncoder(SMsgWriter* writer_) : writer(writer_)
+HextileEncoder::HextileEncoder(SMsgWriter* writer_) : Encoder(writer_)
 {
 }
 
index 5540c642f7b3bb2687d9574523a5f2390b1afd97..705cbc6f4198c4501c5a63f0d1c4180f9057e903 100644 (file)
@@ -27,8 +27,6 @@ namespace rfb {
     HextileEncoder(SMsgWriter* writer);
     virtual ~HextileEncoder();
     virtual void writeRect(const Rect& r, TransImageGetter* ig);
-  private:
-    SMsgWriter* writer;
   };
 }
 #endif
index b81a4a8205c90a0c82cf381c4acc63556e059ce9..97d7a71d56867f8094314d8f38c313b57d7b21a2 100644 (file)
@@ -34,7 +34,7 @@ using namespace rfb;
 #include <rfb/rreDecode.h>
 #undef BPP
 
-RREDecoder::RREDecoder(CMsgReader* reader_) : reader(reader_)
+RREDecoder::RREDecoder(CMsgReader* reader) : Decoder(reader)
 {
 }
 
index 98abf98201ecfcd2040c1e437802fa37e9490f25..bee634fb160e4e733a125ac32e6f3d602b60ceb8 100644 (file)
@@ -27,8 +27,6 @@ namespace rfb {
     RREDecoder(CMsgReader* reader);
     virtual ~RREDecoder();
     virtual void readRect(const Rect& r, CMsgHandler* handler);
-  private:
-    CMsgReader* reader;
   };
 }
 #endif
index 09702cf7fe2c918c0f2654c9a922c9c3d972fd77..b37b7588d01cb815ade14cd6da1d84ed49a328b7 100644 (file)
@@ -33,7 +33,7 @@ using namespace rfb;
 #include <rfb/rreEncode.h>
 #undef BPP
 
-RREEncoder::RREEncoder(SMsgWriter* writer_) : writer(writer_)
+RREEncoder::RREEncoder(SMsgWriter* writer) : Encoder(writer)
 {
 }
 
index 4b990f5b7d6ee0c7643865708d0fff3fefc0e35b..c5e655695e83826740d90ca5ee0cf31ca212d581 100644 (file)
@@ -29,7 +29,6 @@ namespace rfb {
     virtual ~RREEncoder();
     virtual void writeRect(const Rect& r, TransImageGetter* ig);
   private:
-    SMsgWriter* writer;
     rdr::MemOutStream mos;
   };
 }
index 5fd3b7c1be2cd3cf448c545cd7f363ee2fc58801..eab92e534bcf029fd583bb82678a6d9372552b8f 100644 (file)
@@ -22,7 +22,7 @@
 
 using namespace rfb;
 
-RawDecoder::RawDecoder(CMsgReader* reader_) : reader(reader_)
+RawDecoder::RawDecoder(CMsgReader* reader) : Decoder(reader)
 {
 }
 
index e09cca2d4272edf676147c4bee15a0dcf72f25d0..9d0dc30038d3fedb85205b76f90eaf7b0e85298f 100644 (file)
@@ -27,8 +27,6 @@ namespace rfb {
     RawDecoder(CMsgReader* reader);
     virtual ~RawDecoder();
     virtual void readRect(const Rect& r, CMsgHandler* handler);
-  private:
-    CMsgReader* reader;
   };
 }
 #endif
index b4e38dbf07d1b405140a6b4811c5570a3421b044..2fc5741c08cf3fd4137dd14c91769293aeb93a4f 100644 (file)
@@ -23,7 +23,7 @@
 
 using namespace rfb;
 
-RawEncoder::RawEncoder(SMsgWriter* writer_) : writer(writer_)
+RawEncoder::RawEncoder(SMsgWriter* writer) : Encoder(writer)
 {
 }
 
index 628f32fdade043a0b4a20c90211d8b86ce9d3560..42d38508071363ed4ac588093a9f7cb36b9934cb 100644 (file)
@@ -27,8 +27,6 @@ namespace rfb {
     RawEncoder(SMsgWriter* writer);
     virtual ~RawEncoder();
     virtual void writeRect(const Rect& r, TransImageGetter* ig);
-  private:
-    SMsgWriter* writer;
   };
 }
 #endif
index d4ee877f5fdeb6bd41842e6f783d07b6dba0fd6d..83e84f7031ee33fec76ee32541e2676bc3312aa4 100644 (file)
@@ -37,7 +37,7 @@ using namespace rfb;
 #include <rfb/tightDecode.h>
 #undef BPP
 
-TightDecoder::TightDecoder(CMsgReader* reader_) : reader(reader_)
+TightDecoder::TightDecoder(CMsgReader* reader) : Decoder(reader)
 {
 }
 
index 8200d2b8d6ff7fbe36d3c56e8dab7c14f6d47bd0..0b915f925426592f0bffb0c9d1a350d0efc73c64 100644 (file)
@@ -54,7 +54,6 @@ namespace rfb {
     void directFillRect16(const Rect& r, Pixel pix);
     void directFillRect32(const Rect& r, Pixel pix);
 
-    CMsgReader* reader;
     CMsgHandler* handler;
     rdr::InStream* is;
     rdr::ZlibInStream zis[4];
index f4633f88b93e30a4d4d159d59fdd184a357f4930..622dc3d40126fa9078d4611f9ab7aab25ecb94e7 100644 (file)
@@ -93,7 +93,7 @@ const int TightEncoder::defaultCompressLevel = 2;
 #include <rfb/tightEncode.h>
 #undef BPP
 
-TightEncoder::TightEncoder(SMsgWriter* writer_) : writer(writer_)
+TightEncoder::TightEncoder(SMsgWriter* writer) : Encoder(writer)
 {
   setCompressLevel(defaultCompressLevel);
   setQualityLevel(-1);
index a499783d08b61c458cd8dc859ecbcbcfe2ed94d2..e2fa96e81fbd4d5c5dc30028bc9026c81b433b90 100644 (file)
@@ -142,7 +142,6 @@ namespace rfb {
     void encodeJpegRect32(rdr::U32 *buf, int stride, const Rect& r,
                           rdr::OutStream *os);
 
-    SMsgWriter* writer;
     rdr::MemOutStream mos;
     rdr::ZlibOutStream zos[4];
     JpegCompressor jc;
index 111e2de6c111304c955efd4d74ea1516c7a6a430..20fe853c62b1d04af9c36a06dd2231e8ad17faf2 100644 (file)
@@ -40,7 +40,7 @@ using namespace rfb;
 #undef CPIXEL
 #undef BPP
 
-ZRLEDecoder::ZRLEDecoder(CMsgReader* reader_) : reader(reader_)
+ZRLEDecoder::ZRLEDecoder(CMsgReader* reader) : Decoder(reader)
 {
 }
 
index 2128ab91a2b26e6e72657b1e9cb79c86932fec85..dee20685d4f2bcbb26b4bb0120427e4a39819d51 100644 (file)
@@ -29,7 +29,6 @@ namespace rfb {
     virtual ~ZRLEDecoder();
     virtual void readRect(const Rect& r, CMsgHandler* handler);
   private:
-    CMsgReader* reader;
     rdr::ZlibInStream zis;
   };
 }
index 7e00fad28a64d52d504b79a41b29851ae3670323..df7cfbdb5c9f4f16c7e922c456e20dde967ea16d 100644 (file)
@@ -46,8 +46,8 @@ IntParameter zlibLevel("ZlibLevel","Zlib compression level",-1);
 #undef CPIXEL
 #undef BPP
 
-ZRLEEncoder::ZRLEEncoder(SMsgWriter* writer_)
-  : writer(writer_), zos(0,0,zlibLevel), mos(129*1024)
+ZRLEEncoder::ZRLEEncoder(SMsgWriter* writer)
+  : Encoder(writer), zos(0,0,zlibLevel), mos(129*1024)
 {
 }
 
index acc6d362def66769ef4ea4238d30fe4ece157d8d..9679887a2a5ea5ab7d6da7dd6c7a8e4a64340f93 100644 (file)
@@ -30,7 +30,6 @@ namespace rfb {
     virtual ~ZRLEEncoder();
     virtual void writeRect(const Rect& r, TransImageGetter* ig);
   private:
-    SMsgWriter* writer;
     rdr::ZlibOutStream zos;
     rdr::MemOutStream mos;
   };