]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/animateg.cpp
Wine fixes
[wxWidgets.git] / src / generic / animateg.cpp
index 2035cbb4f4b665900d77c7a0972600e2d1561801..4f793eac482f1272336ad7e8f19d8a9d8bdcdbfc 100644 (file)
@@ -343,7 +343,7 @@ void wxAnimationCtrl::SetAnimation(const wxAnimation& animation)
 
 void wxAnimationCtrl::SetInactiveBitmap(const wxBitmap &bmp)
 {
-    wxAnimationCtrlBase::SetInactiveBitmap(bmp);
+    m_bmpStatic = bmp;
 
     // if not playing, update the backing store now
     if (!IsPlaying())
@@ -373,15 +373,11 @@ bool wxAnimationCtrl::Play(bool looped)
     if (!m_animation.IsOk())
         return false;
 
-    int oldframe = m_currentFrame;
     m_looped = looped;
     m_currentFrame = 0;
 
-    // small optimization: if the back store was already updated to the
-    // first frame, don't rebuild it
-    if (oldframe != 0)
-        if (!RebuildBackingStoreUpToFrame(0))
-            return false;
+    if (!RebuildBackingStoreUpToFrame(0))
+        return false;
 
     m_isPlaying = true;
 
@@ -630,10 +626,21 @@ void wxAnimationCtrl::OnSize(wxSizeEvent &WXUNUSED(event))
 {
     // NB: resizing an animation control may take a lot of time
     //     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())
+    {
+        // 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))
             Stop();     // in case we are playing
+        }
+    }
 }
 
 #endif      // wxUSE_ANIMATIONCTRL