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


C++ ObjectBaseRef::set方法代码示例

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


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

示例1: Element

ObjectBaseRef<const Element> Element::createRef(Context *rsc, RsDataType dt, RsDataKind dk,
                                bool isNorm, uint32_t vecSize) {
    ObjectBaseRef<const Element> returnRef;
    // Look for an existing match.
    ObjectBase::asyncLock();
    for (uint32_t ct=0; ct < rsc->mStateElement.mElements.size(); ct++) {
        const Element *ee = rsc->mStateElement.mElements[ct];
        if (!ee->getFieldCount() &&
            (ee->getComponent().getType() == dt) &&
            (ee->getComponent().getKind() == dk) &&
            (ee->getComponent().getIsNormalized() == isNorm) &&
            (ee->getComponent().getVectorSize() == vecSize)) {
            // Match
            returnRef.set(ee);
            ObjectBase::asyncUnlock();
            return ee;
        }
    }
    ObjectBase::asyncUnlock();

    Element *e = new Element(rsc);
    returnRef.set(e);
    e->mComponent.set(dt, dk, isNorm, vecSize);
    e->compute();

    ObjectBase::asyncLock();
    rsc->mStateElement.mElements.push(e);
    ObjectBase::asyncUnlock();

    return returnRef;
}
开发者ID:28vicky,项目名称:platform_frameworks_base,代码行数:31,代码来源:rsElement.cpp

示例2: new

ObjectBaseRef<Sampler> Sampler::getSampler(Context *rsc,
                                           RsSamplerValue magFilter,
                                           RsSamplerValue minFilter,
                                           RsSamplerValue wrapS,
                                           RsSamplerValue wrapT,
                                           RsSamplerValue wrapR,
                                           float aniso) {
    ObjectBaseRef<Sampler> returnRef;
    ObjectBase::asyncLock();
    for (uint32_t ct = 0; ct < rsc->mStateSampler.mAllSamplers.size(); ct++) {
        Sampler *existing = rsc->mStateSampler.mAllSamplers[ct];
        if (existing->mHal.state.magFilter != magFilter) continue;
        if (existing->mHal.state.minFilter != minFilter ) continue;
        if (existing->mHal.state.wrapS != wrapS) continue;
        if (existing->mHal.state.wrapT != wrapT) continue;
        if (existing->mHal.state.wrapR != wrapR) continue;
        if (existing->mHal.state.aniso != aniso) continue;
        returnRef.set(existing);
        ObjectBase::asyncUnlock();
        return returnRef;
    }
    ObjectBase::asyncUnlock();

    void* allocMem = rsc->mHal.funcs.allocRuntimeMem(sizeof(Sampler), 0);
    if (!allocMem) {
        rsc->setError(RS_ERROR_FATAL_DRIVER, "Couldn't allocate memory for Allocation");
        return NULL;
    }

    Sampler *s = new (allocMem) Sampler(rsc, magFilter, minFilter, wrapS, wrapT, wrapR, aniso);
    returnRef.set(s);

#ifdef RS_FIND_OFFSETS
    ALOGE("pointer for sampler: %p", s);
    ALOGE("pointer for sampler.drv: %p", &s->mHal.drv);
#endif

    ObjectBase::asyncLock();
    rsc->mStateSampler.mAllSamplers.push(s);
    ObjectBase::asyncUnlock();

    return returnRef;
}
开发者ID:SundownerROM,项目名称:frameworks_rs,代码行数:43,代码来源:rsSampler.cpp

示例3: ProgramRaster

ObjectBaseRef<ProgramRaster> ProgramRaster::getProgramRaster(Context *rsc,
                                                             bool pointSprite,
                                                             RsCullMode cull) {
    ObjectBaseRef<ProgramRaster> returnRef;
    ObjectBase::asyncLock();
    for (uint32_t ct = 0; ct < rsc->mStateRaster.mRasterPrograms.size(); ct++) {
        ProgramRaster *existing = rsc->mStateRaster.mRasterPrograms[ct];
        if (existing->mHal.state.pointSprite != pointSprite) continue;
        if (existing->mHal.state.cull != cull) continue;
        returnRef.set(existing);
        ObjectBase::asyncUnlock();
        return returnRef;
    }
    ObjectBase::asyncUnlock();

    ProgramRaster *pr = new ProgramRaster(rsc, pointSprite, cull);
    returnRef.set(pr);

    ObjectBase::asyncLock();
    rsc->mStateRaster.mRasterPrograms.push(pr);
    ObjectBase::asyncUnlock();

    return returnRef;
}
开发者ID:cpflayan,项目名称:android_frameworks_rs-dt,代码行数:24,代码来源:rsProgramRaster.cpp


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