Changeset 167356 in webkit


Ignore:
Timestamp:
Apr 16, 2014 10:50:57 AM (10 years ago)
Author:
Simon Fraser
Message:

Convert the boolean param of Image::startAnimation() to an enum
https://bugs.webkit.org/show_bug.cgi?id=131742

Reviewed by Tim Horton.

Use an enum to make the code more readable.

  • platform/graphics/BitmapImage.cpp:

(WebCore::BitmapImage::startAnimation):

  • platform/graphics/BitmapImage.h:
  • platform/graphics/Image.cpp:

(WebCore::Image::drawTiled):

  • platform/graphics/Image.h:

(WebCore::Image::startAnimation):

  • svg/graphics/SVGImage.cpp:

(WebCore::SVGImage::startAnimation):

  • svg/graphics/SVGImage.h:
Location:
trunk/Source/WebCore
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r167353 r167356  
     12014-04-16  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Convert the boolean param of Image::startAnimation() to an enum
     4        https://bugs.webkit.org/show_bug.cgi?id=131742
     5
     6        Reviewed by Tim Horton.
     7
     8        Use an enum to make the code more readable.
     9
     10        * platform/graphics/BitmapImage.cpp:
     11        (WebCore::BitmapImage::startAnimation):
     12        * platform/graphics/BitmapImage.h:
     13        * platform/graphics/Image.cpp:
     14        (WebCore::Image::drawTiled):
     15        * platform/graphics/Image.h:
     16        (WebCore::Image::startAnimation):
     17        * svg/graphics/SVGImage.cpp:
     18        (WebCore::SVGImage::startAnimation):
     19        * svg/graphics/SVGImage.h:
     20
    1212014-04-16  David Hyatt  <hyatt@apple.com>
    222
  • trunk/Source/WebCore/platform/graphics/BitmapImage.cpp

    r166582 r167356  
    540540}
    541541
    542 void BitmapImage::startAnimation(bool catchUpIfNecessary)
     542void BitmapImage::startAnimation(CatchUpAnimation catchUpIfNecessary)
    543543{
    544544    if (m_frameTimer || !shouldAnimate() || frameCount() <= 1)
     
    594594        m_desiredFrameStartTime = time;
    595595
    596     if (!catchUpIfNecessary || time < m_desiredFrameStartTime) {
     596    if (catchUpIfNecessary == DoNotCatchUp || time < m_desiredFrameStartTime) {
    597597        // Haven't yet reached time for next frame to start; delay until then.
    598598        m_frameTimer = std::make_unique<Timer<BitmapImage>>(this, &BitmapImage::advanceAnimation);
     
    637637            // as possible, so force startAnimation() to set a zero-delay timer
    638638            // and bail out if we're not caught up.
    639             startAnimation(false);
     639            startAnimation(DoNotCatchUp);
    640640        }
    641641    }
  • trunk/Source/WebCore/platform/graphics/BitmapImage.h

    r166582 r167356  
    273273    int repetitionCount(bool imageKnownToBeComplete);  // |imageKnownToBeComplete| should be set if the caller knows the entire image has been decoded.
    274274    bool shouldAnimate();
    275     virtual void startAnimation(bool catchUpIfNecessary = true) override;
     275    virtual void startAnimation(CatchUpAnimation = CatchUp) override;
    276276    void advanceAnimation(Timer<BitmapImage>&);
    277277
  • trunk/Source/WebCore/platform/graphics/Image.cpp

    r166582 r167356  
    186186
    187187#if PLATFORM(IOS)
    188     startAnimation(false);
     188    startAnimation(DoNotCatchUp);
    189189#else
    190190    startAnimation();
     
    224224
    225225#if PLATFORM(IOS)
    226     startAnimation(false);
     226    startAnimation(DoNotCatchUp);
    227227#else
    228228    startAnimation();
  • trunk/Source/WebCore/platform/graphics/Image.h

    r166582 r167356  
    116116    // Animation begins whenever someone draws the image, so startAnimation() is not normally called.
    117117    // It will automatically pause once all observers no longer want to render the image anywhere.
    118     virtual void startAnimation(bool /*catchUpIfNecessary*/ = true) { }
     118    enum CatchUpAnimation { DoNotCatchUp, CatchUp };
     119    virtual void startAnimation(CatchUpAnimation = CatchUp) { }
    119120    virtual void stopAnimation() {}
    120121    virtual void resetAnimation() {}
  • trunk/Source/WebCore/svg/graphics/SVGImage.cpp

    r166582 r167356  
    317317
    318318// FIXME: support catchUpIfNecessary.
    319 void SVGImage::startAnimation(bool /* catchUpIfNecessary */)
     319void SVGImage::startAnimation(CatchUpAnimation)
    320320{
    321321    if (!m_page)
  • trunk/Source/WebCore/svg/graphics/SVGImage.h

    r166582 r167356  
    6161    virtual bool hasRelativeHeight() const override;
    6262
    63     virtual void startAnimation(bool /*catchUpIfNecessary*/ = true) override;
     63    virtual void startAnimation(CatchUpAnimation = CatchUp) override;
    6464    virtual void stopAnimation() override;
    6565    virtual void resetAnimation() override;
Note: See TracChangeset for help on using the changeset viewer.