If the client and server are using identical pixel formats, then perform Tight decoding directly into the viewer's back buffer, rather than going through the slow fillRect/imageRect routines.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4757 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/common/rfb/TightDecoder.h b/common/rfb/TightDecoder.h
index 1047b37..9a28fb9 100644
--- a/common/rfb/TightDecoder.h
+++ b/common/rfb/TightDecoder.h
@@ -1,4 +1,5 @@
 /* Copyright (C) 2000-2003 Constantin Kaplinsky.  All Rights Reserved.
+ * Copyright (C) 2011 D. R. Commander.  All Rights Reserved.
  *    
  * This is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -20,18 +21,49 @@
 
 #include <rdr/ZlibInStream.h>
 #include <rfb/Decoder.h>
+#include <rfb/JpegDecompressor.h>
 
 namespace rfb {
 
   class TightDecoder : public Decoder {
+
   public:
     static Decoder* create(CMsgReader* reader);
     virtual void readRect(const Rect& r, CMsgHandler* handler);
     virtual ~TightDecoder();
+
   private:
+    void tightDecode8(const Rect& r);
+    void tightDecode16(const Rect& r);
+    void tightDecode32(const Rect& r);
+
+    void DecompressJpegRect8(const Rect& r);
+    void DecompressJpegRect16(const Rect& r);
+    void DecompressJpegRect32(const Rect& r);
+
+    void FilterGradient8(rdr::InStream* is, rdr::U8* buf, int stride, 
+                         const Rect& r, int dataSize);
+    void FilterGradient16(rdr::InStream* is, rdr::U16* buf, int stride, 
+                          const Rect& r, int dataSize);
+    void FilterGradient24(rdr::InStream* is, rdr::U32* buf, int stride, 
+                          const Rect& r, int dataSize);
+    void FilterGradient32(rdr::InStream* is, rdr::U32* buf, int stride, 
+                          const Rect& r, int dataSize);
+
+    void directFillRect8(const Rect& r, Pixel pix);
+    void directFillRect16(const Rect& r, Pixel pix);
+    void directFillRect32(const Rect& r, Pixel pix);
+
     TightDecoder(CMsgReader* reader);
+
     CMsgReader* reader;
+    CMsgHandler* handler;
+    rdr::InStream* is;
     rdr::ZlibInStream zis[4];
+    JpegDecompressor jd;
+    PixelFormat clientpf;
+    PixelFormat serverpf;
+    bool directDecode;
   };
 
   // Compression control