]> git.sesse.net Git - vlc/blobdiff - modules/gui/skins2/src/vout_window.cpp
* skins2/src/generic_layout.cpp: Fixed a resizing bug (the invisible controls
[vlc] / modules / gui / skins2 / src / vout_window.cpp
index c5f910d2e8c42089ae5e192e5e0b3ff723fdd438..56d3a00e98515c4e0a1f1d03f2b3b0e78de8ece9 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * vout_window.cpp
  *****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
  * $Id$
  *
  * Authors: Cyril Deguet     <asmax@via.ecp.fr>
  *****************************************************************************/
 
 #include "vout_window.hpp"
+#include "vlcproc.hpp"
 #include "os_factory.hpp"
+#include "os_graphics.hpp"
 #include "os_window.hpp"
 
 
 VoutWindow::VoutWindow( intf_thread_t *pIntf, int left, int top,
-                        WindowManager &rWindowManager,
-                        bool dragDrop, bool playOnDrop, GenericWindow &rParent ):
-    GenericWindow( pIntf, left, top, rWindowManager, dragDrop, playOnDrop,
-                   &rParent )
+                        bool dragDrop, bool playOnDrop,
+                        GenericWindow &rParent ):
+    GenericWindow( pIntf, left, top, dragDrop, playOnDrop,
+                   &rParent ), m_pImage( NULL )
 {
 }
 
 
 VoutWindow::~VoutWindow()
 {
-    // XXX we should stop the vout before destroying the window!
+    if( m_pImage )
+    {
+        delete m_pImage;
+    }
+
+    // Get the VlcProc
+    VlcProc *pVlcProc = getIntf()->p_sys->p_vlcProc;
+
+    // Reparent the video output
+    if( pVlcProc && pVlcProc->isVoutUsed() )
+    {
+        pVlcProc->dropVout();
+    }
+}
+
+
+void VoutWindow::resize( int width, int height )
+{
+    // Get the OSFactory
+    OSFactory *pOsFactory = OSFactory::instance( getIntf() );
+
+    // Recreate the image
+    if( m_pImage )
+    {
+        delete m_pImage;
+    }
+    m_pImage = pOsFactory->createOSGraphics( width, height );
+    // Draw a black rectangle
+    m_pImage->fillRect( 0, 0, width, height, 0 );
+
+    // Resize the window
+    GenericWindow::resize( width, height );
 }
 
+
+void VoutWindow::refresh( int left, int top, int width, int height )
+{
+    if( m_pImage )
+    {
+        // Get the VlcProc
+        VlcProc *pVlcProc = getIntf()->p_sys->p_vlcProc;
+
+        // Refresh only when there is no video!
+        if( pVlcProc && !pVlcProc->isVoutUsed() )
+        {
+            m_pImage->copyToWindow( *getOSWindow(), left, top,
+                                    width, height, left, top );
+        }
+    }
+}