зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1454550 - Call AnimationHelper::SampleAnimationForEachNode only for layers that have animations. r=kats
This is slightly efficient since we don't need to call GetBaseAnimationStyle() or we do skip allocating animation data for such case. MozReview-Commit-ID: BYFNwZsZ1oE --HG-- extra : rebase_source : 441d7431bd444f1513a32d4da3c206c7df34ed94
This commit is contained in:
Родитель
f6e88dec70
Коммит
e53f74cb86
|
@ -134,7 +134,7 @@ CompositorAnimationStorage::SetAnimations(uint64_t aId, const AnimationArray& aV
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
void
|
||||||
AnimationHelper::SampleAnimationForEachNode(
|
AnimationHelper::SampleAnimationForEachNode(
|
||||||
TimeStamp aTime,
|
TimeStamp aTime,
|
||||||
AnimationArray& aAnimations,
|
AnimationArray& aAnimations,
|
||||||
|
@ -142,19 +142,13 @@ AnimationHelper::SampleAnimationForEachNode(
|
||||||
AnimationValue& aAnimationValue,
|
AnimationValue& aAnimationValue,
|
||||||
bool& aHasInEffectAnimations)
|
bool& aHasInEffectAnimations)
|
||||||
{
|
{
|
||||||
bool activeAnimations = false;
|
MOZ_ASSERT(!aAnimations.IsEmpty(), "Should be called with animations");
|
||||||
|
|
||||||
if (aAnimations.IsEmpty()) {
|
|
||||||
return activeAnimations;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process in order, since later aAnimations override earlier ones.
|
// Process in order, since later aAnimations override earlier ones.
|
||||||
for (size_t i = 0, iEnd = aAnimations.Length(); i < iEnd; ++i) {
|
for (size_t i = 0, iEnd = aAnimations.Length(); i < iEnd; ++i) {
|
||||||
Animation& animation = aAnimations[i];
|
Animation& animation = aAnimations[i];
|
||||||
AnimData& animData = aAnimationData[i];
|
AnimData& animData = aAnimationData[i];
|
||||||
|
|
||||||
activeAnimations = true;
|
|
||||||
|
|
||||||
MOZ_ASSERT((!animation.originTime().IsNull() &&
|
MOZ_ASSERT((!animation.originTime().IsNull() &&
|
||||||
animation.startTime().type() ==
|
animation.startTime().type() ==
|
||||||
MaybeTimeDuration::TTimeDuration) ||
|
MaybeTimeDuration::TTimeDuration) ||
|
||||||
|
@ -258,7 +252,6 @@ AnimationHelper::SampleAnimationForEachNode(
|
||||||
"All of members of TransformData should be the same");
|
"All of members of TransformData should be the same");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return activeAnimations;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct BogusAnimation {};
|
struct BogusAnimation {};
|
||||||
|
@ -514,6 +507,10 @@ AnimationHelper::SampleAnimations(CompositorAnimationStorage* aStorage,
|
||||||
!iter.Done(); iter.Next()) {
|
!iter.Done(); iter.Next()) {
|
||||||
bool hasInEffectAnimations = false;
|
bool hasInEffectAnimations = false;
|
||||||
AnimationArray* animations = iter.UserData();
|
AnimationArray* animations = iter.UserData();
|
||||||
|
if (animations->IsEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
AnimationValue animationValue;
|
AnimationValue animationValue;
|
||||||
InfallibleTArray<AnimData> animationData;
|
InfallibleTArray<AnimData> animationData;
|
||||||
AnimationHelper::SetAnimations(*animations,
|
AnimationHelper::SetAnimations(*animations,
|
||||||
|
|
|
@ -196,10 +196,8 @@ public:
|
||||||
/**
|
/**
|
||||||
* Sample animations based on a given time stamp for a element(layer) with
|
* Sample animations based on a given time stamp for a element(layer) with
|
||||||
* its animation data.
|
* its animation data.
|
||||||
* Returns true if there exists compositor animation, and stores corresponding
|
|
||||||
* animated value in |aAnimationValue|.
|
|
||||||
*/
|
*/
|
||||||
static bool
|
static void
|
||||||
SampleAnimationForEachNode(TimeStamp aTime,
|
SampleAnimationForEachNode(TimeStamp aTime,
|
||||||
AnimationArray& aAnimations,
|
AnimationArray& aAnimations,
|
||||||
InfallibleTArray<AnimData>& aAnimationData,
|
InfallibleTArray<AnimData>& aAnimationData,
|
||||||
|
|
|
@ -649,17 +649,20 @@ SampleAnimations(Layer* aLayer,
|
||||||
aLayer,
|
aLayer,
|
||||||
[&] (Layer* layer)
|
[&] (Layer* layer)
|
||||||
{
|
{
|
||||||
|
AnimationArray& animations = layer->GetAnimations();
|
||||||
|
if (animations.IsEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
isAnimating = true;
|
||||||
bool hasInEffectAnimations = false;
|
bool hasInEffectAnimations = false;
|
||||||
AnimationValue animationValue = layer->GetBaseAnimationStyle();
|
AnimationValue animationValue = layer->GetBaseAnimationStyle();
|
||||||
if (AnimationHelper::SampleAnimationForEachNode(aTime,
|
AnimationHelper::SampleAnimationForEachNode(aTime,
|
||||||
layer->GetAnimations(),
|
animations,
|
||||||
layer->GetAnimationData(),
|
layer->GetAnimationData(),
|
||||||
animationValue,
|
animationValue,
|
||||||
hasInEffectAnimations)) {
|
hasInEffectAnimations);
|
||||||
isAnimating = true;
|
|
||||||
}
|
|
||||||
if (hasInEffectAnimations) {
|
if (hasInEffectAnimations) {
|
||||||
Animation& animation = layer->GetAnimations().LastElement();
|
Animation& animation = animations.LastElement();
|
||||||
ApplyAnimatedValue(layer,
|
ApplyAnimatedValue(layer,
|
||||||
aStorage,
|
aStorage,
|
||||||
animation.property(),
|
animation.property(),
|
||||||
|
|
Загрузка…
Ссылка в новой задаче