[vlc-commits] skins2: fix buttons and checkbox artefacts with animated images
Erwan Tulou
git at videolan.org
Fri Sep 5 00:03:21 CEST 2014
vlc/vlc-2.2 | branch: master | Erwan Tulou <erwan10 at videolan.org> | Wed Sep 3 23:31:43 2014 +0200| [cb3f44ba9d8dc38ffa6b82f86d4806e7a455ef60] | committer: 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: Felix Paul Kühne <fkuehne at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=cb3f44ba9d8dc38ffa6b82f86d4806e7a455ef60
---
modules/gui/skins2/controls/ctrl_button.cpp | 3 +++
modules/gui/skins2/controls/ctrl_checkbox.cpp | 3 +++
modules/gui/skins2/src/anim_bitmap.cpp | 7 +++++++
modules/gui/skins2/src/anim_bitmap.hpp | 3 +++
4 files changed, 16 insertions(+)
diff --git a/modules/gui/skins2/controls/ctrl_button.cpp b/modules/gui/skins2/controls/ctrl_button.cpp
index 0530bbb..06a2944 100644
--- a/modules/gui/skins2/controls/ctrl_button.cpp
+++ b/modules/gui/skins2/controls/ctrl_button.cpp
@@ -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;
diff --git a/modules/gui/skins2/controls/ctrl_checkbox.cpp b/modules/gui/skins2/controls/ctrl_checkbox.cpp
index 31f35fe..4b06572 100644
--- a/modules/gui/skins2/controls/ctrl_checkbox.cpp
+++ b/modules/gui/skins2/controls/ctrl_checkbox.cpp
@@ -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;
diff --git a/modules/gui/skins2/src/anim_bitmap.cpp b/modules/gui/skins2/src/anim_bitmap.cpp
index 0ac5ac4..b01b16d 100644
--- a/modules/gui/skins2/src/anim_bitmap.cpp
+++ b/modules/gui/skins2/src/anim_bitmap.cpp
@@ -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;
+}
diff --git a/modules/gui/skins2/src/anim_bitmap.hpp b/modules/gui/skins2/src/anim_bitmap.hpp
index eea3de9..6825544 100644
--- a/modules/gui/skins2/src/anim_bitmap.hpp
+++ b/modules/gui/skins2/src/anim_bitmap.hpp
@@ -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;
More information about the vlc-commits
mailing list