当前位置: 首页>>代码示例>>C++>>正文


C++ Layer::GetAnimationGeneration方法代码示例

本文整理汇总了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);
}
开发者ID:abhishekvp,项目名称:gecko-dev,代码行数:30,代码来源:AnimationCommon.cpp

示例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;
}
开发者ID:WuChengLin,项目名称:gecko-dev,代码行数:41,代码来源:AnimationCommon.cpp


注:本文中的Layer::GetAnimationGeneration方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。