Exemplo n.º 1
0
void PathInterpolationFunctions::composite(
    UnderlyingValueOwner& underlyingValueOwner,
    double underlyingFraction,
    const InterpolationType& type,
    const InterpolationValue& value) {
  const InterpolableList& list = toInterpolableList(*value.interpolableValue);
  double neutralComponent =
      toInterpolableNumber(list.get(PathNeutralIndex))->value();

  if (neutralComponent == 0) {
    underlyingValueOwner.set(type, value);
    return;
  }

  DCHECK(pathSegTypesMatch(
      toSVGPathNonInterpolableValue(
          *underlyingValueOwner.value().nonInterpolableValue)
          .pathSegTypes(),
      toSVGPathNonInterpolableValue(*value.nonInterpolableValue)
          .pathSegTypes()));
  underlyingValueOwner.mutableValue().interpolableValue->scaleAndAdd(
      neutralComponent, *value.interpolableValue);
  underlyingValueOwner.mutableValue().nonInterpolableValue =
      value.nonInterpolableValue.get();
}
PassOwnPtr<PairwisePrimitiveInterpolation> PathInterpolationFunctions::mergeSingleConversions(const InterpolationType& type, InterpolationValue& startValue, InterpolationValue& endValue)
{
    const Vector<SVGPathSegType>& startTypes = toSVGPathNonInterpolableValue(startValue.nonInterpolableValue())->pathSegTypes();
    const Vector<SVGPathSegType>& endTypes = toSVGPathNonInterpolableValue(endValue.nonInterpolableValue())->pathSegTypes();
    if (!pathSegTypesMatch(startTypes, endTypes))
        return nullptr;

    return PairwisePrimitiveInterpolation::create(type,
        startValue.mutableComponent().interpolableValue.release(),
        endValue.mutableComponent().interpolableValue.release(),
        const_cast<NonInterpolableValue*>(endValue.nonInterpolableValue())); // Take ref.
}
Exemplo n.º 3
0
PairwiseInterpolationValue PathInterpolationFunctions::maybeMergeSingles(
    InterpolationValue&& start,
    InterpolationValue&& end) {
  const Vector<SVGPathSegType>& startTypes =
      toSVGPathNonInterpolableValue(*start.nonInterpolableValue).pathSegTypes();
  const Vector<SVGPathSegType>& endTypes =
      toSVGPathNonInterpolableValue(*end.nonInterpolableValue).pathSegTypes();
  if (!pathSegTypesMatch(startTypes, endTypes))
    return nullptr;

  return PairwiseInterpolationValue(std::move(start.interpolableValue),
                                    std::move(end.interpolableValue),
                                    end.nonInterpolableValue.release());
}
void PathInterpolationFunctions::composite(UnderlyingValue& underlyingValue, double underlyingFraction, const InterpolationValue& value)
{
    const InterpolableList& list = toInterpolableList(value.interpolableValue());
    double neutralComponent = toInterpolableNumber(list.get(PathNeutralIndex))->value();

    if (neutralComponent == 0) {
        underlyingValue.set(&value);
        return;
    }

    ASSERT(pathSegTypesMatch(
        toSVGPathNonInterpolableValue(underlyingValue->nonInterpolableValue())->pathSegTypes(),
        toSVGPathNonInterpolableValue(value.nonInterpolableValue())->pathSegTypes()));
    underlyingValue.mutableComponent().interpolableValue->scaleAndAdd(neutralComponent, value.interpolableValue());
    underlyingValue.mutableComponent().nonInterpolableValue = const_cast<NonInterpolableValue*>(value.nonInterpolableValue()); // Take ref.
}
PassRefPtr<SVGPathByteStream> PathInterpolationFunctions::appliedValue(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue)
{
    RefPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create();
    InterpolatedSVGPathSource source(
        toInterpolableList(*toInterpolableList(interpolableValue).get(PathArgsIndex)),
        toSVGPathNonInterpolableValue(nonInterpolableValue)->pathSegTypes());
    SVGPathByteStreamBuilder builder(*pathByteStream);
    SVGPathParser(&source, &builder).parsePathDataFromSource(false);
    return pathByteStream.release();
}
PassRefPtrWillBeRawPtr<SVGPropertyBase> SVGPathInterpolationType::appliedSVGValue(const InterpolableValue& interpolableValue, const NonInterpolableValue* nonInterpolableValue) const
{
    OwnPtr<SVGPathByteStream> pathByteStream = SVGPathByteStream::create();
    InterpolatedSVGPathSource source(
        toInterpolableList(*toInterpolableList(interpolableValue).get(PathArgsIndex)),
        toSVGPathNonInterpolableValue(nonInterpolableValue)->pathSegTypes());
    SVGPathByteStreamBuilder builder(*pathByteStream);
    SVGPathParser(&source, &builder).parsePathDataFromSource(UnalteredParsing, false);
    return SVGPath::create(CSSPathValue::create(pathByteStream.release()));
}
Exemplo n.º 7
0
std::unique_ptr<SVGPathByteStream> PathInterpolationFunctions::appliedValue(
    const InterpolableValue& interpolableValue,
    const NonInterpolableValue* nonInterpolableValue) {
  std::unique_ptr<SVGPathByteStream> pathByteStream =
      SVGPathByteStream::create();
  InterpolatedSVGPathSource source(
      toInterpolableList(
          *toInterpolableList(interpolableValue).get(PathArgsIndex)),
      toSVGPathNonInterpolableValue(nonInterpolableValue)->pathSegTypes());
  SVGPathByteStreamBuilder builder(*pathByteStream);
  SVGPathParser::parsePath(source, builder);
  return pathByteStream;
}
Exemplo n.º 8
0
 static const Vector<SVGPathSegType>& getPathSegTypes(
     const InterpolationValue& underlying) {
   return toSVGPathNonInterpolableValue(*underlying.nonInterpolableValue)
       .pathSegTypes();
 }
 static const Vector<SVGPathSegType>& getPathSegTypes(const UnderlyingValue& underlyingValue)
 {
     return toSVGPathNonInterpolableValue(underlyingValue->nonInterpolableValue())->pathSegTypes();
 }