Commit d022052a authored by hyatt's avatar hyatt
Browse files

Fix regression from throwing away frames of large animated images. Alter

        animated images so that they refuse to advance the animation until the
        current displayed frame has been fully decoded.

        Reviewed by ggaren

        * platform/graphics/BitmapImage.cpp:
        (WebCore::BitmapImage::startAnimation):
        (WebCore::BitmapImage::advanceAnimation):
        * platform/graphics/ImageSource.h:
        * platform/graphics/cg/ImageSourceCG.cpp:
        (WebCore::ImageSource::frameIsCompleteAtIndex):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20070 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 588ba974
2007-03-08 David Hyatt <hyatt@apple.com>
Fix regression from throwing away frames of large animated images. Alter
animated images so that they refuse to advance the animation until the
current displayed frame has been fully decoded.
Reviewed by ggaren
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::startAnimation):
(WebCore::BitmapImage::advanceAnimation):
* platform/graphics/ImageSource.h:
* platform/graphics/cg/ImageSourceCG.cpp:
(WebCore::ImageSource::frameIsCompleteAtIndex):
2007-03-08 David Hyatt <hyatt@apple.com>
 
Fix 2% performance regression on the PLT. Increase the large animated
......
......@@ -209,6 +209,10 @@ void BitmapImage::startAnimation()
if (m_frameTimer || !shouldAnimate() || frameCount() <= 1)
return;
// Don't advance the animation until the current frame has completely loaded.
if (!m_source.frameIsCompleteAtIndex(m_currentFrame))
return;
m_frameTimer = new Timer<BitmapImage>(this, &BitmapImage::advanceAnimation);
m_frameTimer->startOneShot(frameDurationAtIndex(m_currentFrame));
}
......@@ -275,7 +279,10 @@ void BitmapImage::advanceAnimation(Timer<BitmapImage>* timer)
}
}
// Kick off a timer to move to the next frame.
// Kick off a timer to move to the next frame, but only if the current frame is complete.
if (!m_source.frameIsCompleteAtIndex(m_currentFrame))
return;
m_frameTimer = new Timer<BitmapImage>(this, &BitmapImage::advanceAnimation);
m_frameTimer->startOneShot(frameDurationAtIndex(m_currentFrame));
}
......
......@@ -86,6 +86,7 @@ public:
float frameDurationAtIndex(size_t);
bool frameHasAlphaAtIndex(size_t); // Whether or not the frame actually used any alpha.
bool frameIsCompleteAtIndex(size_t); // Whether or not the frame is completely decoded.
private:
NativeImageSourcePtr m_decoder;
......
......@@ -155,6 +155,11 @@ void ImageSource::destroyFrameAtIndex(size_t index)
CGImageRelease(image);
}
bool ImageSource::frameIsCompleteAtIndex(size_t index)
{
return CGImageSourceGetStatusAtIndex(m_decoder, index) == kCGImageStatusComplete;
}
float ImageSource::frameDurationAtIndex(size_t index)
{
float duration = 0;
......
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