本文整理汇总了C++中PropertySet::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertySet::begin方法的具体用法?C++ PropertySet::begin怎么用?C++ PropertySet::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertySet
的用法示例。
在下文中一共展示了PropertySet::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ensureKeyframeGroups
void KeyframeEffectModelBase::ensureKeyframeGroups() const
{
if (m_keyframeGroups)
return;
m_keyframeGroups = adoptPtrWillBeNoop(new KeyframeGroupMap);
const KeyframeVector keyframes = normalizedKeyframes(getFrames());
for (KeyframeVector::const_iterator keyframeIter = keyframes.begin(); keyframeIter != keyframes.end(); ++keyframeIter) {
const Keyframe* keyframe = keyframeIter->get();
PropertySet keyframeProperties = keyframe->properties();
for (PropertySet::const_iterator propertyIter = keyframeProperties.begin(); propertyIter != keyframeProperties.end(); ++propertyIter) {
CSSPropertyID property = *propertyIter;
ASSERT_WITH_MESSAGE(!isExpandedShorthand(property), "Web Animations: Encountered shorthand CSS property (%d) in normalized keyframes.", property);
KeyframeGroupMap::iterator groupIter = m_keyframeGroups->find(property);
PropertySpecificKeyframeGroup* group;
if (groupIter == m_keyframeGroups->end())
group = m_keyframeGroups->add(property, adoptPtrWillBeNoop(new PropertySpecificKeyframeGroup)).storedValue->value.get();
else
group = groupIter->value.get();
group->appendKeyframe(keyframe->createPropertySpecificKeyframe(property));
}
}
// Add synthetic keyframes.
for (KeyframeGroupMap::iterator iter = m_keyframeGroups->begin(); iter != m_keyframeGroups->end(); ++iter) {
iter->value->addSyntheticKeyframeIfRequired(this);
iter->value->removeRedundantKeyframes();
}
}
示例2: getAnimationOnCompositor
void CompositorAnimationsImpl::getAnimationOnCompositor(const Timing& timing, const KeyframeEffectModel& effect, Vector<OwnPtr<blink::WebAnimation> >& animations)
{
ASSERT(animations.isEmpty());
CompositorTiming compositorTiming;
bool timingValid = convertTimingForCompositor(timing, compositorTiming);
ASSERT_UNUSED(timingValid, timingValid);
RefPtr<TimingFunction> timingFunction = timing.timingFunction;
if (compositorTiming.reverse)
timingFunction = CompositorAnimationsTimingFunctionReverser::reverse(timingFunction.get());
PropertySet properties = effect.properties();
ASSERT(!properties.isEmpty());
for (PropertySet::iterator it = properties.begin(); it != properties.end(); ++it) {
KeyframeVector values;
getKeyframeValuesForProperty(&effect, *it, compositorTiming.scaledDuration, compositorTiming.reverse, values);
blink::WebAnimation::TargetProperty targetProperty;
OwnPtr<blink::WebAnimationCurve> curve;
switch (*it) {
case CSSPropertyOpacity: {
targetProperty = blink::WebAnimation::TargetPropertyOpacity;
blink::WebFloatAnimationCurve* floatCurve = blink::Platform::current()->compositorSupport()->createFloatAnimationCurve();
addKeyframesToCurve(*floatCurve, values, *timingFunction.get());
curve = adoptPtr(floatCurve);
break;
}
case CSSPropertyWebkitFilter: {
targetProperty = blink::WebAnimation::TargetPropertyFilter;
blink::WebFilterAnimationCurve* filterCurve = blink::Platform::current()->compositorSupport()->createFilterAnimationCurve();
addKeyframesToCurve(*filterCurve, values, *timingFunction);
curve = adoptPtr(filterCurve);
break;
}
case CSSPropertyWebkitTransform: {
targetProperty = blink::WebAnimation::TargetPropertyTransform;
blink::WebTransformAnimationCurve* transformCurve = blink::Platform::current()->compositorSupport()->createTransformAnimationCurve();
addKeyframesToCurve(*transformCurve, values, *timingFunction.get());
curve = adoptPtr(transformCurve);
break;
}
default:
ASSERT_NOT_REACHED();
continue;
}
ASSERT(curve.get());
OwnPtr<blink::WebAnimation> animation = adoptPtr(blink::Platform::current()->compositorSupport()->createAnimation(*curve, targetProperty));
animation->setIterations(compositorTiming.adjustedIterationCount);
animation->setTimeOffset(compositorTiming.scaledTimeOffset);
animation->setAlternatesDirection(compositorTiming.alternate);
animations.append(animation.release());
}
ASSERT(!animations.isEmpty());
}
示例3: properties
PropertySet KeyframeEffectModelBase::properties() const
{
PropertySet result;
if (!m_keyframes.size()) {
return result;
}
result = m_keyframes[0]->properties();
for (size_t i = 1; i < m_keyframes.size(); i++) {
PropertySet extras = m_keyframes[i]->properties();
for (PropertySet::const_iterator it = extras.begin(); it != extras.end(); ++it) {
result.add(*it);
}
}
return result;
}
示例4: isCandidateForAnimationOnCompositor
bool CompositorAnimations::isCandidateForAnimationOnCompositor(const Timing& timing, const AnimationEffect& effect)
{
const KeyframeEffectModel& keyframeEffect = *toKeyframeEffectModel(&effect);
// Are the keyframes convertible?
const KeyframeEffectModel::KeyframeVector frames = keyframeEffect.getFrames();
for (size_t i = 0; i < frames.size(); ++i) {
// Only replace mode can be accelerated
if (frames[i]->composite() != AnimationEffect::CompositeReplace)
return false;
// Check all the properties can be accelerated
const PropertySet properties = frames[i]->properties(); // FIXME: properties creates a whole new PropertySet!
if (properties.isEmpty())
return false;
for (PropertySet::const_iterator it = properties.begin(); it != properties.end(); ++it) {
switch (*it) {
case CSSPropertyOpacity:
continue;
case CSSPropertyWebkitTransform:
if (toAnimatableTransform(frames[i]->propertyValue(CSSPropertyWebkitTransform))->transformOperations().dependsOnBoxSize())
return false;
continue;
case CSSPropertyWebkitFilter: {
const FilterOperations& operations = toAnimatableFilterOperations(frames[i]->propertyValue(CSSPropertyWebkitFilter))->operations();
if (operations.hasFilterThatMovesPixels())
return false;
for (size_t i = 0; i < operations.size(); i++) {
const FilterOperation& op = *operations.at(i);
if (op.type() == FilterOperation::VALIDATED_CUSTOM || op.type() == FilterOperation::CUSTOM)
return false;
}
continue;
}
default:
return false;
}
}
}
// Is the timing object convertible?
CompositorAnimationsImpl::CompositorTiming out;
if (!CompositorAnimationsImpl::convertTimingForCompositor(timing, out))
return false;
// Is the timing function convertible?
switch (timing.timingFunction->type()) {
case TimingFunction::LinearFunction:
break;
case TimingFunction::CubicBezierFunction:
// Can have a cubic if we don't have to split it (IE only have two frames).
if (frames.size() != 2)
return false;
ASSERT(frames[0]->offset() == 0.0 && frames[1]->offset() == 1.0);
break;
case TimingFunction::StepsFunction:
return false;
case TimingFunction::ChainedFunction: {
// Currently we only support chained segments in the form the CSS code
// generates. These chained segments are only one level deep and have
// one timing function per frame.
const ChainedTimingFunction* chained = static_cast<const ChainedTimingFunction*>(timing.timingFunction.get());
if (!chained->m_segments.size())
return false;
if (frames.size() != chained->m_segments.size() + 1)
return false;
for (size_t timeIndex = 0; timeIndex < chained->m_segments.size(); timeIndex++) {
const ChainedTimingFunction::Segment& segment = chained->m_segments[timeIndex];
if (frames[timeIndex]->offset() != segment.m_min || frames[timeIndex + 1]->offset() != segment.m_max)
return false;
switch (segment.m_timingFunction->type()) {
case TimingFunction::LinearFunction:
case TimingFunction::CubicBezierFunction:
continue;
case TimingFunction::StepsFunction:
case TimingFunction::ChainedFunction:
default:
return false;
}
}
break;
}
default:
ASSERT_NOT_REACHED();
return false;
}
return true;
//.........这里部分代码省略.........