зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1637808 - Make SampleAnimations a member function of AsyncCompositionManager. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D75225
This commit is contained in:
Родитель
e5989d6961
Коммит
72a269999d
|
@ -10,6 +10,7 @@
|
|||
#include "Layers.h" // for Layer, ContainerLayer, etc
|
||||
#include "gfxPoint.h" // for gfxPoint, gfxSize
|
||||
#include "mozilla/ServoBindings.h" // for Servo_AnimationValue_GetOpacity, etc
|
||||
#include "mozilla/ScopeExit.h" // for MakeScopeExit
|
||||
#include "mozilla/StaticPrefs_apz.h"
|
||||
#include "mozilla/StaticPrefs_gfx.h"
|
||||
#include "mozilla/WidgetUtils.h" // for ComputeTransformForRotation
|
||||
|
@ -641,11 +642,19 @@ static void ApplyAnimatedValue(
|
|||
}
|
||||
}
|
||||
|
||||
static bool SampleAnimations(Layer* aLayer,
|
||||
CompositorAnimationStorage* aStorage,
|
||||
TimeStamp aPreviousFrameTime,
|
||||
TimeStamp aCurrentFrameTime) {
|
||||
bool AsyncCompositionManager::SampleAnimations(Layer* aLayer,
|
||||
TimeStamp aCurrentFrameTime) {
|
||||
bool isAnimating = false;
|
||||
CompositorAnimationStorage* storage =
|
||||
mCompositorBridge->GetAnimationStorage();
|
||||
|
||||
auto autoClearAnimationStorage = MakeScopeExit([&] {
|
||||
if (!isAnimating) {
|
||||
// Clean up the CompositorAnimationStorage because
|
||||
// there are no active animations running
|
||||
storage->Clear();
|
||||
}
|
||||
});
|
||||
|
||||
ForEachNode<ForwardIterator>(aLayer, [&](Layer* layer) {
|
||||
auto& propertyAnimationGroups = layer->GetPropertyAnimationGroups();
|
||||
|
@ -655,12 +664,12 @@ static bool SampleAnimations(Layer* aLayer,
|
|||
|
||||
isAnimating = true;
|
||||
AnimatedValue* previousValue =
|
||||
aStorage->GetAnimatedValue(layer->GetCompositorAnimationsId());
|
||||
storage->GetAnimatedValue(layer->GetCompositorAnimationsId());
|
||||
|
||||
nsTArray<RefPtr<RawServoAnimationValue>> animationValues;
|
||||
AnimationHelper::SampleResult sampleResult =
|
||||
AnimationHelper::SampleAnimationForEachNode(
|
||||
aPreviousFrameTime, aCurrentFrameTime, previousValue,
|
||||
mPreviousFrameTimeStamp, aCurrentFrameTime, previousValue,
|
||||
propertyAnimationGroups, animationValues);
|
||||
|
||||
const PropertyAnimationGroup& lastPropertyAnimationGroup =
|
||||
|
@ -671,8 +680,7 @@ static bool SampleAnimations(Layer* aLayer,
|
|||
// We assume all transform like properties (on the same frame) live in
|
||||
// a single same layer, so using the transform data of the last element
|
||||
// should be fine.
|
||||
ApplyAnimatedValue(layer, aStorage,
|
||||
lastPropertyAnimationGroup.mProperty,
|
||||
ApplyAnimatedValue(layer, storage, lastPropertyAnimationGroup.mProperty,
|
||||
animationValues);
|
||||
break;
|
||||
case AnimationHelper::SampleResult::Skipped:
|
||||
|
@ -687,7 +695,7 @@ static bool SampleAnimations(Layer* aLayer,
|
|||
// 1459775.
|
||||
// MOZ_ASSERT(FuzzyEqualsMultiplicative(
|
||||
// Servo_AnimationValue_GetOpacity(animationValue),
|
||||
// *(aStorage->GetAnimationOpacity(layer->GetCompositorAnimationsId()))));
|
||||
// *(storage->GetAnimationOpacity(layer->GetCompositorAnimationsId()))));
|
||||
#endif
|
||||
}
|
||||
// Even if opacity or background-color animation value has
|
||||
|
@ -1425,19 +1433,10 @@ bool AsyncCompositionManager::TransformShadowTree(
|
|||
return false;
|
||||
}
|
||||
|
||||
CompositorAnimationStorage* storage =
|
||||
mCompositorBridge->GetAnimationStorage();
|
||||
// First, compute and set the shadow transforms from OMT animations.
|
||||
// NB: we must sample animations *before* sampling pan/zoom
|
||||
// transforms.
|
||||
bool wantNextFrame =
|
||||
SampleAnimations(root, storage, mPreviousFrameTimeStamp, aCurrentFrame);
|
||||
|
||||
if (!wantNextFrame) {
|
||||
// Clean up the CompositorAnimationStorage because
|
||||
// there are no active animations running
|
||||
storage->Clear();
|
||||
}
|
||||
bool wantNextFrame = SampleAnimations(root, aCurrentFrame);
|
||||
|
||||
// Advance animations to the next expected vsync timestamp, if we can
|
||||
// get it.
|
||||
|
|
|
@ -220,6 +220,8 @@ class AsyncCompositionManager final {
|
|||
// layer
|
||||
void RecordShadowTransforms(Layer* aLayer);
|
||||
|
||||
bool SampleAnimations(Layer* aLayer, TimeStamp aCurrentFrameTime);
|
||||
|
||||
TargetConfig mTargetConfig;
|
||||
CSSRect mContentRect;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче