当前位置: 首页>>代码示例>>C++>>正文


C++ SkDisplayable类代码示例

本文整理汇总了C++中SkDisplayable的典型用法代码示例。如果您正苦于以下问题:C++ SkDisplayable类的具体用法?C++ SkDisplayable怎么用?C++ SkDisplayable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SkDisplayable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SkASSERT

void SkApply::enableDynamic(SkAnimateMaker& maker) {
    SkASSERT(mode != kMode_create); // create + dynamic are not currently compatible
    SkDisplayable* newScope;
    bool success = SkAnimatorScript::EvaluateDisplayable(maker, this, dynamicScope.c_str(),
        &newScope);
    if (success && scope != newScope) {
        SkTDDrawableArray* pList, * gList;
        SkGroup* pGroup = NULL, * found = NULL;
        int old = maker.fDisplayList.findGroup(scope, &pList, &pGroup, &found, &gList);
        if (pList && old >= 0 && (*pList)[old]->isApply() && (*pList)[old] != this) {
            if (fAppended == false) {
                if (found != NULL) {
                    SkDisplayable* oldChild = (*pList)[old];
                    if (oldChild->isApply() && found->copySet(old)) {
                        found->markCopyClear(old);
    //                  delete oldChild;
                    }
                }
                (*pList)[old] = scope;
            } else
                pList->remove(old);
        }
        scope = (SkDrawable*) newScope;
        onEndElement(maker);
    }
    maker.removeActive(fActive);
    delete fActive;
    fActive = NULL;
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例2: getTarget

void SkApply::endSave(int index) {
    SkAnimateBase* animate = fActive->fAnimators[index];
    const SkMemberInfo* info = animate->fFieldInfo;
    SkDisplayTypes type = (SkDisplayTypes) info->fType;
    if (type == SkType_MemberFunction)
        return;
    SkDisplayable* target = getTarget(animate);
    size_t size = info->getSize(target);
    int count = (int) (size / sizeof(SkScalar));
    int activeIndex = fActive->fDrawIndex + index;
    SkOperand* last = new SkOperand[count];
    SkAutoTDelete<SkOperand> autoLast(last);
    if (type != SkType_MemberProperty) {
        info->getValue(target, last, count);
        SkOperand* saveOperand = fActive->fSaveRestore[activeIndex];
        if (saveOperand)
            info->setValue(target, fActive->fSaveRestore[activeIndex], count);
    } else {
        SkScriptValue scriptValue;
        bool success = target->getProperty(info->propertyIndex(), &scriptValue);
        SkASSERT(success = true);
        last[0] = scriptValue.fOperand;
        scriptValue.fOperand = fActive->fSaveRestore[activeIndex][0];
        target->setProperty(info->propertyIndex(), scriptValue);
    }
    SkOperand* save = fActive->fSaveRestore[activeIndex];
    if (save)
        memcpy(save, last, count * sizeof(SkOperand));
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例3: SkDebugf

bool SkDisplayEvent::enableEvent(SkAnimateMaker& maker)
{
    maker.fActiveEvent = this;
    if (fChildren.count() == 0)
        return false;
    if (disable)
        return false;
#ifdef SK_DUMP_ENABLED
    if (maker.fDumpEvents) {
        SkDebugf("enable: ");
        dumpEvent(&maker);
    }
#endif
    SkDisplayList& displayList = maker.fDisplayList;
    for (int index = 0; index < fChildren.count(); index++) {
        SkDisplayable* displayable = fChildren[index];
        if (displayable->isGroup()) {
            SkTDDrawableArray* parentList = displayList.getDrawList();
            *parentList->append() = (SkADrawable*) displayable;  // make it findable before children are enabled
        }
        if (displayable->enable(maker))
            continue;
        if (maker.hasError())
            return true;
        if (displayable->isDrawable() == false)
            return true;    // error
        SkADrawable* drawable = (SkADrawable*) displayable;
        SkTDDrawableArray* parentList = displayList.getDrawList();
        *parentList->append() = drawable;
    }
    return false;
}
开发者ID:Arternis,项目名称:skia,代码行数:32,代码来源:SkDisplayEvent.cpp

示例4: draw

bool SkHitTest::draw(SkAnimateMaker& maker) {
    hits.setCount(bullets.count());
    value = false;
    int bulletCount = bullets.count();
    int targetCount = targets.count();
    for (int bIndex = 0; bIndex < bulletCount; bIndex++) {
        SkDisplayable* bullet = bullets[bIndex];
        SkRect bBounds;
        bullet->getBounds(&bBounds);
        hits[bIndex] = -1;
        if (bBounds.fLeft == (int16_t)0x8000U)
            continue;
        for (int tIndex = 0; tIndex < targetCount; tIndex++) {
            SkDisplayable* target = targets[tIndex];
            SkRect tBounds;
            target->getBounds(&tBounds);
            if (bBounds.intersect(tBounds)) {
                hits[bIndex] = tIndex;
                value = true;
                break;
            }
        }
    }
    return false;
}
开发者ID:Cue,项目名称:skia,代码行数:25,代码来源:SkHitTest.cpp

示例5: enable

bool SkHitClear::enable(SkAnimateMaker& maker) {
    for (int tIndex = 0; tIndex < targets.count(); tIndex++) {
        SkDisplayable* target = targets[tIndex];
        target->clearBounder();
    }
    return true;
}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例6: EvalID

bool SkAnimatorScript::EvalID(const char* token, size_t len, void* user, SkScriptValue* value) {
    SkAnimatorScript* engine = (SkAnimatorScript*) user;
    SkTDict<SkDisplayable*>* ids = &engine->fMaker.fIDs;
    SkDisplayable* displayable;
    bool success = ids->find(token, len, &displayable);
    if (success == false) {
        displayable = engine->fWorking;
        if (SK_LITERAL_STR_EQUAL("parent", token, len)) {
            SkDisplayable* parent = displayable->getParent();
            if (parent == false)
                parent = engine->fParent;
            if (parent) {
                value->fOperand.fDisplayable = parent;
                value->fType = SkType_Displayable;
                return true;
            }
        }
        if (displayable && EvalMember(token, len, displayable, engine, value))
            return true;
        value->fOperand.fString = NULL;
        value->fType = SkType_String;
    } else {
        SkDisplayable* working = engine->fWorking;
        value->fOperand.fDisplayable = displayable;
        value->fType = SkType_Displayable;
        if (displayable->canContainDependents() && working && working->isAnimate()) {
            SkAnimateBase* animator = (SkAnimateBase*) working;
            if (animator->isDynamic()) {
                SkDisplayDepend* depend = (SkDisplayDepend* ) displayable;
                depend->addDependent(working);
            }
        }
    }
    return true;
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:35,代码来源:SkAnimatorScript.cpp

示例7: contains

SkDisplayable* SkDisplayEvent::contains(const SkString& match) {
    for (int index = 0; index < fChildren.count(); index++) {
        SkDisplayable* child = fChildren[index];
        if (child->contains(match))
            return child;
    }
    return NULL;
}
开发者ID:Arternis,项目名称:skia,代码行数:8,代码来源:SkDisplayEvent.cpp

示例8: iter

void SkAnimateMaker::dump(const char* match) {
        SkTDict<SkDisplayable*>::Iter iter(fIDs);
        const char* name;
        SkDisplayable* result;
        while ((name = iter.next(&result)) != NULL) {
            if (strcmp(match,name) == 0)
                result->dump(this);
        }
}
开发者ID:ghub,项目名称:NVprSDK,代码行数:9,代码来源:SkAnimateMaker.cpp

示例9: deepCopy

SkDisplayable* SkGroup::deepCopy(SkAnimateMaker* maker) {
    SkDisplayable* copy = INHERITED::deepCopy(maker);
    for (SkDrawable** ptr = fChildren.begin(); ptr < fChildren.end(); ptr++) {
        SkDisplayable* displayable = (SkDisplayable*)*ptr;
        SkDisplayable* deeperCopy = displayable->deepCopy(maker);
        ((SkGroup*)copy)->addChild(*maker, deeperCopy);
    }
    return copy;
}
开发者ID:hicdre,项目名称:skiaui,代码行数:9,代码来源:SkDrawGroup.cpp

示例10: loadMovies

void SkAnimateMaker::loadMovies() {
    for (SkDisplayable** dispPtr = fMovies.begin(); dispPtr < fMovies.end(); dispPtr++) {
        SkDisplayable* displayable = *dispPtr;
        SkASSERT(displayable->getType() == SkType_Movie);
        SkDisplayMovie* movie = (SkDisplayMovie*) displayable;
        SkAnimateMaker* movieMaker = movie->fMovie.fMaker;
        movieMaker->fEvents.doEvent(*movieMaker, SkDisplayEvent::kOnload, NULL);
        movieMaker->fEvents.removeEvent(SkDisplayEvent::kOnload, NULL);
        movieMaker->loadMovies();
    }
}
开发者ID:ghub,项目名称:NVprSDK,代码行数:11,代码来源:SkAnimateMaker.cpp

示例11: enable

bool SkHitTest::enable(SkAnimateMaker& maker) {
    for (int bIndex = 0; bIndex < bullets.count(); bIndex++) {
        SkDisplayable* bullet = bullets[bIndex];
        bullet->enableBounder();
    }
    for (int tIndex = 0; tIndex < targets.count(); tIndex++) {
        SkDisplayable* target = targets[tIndex];
        target->enableBounder();
    }
    return false;
}
开发者ID:Cue,项目名称:skia,代码行数:11,代码来源:SkHitTest.cpp

示例12: getAppTime

void SkAnimateMaker::doDelayedEvent() {
    fEnableTime = getAppTime();
    for (int index = 0; index < fDelayed.count(); ) {
        SkDisplayable* child = fDelayed[index];
        SkASSERT(child->isApply());
        SkApply* apply = (SkApply*) child;
        apply->interpolate(*this, fEnableTime);
        if (apply->hasDelayedAnimator())
            index++;
        else
            fDelayed.remove(index);
    }
}
开发者ID:ghub,项目名称:NVprSDK,代码行数:13,代码来源:SkAnimateMaker.cpp

示例13: strchr

int SkAnimateMaker::dynamicProperty(SkString& nameStr, SkDisplayable** displayablePtr ) {
    const char* name = nameStr.c_str();
    const char* dot = strchr(name, '.');
    SkASSERT(dot);
    SkDisplayable* displayable;
    if (find(name, dot - name, &displayable) == false) {
        SkASSERT(0);
        return 0;
    }
    const char* fieldName = dot + 1;
    const SkMemberInfo* memberInfo = displayable->getMember(fieldName);
    *displayablePtr = displayable;
    return (int) memberInfo->fOffset;
}
开发者ID:ghub,项目名称:NVprSDK,代码行数:14,代码来源:SkAnimateMaker.cpp

示例14: iter

void SkDisplayEvent::populateInput(SkAnimateMaker& maker, const SkEvent& fEvent) {
    const SkMetaData& meta = fEvent.getMetaData();
    SkMetaData::Iter iter(meta);
    SkMetaData::Type    type;
    int number;
    const char* name;
    while ((name = iter.next(&type, &number)) != NULL) {
        if (name[0] == '\0')
            continue;
        SkDisplayable* displayable;
        SkInput* input;
        for (int index = 0; index < fChildren.count(); index++) {
            displayable = fChildren[index];
            if (displayable->getType() != SkType_Input)
                continue;
            input = (SkInput*) displayable;
            if (input->name.equals(name))
                goto found;
        }
        if (!maker.find(name, &displayable) || displayable->getType() != SkType_Input)
            continue;
        input = (SkInput*) displayable;
    found:
        switch (type) {
            case SkMetaData::kS32_Type:
                meta.findS32(name, &input->fInt);
                break;
            case SkMetaData::kScalar_Type:
                meta.findScalar(name, &input->fFloat);
                break;
            case SkMetaData::kPtr_Type:
                SkASSERT(0);
                break; // !!! not handled for now
            case SkMetaData::kString_Type:
                input->string.set(meta.findString(name));
                break;
            default:
                SkASSERT(0);
        }
    }
    // re-evaluate all animators that may have built their values from input strings
    for (SkDisplayable** childPtr = fChildren.begin(); childPtr < fChildren.end(); childPtr++) {
        SkDisplayable* displayable = *childPtr;
        if (displayable->isApply() == false)
            continue;
        SkApply* apply = (SkApply*) displayable;
        apply->refresh(maker);
    }
}
开发者ID:jiezh,项目名称:h5vcc,代码行数:49,代码来源:SkDisplayEvent.cpp

示例15: EvalMemberFunction

bool SkAnimatorScript::EvalMemberFunction(const char* member, size_t len, void* object,
        SkTDArray<SkScriptValue>& params, void* eng, SkScriptValue* value) {
    SkScriptEngine* engine = (SkScriptEngine*) eng;
    SkDisplayable* displayable = (SkDisplayable*) object;
    SkString name(member, len);
    const SkMemberInfo* info = displayable->getMember(name.c_str());
    SkASSERT(info != NULL); /* !!! error handling unimplemented */
    if (info->fType != SkType_MemberFunction) {
        SkASSERT(0);
        return false;
    }
    displayable->executeFunction(displayable, info->functionIndex(), params, info->getType(),
        value);
    return EvalMemberCommon(engine, info, displayable, value);
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:15,代码来源:SkAnimatorScript.cpp


注:本文中的SkDisplayable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。