User:Shellylin/Async Animations and OMTA: Difference between revisions

Jump to navigation Jump to search
Line 1: Line 1:
== Add layers::Animation into mAnimations of Layer ==
== Add layers::Animation into mAnimations of Layer ==


nsDisplayTransform::BuildLayer()
  nsDisplayTransform::BuildLayer()
 
  |-> '''AddAnimationsAndTransitionsToLayer'''(Layer* aLayer, nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem, nsCSSProperty aProperty)
|-> AddAnimationsAndTransitionsToLayer(Layer* aLayer, nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem, nsCSSProperty aProperty)
     |-> aLayer->ClearAnimations();
     |-> aLayer->ClearAnimations();
(Rest of the part below is skipped if OMTA is not supported nor async animations is not supported.)
Rest of the part below is skipped if OMTA is not supported nor async animations is not supported.
    |-> Check to see if the animations(transitions) can perform on compositor thread.
1. Check to see if the animations(transitions) can perform on compositor thread.
    |-> ElementTransitions* et = nsTransitionManager::GetTransitionsForCompositor(content, aProperty);
   
        ElementAnimations* ea = nsAnimationManager::GetAnimationsForCompositor(content, aProperty);
2. Check to see if async animations is enabled (Can draw by GPU), currently, only Display type of Transform and Opacity adapt OMTA.
     |-> aItem->CanUseAsyncAnimations(aBuilder)
     |-> aItem->CanUseAsyncAnimations(aBuilder)
        - Check to see if this item can use async animations. (Can draw by GPU), currently, only Display type of Transform and Opacity adapt OMTA.
3. Set up some extra information for transformation, so that a gfx3DMatrix can applied directly to the layer. (defined in LayersMessage.ipdlh)
    |-> some implementation here.
     |-> AnimationData data = TransformData(...);
     |-> AnimationData data = TransformData(...);
        - Set up some extra information for transformation, so that a gfx3DMatrix can applied directly to the layer. (defined in LayersMessage.ipdlh)
     |
     |
     |   For each ElementAnimation in ea:
4. For each ElementPropertyTransition in et, convert its transition properties into a ElementAnimation, and add it to aLayer (details describe in section 5).
     |-> ElementPropertyTransition* pt = &et->mPropertyTransitions[tranIdx];
    |-> ElementAnimation anim;
    |-> ''AddAnimationsForProperty(frame, aProperty, &anim, aLayer, data);''
5. For each ElementAnimation (anim) in ElementAnimations (ea), extract some data out from anim, create a layers::Animation from those data, and append this new created layers::Animation to the animation list of aLayer (mAnimations).
     |-> ElementAnimation* anim = &ea->mAnimations[animIdx];
     |-> ElementAnimation* anim = &ea->mAnimations[animIdx];
     |-> AddAnimationsForProperty(frame, aProperty, anim, aLayer, data);
     |-> ''AddAnimationsForProperty(frame, aProperty, anim, aLayer, data);''
         |-> layers::Animation* animation = aLayer->AddAnimation()
         |-> layers::Animation* animation = aLayer->AddAnimation(startTime, duration,
            - Add an Animation to the layer, and return it.
                                                                iterations, direction,
        For each segment in a anim:
                                                                aProperty, aData)
5.1 For each segment in a anim:
             |-> AddTransformFunctions()
             |-> AddTransformFunctions()
6. Update the number of animations.
     |-> aLayer->SetAnimationGeneration(a number);
     |-> aLayer->SetAnimationGeneration(a number);
Confirmed users
220

edits

Navigation menu