- // Locate the right image in the background bitmap
- int x = m_bgWidth * ( m_position % m_nbHoriz );
- int y = m_bgHeight * ( m_position / m_nbHoriz );
- // Draw the background image
- rImage.drawGraphics( *m_pImgSeq, x, y, xDest, yDest,
- m_bgWidth - m_padHoriz, m_bgHeight - m_padVert );
+ if( m_bgWidth > 0 && m_bgHeight > 0 )
+ {
+ // Compute the resize factors
+ float factorX, factorY;
+ getResizeFactors( factorX, factorY );
+
+ // Rescale the image with the actual size of the control
+ ScaledBitmap bmp( getIntf(), *m_pImgSeq, m_bgWidth * m_nbHoriz,
+ m_bgHeight * m_nbVert );
+
+ // Locate the right image in the background bitmap
+ int x = m_bgWidth * ( m_position % m_nbHoriz );
+ int y = m_bgHeight * ( m_position / m_nbHoriz );
+ // Draw the background image
+ rImage.drawBitmap( bmp, x, y, xDest, yDest,
+ m_bgWidth - (int)(m_padHoriz * factorX),
+ m_bgHeight - (int)(m_padVert * factorY) );
+ }