Commit 4ac94e6c authored by eric@webkit.org's avatar eric@webkit.org
Browse files

2008-09-18 Peter Kasting <pkasting@google.com>

        Reviewed by hyatt.  Landed by eseidel.

        https://bugs.webkit.org/show_bug.cgi?id=20745
        Animated GIFs do not animate properly with (at least) CG.

        * WebCore\platform\graphics\BitmapImage.cpp:
        * WebCore\platform\graphics\BitmapImage.h:
        * WebCore\platform\graphics\cairo\ImageCairo.cpp:
        * WebCore\platform\graphics\cg\ImageCG.cpp:
        * WebCore\platform\graphics\qt\ImageQt.cpp:
        * WebCore\platform\graphics\wx\ImageWx.cpp:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@36628 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 2a72d8f2
2008-09-18 Peter Kasting <pkasting@google.com>
Reviewed by hyatt. Landed by eseidel.
https://bugs.webkit.org/show_bug.cgi?id=20745
Animated GIFs do not animate properly with (at least) CG.
* WebCore\platform\graphics\BitmapImage.cpp:
* WebCore\platform\graphics\BitmapImage.h:
* WebCore\platform\graphics\cairo\ImageCairo.cpp:
* WebCore\platform\graphics\cg\ImageCG.cpp:
* WebCore\platform\graphics\qt\ImageQt.cpp:
* WebCore\platform\graphics\wx\ImageWx.cpp:
2008-09-18 Chris Fleizach <cfleizach@apple.com>
Reviewed by Beth Dakin
......@@ -4354,7 +4368,7 @@
* platform/graphics/cairo/FontCairo.cpp:
(WebCore::Font::drawGlyphs):
2008-09-03 Peter Kasting <zerodpx@gmail.com>
2008-09-03 Peter Kasting <pkasting@google.com>
Reviewed by Dave Hyatt.
......
......@@ -130,6 +130,7 @@ void BitmapImage::cacheFrame(size_t index)
if (numFrames == 1 && m_frames[index].m_frame)
checkForSolidColor();
m_frames[index].m_isComplete = m_source.frameIsCompleteAtIndex(index);
if (shouldAnimate())
m_frames[index].m_duration = m_source.frameDurationAtIndex(index);
m_frames[index].m_hasAlpha = m_source.frameHasAlphaAtIndex(index);
......@@ -214,6 +215,17 @@ NativeImagePtr BitmapImage::frameAtIndex(size_t index)
return m_frames[index].m_frame;
}
bool BitmapImage::frameIsCompleteAtIndex(size_t index)
{
if (index >= frameCount())
return true;
if (index >= m_frames.size() || !m_frames[index].m_frame)
cacheFrame(index);
return m_frames[index].m_isComplete;
}
float BitmapImage::frameDurationAtIndex(size_t index)
{
if (index >= frameCount())
......@@ -247,7 +259,7 @@ void BitmapImage::startAnimation()
return;
// Don't advance the animation until the current frame has completely loaded.
if (!m_source.frameIsCompleteAtIndex(m_currentFrame))
if (!frameIsCompleteAtIndex(m_currentFrame))
return;
// Don't advance past the last frame if we haven't decoded the whole image
......@@ -282,7 +294,7 @@ void BitmapImage::startAnimation()
// See if we've also passed the time for frames after that to start, in
// case we need to skip some frames entirely.
size_t nextFrame = (m_currentFrame + 1) % frameCount();
while (m_source.frameIsCompleteAtIndex(nextFrame)) {
while (frameIsCompleteAtIndex(nextFrame)) {
// Should we skip the current frame?
double nextFrameStartTime = m_desiredFrameStartTime + frameDurationAtIndex(nextFrame);
if (time < nextFrameStartTime)
......
......@@ -66,6 +66,7 @@ template <typename T> class Timer;
struct FrameData : Noncopyable {
FrameData()
: m_frame(0)
, m_isComplete(false)
, m_duration(0)
, m_hasAlpha(true)
{
......@@ -79,6 +80,7 @@ struct FrameData : Noncopyable {
void clear();
NativeImagePtr m_frame;
bool m_isComplete;
float m_duration;
bool m_hasAlpha;
};
......@@ -150,6 +152,7 @@ protected:
size_t currentFrame() const { return m_currentFrame; }
size_t frameCount();
NativeImagePtr frameAtIndex(size_t);
bool frameIsCompleteAtIndex(size_t);
float frameDurationAtIndex(size_t);
bool frameHasAlphaAtIndex(size_t);
......
......@@ -43,6 +43,7 @@ void FrameData::clear()
if (m_frame) {
cairo_surface_destroy(m_frame);
m_frame = 0;
m_isComplete = false;
m_duration = 0.;
m_hasAlpha = true;
}
......
......@@ -52,6 +52,7 @@ void FrameData::clear()
if (m_frame) {
CGImageRelease(m_frame);
m_frame = 0;
m_isComplete = false;
m_duration = 0.0f;
m_hasAlpha = true;
}
......
......@@ -73,6 +73,7 @@ void FrameData::clear()
{
if (m_frame) {
m_frame = 0;
m_isComplete = false;
m_duration = 0.0f;
m_hasAlpha = true;
}
......
......@@ -57,6 +57,7 @@ void FrameData::clear()
if (m_frame) {
delete m_frame;
m_frame = 0;
m_isComplete = false;
m_duration = 0.;
m_hasAlpha = true;
}
......
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