Changeset 248406 in webkit


Ignore:
Timestamp:
Aug 8, 2019 7:13:20 AM (5 years ago)
Author:
magomez@igalia.com
Message:

[GTK][WPE] Remove the reference to WebCore::Animation from TextureMapperAnimation
https://bugs.webkit.org/show_bug.cgi?id=200533

Reviewed by Žan Doberšek.

Pass the relevant parameters to TextureMapperAnimation instead of creating a new WebCore::Animation
inside it.

  • platform/graphics/texmap/TextureMapperAnimation.cpp:

(WebCore::timingFunctionForAnimationValue):
(WebCore::TextureMapperAnimation::TextureMapperAnimation):
(WebCore::TextureMapperAnimation::apply):
(WebCore::TextureMapperAnimation::isActive const):

  • platform/graphics/texmap/TextureMapperAnimation.h:

(WebCore::TextureMapperAnimation::keyframes const):
(WebCore::TextureMapperAnimation::timingFunction const):
(WebCore::TextureMapperAnimation::animation const): Deleted.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r248405 r248406  
     12019-08-08  Miguel Gomez  <magomez@igalia.com>
     2
     3        [GTK][WPE] Remove the reference to WebCore::Animation from TextureMapperAnimation
     4        https://bugs.webkit.org/show_bug.cgi?id=200533
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Pass the relevant parameters to TextureMapperAnimation instead of creating a new WebCore::Animation
     9        inside it.
     10
     11        * platform/graphics/texmap/TextureMapperAnimation.cpp:
     12        (WebCore::timingFunctionForAnimationValue):
     13        (WebCore::TextureMapperAnimation::TextureMapperAnimation):
     14        (WebCore::TextureMapperAnimation::apply):
     15        (WebCore::TextureMapperAnimation::isActive const):
     16        * platform/graphics/texmap/TextureMapperAnimation.h:
     17        (WebCore::TextureMapperAnimation::keyframes const):
     18        (WebCore::TextureMapperAnimation::timingFunction const):
     19        (WebCore::TextureMapperAnimation::animation const): Deleted.
     20
    1212019-08-08  Charlie Turner  <cturner@igalia.com>
    222
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp

    r246963 r248406  
    156156}
    157157
    158 static const TimingFunction& timingFunctionForAnimationValue(const AnimationValue& animationValue, const Animation& animation)
     158static const TimingFunction& timingFunctionForAnimationValue(const AnimationValue& animationValue, const TextureMapperAnimation& animation)
    159159{
    160160    if (animationValue.timingFunction())
     
    169169    , m_keyframes(keyframes)
    170170    , m_boxSize(boxSize)
    171     , m_animation(Animation::create(animation))
     171    , m_timingFunction(animation.timingFunction()->clone())
     172    , m_iterationCount(animation.iterationCount())
     173    , m_duration(animation.duration())
     174    , m_direction(animation.direction())
     175    , m_fillsForwards(animation.fillsForwards())
    172176    , m_listsMatch(listsMatch)
    173177    , m_startTime(startTime)
     
    183187    , m_keyframes(other.m_keyframes)
    184188    , m_boxSize(other.m_boxSize)
    185     , m_animation(Animation::create(*other.m_animation))
     189    , m_timingFunction(other.m_timingFunction->clone())
     190    , m_iterationCount(other.m_iterationCount)
     191    , m_duration(other.m_duration)
     192    , m_direction(other.m_direction)
     193    , m_fillsForwards(other.m_fillsForwards)
    186194    , m_listsMatch(other.m_listsMatch)
    187195    , m_startTime(other.m_startTime)
     
    199207
    200208    Seconds totalRunningTime = computeTotalRunningTime(time);
    201     double normalizedValue = normalizedAnimationValue(totalRunningTime.seconds(), m_animation->duration(), m_animation->direction(), m_animation->iterationCount());
    202 
    203     if (m_animation->iterationCount() != Animation::IterationCountInfinite && totalRunningTime.seconds() >= m_animation->duration() * m_animation->iterationCount()) {
     209    double normalizedValue = normalizedAnimationValue(totalRunningTime.seconds(), m_duration, m_direction, m_iterationCount);
     210
     211    if (m_iterationCount != Animation::IterationCountInfinite && totalRunningTime.seconds() >= m_duration * m_iterationCount) {
    204212        m_state = AnimationState::Stopped;
    205213        m_pauseTime = 0_s;
    206         if (m_animation->fillsForwards())
    207             normalizedValue = normalizedAnimationValueForFillsForwards(m_animation->iterationCount(), m_animation->direction());
     214        if (m_fillsForwards)
     215            normalizedValue = normalizedAnimationValueForFillsForwards(m_iterationCount, m_direction);
    208216    }
    209217
     
    220228    }
    221229    if (m_keyframes.size() == 2) {
    222         auto& timingFunction = timingFunctionForAnimationValue(m_keyframes.at(0), *m_animation);
    223         normalizedValue = timingFunction.transformTime(normalizedValue, m_animation->duration());
     230        auto& timingFunction = timingFunctionForAnimationValue(m_keyframes.at(0), *this);
     231        normalizedValue = timingFunction.transformTime(normalizedValue, m_duration);
    224232        applyInternal(applicationResults, m_keyframes.at(0), m_keyframes.at(1), normalizedValue);
    225233        return;
     
    233241
    234242        normalizedValue = (normalizedValue - from.keyTime()) / (to.keyTime() - from.keyTime());
    235         auto& timingFunction = timingFunctionForAnimationValue(from, *m_animation);
    236         normalizedValue = timingFunction.transformTime(normalizedValue, m_animation->duration());
     243        auto& timingFunction = timingFunctionForAnimationValue(from, *this);
     244        normalizedValue = timingFunction.transformTime(normalizedValue, m_duration);
    237245        applyInternal(applicationResults, from, to, normalizedValue);
    238246        break;
     
    282290bool TextureMapperAnimation::isActive() const
    283291{
    284     return m_state != AnimationState::Stopped || m_animation->fillsForwards();
     292    return m_state != AnimationState::Stopped || m_fillsForwards;
    285293}
    286294
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h

    r246963 r248406  
    5252    const String& name() const { return m_name; }
    5353    const KeyframeValueList& keyframes() const { return m_keyframes; }
    54     const RefPtr<Animation> animation() const { return m_animation; }
    5554    AnimationState state() const { return m_state; }
     55    TimingFunction* timingFunction() const { return m_timingFunction.get(); }
    5656
    5757private:
     
    6262    KeyframeValueList m_keyframes;
    6363    FloatSize m_boxSize;
    64     RefPtr<Animation> m_animation;
     64    RefPtr<TimingFunction> m_timingFunction;
     65    double m_iterationCount;
     66    double m_duration;
     67    Animation::AnimationDirection m_direction;
     68    bool m_fillsForwards;
    6569    bool m_listsMatch;
    6670    MonotonicTime m_startTime;
Note: See TracChangeset for help on using the changeset viewer.