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/vncviewer/CConn.cxx b/vncviewer/CConn.cxx
index 4e74127..3d3d582 100644
--- a/vncviewer/CConn.cxx
+++ b/vncviewer/CConn.cxx
@@ -1,5 +1,6 @@
 /* Copyright (C) 2002-2005 RealVNC Ltd.  All Rights Reserved.
  * Copyright 2009-2011 Pierre Ossman <ossman@cendio.se> for Cendio AB
+ * 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
@@ -411,6 +412,14 @@
   desktop->setCursor(width, height, hotspot, data, mask);
 }
 
+rdr::U8* CConn::getRawPixelsRW(const rfb::Rect& r, int* stride) {
+  return desktop->getPixelsRW(r, stride);
+}
+void CConn::releaseRawPixels(const rfb::Rect& r) {
+  desktop->damageRect(r);
+}
+
+
 ////////////////////// Internal methods //////////////////////
 
 void CConn::resizeFramebuffer()
diff --git a/vncviewer/CConn.h b/vncviewer/CConn.h
index 3cde6d5..d6177fc 100644
--- a/vncviewer/CConn.h
+++ b/vncviewer/CConn.h
@@ -67,6 +67,11 @@
   void imageRect(const rfb::Rect& r, void* p);
   void copyRect(const rfb::Rect& r, int sx, int sy);
 
+  rdr::U8* getRawPixelsRW(const rfb::Rect& r, int* stride);
+  void releaseRawPixels(const rfb::Rect& r);
+
+  const rfb::PixelFormat &getPreferredPF() { return fullColourPF; }
+
   void setCursor(int width, int height, const rfb::Point& hotspot,
                  void* data, void* mask);
 
diff --git a/vncviewer/DesktopWindow.h b/vncviewer/DesktopWindow.h
index a190b70..fbb5f95 100644
--- a/vncviewer/DesktopWindow.h
+++ b/vncviewer/DesktopWindow.h
@@ -61,6 +61,13 @@
     viewport->copyRect(r, srcX, srcY);
   }
 
+  rdr::U8* getPixelsRW(const rfb::Rect& r, int* stride) {
+    return viewport->getPixelsRW(r, stride);
+  }
+  void damageRect(const rfb::Rect& r) {
+    viewport->damageRect(r);
+  }
+
   void resizeFramebuffer(int new_w, int new_h);
 
   void setCursor(int width, int height, const rfb::Point& hotspot,
diff --git a/vncviewer/Viewport.h b/vncviewer/Viewport.h
index 144ad42..c66c19a 100644
--- a/vncviewer/Viewport.h
+++ b/vncviewer/Viewport.h
@@ -97,6 +97,16 @@
     damageRect(r);
   }
 
+  rdr::U8* getPixelsRW(const rfb::Rect& r, int* stride) {
+    return frameBuffer->getPixelsRW(r, stride);
+  }
+
+  void damageRect(const rfb::Rect& r) {
+    damage.assign_union(rfb::Region(r));
+    if (!Fl::has_timeout(handleUpdateTimeout, this))
+      Fl::add_timeout(0.500, handleUpdateTimeout, this);
+  };
+
   void setCursor(int width, int height, const rfb::Point& hotspot,
                  void* data, void* mask);
 
@@ -110,12 +120,6 @@
 
 private:
 
-  void damageRect(const rfb::Rect& r) {
-    damage.assign_union(rfb::Region(r));
-    if (!Fl::has_timeout(handleUpdateTimeout, this))
-      Fl::add_timeout(0.500, handleUpdateTimeout, this);
-  };
-
   static void handleUpdateTimeout(void *data);
 
   void commitColourMap();