[vlc-commits] commit: skins2: optimize refresh of text control (Erwan Tulou )
git at videolan.org
git at videolan.org
Thu Jul 29 16:43:36 CEST 2010
vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Thu Jul 29 15:58:51 2010 +0200| [1e965d5a46e92c01f332fa306a1d1feb97fd5b2d] | committer: Erwan Tulou
skins2: optimize refresh of text control
text controls were far from being optimized
- a notifyLayout was executed at creation of text control, leading
to rebuilding the layout twice.
- the init of the variable was done after the control was created
which means still more rebuild of the layout.
This patch ensures that no rebuild is done at init since we are already in the
process of rebuilding the entire layout.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1e965d5a46e92c01f332fa306a1d1feb97fd5b2d
---
modules/gui/skins2/controls/ctrl_text.cpp | 3 ++-
modules/gui/skins2/parser/builder.cpp | 7 ++++---
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/modules/gui/skins2/controls/ctrl_text.cpp b/modules/gui/skins2/controls/ctrl_text.cpp
index a6c90a0..867c661 100644
--- a/modules/gui/skins2/controls/ctrl_text.cpp
+++ b/modules/gui/skins2/controls/ctrl_text.cpp
@@ -207,6 +207,7 @@ void CtrlText::onUpdate( Subject<VarText> &rVariable, void* arg )
if( isVisible() )
{
displayText( m_rVariable.get() );
+ notifyLayout( getPosition()->getWidth(), getPosition()->getHeight() );
}
}
@@ -219,6 +220,7 @@ void CtrlText::onUpdate( Subject<VarBool> &rVariable, void *arg )
if( isVisible() )
{
displayText( m_rVariable.get() );
+ notifyLayout( getPosition()->getWidth(), getPosition()->getHeight() );
}
else
{
@@ -278,7 +280,6 @@ void CtrlText::displayText( const UString &rText )
m_pTimer->stop();
}
}
- notifyLayout( getPosition()->getWidth(), getPosition()->getHeight() );
}
}
diff --git a/modules/gui/skins2/parser/builder.cpp b/modules/gui/skins2/parser/builder.cpp
index 6981757..72efbe6 100644
--- a/modules/gui/skins2/parser/builder.cpp
+++ b/modules/gui/skins2/parser/builder.cpp
@@ -722,6 +722,10 @@ void Builder::addText( const BuilderData::Text &rData )
VarText *pVar = new VarText( getIntf() );
m_pTheme->m_vars.push_back( VariablePtr( pVar ) );
+ // Set the text of the control
+ UString msg( getIntf(), rData.m_text.c_str() );
+ pVar->set( msg );
+
// Get the visibility variable
// XXX check when it is null
Interpreter *pInterpreter = Interpreter::instance( getIntf() );
@@ -744,9 +748,6 @@ void Builder::addText( const BuilderData::Text &rData )
pLayout->addControl( pText, pos, rData.m_layer );
- // Set the text of the control
- UString msg( getIntf(), rData.m_text.c_str() );
- pVar->set( msg );
}
More information about the vlc-commits
mailing list