本文整理汇总了C++中AnimationPlayer::compositorPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ AnimationPlayer::compositorPlayer方法的具体用法?C++ AnimationPlayer::compositorPlayer怎么用?C++ AnimationPlayer::compositorPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnimationPlayer
的用法示例。
在下文中一共展示了AnimationPlayer::compositorPlayer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startAnimationOnCompositor
bool CompositorAnimations::startAnimationOnCompositor(const Element& element, int group, double startTime, double timeOffset, const Timing& timing, const AnimationPlayer& player, const AnimationEffect& effect, Vector<int>& startedAnimationIds, double playerPlaybackRate)
{
ASSERT(startedAnimationIds.isEmpty());
ASSERT(isCandidateForAnimationOnCompositor(timing, element, &player, effect, playerPlaybackRate));
ASSERT(canStartAnimationOnCompositor(element));
const KeyframeEffectModelBase& keyframeEffect = toKeyframeEffectModelBase(effect);
DeprecatedPaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
ASSERT(layer);
Vector<OwnPtr<WebCompositorAnimation>> animations;
CompositorAnimationsImpl::getAnimationOnCompositor(timing, group, startTime, timeOffset, keyframeEffect, animations, playerPlaybackRate);
ASSERT(!animations.isEmpty());
for (auto& animation : animations) {
int id = animation->id();
if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
ASSERT(compositorPlayer);
compositorPlayer->addAnimation(animation.leakPtr());
} else if (!layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->addAnimation(animation.release())) {
// FIXME: We should know ahead of time whether these animations can be started.
for (int startedAnimationId : startedAnimationIds)
cancelAnimationOnCompositor(element, player, startedAnimationId);
startedAnimationIds.clear();
return false;
}
startedAnimationIds.append(id);
}
ASSERT(!startedAnimationIds.isEmpty());
return true;
}
示例2: attachCompositedLayers
void CompositorAnimations::attachCompositedLayers(const Element& element, const AnimationPlayer& player)
{
ASSERT(element.layoutObject());
DeprecatedPaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
ASSERT(layer);
WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
ASSERT(compositorPlayer);
ASSERT(layer->compositedDeprecatedPaintLayerMapping());
compositorPlayer->attachLayer(layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->platformLayer());
}
示例3: pauseAnimationForTestingOnCompositor
void CompositorAnimations::pauseAnimationForTestingOnCompositor(const Element& element, const AnimationPlayer& player, int id, double pauseTime)
{
// FIXME: canStartAnimationOnCompositor queries compositingState, which is not necessarily up to date.
// https://code.google.com/p/chromium/issues/detail?id=339847
DisableCompositingQueryAsserts disabler;
if (!canStartAnimationOnCompositor(element)) {
ASSERT_NOT_REACHED();
return;
}
if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
ASSERT(compositorPlayer);
compositorPlayer->pauseAnimation(id, pauseTime);
} else {
toLayoutBoxModelObject(element.layoutObject())->layer()->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->pauseAnimation(id, pauseTime);
}
}
示例4: cancelAnimationOnCompositor
void CompositorAnimations::cancelAnimationOnCompositor(const Element& element, const AnimationPlayer& player, int id)
{
if (!canStartAnimationOnCompositor(element)) {
// When an element is being detached, we cancel any associated
// AnimationPlayers for CSS animations. But by the time we get
// here the mapping will have been removed.
// FIXME: Defer remove/pause operations until after the
// compositing update.
return;
}
if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled()) {
WebCompositorAnimationPlayer* compositorPlayer = player.compositorPlayer();
ASSERT(compositorPlayer);
compositorPlayer->removeAnimation(id);
} else {
toLayoutBoxModelObject(element.layoutObject())->layer()->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->removeAnimation(id);
}
}
示例5: canAttachCompositedLayers
bool CompositorAnimations::canAttachCompositedLayers(const Element& element, const AnimationPlayer& player)
{
if (!RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled())
return false;
if (!player.compositorPlayer())
return false;
if (!element.layoutObject() || !element.layoutObject()->isBoxModelObject())
return false;
DeprecatedPaintLayer* layer = toLayoutBoxModelObject(element.layoutObject())->layer();
if (!layer || !layer->isAllowedToQueryCompositingState()
|| !layer->compositedDeprecatedPaintLayerMapping()
|| !layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer())
return false;
if (!layer->compositedDeprecatedPaintLayerMapping()->mainGraphicsLayer()->platformLayer())
return false;
return true;
}