diff options
author | jmarshallnz <jmarshallnz@svn> | 2010-03-11 22:07:41 +0000 |
---|---|---|
committer | jmarshallnz <jmarshallnz@svn> | 2010-03-11 22:07:41 +0000 |
commit | c8f61f25b0f1151bc925112d1ecc39b329dc091c (patch) | |
tree | db087f9da214d42b1f1299e4985b2d3b2d44d50f /guilib/GUISliderControl.cpp | |
parent | 9671451c0f1fa973a7e6235552fb1e505cc00017 (diff) |
cleanup: get rid of dupe'd code.
git-svn-id: https://xbmc.svn.sourceforge.net/svnroot/xbmc/trunk@28549 568bbfeb-2a22-0410-94d2-cc84cf5bfa90
Diffstat (limited to 'guilib/GUISliderControl.cpp')
-rw-r--r-- | guilib/GUISliderControl.cpp | 23 |
1 files changed, 3 insertions, 20 deletions
diff --git a/guilib/GUISliderControl.cpp b/guilib/GUISliderControl.cpp index 6911d26aef..4c1ed9eb7a 100644 --- a/guilib/GUISliderControl.cpp +++ b/guilib/GUISliderControl.cpp @@ -50,27 +50,10 @@ CGUISliderControl::~CGUISliderControl(void) void CGUISliderControl::Render() { m_guiBackground.SetPosition( m_posX, m_posY ); - float proportion = 0; if (!IsDisabled()) { - switch (m_iType) - { - case SPIN_CONTROL_TYPE_FLOAT: - if (m_iInfoCode) m_fValue = (float)g_infoManager.GetInt(m_iInfoCode); - - proportion = (m_fValue - m_fStart) / (m_fEnd - m_fStart); - break; - - case SPIN_CONTROL_TYPE_INT: - if (m_iInfoCode) m_iValue = g_infoManager.GetInt(m_iInfoCode); - - proportion = (float)(m_iValue - m_iStart) / (float)(m_iEnd - m_iStart); - break; - default: - if (m_iInfoCode) m_iPercent = g_infoManager.GetInt(m_iInfoCode); - proportion = 0.01f * m_iPercent; - break; - } + if (m_iInfoCode) + SetIntValue(g_infoManager.GetInt(m_iInfoCode)); float fScaleX = m_width == 0 ? 1.0f : m_width / m_guiBackground.GetTextureWidth(); float fScaleY = m_height == 0 ? 1.0f : m_height / m_guiBackground.GetTextureHeight(); @@ -81,7 +64,7 @@ void CGUISliderControl::Render() float fWidth = (m_guiBackground.GetTextureWidth() - m_guiMid.GetTextureWidth())*fScaleX; - float fPos = m_guiBackground.GetXPosition() + proportion * fWidth; + float fPos = m_guiBackground.GetXPosition() + GetProportion() * fWidth; if ((int)fWidth > 1) { |