コード例 #1
0
void SVGAnimationElement::updateAnimationMode()
{
    // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues
    if (hasAttribute(SVGNames::valuesAttr))
        setAnimationMode(ValuesAnimation);
    else if (!toValue().isEmpty())
        setAnimationMode(fromValue().isEmpty() ? ToAnimation : FromToAnimation);
    else if (!byValue().isEmpty())
        setAnimationMode(fromValue().isEmpty() ? ByAnimation : FromByAnimation);
    else
        setAnimationMode(NoAnimation);
}
コード例 #2
0
ファイル: ck_fix.cpp プロジェクト: ChrysanthemumWang/catcake
ckFix ckFix::operator+(ckFix fix) const
{
    s64 value = static_cast<s64>(m_value) + static_cast<s64>(fix.m_value);
    checkOverflow(value);

    return fromValue(static_cast<s32>(value));
}
コード例 #3
0
ファイル: ck_fix.cpp プロジェクト: ChrysanthemumWang/catcake
ckFix ckFix::operator-() const
{
    s64 value = -static_cast<s64>(m_value);
    checkOverflow(value);

    return fromValue(static_cast<s32>(value));
}
コード例 #4
0
void SVGAnimationElement::startedActiveInterval()
{
    m_animationValid = false;

    if (!isValid())
        return;

    if (!hasValidAttributeType())
        return;

    // These validations are appropriate for all animation modes.
    if (fastHasAttribute(SVGNames::keyPointsAttr) && m_keyPoints.size() != m_keyTimes.size())
        return;

    AnimationMode animationMode = this->animationMode();
    CalcMode calcMode = this->calcMode();
    if (calcMode == CalcModeSpline) {
        unsigned splinesCount = m_keySplines.size();
        if (!splinesCount
            || (fastHasAttribute(SVGNames::keyPointsAttr) && m_keyPoints.size() - 1 != splinesCount)
            || (animationMode == ValuesAnimation && m_values.size() - 1 != splinesCount)
            || (fastHasAttribute(SVGNames::keyTimesAttr) && m_keyTimes.size() - 1 != splinesCount))
            return;
    }

    String from = fromValue();
    String to = toValue();
    String by = byValue();
    if (animationMode == NoAnimation)
        return;
    if ((animationMode == FromToAnimation || animationMode == FromByAnimation || animationMode == ToAnimation || animationMode == ByAnimation)
        && (fastHasAttribute(SVGNames::keyPointsAttr) && fastHasAttribute(SVGNames::keyTimesAttr) && (m_keyTimes.size() < 2 || m_keyTimes.size() != m_keyPoints.size())))
        return;
    if (animationMode == FromToAnimation) {
        m_animationValid = calculateFromAndToValues(from, to);
    } else if (animationMode == ToAnimation) {
        // For to-animations the from value is the current accumulated value from lower priority animations.
        // The value is not static and is determined during the animation.
        m_animationValid = calculateFromAndToValues(emptyString(), to);
    } else if (animationMode == FromByAnimation) {
        m_animationValid = calculateFromAndByValues(from, by);
    } else if (animationMode == ByAnimation) {
        m_animationValid = calculateFromAndByValues(emptyString(), by);
    } else if (animationMode == ValuesAnimation) {
        m_animationValid = m_values.size() >= 1
            && (calcMode == CalcModePaced || !fastHasAttribute(SVGNames::keyTimesAttr) || fastHasAttribute(SVGNames::keyPointsAttr) || (m_values.size() == m_keyTimes.size()))
            && (calcMode == CalcModeDiscrete || !m_keyTimes.size() || m_keyTimes.last() == 1)
            && (calcMode != CalcModeSpline || ((m_keySplines.size() && (m_keySplines.size() == m_values.size() - 1)) || m_keySplines.size() == m_keyPoints.size() - 1))
            && (!fastHasAttribute(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size()));
        if (m_animationValid)
            m_animationValid = calculateToAtEndOfDurationValue(m_values.last());
        if (calcMode == CalcModePaced && m_animationValid)
            calculateKeyTimesForCalcModePaced();
    } else if (animationMode == PathAnimation) {
        m_animationValid = calcMode == CalcModePaced || !fastHasAttribute(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
    }
}
コード例 #5
0
    static OSSIA::Address& pushValue(Address_T& addr, const OSSIA::Value* v)
    {
      if(v)
      {
        addr.dev().push(addr.destination(), coppa::ossia::Value{fromValue(v)});
      }

      return addr;
    }
コード例 #6
0
ファイル: SVGAnimationElement.cpp プロジェクト: KDE/khtml
SVGAnimationElement::AnimationMode SVGAnimationElement::animationMode() const
{
    // http://www.w3.org/TR/2001/REC-smil-animation-20010904/#AnimFuncValues
    if (hasTagName(SVGNames::setTag)) {
        return ToAnimation;
    }
    if (!animationPath().isEmpty()) {
        return PathAnimation;
    }
    if (hasAttribute(SVGNames::valuesAttr)) {
        return ValuesAnimation;
    }
    if (!toValue().isEmpty()) {
        return fromValue().isEmpty() ? ToAnimation : FromToAnimation;
    }
    if (!byValue().isEmpty()) {
        return fromValue().isEmpty() ? ByAnimation : FromByAnimation;
    }
    return NoAnimation;
}
コード例 #7
0
ファイル: target-profile.cpp プロジェクト: miraeye/hhvm
void MethProfile::reduce(MethProfile& a, const MethProfile& b) {
  if (a.curTag() == Tag::Invalid) return;

  uintptr_t bMethVal;

  // this part is racy, and could slice if we're not careful
  while (true) {
    auto cls = b.m_curClass.get();
    bMethVal = b.methValue();
    if (!bMethVal) return;
    if (toTag(bMethVal) != Tag::UniqueClass) break;
    if (UNLIKELY(cls != b.m_curClass.get())) {
      continue;
    }
    assertx(cls);
    a.reportMethHelper(cls, fromValue(bMethVal));
    return;
  }

  // Now we know the entire representation is in bMethVal,
  // so no more danger of a race
  if (toTag(bMethVal) == Tag::Invalid) {
    a.setMeth(nullptr, Tag::Invalid);
    return;
  }

  assertx(toTag(bMethVal) == Tag::UniqueMeth ||
          toTag(bMethVal) == Tag::BaseMeth ||
          toTag(bMethVal) == Tag::InterfaceMeth);

  auto const meth = fromValue(bMethVal);
  if (!a.methValue()) {
    a.setMeth(meth, toTag(bMethVal));
    return;
  }

  a.reportMethHelper(nullptr, meth);
  if (a.curTag() == Tag::UniqueMeth && toTag(bMethVal) == Tag::BaseMeth) {
    a.setMeth(meth, Tag::BaseMeth);
  }
}
コード例 #8
0
ファイル: SVGAnimationElement.cpp プロジェクト: KDE/khtml
void SVGAnimationElement::startedActiveInterval()
{
    m_animationValid = false;

    if (!hasValidTarget()) {
        return;
    }

    AnimationMode animationMode = this->animationMode();
    if (animationMode == NoAnimation) {
        return;
    }
    if (animationMode == FromToAnimation) {
        m_animationValid = calculateFromAndToValues(fromValue(), toValue());
    } else if (animationMode == ToAnimation) {
        // For to-animations the from value is the current accumulated value from lower priority animations.
        // The value is not static and is determined during the animation.
        m_animationValid = calculateFromAndToValues(String(), toValue());
    } else if (animationMode == FromByAnimation) {
        m_animationValid = calculateFromAndByValues(fromValue(), byValue());
    } else if (animationMode == ByAnimation) {
        m_animationValid = calculateFromAndByValues(String(), byValue());
    } else if (animationMode == ValuesAnimation) {
        CalcMode calcMode = this->calcMode();
        m_animationValid = m_values.size() > 1
                           && (calcMode == CalcModePaced || !hasAttribute(SVGNames::keyTimesAttr) || hasAttribute(SVGNames::keyPointsAttr) || (m_values.size() == m_keyTimes.size()))
                           && (calcMode == CalcModeDiscrete || !m_keyTimes.size() || m_keyTimes.last() == 1.0)
                           && (calcMode != CalcModeSpline || (m_keySplines.size() && (m_keySplines.size() == m_values.size() - 1) || m_keySplines.size() == m_keyPoints.size() - 1))
                           && (!hasAttribute(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size()));
        if (calcMode == CalcModePaced && m_animationValid) {
            calculateKeyTimesForCalcModePaced();
        }
    } else if (animationMode == PathAnimation) {
        m_animationValid = calcMode() == CalcModePaced || !hasAttribute(SVGNames::keyPointsAttr) || (m_keyTimes.size() > 1 && m_keyTimes.size() == m_keyPoints.size());
    }
}
コード例 #9
0
ファイル: accumulatortests.cpp プロジェクト: Andiry/mongo
 void run() {
     createAccumulator();
     accumulator()->process(Value(DOC("subTotal" << 6.0 << "count" << 1LL)), true);
     accumulator()->process(Value(DOC("subTotal" << 5.0 << "count" << 2LL)), true);
     assertBinaryEqual(BSON("" << 11.0 / 3), fromValue(accumulator()->getValue(false)));
 }