Răsfoiți Sursa

remove legacy code: graphics engine now owns window pointers, not pipe

David Rose 23 ani în urmă
părinte
comite
3d63983b5c

+ 1 - 4
panda/src/display/graphicsEngine.cxx

@@ -765,10 +765,7 @@ setup_gsg(GraphicsStateGuardian *gsg, SceneSetup *scene_setup) {
 void GraphicsEngine::
 do_remove_window(GraphicsWindow *window) {
   PT(GraphicsPipe) pipe = window->get_pipe();
-  if (pipe != (GraphicsPipe *)NULL) {
-    pipe->remove_window(window);
-    window->_pipe = (GraphicsPipe *)NULL;
-  }
+  window->_pipe = (GraphicsPipe *)NULL;
 
   // Now remove the window from all threads that know about it.
   _app.remove_window(window);

+ 0 - 80
panda/src/display/graphicsPipe.cxx

@@ -69,48 +69,6 @@ operator = (const GraphicsPipe &) {
 ////////////////////////////////////////////////////////////////////
 GraphicsPipe::
 ~GraphicsPipe() {
-  // On destruction, we need to clean up our references to all of the
-  // windows.
-  Windows::iterator wi;
-  for (wi = _windows.begin(); wi != _windows.end(); ++wi) {
-    GraphicsWindow *window = (*wi);
-    window->_pipe = NULL;
-  }
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: GraphicsPipe::get_num_windows
-//       Access: Published
-//  Description: Returns the number of windows that have been created
-//               on this pipe.
-////////////////////////////////////////////////////////////////////
-int GraphicsPipe::
-get_num_windows() const {
-  int result;
-  {
-    MutexHolder holder(_lock);
-    result = _windows.size();
-  }
-  return result;
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: GraphicsPipe::get_window
-//       Access: Published
-//  Description: Returns the nth window that has been created
-//               on this pipe.  It is possible for this to return NULL
-//               due to a window being removed in another thread.
-////////////////////////////////////////////////////////////////////
-PT(GraphicsWindow) GraphicsPipe::
-get_window(int n) const {
-  PT(GraphicsWindow) result;
-  {
-    MutexHolder holder(_lock);
-    if (n >= 0 && n < (int)_windows.size()) {
-      result = _windows[n];
-    }
-  }
-  return result;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -142,41 +100,3 @@ HardwareChannel *GraphicsPipe::
 get_hw_channel(GraphicsWindow *, int) {
   return (HardwareChannel*)0L;
 }
-
-////////////////////////////////////////////////////////////////////
-//     Function: GraphicsPipe::add_window
-//       Access: Protected
-//  Description: This is intended to be called by the derived
-//               make_window() function to add the newly-created
-//               window to the list of windows owned by this pipe.
-////////////////////////////////////////////////////////////////////
-void GraphicsPipe::
-add_window(GraphicsWindow *window) {
-  nassertv(window->_pipe == this);
-  MutexHolder holder(_lock);
-  _windows.push_back(window);
-}
-
-////////////////////////////////////////////////////////////////////
-//     Function: GraphicsPipe::remove_window
-//       Access: Protected
-//  Description: This is intended to be called by the GraphicsEngine
-//               when a window is to be removed.  It returns true if
-//               the window is removed, or false if it was not found.
-////////////////////////////////////////////////////////////////////
-bool GraphicsPipe::
-remove_window(GraphicsWindow *window) {
-  bool removed = false;
-  {
-    MutexHolder holder(_lock);
-    PT(GraphicsWindow) ptwin = window;
-    window->_pipe = NULL;
-    Windows::iterator wi = find(_windows.begin(), _windows.end(), ptwin);
-    if (wi != _windows.end()) {
-      _windows.erase(wi);
-      removed = true;
-    }
-  }
-
-  return removed;
-}

+ 0 - 8
panda/src/display/graphicsPipe.h

@@ -56,9 +56,6 @@ private:
 PUBLISHED:
   virtual ~GraphicsPipe();
 
-  int get_num_windows() const;
-  PT(GraphicsWindow) get_window(int n) const;
-
   INLINE bool is_valid() const;
   INLINE bool supports_fullscreen() const;
 
@@ -78,11 +75,6 @@ protected:
   // particular pipe.
   virtual PT(GraphicsWindow) make_window()=0;
 
-  void add_window(GraphicsWindow *window);
-  bool remove_window(GraphicsWindow *window);
-
-  typedef pvector< PT(GraphicsWindow) > Windows;
-  Windows _windows;
   Mutex _lock;
 
   bool _is_valid;

+ 2 - 5
panda/src/display/graphicsWindow.h

@@ -15,6 +15,7 @@
 // [email protected] .
 //
 ////////////////////////////////////////////////////////////////////
+
 #ifndef GRAPHICSWINDOW_H
 #define GRAPHICSWINDOW_H
 
@@ -39,10 +40,6 @@
 #include "pvector.h"
 #include "pdeque.h"
 
-class GraphicsPipe;
-class GraphicsWindow;
-class CullHandler;
-
 ////////////////////////////////////////////////////////////////////
 //       Class : GraphicsWindow
 // Description : An output medium for receiving the results of
@@ -158,7 +155,7 @@ protected:
   Mutex _input_lock;
 
   PT(GraphicsStateGuardian) _gsg;
-  GraphicsPipe *_pipe;
+  PT(GraphicsPipe) _pipe;
 
 private:
   INLINE void determine_display_regions() const;