X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fskins2%2Fsrc%2Fvout_window.cpp;h=dec3a312556af24763d677ad43882c44542567d3;hb=94b56e80e5ddb0ad45759e3e7117009f26e6d7eb;hp=7af3f7fd26342403f24b6f8402d687cbf9bad16f;hpb=1e34cf517bdd2829bbcf68220e91cd784708051f;p=vlc diff --git a/modules/gui/skins2/src/vout_window.cpp b/modules/gui/skins2/src/vout_window.cpp index 7af3f7fd26..dec3a31255 100644 --- a/modules/gui/skins2/src/vout_window.cpp +++ b/modules/gui/skins2/src/vout_window.cpp @@ -1,7 +1,7 @@ /***************************************************************************** * vout_window.cpp ***************************************************************************** - * Copyright (C) 2003 VideoLAN + * Copyright (C) 2003 the VideoLAN team * $Id$ * * Authors: Cyril Deguet @@ -18,24 +18,74 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #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, - bool dragDrop, bool playOnDrop, GenericWindow &rParent ): + bool dragDrop, bool playOnDrop, + GenericWindow &rParent ): GenericWindow( pIntf, left, top, dragDrop, playOnDrop, - &rParent ) + &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 ); + } + } +}