]> git.sesse.net Git - vlc/commitdiff
skins2: optimize the refresh of slider control
authorErwan Tulou <erwan10@videolan.org>
Thu, 29 Jul 2010 14:07:18 +0000 (16:07 +0200)
committerErwan Tulou <erwan10@videolan.org>
Thu, 29 Jul 2010 14:41:48 +0000 (16:41 +0200)
only refresh position if the value really changed w.r.t the control measure unit.

modules/gui/skins2/controls/ctrl_slider.cpp

index 995cf7521ad7c4c490f14cd2364bcb58a1d7aca2..5159caebde40434c36970bbb83f2677947251a42 100644 (file)
@@ -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 );
 }