[vlc-devel] commit: skins2: improve resizing when multiple layers are used and solve zoom misfunctioning in this case (Erwan Tulou )
git version control
git at videolan.org
Fri Jun 12 21:10:33 CEST 2009
vlc | branch: bugfix10 | Erwan Tulou <brezhoneg1 at yahoo.fr> | Fri Jun 12 10:49:58 2009 +0200| [a7088fde1cf6c907bfe339ea64198460d636dd62] | committer: Erwan Tulou
skins2: improve resizing when multiple layers are used and solve zoom misfunctioning in this case
(cherry picked from commit 4de9a2e2845780150be33b9b98ff0b07ae1c89ac)
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a7088fde1cf6c907bfe339ea64198460d636dd62
---
modules/gui/skins2/commands/cmd_resize.cpp | 19 ++++++++++++----
modules/gui/skins2/commands/cmd_resize.hpp | 6 ++--
modules/gui/skins2/controls/ctrl_video.cpp | 6 ++--
modules/gui/skins2/controls/ctrl_video.hpp | 3 +-
modules/gui/skins2/src/vout_manager.cpp | 31 +++++++++++++++++++++------
modules/gui/skins2/src/vout_window.hpp | 7 +++++-
6 files changed, 52 insertions(+), 20 deletions(-)
diff --git a/modules/gui/skins2/commands/cmd_resize.cpp b/modules/gui/skins2/commands/cmd_resize.cpp
index 5a768da..2180ed5 100644
--- a/modules/gui/skins2/commands/cmd_resize.cpp
+++ b/modules/gui/skins2/commands/cmd_resize.cpp
@@ -46,9 +46,9 @@ void CmdResize::execute()
}
-CmdResizeVout::CmdResizeVout( intf_thread_t *pIntf, void *pWindow, int width,
- int height ):
- CmdGeneric( pIntf ), m_pWindow( pWindow ), m_width( width ),
+CmdResizeVout::CmdResizeVout( intf_thread_t *pIntf, VoutWindow *pVoutWindow,
+ int width, int height ):
+ CmdGeneric( pIntf ), m_pVoutWindow( pVoutWindow ), m_width( width ),
m_height( height )
{
}
@@ -56,8 +56,17 @@ CmdResizeVout::CmdResizeVout( intf_thread_t *pIntf, void *pWindow, int width,
void CmdResizeVout::execute()
{
- VarBox &rVoutSize = VlcProc::instance( getIntf() )->getVoutSizeVar();
- rVoutSize.setSize( m_width, m_height );
+ if( m_pVoutWindow )
+ {
+ m_pVoutWindow->setOriginalWidth( m_width );
+ m_pVoutWindow->setOriginalHeight( m_height );
+
+ CtrlVideo* pCtrlVideo = m_pVoutWindow->getCtrlVideo();
+ if( pCtrlVideo )
+ {
+ pCtrlVideo->resizeControl( m_width, m_height );
+ }
+ }
}
diff --git a/modules/gui/skins2/commands/cmd_resize.hpp b/modules/gui/skins2/commands/cmd_resize.hpp
index 3233dd3..78f2bfa 100644
--- a/modules/gui/skins2/commands/cmd_resize.hpp
+++ b/modules/gui/skins2/commands/cmd_resize.hpp
@@ -61,8 +61,8 @@ class CmdResizeVout: public CmdGeneric
{
public:
/// Resize the given layout
- CmdResizeVout( intf_thread_t *pIntf, void *pWindow, int width,
- int height );
+ CmdResizeVout( intf_thread_t *pIntf, VoutWindow *pVoutWindow,
+ int width, int height );
virtual ~CmdResizeVout() {}
/// This method does the real job of the command
@@ -72,7 +72,7 @@ class CmdResizeVout: public CmdGeneric
virtual string getType() const { return "resize vout"; }
private:
- void *m_pWindow;
+ VoutWindow *m_pVoutWindow;
int m_width, m_height;
};
diff --git a/modules/gui/skins2/controls/ctrl_video.cpp b/modules/gui/skins2/controls/ctrl_video.cpp
index ce62d72..f8083d3 100644
--- a/modules/gui/skins2/controls/ctrl_video.cpp
+++ b/modules/gui/skins2/controls/ctrl_video.cpp
@@ -187,10 +187,10 @@ void CtrlVideo::onUpdate( Subject<VarBool> &rVariable, void *arg )
}
}
-void CtrlVideo::attachVoutWindow( VoutWindow* pVoutWindow )
+void CtrlVideo::attachVoutWindow( VoutWindow* pVoutWindow, int width, int height )
{
- int width = pVoutWindow->getOriginalWidth();
- int height = pVoutWindow->getOriginalHeight();
+ width = ( width < 0 ) ? pVoutWindow->getOriginalWidth() : width;
+ height = ( height < 0 ) ? pVoutWindow->getOriginalHeight() : height;
WindowManager &rWindowManager =
getIntf()->p_sys->p_theme->getWindowManager();
diff --git a/modules/gui/skins2/controls/ctrl_video.hpp b/modules/gui/skins2/controls/ctrl_video.hpp
index d7b67d5..c152664 100644
--- a/modules/gui/skins2/controls/ctrl_video.hpp
+++ b/modules/gui/skins2/controls/ctrl_video.hpp
@@ -63,7 +63,8 @@ class CtrlVideo: public CtrlGeneric, public Observer<VarBox>
virtual void onUpdate( Subject<VarBool> &rVariable , void* );
// Attach a voutWindow to a Video Control
- void attachVoutWindow( VoutWindow* pVoutWindow );
+ void attachVoutWindow( VoutWindow* pVoutWindow,
+ int width = -1, int height = -1 );
// Detach a voutWindow from a Video Control
void detachVoutWindow( );
diff --git a/modules/gui/skins2/src/vout_manager.cpp b/modules/gui/skins2/src/vout_manager.cpp
index 2315e58..65d8d89 100644
--- a/modules/gui/skins2/src/vout_manager.cpp
+++ b/modules/gui/skins2/src/vout_manager.cpp
@@ -154,7 +154,8 @@ void VoutManager::requestVout( CtrlVideo* pCtrlVideo )
{
if( (*it).pCtrlVideo == NULL )
{
- pCtrlVideo->attachVoutWindow( (*it).pVoutWindow );
+ pCtrlVideo->attachVoutWindow( (*it).pVoutWindow,
+ (*it).width, (*it).height );
(*it).pCtrlVideo = pCtrlVideo;
break;
}
@@ -274,6 +275,7 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd,
{
intf_thread_t *pIntf = (intf_thread_t *)pWnd->p_private;
VoutManager *pThis = pIntf->p_sys->p_voutManager;
+ vout_thread_t* pVout = pWnd->vout;
switch( query )
{
@@ -284,12 +286,27 @@ int VoutManager::controlWindow( struct vout_window_t *pWnd,
if( i_width && i_height )
{
- // Post a resize vout command
- CmdResizeVout *pCmd =
- new CmdResizeVout( pThis->getIntf(), pWnd->handle.hwnd,
- i_width, i_height );
- AsyncQueue *pQueue = AsyncQueue::instance( pThis->getIntf() );
- pQueue->push( CmdGenericPtr( pCmd ) );
+ pThis->lockVout();
+
+ vector<SavedVout>::iterator it;
+ for( it = pThis->m_SavedVoutVec.begin();
+ it != pThis->m_SavedVoutVec.end(); it++ )
+ {
+ if( (*it).pVout == pVout )
+ {
+ // Post a vout resize command
+ CmdResizeVout *pCmd =
+ new CmdResizeVout( pThis->getIntf(),
+ (*it).pVoutWindow,
+ (int)i_width, (int)i_height );
+ AsyncQueue *pQueue =
+ AsyncQueue::instance( pThis->getIntf() );
+ pQueue->push( CmdGenericPtr( pCmd ) );
+ break;
+ }
+ }
+
+ pThis->unlockVout();
}
}
diff --git a/modules/gui/skins2/src/vout_window.hpp b/modules/gui/skins2/src/vout_window.hpp
index 90d8225..b355ad4 100644
--- a/modules/gui/skins2/src/vout_window.hpp
+++ b/modules/gui/skins2/src/vout_window.hpp
@@ -59,13 +59,18 @@ class VoutWindow: private GenericWindow
/// Refresh an area of the window
virtual void refresh( int left, int top, int width, int height );
- /// set Video Control for VoutWindow
+ /// set and get Video Control for VoutWindow
virtual void setCtrlVideo( CtrlVideo* pCtrlVideo );
+ virtual CtrlVideo* getCtrlVideo( ) { return m_pCtrlVideo; }
/// get original size of vout
virtual int getOriginalWidth( ) { return original_width; }
virtual int getOriginalHeight( ) { return original_height; }
+ /// set original size of vout
+ virtual void setOriginalWidth( int width ) { original_width = width; }
+ virtual void setOriginalHeight( int height ) { original_height = height; }
+
virtual string getType() const { return "Vout"; }
private:
More information about the vlc-devel
mailing list