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


C++ UnderlyingValueOwner::type方法代码示例

本文整理汇总了C++中UnderlyingValueOwner::type方法的典型用法代码示例。如果您正苦于以下问题:C++ UnderlyingValueOwner::type方法的具体用法?C++ UnderlyingValueOwner::type怎么用?C++ UnderlyingValueOwner::type使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnderlyingValueOwner的用法示例。


在下文中一共展示了UnderlyingValueOwner::type方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: applyStack

void InvalidatableInterpolation::applyStack(
    const ActiveInterpolations& interpolations,
    InterpolationEnvironment& environment) {
  DCHECK(!interpolations.isEmpty());
  size_t startingIndex = 0;

  // Compute the underlying value to composite onto.
  UnderlyingValueOwner underlyingValueOwner;
  const InvalidatableInterpolation& firstInterpolation =
      toInvalidatableInterpolation(*interpolations.at(startingIndex));
  if (firstInterpolation.dependsOnUnderlyingValue()) {
    underlyingValueOwner.set(
        firstInterpolation.maybeConvertUnderlyingValue(environment));
  } else {
    const TypedInterpolationValue* firstValue =
        firstInterpolation.ensureValidInterpolation(environment,
                                                    underlyingValueOwner);
    // Fast path for replace interpolations that are the only one to apply.
    if (interpolations.size() == 1) {
      if (firstValue) {
        firstInterpolation.setFlagIfInheritUsed(environment);
        firstValue->type().apply(firstValue->interpolableValue(),
                                 firstValue->getNonInterpolableValue(),
                                 environment);
      }
      return;
    }
    underlyingValueOwner.set(firstValue);
    startingIndex++;
  }

  // Composite interpolations onto the underlying value.
  bool shouldApply = false;
  for (size_t i = startingIndex; i < interpolations.size(); i++) {
    const InvalidatableInterpolation& currentInterpolation =
        toInvalidatableInterpolation(*interpolations.at(i));
    DCHECK(currentInterpolation.dependsOnUnderlyingValue());
    const TypedInterpolationValue* currentValue =
        currentInterpolation.ensureValidInterpolation(environment,
                                                      underlyingValueOwner);
    if (!currentValue)
      continue;
    shouldApply = true;
    currentInterpolation.setFlagIfInheritUsed(environment);
    double underlyingFraction = currentInterpolation.underlyingFraction();
    if (underlyingFraction == 0 || !underlyingValueOwner ||
        underlyingValueOwner.type() != currentValue->type())
      underlyingValueOwner.set(currentValue);
    else
      currentValue->type().composite(underlyingValueOwner, underlyingFraction,
                                     currentValue->value(),
                                     currentInterpolation.m_currentFraction);
  }

  if (shouldApply && underlyingValueOwner)
    underlyingValueOwner.type().apply(
        *underlyingValueOwner.value().interpolableValue,
        underlyingValueOwner.value().nonInterpolableValue.get(), environment);
}
开发者ID:mirror,项目名称:chromium,代码行数:59,代码来源:InvalidatableInterpolation.cpp

示例2: isCacheValid

bool InvalidatableInterpolation::isCacheValid(
    const InterpolationEnvironment& environment,
    const UnderlyingValueOwner& underlyingValueOwner) const {
  if (!m_isCached)
    return false;
  if (isNeutralKeyframeActive()) {
    if (m_cachedPairConversion && m_cachedPairConversion->isFlip())
      return false;
    // Pairwise interpolation can never happen between different
    // InterpolationTypes, neutral values always represent the underlying value.
    if (!underlyingValueOwner || !m_cachedValue ||
        m_cachedValue->type() != underlyingValueOwner.type())
      return false;
  }
  for (const auto& checker : m_conversionCheckers) {
    if (!checker->isValid(environment, underlyingValueOwner.value()))
      return false;
  }
  return true;
}
开发者ID:mirror,项目名称:chromium,代码行数:20,代码来源:InvalidatableInterpolation.cpp

示例3: create

std::unique_ptr<TypedInterpolationValue>
InvalidatableInterpolation::convertSingleKeyframe(
    const PropertySpecificKeyframe& keyframe,
    const InterpolationEnvironment& environment,
    const UnderlyingValueOwner& underlyingValueOwner) const {
  if (keyframe.isNeutral() && !underlyingValueOwner)
    return nullptr;
  for (const auto& interpolationType : m_interpolationTypes) {
    if (keyframe.isNeutral() &&
        underlyingValueOwner.type() != *interpolationType)
      continue;
    ConversionCheckers conversionCheckers;
    InterpolationValue result = interpolationType->maybeConvertSingle(
        keyframe, environment, underlyingValueOwner.value(),
        conversionCheckers);
    addConversionCheckers(*interpolationType, conversionCheckers);
    if (result)
      return TypedInterpolationValue::create(
          *interpolationType, std::move(result.interpolableValue),
          result.nonInterpolableValue.release());
  }
  DCHECK(keyframe.isNeutral());
  return nullptr;
}
开发者ID:mirror,项目名称:chromium,代码行数:24,代码来源:InvalidatableInterpolation.cpp


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