]> source.dussan.org Git - tigervnc.git/commitdiff
Remove some premature optimisation
authorPierre Ossman <ossman@cendio.se>
Mon, 27 Jan 2014 15:52:35 +0000 (16:52 +0100)
committerPierre Ossman <ossman@cendio.se>
Mon, 7 Jul 2014 11:27:08 +0000 (13:27 +0200)
Reduces header dependencies.

vncviewer/CConn.cxx
vncviewer/CConn.h
vncviewer/DesktopWindow.cxx
vncviewer/DesktopWindow.h
vncviewer/Viewport.cxx
vncviewer/Viewport.h

index cf963f0f48a9853459813af1e70cea5ccd0c22df..c5cd4a45467f4daf73ffac68d96fd17d75199016 100644 (file)
@@ -44,6 +44,7 @@
 
 #include "CConn.h"
 #include "OptionsDialog.h"
+#include "DesktopWindow.h"
 #include "i18n.h"
 #include "parameters.h"
 #include "vncviewer.h"
index 33dcf4abb6630967425860aee92e6f56b231cc45..286a09eda04041a9f435e665cc5fdc829b29a206 100644 (file)
 #ifndef __CCONN_H__
 #define __CCONN_H__
 
+#include <FL/Fl.H>
+
 #include <rfb/CConnection.h>
 #include <network/Socket.h>
 
-#include "DesktopWindow.h"
+class DesktopWindow;
 
 class CConn : public rfb::CConnection,
               public rdr::FdInStreamBlockCallback
index 40d08ae2d71b420aebff6a6b92ae538c85be0c9d..2a2f8734db56970e22419225140cd8f4635f5ab8 100644 (file)
@@ -34,7 +34,9 @@
 #include "parameters.h"
 #include "vncviewer.h"
 #include "CConn.h"
+#include "Viewport.h"
 
+#include <FL/Fl.H>
 #include <FL/Fl_Scroll.H>
 #include <FL/x.H>
 
@@ -220,6 +222,26 @@ void DesktopWindow::setColourMapEntries(int firstColour, int nColours,
   viewport->setColourMapEntries(firstColour, nColours, rgbs);
 }
 
+void DesktopWindow::fillRect(const rfb::Rect& r, rfb::Pixel pix) {
+  viewport->fillRect(r, pix);
+}
+
+void DesktopWindow::imageRect(const rfb::Rect& r, void* pixels) {
+  viewport->imageRect(r, pixels);
+}
+
+void DesktopWindow::copyRect(const rfb::Rect& r, int srcX, int srcY) {
+  viewport->copyRect(r, srcX, srcY);
+}
+
+rdr::U8* DesktopWindow::getBufferRW(const rfb::Rect& r, int* stride) {
+  return viewport->getBufferRW(r, stride);
+}
+
+void DesktopWindow::damageRect(const rfb::Rect& r) {
+  viewport->damageRect(r);
+}
+
 
 // Copy the areas of the framebuffer that have been changed (damaged)
 // to the displayed window.
index fefdd35bd89563c50f3ebf6fa03695c354df1c74..06f25f557d69cf72eb3a0b520855484632a5f43f 100644 (file)
 #include <map>
 
 #include <rfb/Rect.h>
+#include <rfb/Pixel.h>
 
-#include "Viewport.h"
-
-#include <FL/Fl.H>
 #include <FL/Fl_Window.H>
 
 class CConn;
+class Viewport;
+
 class Fl_Scroll;
 
 class DesktopWindow : public Fl_Window {
@@ -52,22 +52,12 @@ public:
 
   void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
 
-  void fillRect(const rfb::Rect& r, rfb::Pixel pix) {
-    viewport->fillRect(r, pix);
-  }
-  void imageRect(const rfb::Rect& r, void* pixels) {
-    viewport->imageRect(r, pixels);
-  }
-  void copyRect(const rfb::Rect& r, int srcX, int srcY) {
-    viewport->copyRect(r, srcX, srcY);
-  }
-
-  rdr::U8* getBufferRW(const rfb::Rect& r, int* stride) {
-    return viewport->getBufferRW(r, stride);
-  }
-  void damageRect(const rfb::Rect& r) {
-    viewport->damageRect(r);
-  }
+  void fillRect(const rfb::Rect& r, rfb::Pixel pix);
+  void imageRect(const rfb::Rect& r, void* pixels);
+  void copyRect(const rfb::Rect& r, int srcX, int srcY);
+
+  rdr::U8* getBufferRW(const rfb::Rect& r, int* stride);
+  void damageRect(const rfb::Rect& r);
 
   void resizeFramebuffer(int new_w, int new_h);
 
index d784a4210ee9bbf000ade85db1dae291796ab67a..0ac7602459ded7e0b3195157871069ab59e8f6a9 100644 (file)
@@ -27,6 +27,7 @@
 
 #include <rfb/CMsgWriter.h>
 #include <rfb/LogWriter.h>
+#include <rfb/PixelTransformer.h>
 
 // FLTK can pull in the X11 headers on some systems
 #ifndef XK_VoidSymbol
@@ -42,6 +43,7 @@
 #include "Viewport.h"
 #include "CConn.h"
 #include "OptionsDialog.h"
+#include "DesktopWindow.h"
 #include "i18n.h"
 #include "fltk_layout.h"
 #include "parameters.h"
 #include "menukey.h"
 #include "vncviewer.h"
 
+#if defined(WIN32)
+#include "Win32PixelBuffer.h"
+#elif defined(__APPLE__)
+#include "OSXPixelBuffer.h"
+#else
+#include "X11PixelBuffer.h"
+#endif
+
+// We also have a generic version of the above, using pure FLTK:
+//
+// #include "PlatformPixelBuffer.h"
+//
+
 #include <FL/fl_draw.H>
 #include <FL/fl_ask.H>
 
@@ -212,6 +227,48 @@ void Viewport::updateWindow()
   damage.clear();
 }
 
+void Viewport::fillRect(const rfb::Rect& r, rfb::Pixel pix) {
+  if (pixelTrans) {
+    rfb::Pixel pix2;
+    if (colourMapChange)
+      commitColourMap();
+    pixelTrans->translatePixels(&pix, &pix2, 1);
+    pix = pix2;
+  }
+
+  frameBuffer->fillRect(r, pix);
+  damageRect(r);
+}
+
+void Viewport::imageRect(const rfb::Rect& r, void* pixels) {
+  if (pixelTrans) {
+    if (colourMapChange)
+      commitColourMap();
+    pixelTrans->translateRect(pixels, r.width(),
+                              rfb::Rect(0, 0, r.width(), r.height()),
+                              frameBuffer->data, frameBuffer->getStride(),
+                              r.tl);
+  } else {
+    frameBuffer->imageRect(r, pixels);
+  }
+  damageRect(r);
+}
+
+void Viewport::copyRect(const rfb::Rect& r, int srcX, int srcY) {
+  frameBuffer->copyRect(r, rfb::Point(r.tl.x-srcX, r.tl.y-srcY));
+  damageRect(r);
+}
+
+rdr::U8* Viewport::getBufferRW(const rfb::Rect& r, int* stride) {
+  return frameBuffer->getBufferRW(r, stride);
+}
+
+void Viewport::damageRect(const rfb::Rect& r) {
+  damage.assign_union(rfb::Region(r));
+  if (!Fl::has_timeout(handleUpdateTimeout, this))
+    Fl::add_timeout(0.500, handleUpdateTimeout, this);
+};
+
 #ifdef HAVE_FLTK_CURSOR
 static const char * dotcursor_xpm[] = {
   "5 5 2 1",
index 59839dcbf900b80f0a099cd17c55ac96f85433e0..e83a14ba5f55910b59e6fcb5ab9eb1901186a96f 100644 (file)
 
 #include <map>
 
-#include <FL/Fl.H>
 #include <FL/Fl_Widget.H>
 
 #include <rfb/Region.h>
-#include <rfb/PixelTransformer.h>
-
-#if defined(WIN32)
-#include "Win32PixelBuffer.h"
-#elif defined(__APPLE__)
-#include "OSXPixelBuffer.h"
-#else
-#include "X11PixelBuffer.h"
-#endif
-
-// We also have a generic version of the above, using pure FLTK:
-//
-// #include "PlatformPixelBuffer.h"
-//
+#include <rfb/Pixel.h>
+#include <rfb/ColourMap.h>
 
 class Fl_Menu_Button;
 class Fl_RGB_Image;
 
+namespace rfb { class PixelTransformer; }
+
 class CConn;
+class PlatformPixelBuffer;
 
 class Viewport : public Fl_Widget {
 public:
@@ -64,45 +54,13 @@ public:
 
   void setColourMapEntries(int firstColour, int nColours, rdr::U16* rgbs);
 
-  void fillRect(const rfb::Rect& r, rfb::Pixel pix) {
-    if (pixelTrans) {
-      rfb::Pixel pix2;
-      if (colourMapChange)
-        commitColourMap();
-      pixelTrans->translatePixels(&pix, &pix2, 1);
-      pix = pix2;
-    }
-
-    frameBuffer->fillRect(r, pix);
-    damageRect(r);
-  }
-  void imageRect(const rfb::Rect& r, void* pixels) {
-    if (pixelTrans) {
-      if (colourMapChange)
-        commitColourMap();
-      pixelTrans->translateRect(pixels, r.width(),
-                                rfb::Rect(0, 0, r.width(), r.height()),
-                                frameBuffer->data, frameBuffer->getStride(),
-                                r.tl);
-    } else {
-      frameBuffer->imageRect(r, pixels);
-    }
-    damageRect(r);
-  }
-  void copyRect(const rfb::Rect& r, int srcX, int srcY) {
-    frameBuffer->copyRect(r, rfb::Point(r.tl.x-srcX, r.tl.y-srcY));
-    damageRect(r);
-  }
-
-  rdr::U8* getBufferRW(const rfb::Rect& r, int* stride) {
-    return frameBuffer->getBufferRW(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 fillRect(const rfb::Rect& r, rfb::Pixel pix);
+  void imageRect(const rfb::Rect& r, void* pixels);
+  void copyRect(const rfb::Rect& r, int srcX, int srcY);
+
+  rdr::U8* getBufferRW(const rfb::Rect& r, int* stride);
+
+  void damageRect(const rfb::Rect& r);
 
   void setCursor(int width, int height, const rfb::Point& hotspot,
                  void* data, void* mask);