本文整理汇总了C++中SkAnimateMaker::setScriptError方法的典型用法代码示例。如果您正苦于以下问题:C++ SkAnimateMaker::setScriptError方法的具体用法?C++ SkAnimateMaker::setScriptError怎么用?C++ SkAnimateMaker::setScriptError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkAnimateMaker
的用法示例。
在下文中一共展示了SkAnimateMaker::setScriptError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setTarget
void SkAnimateBase::setTarget(SkAnimateMaker& maker) {
if (target.size()) {
SkAnimatorScript engine(maker, this, SkType_Displayable);
const char* script = target.c_str();
SkScriptValue scriptValue;
bool success = engine.evaluateScript(&script, &scriptValue);
if (success && scriptValue.fType == SkType_Displayable)
fTarget = scriptValue.fOperand.fDrawable;
else if (maker.find(target.c_str(), (SkDisplayable**) &fTarget) == false) {
if (fApply->getMode() == SkApply::kMode_create)
return; // may not be an error
if (engine.getError() != SkScriptEngine::kNoError)
maker.setScriptError(engine);
else {
maker.setErrorNoun(target);
maker.setErrorCode(SkDisplayXMLParserError::kTargetIDNotFound);
}
return;
}
if (fApply && fApply->getMode() != SkApply::kMode_create)
target.reset();
}
}
示例2: setValue
bool SkMemberInfo::setValue(SkAnimateMaker& maker, SkTDOperandArray* arrayStorage,
int storageOffset, int maxStorage, SkDisplayable* displayable, SkDisplayTypes outType,
const char rawValue[], size_t rawValueLen) const
{
SkString valueStr(rawValue, rawValueLen);
SkScriptValue scriptValue;
scriptValue.fType = SkType_Unknown;
scriptValue.fOperand.fS32 = 0;
SkDisplayTypes type = getType();
SkAnimatorScript engine(maker, displayable, type);
if (arrayStorage)
displayable = NULL;
bool success = true;
void* untypedStorage = NULL;
if (displayable && fType != SkType_MemberProperty && fType != SkType_MemberFunction)
untypedStorage = (SkTDOperandArray*) memberData(displayable);
if (type == SkType_ARGB) {
// for both SpiderMonkey and SkiaScript, substitute any #xyz or #xxyyzz first
// it's enough to expand the colors into 0xFFxxyyzz
const char* poundPos;
while ((poundPos = strchr(valueStr.c_str(), '#')) != NULL) {
size_t offset = poundPos - valueStr.c_str();
if (valueStr.size() - offset < 4)
break;
char r = poundPos[1];
char g = poundPos[2];
char b = poundPos[3];
if (is_hex(r) == false || is_hex(g) == false || is_hex(b) == false)
break;
char hex = poundPos[4];
if (is_hex(hex) == false) {
valueStr.insertUnichar(offset + 1, r);
valueStr.insertUnichar(offset + 3, g);
valueStr.insertUnichar(offset + 5, b);
}
*(char*) poundPos = '0'; // overwrite '#'
valueStr.insert(offset + 1, "xFF");
}
}
if (SkDisplayType::IsDisplayable(&maker, type) || SkDisplayType::IsEnum(&maker, type) || type == SkType_ARGB)
goto scriptCommon;
switch (type) {
case SkType_String:
#if 0
if (displayable && displayable->isAnimate()) {
goto noScriptString;
}
if (strncmp(rawValue, "#string:", sizeof("#string:") - 1) == 0) {
SkASSERT(sizeof("string") == sizeof("script"));
char* stringHeader = valueStr.writable_str();
memcpy(&stringHeader[1], "script", sizeof("script") - 1);
rawValue = valueStr.c_str();
goto noScriptString;
} else
#endif
if (strncmp(rawValue, "#script:", sizeof("#script:") - 1) != 0)
goto noScriptString;
valueStr.remove(0, 8);
case SkType_Unknown:
case SkType_Int:
case SkType_MSec: // for the purposes of script, MSec is treated as a Scalar
case SkType_Point:
case SkType_3D_Point:
case SkType_Float:
case SkType_Array:
scriptCommon: {
const char* script = valueStr.c_str();
success = engine.evaluateScript(&script, &scriptValue);
if (success == false) {
maker.setScriptError(engine);
return false;
}
}
SkASSERT(success);
if (scriptValue.fType == SkType_Displayable) {
if (type == SkType_String) {
const char* charPtr;
maker.findKey(scriptValue.fOperand.fDisplayable, &charPtr);
scriptValue.fOperand.fString = new SkString(charPtr);
scriptValue.fType = SkType_String;
engine.SkScriptEngine::track(scriptValue.fOperand.fString);
break;
}
SkASSERT(SkDisplayType::IsDisplayable(&maker, type));
if (displayable)
displayable->setReference(this, scriptValue.fOperand.fDisplayable);
else
arrayStorage->begin()[0].fDisplayable = scriptValue.fOperand.fDisplayable;
return true;
}
if (type != scriptValue.fType) {
if (scriptValue.fType == SkType_Array) {
engine.forget(scriptValue.getArray());
goto writeStruct; // real structs have already been written by script
}
switch (type) {
case SkType_String:
success = engine.convertTo(SkType_String, &scriptValue);
//.........这里部分代码省略.........