Changeset 147549 in webkit


Ignore:
Timestamp:
Apr 3, 2013 6:23:26 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

[GTK][AC] Implement matrix keyframe animations with clutter ac backend
https://bugs.webkit.org/show_bug.cgi?id=110314

Patch by ChangSeok Oh <ChangSeok Oh> on 2013-04-03
Reviewed by Gustavo Noronha Silva.

Clutter 1.12 doesn't support additive transform animations yet, So clutter ac backend
uses matrix animations for the case. This patch follows changeset 143369, 143343
to support matrix keyframe animations. I believe this change is easy if you understand
above two changesets.

Covered by existing animation tests.

  • platform/graphics/clutter/PlatformClutterAnimation.cpp:

(WebCore::PlatformClutterAnimation::setValues):
(WebCore::PlatformClutterAnimation::addClutterKeyframeTransitionForProperty):
(WebCore):
(WebCore::PlatformClutterAnimation::addTransformTransition):

  • platform/graphics/clutter/PlatformClutterAnimation.h:

(PlatformClutterAnimation):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r147548 r147549  
     12013-04-03  ChangSeok Oh  <changseok.oh@collabora.com>
     2
     3        [GTK][AC] Implement matrix keyframe animations with clutter ac backend
     4        https://bugs.webkit.org/show_bug.cgi?id=110314
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        Clutter 1.12 doesn't support additive transform animations yet, So clutter ac backend
     9        uses matrix animations for the case. This patch follows changeset 143369, 143343
     10        to support matrix keyframe animations. I believe this change is easy if you understand
     11        above two changesets.
     12
     13        Covered by existing animation tests.
     14
     15        * platform/graphics/clutter/PlatformClutterAnimation.cpp:
     16        (WebCore::PlatformClutterAnimation::setValues):
     17        (WebCore::PlatformClutterAnimation::addClutterKeyframeTransitionForProperty):
     18        (WebCore):
     19        (WebCore::PlatformClutterAnimation::addTransformTransition):
     20        * platform/graphics/clutter/PlatformClutterAnimation.h:
     21        (PlatformClutterAnimation):
     22
    1232013-04-03  Gustavo Noronha Silva  <gustavo.noronha@collabora.com>
    224
  • trunk/Source/WebCore/platform/graphics/clutter/PlatformClutterAnimation.cpp

    r147145 r147549  
    369369void PlatformClutterAnimation::setValues(const Vector<WebCore::TransformationMatrix>& value)
    370370{
    371     notImplemented();
     371    ASSERT(animationType() == Keyframe);
     372
     373    m_valuesMatrix = value;
    372374}
    373375
     
    523525
    524526    clutter_transition_group_add_transition(CLUTTER_TRANSITION_GROUP(m_animation.get()), transition.get());
     527
     528    for (unsigned i = 0; i < nKeyframes; ++i)
     529        g_value_unset(&keyValues.get()[i]);
     530}
     531
     532void PlatformClutterAnimation::addClutterKeyframeTransitionForProperty(const String& property, const Vector<WebCore::TransformationMatrix>& values)
     533{
     534    ASSERT(property != "NoProperty");
     535
     536    Vector<CoglMatrix> coglMatrices;
     537    for (unsigned i = 0; i < values.size(); ++i)
     538        coglMatrices.append(values[i]);
     539
     540    GRefPtr<ClutterTransition> transition = adoptGRef(clutter_keyframe_transition_new(property.utf8().data()));
     541    clutter_transition_set_from(transition.get(), CLUTTER_TYPE_MATRIX, coglMatrices.first());
     542    clutter_transition_set_to(transition.get(), CLUTTER_TYPE_MATRIX, coglMatrices.last());
     543
     544    // Ignore the first keyframe, since it's a '0' frame, meaningless.
     545    const unsigned nKeyframes = values.size() - 1;
     546    OwnArrayPtr<ClutterAnimationMode> animationModes = adoptArrayPtr(new ClutterAnimationMode[nKeyframes]);
     547    OwnArrayPtr<double> keyTimes = adoptArrayPtr(new double[nKeyframes]);
     548    GOwnPtr<GValue> keyValues(g_new0(GValue, nKeyframes));
     549
     550    for (unsigned i = 0; i < nKeyframes; ++i) {
     551        keyTimes[i] = static_cast<double>(m_keyTimes[i + 1]);
     552        animationModes[i] = toClutterAnimationMode(m_timingFunctions[i]);
     553        g_value_init(&keyValues.get()[i], CLUTTER_TYPE_MATRIX);
     554        g_value_set_boxed(&keyValues.get()[i], &coglMatrices[i + 1]);
     555    }
     556
     557    clutter_keyframe_transition_set_key_frames(CLUTTER_KEYFRAME_TRANSITION(transition.get()), nKeyframes, keyTimes.get());
     558    clutter_keyframe_transition_set_values(CLUTTER_KEYFRAME_TRANSITION(transition.get()), nKeyframes, keyValues.get());
     559    clutter_keyframe_transition_set_modes(CLUTTER_KEYFRAME_TRANSITION(transition.get()), nKeyframes, animationModes.get());
     560
     561    clutter_transition_group_add_transition(CLUTTER_TRANSITION_GROUP(m_animation.get()), transition.get());
     562
     563    clutter_interval_register_progress_func(CLUTTER_TYPE_MATRIX, clutterMatrixProgress);
    525564
    526565    for (unsigned i = 0; i < nKeyframes; ++i)
     
    606645        break;
    607646    case Matrix:
    608         addClutterTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_fromValueMatrix, m_toValueMatrix);
     647        if (isKeyframe)
     648            addClutterKeyframeTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_valuesMatrix);
     649        else
     650            addClutterTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_fromValueMatrix, m_toValueMatrix);
    609651        break;
    610652    default:
  • trunk/Source/WebCore/platform/graphics/clutter/PlatformClutterAnimation.h

    r143369 r147549  
    145145
    146146    void addClutterKeyframeTransitionForProperty(const String& property, const Vector<float>& values);
     147    void addClutterKeyframeTransitionForProperty(const String& property, const Vector<WebCore::TransformationMatrix>& values);
    147148    void addClutterKeyframeTransitionForProperty(const String& property, const Vector<FloatPoint3D>& values);
    148149
     
    177178    Vector<float> m_values;
    178179    Vector<FloatPoint3D> m_values3D;
     180    Vector<WebCore::TransformationMatrix> m_valuesMatrix;
    179181};
    180182
Note: See TracChangeset for help on using the changeset viewer.