wxAnimationCtrl fix to display inactive bitmap at start (patch 1590192)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43001 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -82,7 +82,7 @@ public: // public API
|
|||||||
|
|
||||||
virtual bool IsPlaying() const = 0;
|
virtual bool IsPlaying() const = 0;
|
||||||
|
|
||||||
virtual void SetInactiveBitmap(const wxBitmap &bmp);
|
virtual void SetInactiveBitmap(const wxBitmap &bmp) = 0;
|
||||||
wxBitmap GetInactiveBitmap() const
|
wxBitmap GetInactiveBitmap() const
|
||||||
{ return m_bmpStatic; }
|
{ return m_bmpStatic; }
|
||||||
|
|
||||||
|
@@ -30,11 +30,5 @@ wxAnimation wxNullAnimation;
|
|||||||
IMPLEMENT_ABSTRACT_CLASS(wxAnimationBase, wxObject)
|
IMPLEMENT_ABSTRACT_CLASS(wxAnimationBase, wxObject)
|
||||||
IMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl)
|
IMPLEMENT_ABSTRACT_CLASS(wxAnimationCtrlBase, wxControl)
|
||||||
|
|
||||||
void wxAnimationCtrlBase::SetInactiveBitmap(const wxBitmap &bmp)
|
|
||||||
{
|
|
||||||
m_bmpStatic = bmp;
|
|
||||||
m_bmpStatic.UnShare();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif // wxUSE_ANIMATIONCTRL
|
#endif // wxUSE_ANIMATIONCTRL
|
||||||
|
@@ -343,7 +343,7 @@ void wxAnimationCtrl::SetAnimation(const wxAnimation& animation)
|
|||||||
|
|
||||||
void wxAnimationCtrl::SetInactiveBitmap(const wxBitmap &bmp)
|
void wxAnimationCtrl::SetInactiveBitmap(const wxBitmap &bmp)
|
||||||
{
|
{
|
||||||
wxAnimationCtrlBase::SetInactiveBitmap(bmp);
|
m_bmpStatic = bmp;
|
||||||
|
|
||||||
// if not playing, update the backing store now
|
// if not playing, update the backing store now
|
||||||
if (!IsPlaying())
|
if (!IsPlaying())
|
||||||
@@ -630,10 +630,21 @@ void wxAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
// NB: resizing an animation control may take a lot of time
|
// NB: resizing an animation control may take a lot of time
|
||||||
// for big animations as the backing store must be
|
// for big animations as the backing store must be
|
||||||
// extended and rebuilt. Try to avoid it!!
|
// extended and rebuilt. Try to avoid it e.g. using
|
||||||
|
// a null proportion value for your wxAnimationCtrls
|
||||||
|
// when using them inside sizers.
|
||||||
if (m_animation.IsOk())
|
if (m_animation.IsOk())
|
||||||
|
{
|
||||||
|
// be careful to change the backing store *only* if we are
|
||||||
|
// playing the animation as otherwise we may be displaying
|
||||||
|
// the inactive bitmap and overwriting the backing store
|
||||||
|
// with the last played frame is wrong in this case
|
||||||
|
if (IsPlaying())
|
||||||
|
{
|
||||||
if (!RebuildBackingStoreUpToFrame(m_currentFrame))
|
if (!RebuildBackingStoreUpToFrame(m_currentFrame))
|
||||||
Stop(); // in case we are playing
|
Stop(); // in case we are playing
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_ANIMATIONCTRL
|
#endif // wxUSE_ANIMATIONCTRL
|
||||||
|
@@ -320,7 +320,7 @@ void wxAnimationCtrl::Stop()
|
|||||||
|
|
||||||
void wxAnimationCtrl::SetInactiveBitmap(const wxBitmap &bmp)
|
void wxAnimationCtrl::SetInactiveBitmap(const wxBitmap &bmp)
|
||||||
{
|
{
|
||||||
wxAnimationCtrlBase::SetInactiveBitmap(bmp);
|
m_bmpStatic = bmp;
|
||||||
|
|
||||||
// update the pixbuf associated with m_widget now...
|
// update the pixbuf associated with m_widget now...
|
||||||
if (!IsPlaying())
|
if (!IsPlaying())
|
||||||
|
Reference in New Issue
Block a user