[vlc-commits] commit: skins2: optimize the refresh of slider 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 16:07:18 2010 +0200| [4382ab9c8c0f949365e88ef9dc6891ce321c40df] | committer: Erwan Tulou 

skins2: optimize the refresh of slider control

only refresh position if the value really changed w.r.t the control measure unit.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4382ab9c8c0f949365e88ef9dc6891ce321c40df
---

 modules/gui/skins2/controls/ctrl_slider.cpp |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/modules/gui/skins2/controls/ctrl_slider.cpp b/modules/gui/skins2/controls/ctrl_slider.cpp
index 995cf75..5159cae 100644
--- a/modules/gui/skins2/controls/ctrl_slider.cpp
+++ b/modules/gui/skins2/controls/ctrl_slider.cpp
@@ -436,7 +436,11 @@ void CtrlSliderBg::associateCursor( CtrlSliderCursor &rCursor )
 
 void CtrlSliderBg::onUpdate( Subject<VarPercent> &rVariable, void*arg )
 {
-    m_position = (int)( m_rVariable.get() * (m_nbHoriz * m_nbVert - 1) );
+    int position = (int)( m_rVariable.get() * (m_nbHoriz * m_nbVert - 1) );
+    if( position == m_position )
+        return;
+
+    m_position = position;
     notifyLayout( m_bgWidth, m_bgHeight );
 }
 



More information about the vlc-commits mailing list