Esempio n. 1
0
void SVGNumberList::add(PassRefPtrWillBeRawPtr<SVGPropertyBase> other, SVGElement* contextElement)
{
    RefPtrWillBeRawPtr<SVGNumberList> otherList = toSVGNumberList(other);

    if (length() != otherList->length())
        return;

    for (size_t i = 0; i < length(); ++i)
        at(i)->setValue(at(i)->value() + otherList->at(i)->value());
}
void SVGNumberList::add(SVGPropertyBase* other, SVGElement* contextElement)
{
    SVGNumberList* otherList = toSVGNumberList(other);

    if (length() != otherList->length())
        return;

    for (size_t i = 0; i < length(); ++i)
        at(i)->setValue(at(i)->value() + otherList->at(i)->value());
}
Esempio n. 3
0
PassOwnPtr<InterpolationValue> SVGNumberListInterpolationType::maybeConvertSVGValue(const SVGPropertyBase& svgValue) const
{
    if (svgValue.type() != AnimatedNumberList)
        return nullptr;

    const SVGNumberList& numberList = toSVGNumberList(svgValue);
    OwnPtr<InterpolableList> result = InterpolableList::create(numberList.length());
    for (size_t i = 0; i < numberList.length(); i++)
        result->set(i, InterpolableNumber::create(numberList.at(i)->value()));
    return InterpolationValue::create(*this, result.release());
}
Esempio n. 4
0
InterpolationValue SVGNumberListInterpolationType::maybeConvertSVGValue(
    const SVGPropertyBase& svgValue) const {
    if (svgValue.type() != AnimatedNumberList)
        return nullptr;

    const SVGNumberList& numberList = toSVGNumberList(svgValue);
    std::unique_ptr<InterpolableList> result =
        InterpolableList::create(numberList.length());
    for (size_t i = 0; i < numberList.length(); i++)
        result->set(i, InterpolableNumber::create(numberList.at(i)->value()));
    return InterpolationValue(std::move(result));
}
Esempio n. 5
0
void SVGNumberList::calculateAnimatedValue(SVGAnimationElement* animationElement, float percentage, unsigned repeatCount, PassRefPtrWillBeRawPtr<SVGPropertyBase> fromValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toValue, PassRefPtrWillBeRawPtr<SVGPropertyBase> toAtEndOfDurationValue, SVGElement* contextElement)
{
    RefPtrWillBeRawPtr<SVGNumberList> fromList = toSVGNumberList(fromValue);
    RefPtrWillBeRawPtr<SVGNumberList> toList = toSVGNumberList(toValue);
    RefPtrWillBeRawPtr<SVGNumberList> toAtEndOfDurationList = toSVGNumberList(toAtEndOfDurationValue);

    size_t fromListSize = fromList->length();
    size_t toListSize = toList->length();
    size_t toAtEndOfDurationListSize = toAtEndOfDurationList->length();

    if (!adjustFromToListValues(fromList, toList, percentage, animationElement->animationMode()))
        return;

    for (size_t i = 0; i < toListSize; ++i) {
        float effectiveFrom = fromListSize ? fromList->at(i)->value() : 0;
        float effectiveTo = toListSize ? toList->at(i)->value() : 0;
        float effectiveToAtEnd = i < toAtEndOfDurationListSize ? toAtEndOfDurationList->at(i)->value() : 0;

        float animated = at(i)->value();
        animationElement->animateAdditiveNumber(percentage, repeatCount, effectiveFrom, effectiveTo, effectiveToAtEnd, animated);
        at(i)->setValue(animated);
    }
}