Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

vout_window.cpp

00001 /*****************************************************************************
00002  * vout_window.cpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: vout_window.cpp 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *
00009  * This program is free software; you can redistribute it and/or modify
00010  * it under the terms of the GNU General Public License as published by
00011  * the Free Software Foundation; either version 2 of the License, or
00012  * (at your option) any later version.
00013  *
00014  * This program is distributed in the hope that it will be useful,
00015  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  * GNU General Public License for more details.
00018  *
00019  * You should have received a copy of the GNU General Public License
00020  * along with this program; if not, write to the Free Software
00021  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00022  *****************************************************************************/
00023 
00024 #include "vout_window.hpp"
00025 #include "vlcproc.hpp"
00026 #include "os_factory.hpp"
00027 #include "os_graphics.hpp"
00028 #include "os_window.hpp"
00029 
00030 
00031 VoutWindow::VoutWindow( intf_thread_t *pIntf, int left, int top,
00032                         bool dragDrop, bool playOnDrop,
00033                         GenericWindow &rParent ):
00034     GenericWindow( pIntf, left, top, dragDrop, playOnDrop,
00035                    &rParent ), m_pImage( NULL )
00036 {
00037 }
00038 
00039 
00040 VoutWindow::~VoutWindow()
00041 {
00042     if( m_pImage )
00043     {
00044         delete m_pImage;
00045     }
00046 
00047     // Get the VlcProc
00048     VlcProc *pVlcProc = getIntf()->p_sys->p_vlcProc;
00049 
00050     // Reparent the video output
00051     if( pVlcProc && pVlcProc->isVoutUsed() )
00052     {
00053         pVlcProc->dropVout();
00054     }
00055 }
00056 
00057 
00058 void VoutWindow::resize( int width, int height )
00059 {
00060     // Get the OSFactory
00061     OSFactory *pOsFactory = OSFactory::instance( getIntf() );
00062 
00063     // Recreate the image
00064     if( m_pImage )
00065     {
00066         delete m_pImage;
00067     }
00068     m_pImage = pOsFactory->createOSGraphics( width, height );
00069     // Draw a black rectangle
00070     m_pImage->fillRect( 0, 0, width, height, 0 );
00071 
00072     // Resize the window
00073     GenericWindow::resize( width, height );
00074 }
00075 
00076 
00077 void VoutWindow::refresh( int left, int top, int width, int height )
00078 {
00079     if( m_pImage )
00080     {
00081         // Get the VlcProc
00082         VlcProc *pVlcProc = getIntf()->p_sys->p_vlcProc;
00083 
00084         // Refresh only when there is no video!
00085         if( pVlcProc && !pVlcProc->isVoutUsed() )
00086         {
00087             m_pImage->copyToWindow( *getOSWindow(), left, top,
00088                                     width, height, left, top );
00089         }
00090     }
00091 }

Generated on Tue Dec 20 10:14:43 2005 for vlc-0.8.4a by  doxygen 1.4.2