Changeset 55039 in webkit


Ignore:
Timestamp:
Feb 19, 2010 4:45:45 PM (14 years ago)
Author:
pkasting@chromium.org
Message:

Fix regression in calculating an animated image's start time.
https://bugs.webkit.org/show_bug.cgi?id=35115

Reviewed by Adam Barth.

  • platform/graphics/BitmapImage.cpp:

(WebCore::BitmapImage::startAnimation):

Location:
trunk/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r55036 r55039  
     12010-02-18  Peter Kasting  <pkasting@google.com>
     2
     3        Reviewed by Adam Barth.
     4
     5        Fix regression in calculating an animated image's start time.
     6        https://bugs.webkit.org/show_bug.cgi?id=35115
     7
     8        * platform/graphics/BitmapImage.cpp:
     9        (WebCore::BitmapImage::startAnimation):
     10
    1112010-02-19  Alexey Proskuryakov  <ap@apple.com>
    212
  • trunk/WebCore/platform/graphics/BitmapImage.cpp

    r54919 r55039  
    267267        return;
    268268
     269    // If we aren't already animating, set now as the animation start time.
     270    const double time = currentTime();
     271    if (!m_desiredFrameStartTime)
     272        m_desiredFrameStartTime = time;
     273
    269274    // Don't advance the animation to an incomplete frame.
    270275    size_t nextFrame = (m_currentFrame + 1) % frameCount();
     
    283288    // rate regardless of how fast it's being repainted.
    284289    const double currentDuration = frameDurationAtIndex(m_currentFrame);
    285     const double time = currentTime();
    286     if (m_desiredFrameStartTime == 0) {
     290    m_desiredFrameStartTime += currentDuration;
     291
     292    // When an animated image is more than five minutes out of date, the
     293    // user probably doesn't care about resyncing and we could burn a lot of
     294    // time looping through frames below.  Just reset the timings.
     295    const double cAnimationResyncCutoff = 5 * 60;
     296    if ((time - m_desiredFrameStartTime) > cAnimationResyncCutoff)
    287297        m_desiredFrameStartTime = time + currentDuration;
    288     } else {
    289         m_desiredFrameStartTime += currentDuration;
    290 
    291         // When an animated image is more than five minutes out of date, the
    292         // user probably doesn't care about resyncing and we could burn a lot of
    293         // time looping through frames below.  Just reset the timings.
    294         const double cAnimationResyncCutoff = 5 * 60;
    295         if ((time - m_desiredFrameStartTime) > cAnimationResyncCutoff)
    296             m_desiredFrameStartTime = time + currentDuration;
    297     }
    298298
    299299    // The image may load more slowly than it's supposed to animate, so that by
     
    308308    // during that initial loop, then switch back later.
    309309    if (nextFrame == 0 && m_repetitionsComplete == 0 && m_desiredFrameStartTime < time)
    310       m_desiredFrameStartTime = time;
     310        m_desiredFrameStartTime = time;
    311311
    312312    if (!catchUpIfNecessary || time < m_desiredFrameStartTime) {
Note: See TracChangeset for help on using the changeset viewer.