本文整理汇总了C++中BitArray::get方法的典型用法代码示例。如果您正苦于以下问题:C++ BitArray::get方法的具体用法?C++ BitArray::get怎么用?C++ BitArray::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BitArray
的用法示例。
在下文中一共展示了BitArray::get方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeReplacedInterpolationsIfNeeded
void SampledEffect::removeReplacedInterpolationsIfNeeded(const BitArray<numCSSProperties>& replacedProperties)
{
if (canChange() && m_animation->isCurrent())
return;
size_t dest = 0;
for (size_t i = 0; i < m_interpolations->size(); i++) {
if (!replacedProperties.get(toStyleInterpolation(m_interpolations->at(i).get())->id()))
m_interpolations->at(dest++) = m_interpolations->at(i);
}
m_interpolations->shrink(dest);
}
示例2: DecodeAnyAI
std::string
ExpandedBinaryDecoder::Decode(const BitArray& bits)
{
if (bits.get(1)) {
return DecodeAI01AndOtherAIs(bits);
}
if (!bits.get(2)) {
return DecodeAnyAI(bits);
}
int fourBitEncodationMethod = GenericAppIdDecoder::ExtractNumeric(bits, 1, 4);
switch (fourBitEncodationMethod) {
case 4: return DecodeAI013103(bits);
case 5: return DecodeAI01320x(bits);
}
int fiveBitEncodationMethod = GenericAppIdDecoder::ExtractNumeric(bits, 1, 5);
switch (fiveBitEncodationMethod) {
case 12: return DecodeAI01392x(bits);
case 13: return DecodeAI01393x(bits);
}
int sevenBitEncodationMethod = GenericAppIdDecoder::ExtractNumeric(bits, 1, 7);
switch (sevenBitEncodationMethod) {
case 56: return DecodeAI013x0x1x(bits, "310", "11");
case 57: return DecodeAI013x0x1x(bits, "320", "11");
case 58: return DecodeAI013x0x1x(bits, "310", "13");
case 59: return DecodeAI013x0x1x(bits, "320", "13");
case 60: return DecodeAI013x0x1x(bits, "310", "15");
case 61: return DecodeAI013x0x1x(bits, "320", "15");
case 62: return DecodeAI013x0x1x(bits, "310", "17");
case 63: return DecodeAI013x0x1x(bits, "320", "17");
}
return std::string();
//throw new IllegalStateException("unknown decoder: " + information);
}
示例3: save_bitarray
void save_bitarray(const char * filename, BitArray & array,
int width, int height)
{
FSFile fp(filename, "w");
if (!fp.is_open())
return;
FileStream stream(fp);
stream.write_uint32(width);
stream.write_uint32(height);
for (int y = 0; y < height; ++y)
for (int x = 0; x < width; ++x) {
if (array.get(y * width + x))
stream.write_uint8(0xFF);
else
stream.write_uint8(0x00);
}
fp.close();
}
示例4: calculateTransitionUpdate
void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate& update, const Element* animatingElement, const ComputedStyle& style)
{
if (!animatingElement)
return;
if (animatingElement->document().printing() || animatingElement->document().wasPrinting())
return;
ElementAnimations* elementAnimations = animatingElement->elementAnimations();
const TransitionMap* activeTransitions = elementAnimations ? &elementAnimations->cssAnimations().m_transitions : nullptr;
const CSSTransitionData* transitionData = style.transitions();
#if ENABLE(ASSERT)
// In debug builds we verify that it would have been safe to avoid populating and testing listedProperties if the style recalc is due to animation.
const bool animationStyleRecalc = false;
#else
// In release builds we avoid the cost of checking for new and interrupted transitions if the style recalc is due to animation.
const bool animationStyleRecalc = elementAnimations && elementAnimations->isAnimationStyleChange();
#endif
BitArray<numCSSProperties> listedProperties;
bool anyTransitionHadTransitionAll = false;
const LayoutObject* layoutObject = animatingElement->layoutObject();
if (!animationStyleRecalc && style.display() != NONE && layoutObject && layoutObject->style() && transitionData) {
const ComputedStyle& oldStyle = *layoutObject->style();
for (size_t i = 0; i < transitionData->propertyList().size(); ++i) {
const CSSTransitionData::TransitionProperty& transitionProperty = transitionData->propertyList()[i];
if (transitionProperty.propertyType != CSSTransitionData::TransitionKnownProperty)
continue;
CSSPropertyID property = resolveCSSPropertyID(transitionProperty.unresolvedProperty);
bool animateAll = property == CSSPropertyAll;
if (animateAll)
anyTransitionHadTransitionAll = true;
const StylePropertyShorthand& propertyList = animateAll ? CSSAnimations::propertiesForTransitionAll() : shorthandForProperty(property);
// If not a shorthand we only execute one iteration of this loop, and refer to the property directly.
for (unsigned j = 0; !j || j < propertyList.length(); ++j) {
CSSPropertyID id = propertyList.length() ? propertyList.properties()[j] : property;
ASSERT(id >= firstCSSProperty);
if (!animateAll) {
if (CSSPropertyMetadata::isInterpolableProperty(id))
listedProperties.set(id - firstCSSProperty);
else
continue;
}
// FIXME: We should transition if an !important property changes even when an animation is running,
// but this is a bit hard to do with the current applyMatchedProperties system.
PropertyHandle property = PropertyHandle(id);
if (!update.activeInterpolationsForAnimations().contains(property)
&& (!elementAnimations || !elementAnimations->cssAnimations().m_previousActiveInterpolationsForAnimations.contains(property))) {
calculateTransitionUpdateForProperty(id, *transitionData, i, oldStyle, style, activeTransitions, update, animatingElement);
}
}
}
}
if (activeTransitions) {
for (const auto& entry : *activeTransitions) {
CSSPropertyID id = entry.key;
if (!anyTransitionHadTransitionAll && !animationStyleRecalc && !listedProperties.get(id - firstCSSProperty)) {
// TODO: Figure out why this fails on Chrome OS login page. crbug.com/365507
// ASSERT(animation.playStateInternal() == Animation::Finished || !(elementAnimations && elementAnimations->isAnimationStyleChange()));
update.cancelTransition(id);
} else if (entry.value.animation->finishedInternal()) {
update.finishTransition(id);
}
}
}
}
示例5: asText
String StylePropertySerializer::asText() const
{
StringBuilder result;
BitArray<numCSSProperties> shorthandPropertyUsed;
BitArray<numCSSProperties> shorthandPropertyAppeared;
unsigned size = m_propertySet.propertyCount();
unsigned numDecls = 0;
for (unsigned n = 0; n < size; ++n) {
StylePropertySet::PropertyReference property = m_propertySet.propertyAt(n);
CSSPropertyID propertyID = property.id();
// Only enabled or internal properties should be part of the style.
ASSERT(RuntimeCSSEnabled::isCSSPropertyEnabled(propertyID) || isInternalProperty(propertyID));
CSSPropertyID shorthandPropertyID = CSSPropertyInvalid;
CSSPropertyID borderFallbackShorthandProperty = CSSPropertyInvalid;
String value;
switch (propertyID) {
case CSSPropertyBackgroundAttachment:
case CSSPropertyBackgroundClip:
case CSSPropertyBackgroundColor:
case CSSPropertyBackgroundImage:
case CSSPropertyBackgroundOrigin:
case CSSPropertyBackgroundPositionX:
case CSSPropertyBackgroundPositionY:
case CSSPropertyBackgroundSize:
case CSSPropertyBackgroundRepeatX:
case CSSPropertyBackgroundRepeatY:
shorthandPropertyAppeared.set(CSSPropertyBackground - firstCSSProperty);
continue;
case CSSPropertyContent:
if (property.value()->isValueList())
value = toCSSValueList(property.value())->customCSSText(AlwaysQuoteCSSString);
break;
case CSSPropertyBorderTopWidth:
case CSSPropertyBorderRightWidth:
case CSSPropertyBorderBottomWidth:
case CSSPropertyBorderLeftWidth:
if (!borderFallbackShorthandProperty)
borderFallbackShorthandProperty = CSSPropertyBorderWidth;
case CSSPropertyBorderTopStyle:
case CSSPropertyBorderRightStyle:
case CSSPropertyBorderBottomStyle:
case CSSPropertyBorderLeftStyle:
if (!borderFallbackShorthandProperty)
borderFallbackShorthandProperty = CSSPropertyBorderStyle;
case CSSPropertyBorderTopColor:
case CSSPropertyBorderRightColor:
case CSSPropertyBorderBottomColor:
case CSSPropertyBorderLeftColor:
if (!borderFallbackShorthandProperty)
borderFallbackShorthandProperty = CSSPropertyBorderColor;
// FIXME: Deal with cases where only some of border-(top|right|bottom|left) are specified.
if (!shorthandPropertyAppeared.get(CSSPropertyBorder - firstCSSProperty)) {
value = borderPropertyValue(ReturnNullOnUncommonValues);
if (value.isNull())
shorthandPropertyAppeared.set(CSSPropertyBorder - firstCSSProperty);
else
shorthandPropertyID = CSSPropertyBorder;
} else if (shorthandPropertyUsed.get(CSSPropertyBorder - firstCSSProperty))
shorthandPropertyID = CSSPropertyBorder;
if (!shorthandPropertyID)
shorthandPropertyID = borderFallbackShorthandProperty;
break;
case CSSPropertyWebkitBorderHorizontalSpacing:
case CSSPropertyWebkitBorderVerticalSpacing:
shorthandPropertyID = CSSPropertyBorderSpacing;
break;
case CSSPropertyFontFamily:
case CSSPropertyLineHeight:
case CSSPropertyFontSize:
case CSSPropertyFontStyle:
case CSSPropertyFontVariant:
case CSSPropertyFontWeight:
// Don't use CSSPropertyFont because old UAs can't recognize them but are important for editing.
break;
case CSSPropertyListStyleType:
case CSSPropertyListStylePosition:
case CSSPropertyListStyleImage:
shorthandPropertyID = CSSPropertyListStyle;
break;
case CSSPropertyMarginTop:
case CSSPropertyMarginRight:
case CSSPropertyMarginBottom:
case CSSPropertyMarginLeft:
shorthandPropertyID = CSSPropertyMargin;
break;
case CSSPropertyOutlineWidth:
case CSSPropertyOutlineStyle:
case CSSPropertyOutlineColor:
shorthandPropertyID = CSSPropertyOutline;
break;
case CSSPropertyOverflowX:
case CSSPropertyOverflowY:
shorthandPropertyID = CSSPropertyOverflow;
break;
case CSSPropertyPaddingTop:
case CSSPropertyPaddingRight:
//.........这里部分代码省略.........
示例6: calculateTransitionUpdate
void CSSAnimations::calculateTransitionUpdate(CSSAnimationUpdate* update, const Element* element, const RenderStyle& style)
{
if (!element)
return;
ActiveAnimations* activeAnimations = element->activeAnimations();
const TransitionMap* activeTransitions = activeAnimations ? &activeAnimations->cssAnimations().m_transitions : 0;
const CSSTransitionData* transitionData = style.transitions();
#if ENABLE(ASSERT)
// In debug builds we verify that it would have been safe to avoid populating and testing listedProperties if the style recalc is due to animation.
const bool animationStyleRecalc = false;
#else
// In release builds we avoid the cost of checking for new and interrupted transitions if the style recalc is due to animation.
const bool animationStyleRecalc = activeAnimations && activeAnimations->isAnimationStyleChange();
#endif
BitArray<numCSSProperties> listedProperties;
bool anyTransitionHadTransitionAll = false;
const RenderObject* renderer = element->renderer();
if (!animationStyleRecalc && style.display() != NONE && renderer && renderer->style() && transitionData) {
const RenderStyle& oldStyle = *renderer->style();
for (size_t i = 0; i < transitionData->propertyList().size(); ++i) {
const CSSTransitionData::TransitionProperty& transitionProperty = transitionData->propertyList()[i];
CSSTransitionData::TransitionPropertyType mode = transitionProperty.propertyType;
CSSPropertyID property = transitionProperty.propertyId;
if (mode == CSSTransitionData::TransitionNone || mode == CSSTransitionData::TransitionUnknown)
continue;
bool animateAll = mode == CSSTransitionData::TransitionAll;
ASSERT(animateAll || mode == CSSTransitionData::TransitionSingleProperty);
if (animateAll)
anyTransitionHadTransitionAll = true;
const StylePropertyShorthand& propertyList = animateAll ? CSSAnimations::animatableProperties() : shorthandForProperty(property);
// If not a shorthand we only execute one iteration of this loop, and refer to the property directly.
for (unsigned j = 0; !j || j < propertyList.length(); ++j) {
CSSPropertyID id = propertyList.length() ? propertyList.properties()[j] : property;
CSSPropertyID eventId = id;
if (!animateAll) {
id = propertyForAnimation(id);
if (CSSPropertyMetadata::isAnimatableProperty(id))
listedProperties.set(id);
else
continue;
}
if (!update->activeInterpolationsForAnimations().contains(id)
&& (!activeAnimations || !activeAnimations->cssAnimations().m_previousActiveInterpolationsForAnimations.contains(id))) {
calculateTransitionUpdateForProperty(id, eventId, *transitionData, i, oldStyle, style, activeTransitions, update, element);
}
}
}
}
if (activeTransitions) {
for (TransitionMap::const_iterator iter = activeTransitions->begin(); iter != activeTransitions->end(); ++iter) {
const AnimationPlayer& player = *iter->value.player;
CSSPropertyID id = iter->key;
if (player.finishedInternal() || (!anyTransitionHadTransitionAll && !animationStyleRecalc && !listedProperties.get(id))) {
// TODO: Figure out why this fails on Chrome OS login page. crbug.com/365507
// ASSERT(player.finishedInternal() || !(activeAnimations && activeAnimations->isAnimationStyleChange()));
update->cancelTransition(id);
}
}
}
}