本文整理汇总了C++中Layer::GetAnimationGeneration方法的典型用法代码示例。如果您正苦于以下问题:C++ Layer::GetAnimationGeneration方法的具体用法?C++ Layer::GetAnimationGeneration怎么用?C++ Layer::GetAnimationGeneration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Layer
的用法示例。
在下文中一共展示了Layer::GetAnimationGeneration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanThrottleTransformChanges
bool
CommonElementAnimationData::CanThrottleAnimation(TimeStamp aTime)
{
nsIFrame* frame = nsLayoutUtils::GetStyleFrame(mElement);
if (!frame) {
return false;
}
bool hasTransform = HasAnimationOfProperty(eCSSProperty_transform);
bool hasOpacity = HasAnimationOfProperty(eCSSProperty_opacity);
if (hasOpacity) {
Layer* layer = FrameLayerBuilder::GetDedicatedLayer(
frame, nsDisplayItem::TYPE_OPACITY);
if (!layer || mAnimationGeneration > layer->GetAnimationGeneration()) {
return false;
}
}
if (!hasTransform) {
return true;
}
Layer* layer = FrameLayerBuilder::GetDedicatedLayer(
frame, nsDisplayItem::TYPE_TRANSFORM);
if (!layer || mAnimationGeneration > layer->GetAnimationGeneration()) {
return false;
}
return CanThrottleTransformChanges(aTime);
}
示例2: GetElementToRestyle
bool
AnimationCollection::CanThrottleAnimation(TimeStamp aTime)
{
dom::Element* element = GetElementToRestyle();
if (!element) {
return false;
}
nsIFrame* frame = nsLayoutUtils::GetStyleFrame(element);
if (!frame) {
return false;
}
const auto& info = CommonAnimationManager::sLayerAnimationInfo;
for (size_t i = 0; i < ArrayLength(info); i++) {
auto record = info[i];
// We only need to worry about *current* animations here.
// - If we have a newly-finished animation, Animation::CanThrottle will
// detect that and force an unthrottled sample.
// - If we have a newly-idle animation, then whatever caused the animation
// to be idle will update the animation generation so we'll return false
// from the layer generation check below for any other running compositor
// animations (and if no other compositor animations exist we won't get
// this far).
if (!HasCurrentAnimationOfProperty(record.mProperty)) {
continue;
}
Layer* layer = FrameLayerBuilder::GetDedicatedLayer(
frame, record.mLayerType);
if (!layer || mAnimationGeneration > layer->GetAnimationGeneration()) {
return false;
}
if (record.mProperty == eCSSProperty_transform &&
!CanThrottleTransformChanges(aTime)) {
return false;
}
}
return true;
}