Commit cb3f44ba authored by Erwan Tulou's avatar Erwan Tulou Committed by Felix Paul Kühne

skins2: fix buttons and checkbox artefacts with animated images

If down or over images are missing, they default to the up image. Yet, in case
of animated images, the animation gets played leading to undesirable artefacts.

This patch adds a comparison operator for animated images and do not restart the
animation if they are alike.

(cherry picked from commit 1c101b97678e5e7a34a062916b24fe0b9366a316)
Signed-off-by: default avatarFelix Paul Kühne <fkuehne@videolan.org>
parent b2b25aeb
......@@ -140,6 +140,9 @@ void CtrlButton::setImage( AnimBitmap *pImg )
if( pImg == m_pImg )
return;
if( pImg && m_pImg && *pImg == *m_pImg )
return;
AnimBitmap *pOldImg = m_pImg;
m_pImg = pImg;
......
......@@ -167,6 +167,9 @@ void CtrlCheckbox::setImage( AnimBitmap *pImg )
if( pImg == m_pImgCurrent )
return;
if( pImg && m_pImgCurrent && *pImg == *m_pImgCurrent )
return;
AnimBitmap *pOldImg = m_pImgCurrent;
m_pImgCurrent = pImg;
......
......@@ -121,3 +121,10 @@ void AnimBitmap::CmdNextFrame::execute()
m_pParent->notify();
}
bool AnimBitmap::operator ==( const AnimBitmap& rOther ) const
{
return &m_rBitmap == &rOther.m_rBitmap
&& m_nbFrames == rOther.m_nbFrames
&& m_frameRate == rOther.m_frameRate
&& m_nbLoops == rOther.m_nbLoops;
}
......@@ -58,6 +58,9 @@ public:
virtual int getWidth() const;
virtual int getHeight() const;
/// compare two animated image
bool operator==( const AnimBitmap& other ) const;
private:
/// Bitmap stored
const GenericBitmap &m_rBitmap;
......
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