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

From MozillaWiki
Jump to navigation Jump to search
 
Line 10: Line 10:
      
      
         ElementAnimations* ea = nsAnimationManager::GetAnimationsForCompositor(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.
2. Check to see if async animations is enabled (Can draw by GPU), but only Display type of Transform and Opacity adapt OMTA (Type check at Layers::SetAnimations()).
     |-> aItem->CanUseAsyncAnimations(aBuilder)
     |-> aItem->CanUseAsyncAnimations(aBuilder)
3. Set up some extra information for transformation, so that a gfx3DMatrix can applied directly to the layer. (defined in LayersMessage.ipdlh)
3. Set up some extra information for transformation, so that a gfx3DMatrix can applied directly to the layer. (defined in LayersMessage.ipdlh)
Line 28: Line 28:
5.1 For each segment in a anim:
5.1 For each segment in a anim:
             |-> AddTransformFunctions()
             |-> AddTransformFunctions()
6. Update the number of animations.
6. Update the number of generated animations.
     |-> aLayer->SetAnimationGeneration(a number);
     |-> aLayer->SetAnimationGeneration(a number);

Latest revision as of 21:03, 18 October 2013

Add layers::Animation into mAnimations of Layer

 nsDisplayTransform::BuildLayer()
 |-> AddAnimationsAndTransitionsToLayer(Layer* aLayer, nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem, nsCSSProperty aProperty)
   |-> aLayer->ClearAnimations();

Rest of the part below is skipped if OMTA is not supported nor async animations is not supported.

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), but only Display type of Transform and Opacity adapt OMTA (Type check at Layers::SetAnimations()).

   |-> aItem->CanUseAsyncAnimations(aBuilder)

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(...);
   |

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];
   |-> AddAnimationsForProperty(frame, aProperty, anim, aLayer, data);
       |-> layers::Animation* animation = aLayer->AddAnimation(startTime, duration,
                                                               iterations, direction,
                                                               aProperty, aData)

5.1 For each segment in a anim:

           |-> AddTransformFunctions()

6. Update the number of generated animations.

   |-> aLayer->SetAnimationGeneration(a number);