本文整理汇总了C++中TransformOperations::clear方法的典型用法代码示例。如果您正苦于以下问题:C++ TransformOperations::clear方法的具体用法?C++ TransformOperations::clear怎么用?C++ TransformOperations::clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TransformOperations
的用法示例。
在下文中一共展示了TransformOperations::clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTransformOperations
bool TransformBuilder::createTransformOperations(CSSValue* inValue, RenderStyle* style, RenderStyle* rootStyle, TransformOperations& outOperations)
{
if (!inValue || !inValue->isValueList()) {
outOperations.clear();
return false;
}
float zoomFactor = style ? style->effectiveZoom() : 1;
TransformOperations operations;
for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) {
CSSValue* currValue = i.value();
if (!currValue->isCSSTransformValue())
continue;
CSSTransformValue* transformValue = static_cast<CSSTransformValue*>(i.value());
if (!transformValue->length())
continue;
bool haveNonPrimitiveValue = false;
for (unsigned j = 0; j < transformValue->length(); ++j) {
if (!transformValue->itemWithoutBoundsCheck(j)->isPrimitiveValue()) {
haveNonPrimitiveValue = true;
break;
}
}
if (haveNonPrimitiveValue)
continue;
CSSPrimitiveValue* firstValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(0));
switch (transformValue->operationType()) {
case CSSTransformValue::ScaleTransformOperation:
case CSSTransformValue::ScaleXTransformOperation:
case CSSTransformValue::ScaleYTransformOperation: {
double sx = 1.0;
double sy = 1.0;
if (transformValue->operationType() == CSSTransformValue::ScaleYTransformOperation)
sy = firstValue->getDoubleValue();
else {
sx = firstValue->getDoubleValue();
if (transformValue->operationType() != CSSTransformValue::ScaleXTransformOperation) {
if (transformValue->length() > 1) {
CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
sy = secondValue->getDoubleValue();
} else
sy = sx;
}
}
operations.operations().append(ScaleTransformOperation::create(sx, sy, 1.0, getTransformOperationType(transformValue->operationType())));
break;
}
case CSSTransformValue::ScaleZTransformOperation:
case CSSTransformValue::Scale3DTransformOperation: {
double sx = 1.0;
double sy = 1.0;
double sz = 1.0;
if (transformValue->operationType() == CSSTransformValue::ScaleZTransformOperation)
sz = firstValue->getDoubleValue();
else if (transformValue->operationType() == CSSTransformValue::ScaleYTransformOperation)
sy = firstValue->getDoubleValue();
else {
sx = firstValue->getDoubleValue();
if (transformValue->operationType() != CSSTransformValue::ScaleXTransformOperation) {
if (transformValue->length() > 2) {
CSSPrimitiveValue* thirdValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(2));
sz = thirdValue->getDoubleValue();
}
if (transformValue->length() > 1) {
CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
sy = secondValue->getDoubleValue();
} else
sy = sx;
}
}
operations.operations().append(ScaleTransformOperation::create(sx, sy, sz, getTransformOperationType(transformValue->operationType())));
break;
}
case CSSTransformValue::TranslateTransformOperation:
case CSSTransformValue::TranslateXTransformOperation:
case CSSTransformValue::TranslateYTransformOperation: {
Length tx = Length(0, Fixed);
Length ty = Length(0, Fixed);
if (transformValue->operationType() == CSSTransformValue::TranslateYTransformOperation)
ty = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
else {
tx = convertToFloatLength(firstValue, style, rootStyle, zoomFactor);
if (transformValue->operationType() != CSSTransformValue::TranslateXTransformOperation) {
if (transformValue->length() > 1) {
CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->itemWithoutBoundsCheck(1));
ty = convertToFloatLength(secondValue, style, rootStyle, zoomFactor);
}
}
}
if (tx.isUndefined() || ty.isUndefined())
return false;
operations.operations().append(TranslateTransformOperation::create(tx, ty, Length(0, Fixed), getTransformOperationType(transformValue->operationType())));
break;
//.........这里部分代码省略.........
示例2: createTransformOperations
bool TransformBuilder::createTransformOperations(CSSValue* inValue, const CSSToLengthConversionData& conversionData, TransformOperations& outOperations)
{
if (!inValue || !inValue->isValueList()) {
outOperations.clear();
return false;
}
TransformOperations operations;
for (CSSValueListIterator i = inValue; i.hasMore(); i.advance()) {
CSSValue* currValue = i.value();
if (!currValue->isTransformValue())
continue;
CSSTransformValue* transformValue = toCSSTransformValue(i.value());
if (!transformValue->length())
continue;
bool haveNonPrimitiveValue = false;
for (unsigned j = 0; j < transformValue->length(); ++j) {
if (!transformValue->item(j)->isPrimitiveValue()) {
haveNonPrimitiveValue = true;
break;
}
}
if (haveNonPrimitiveValue)
continue;
CSSPrimitiveValue* firstValue = toCSSPrimitiveValue(transformValue->item(0));
switch (transformValue->operationType()) {
case CSSTransformValue::ScaleTransformOperation:
case CSSTransformValue::ScaleXTransformOperation:
case CSSTransformValue::ScaleYTransformOperation: {
double sx = 1.0;
double sy = 1.0;
if (transformValue->operationType() == CSSTransformValue::ScaleYTransformOperation)
sy = firstValue->getDoubleValue();
else {
sx = firstValue->getDoubleValue();
if (transformValue->operationType() != CSSTransformValue::ScaleXTransformOperation) {
if (transformValue->length() > 1) {
CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->item(1));
sy = secondValue->getDoubleValue();
} else
sy = sx;
}
}
operations.operations().append(ScaleTransformOperation::create(sx, sy, 1.0, getTransformOperationType(transformValue->operationType())));
break;
}
case CSSTransformValue::ScaleZTransformOperation:
case CSSTransformValue::Scale3DTransformOperation: {
double sx = 1.0;
double sy = 1.0;
double sz = 1.0;
if (transformValue->operationType() == CSSTransformValue::ScaleZTransformOperation)
sz = firstValue->getDoubleValue();
else if (transformValue->operationType() == CSSTransformValue::ScaleYTransformOperation)
sy = firstValue->getDoubleValue();
else {
sx = firstValue->getDoubleValue();
if (transformValue->operationType() != CSSTransformValue::ScaleXTransformOperation) {
if (transformValue->length() > 2) {
CSSPrimitiveValue* thirdValue = toCSSPrimitiveValue(transformValue->item(2));
sz = thirdValue->getDoubleValue();
}
if (transformValue->length() > 1) {
CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->item(1));
sy = secondValue->getDoubleValue();
} else
sy = sx;
}
}
operations.operations().append(ScaleTransformOperation::create(sx, sy, sz, getTransformOperationType(transformValue->operationType())));
break;
}
case CSSTransformValue::TranslateTransformOperation:
case CSSTransformValue::TranslateXTransformOperation:
case CSSTransformValue::TranslateYTransformOperation: {
Length tx = Length(0, Fixed);
Length ty = Length(0, Fixed);
if (transformValue->operationType() == CSSTransformValue::TranslateYTransformOperation)
ty = convertToFloatLength(firstValue, conversionData);
else {
tx = convertToFloatLength(firstValue, conversionData);
if (transformValue->operationType() != CSSTransformValue::TranslateXTransformOperation) {
if (transformValue->length() > 1) {
CSSPrimitiveValue* secondValue = toCSSPrimitiveValue(transformValue->item(1));
ty = convertToFloatLength(secondValue, conversionData);
}
}
}
operations.operations().append(TranslateTransformOperation::create(tx, ty, 0, getTransformOperationType(transformValue->operationType())));
break;
}
case CSSTransformValue::TranslateZTransformOperation:
case CSSTransformValue::Translate3DTransformOperation: {
Length tx = Length(0, Fixed);
//.........这里部分代码省略.........