Commit 3189c99d authored by ipkiss's avatar ipkiss
Browse files

* skins2/controls/ctrl_slider.cpp: fixed 2 little offset problems, introduced

   by a previous commit
parent 0fbf13c3
...@@ -323,6 +323,11 @@ CtrlSliderBg::CtrlSliderBg( intf_thread_t *pIntf, ...@@ -323,6 +323,11 @@ CtrlSliderBg::CtrlSliderBg( intf_thread_t *pIntf,
if( pBackground ) if( pBackground )
{ {
// Build the background image sequence // Build the background image sequence
// Note: we suppose that the last padding is not included in the
// given image
// TODO: we should probably change this assumption, as it would make
// the code a bit simpler and it would be more natural for the skins
// designers
m_bgWidth = (pBackground->getWidth() + m_padHoriz) / nbHoriz; m_bgWidth = (pBackground->getWidth() + m_padHoriz) / nbHoriz;
m_bgHeight = (pBackground->getHeight() + m_padVert) / nbVert; m_bgHeight = (pBackground->getHeight() + m_padVert) / nbVert;
...@@ -363,8 +368,9 @@ void CtrlSliderBg::draw( OSGraphics &rImage, int xDest, int yDest ) ...@@ -363,8 +368,9 @@ void CtrlSliderBg::draw( OSGraphics &rImage, int xDest, int yDest )
getResizeFactors( factorX, factorY ); getResizeFactors( factorX, factorY );
// Rescale the image with the actual size of the control // Rescale the image with the actual size of the control
ScaledBitmap bmp( getIntf(), *m_pImgSeq, m_bgWidth * m_nbHoriz, ScaledBitmap bmp( getIntf(), *m_pImgSeq,
m_bgHeight * m_nbVert ); m_bgWidth * m_nbHoriz - (int)(m_padHoriz * factorX),
m_bgHeight * m_nbVert - (int)(m_padVert * factorY) );
// Locate the right image in the background bitmap // Locate the right image in the background bitmap
int x = m_bgWidth * ( m_position % m_nbHoriz ); int x = m_bgWidth * ( m_position % m_nbHoriz );
...@@ -439,8 +445,8 @@ void CtrlSliderBg::onResize() ...@@ -439,8 +445,8 @@ void CtrlSliderBg::onResize()
getResizeFactors( factorX, factorY ); getResizeFactors( factorX, factorY );
// Size of one elementary background image (padding included) // Size of one elementary background image (padding included)
m_bgWidth = (int)(m_pImgSeq->getWidth() * factorX / m_nbHoriz); m_bgWidth = (int)((m_pImgSeq->getWidth() + m_padHoriz) * factorX / m_nbHoriz);
m_bgHeight = (int)(m_pImgSeq->getHeight() * factorY / m_nbVert); m_bgHeight = (int)((m_pImgSeq->getHeight() + m_padVert) * factorY / m_nbVert);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment